p1689r5: initial support
[official-gcc.git] / gcc / doc / invoke.texi
blob09b2b92ad8485a1cab4b55a34bddb7305d5005b2
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} -msimd=@var{simd-type}
1034 -msoft-float -msingle-float -mdouble-float -mlsx -mno-lsx -mlasx -mno-lasx
1035 -mbranch-cost=@var{n}  -mcheck-zero-division -mno-check-zero-division
1036 -mcond-move-int  -mno-cond-move-int
1037 -mcond-move-float  -mno-cond-move-float
1038 -memcpy  -mno-memcpy -mstrict-align -mno-strict-align
1039 -mmax-inline-memcpy-size=@var{n}
1040 -mexplicit-relocs -mno-explicit-relocs
1041 -mdirect-extern-access -mno-direct-extern-access
1042 -mcmodel=@var{code-model}}
1044 @emph{M32R/D Options}
1045 @gccoptlist{-m32r2  -m32rx  -m32r
1046 -mdebug
1047 -malign-loops  -mno-align-loops
1048 -missue-rate=@var{number}
1049 -mbranch-cost=@var{number}
1050 -mmodel=@var{code-size-model-type}
1051 -msdata=@var{sdata-type}
1052 -mno-flush-func  -mflush-func=@var{name}
1053 -mno-flush-trap  -mflush-trap=@var{number}
1054 -G @var{num}}
1056 @emph{M32C Options}
1057 @gccoptlist{-mcpu=@var{cpu}  -msim  -memregs=@var{number}}
1059 @emph{M680x0 Options}
1060 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune}
1061 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040
1062 -m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407
1063 -mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020
1064 -mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort
1065 -mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel
1066 -malign-int  -mstrict-align  -msep-data  -mno-sep-data
1067 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library
1068 -mxgot  -mno-xgot  -mlong-jump-table-offsets}
1070 @emph{MCore Options}
1071 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates
1072 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields
1073 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data
1074 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim
1075 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
1077 @emph{MicroBlaze Options}
1078 @gccoptlist{-msoft-float  -mhard-float  -msmall-divides  -mcpu=@var{cpu}
1079 -mmemcpy  -mxl-soft-mul  -mxl-soft-div  -mxl-barrel-shift
1080 -mxl-pattern-compare  -mxl-stack-check  -mxl-gp-opt  -mno-clearbss
1081 -mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt
1082 -mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model}
1083 -mpic-data-is-text-relative}
1085 @emph{MIPS Options}
1086 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch}
1087 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips32r3  -mips32r5
1088 -mips32r6  -mips64  -mips64r2  -mips64r3  -mips64r5  -mips64r6
1089 -mips16  -mno-mips16  -mflip-mips16
1090 -minterlink-compressed  -mno-interlink-compressed
1091 -minterlink-mips16  -mno-interlink-mips16
1092 -mabi=@var{abi}  -mabicalls  -mno-abicalls
1093 -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot
1094 -mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float
1095 -mno-float  -msingle-float  -mdouble-float
1096 -modd-spreg  -mno-odd-spreg
1097 -mabs=@var{mode}  -mnan=@var{encoding}
1098 -mdsp  -mno-dsp  -mdspr2  -mno-dspr2
1099 -mmcu  -mmno-mcu
1100 -meva  -mno-eva
1101 -mvirt  -mno-virt
1102 -mxpa  -mno-xpa
1103 -mcrc  -mno-crc
1104 -mginv  -mno-ginv
1105 -mmicromips  -mno-micromips
1106 -mmsa  -mno-msa
1107 -mloongson-mmi  -mno-loongson-mmi
1108 -mloongson-ext  -mno-loongson-ext
1109 -mloongson-ext2  -mno-loongson-ext2
1110 -mfpu=@var{fpu-type}
1111 -msmartmips  -mno-smartmips
1112 -mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx
1113 -mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc
1114 -mlong64  -mlong32  -msym32  -mno-sym32
1115 -G@var{num}  -mlocal-sdata  -mno-local-sdata
1116 -mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt
1117 -membedded-data  -mno-embedded-data
1118 -muninit-const-in-rodata  -mno-uninit-const-in-rodata
1119 -mcode-readable=@var{setting}
1120 -msplit-addresses  -mno-split-addresses
1121 -mexplicit-relocs  -mno-explicit-relocs
1122 -mcheck-zero-division  -mno-check-zero-division
1123 -mdivide-traps  -mdivide-breaks
1124 -mload-store-pairs  -mno-load-store-pairs
1125 -munaligned-access  -mno-unaligned-access
1126 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls
1127 -mmad  -mno-mad  -mimadd  -mno-imadd  -mfused-madd  -mno-fused-madd  -nocpp
1128 -mfix-24k  -mno-fix-24k
1129 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400
1130 -mfix-r5900  -mno-fix-r5900
1131 -mfix-r10000  -mno-fix-r10000  -mfix-rm7000  -mno-fix-rm7000
1132 -mfix-vr4120  -mno-fix-vr4120
1133 -mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1
1134 -mflush-func=@var{func}  -mno-flush-func
1135 -mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely
1136 -mcompact-branches=@var{policy}
1137 -mfp-exceptions  -mno-fp-exceptions
1138 -mvr4130-align  -mno-vr4130-align  -msynci  -mno-synci
1139 -mlxc1-sxc1  -mno-lxc1-sxc1  -mmadd4  -mno-madd4
1140 -mrelax-pic-calls  -mno-relax-pic-calls  -mmcount-ra-address
1141 -mframe-header-opt  -mno-frame-header-opt}
1143 @emph{MMIX Options}
1144 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu
1145 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols
1146 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses
1147 -mno-base-addresses  -msingle-exit  -mno-single-exit}
1149 @emph{MN10300 Options}
1150 @gccoptlist{-mmult-bug  -mno-mult-bug
1151 -mno-am33  -mam33  -mam33-2  -mam34
1152 -mtune=@var{cpu-type}
1153 -mreturn-pointer-on-d0
1154 -mno-crt0  -mrelax  -mliw  -msetlb}
1156 @emph{Moxie Options}
1157 @gccoptlist{-meb  -mel  -mmul.x  -mno-crt0}
1159 @emph{MSP430 Options}
1160 @gccoptlist{-msim  -masm-hex  -mmcu=  -mcpu=  -mlarge  -msmall  -mrelax
1161 -mwarn-mcu
1162 -mcode-region=  -mdata-region=
1163 -msilicon-errata=  -msilicon-errata-warn=
1164 -mhwmult=  -minrt  -mtiny-printf  -mmax-inline-shift=}
1166 @emph{NDS32 Options}
1167 @gccoptlist{-mbig-endian  -mlittle-endian
1168 -mreduced-regs  -mfull-regs
1169 -mcmov  -mno-cmov
1170 -mext-perf  -mno-ext-perf
1171 -mext-perf2  -mno-ext-perf2
1172 -mext-string  -mno-ext-string
1173 -mv3push  -mno-v3push
1174 -m16bit  -mno-16bit
1175 -misr-vector-size=@var{num}
1176 -mcache-block-size=@var{num}
1177 -march=@var{arch}
1178 -mcmodel=@var{code-model}
1179 -mctor-dtor  -mrelax}
1181 @emph{Nios II Options}
1182 @gccoptlist{-G @var{num}  -mgpopt=@var{option}  -mgpopt  -mno-gpopt
1183 -mgprel-sec=@var{regexp}  -mr0rel-sec=@var{regexp}
1184 -mel  -meb
1185 -mno-bypass-cache  -mbypass-cache
1186 -mno-cache-volatile  -mcache-volatile
1187 -mno-fast-sw-div  -mfast-sw-div
1188 -mhw-mul  -mno-hw-mul  -mhw-mulx  -mno-hw-mulx  -mno-hw-div  -mhw-div
1189 -mcustom-@var{insn}=@var{N}  -mno-custom-@var{insn}
1190 -mcustom-fpu-cfg=@var{name}
1191 -mhal  -msmallc  -msys-crt0=@var{name}  -msys-lib=@var{name}
1192 -march=@var{arch}  -mbmx  -mno-bmx  -mcdx  -mno-cdx}
1194 @emph{Nvidia PTX Options}
1195 @gccoptlist{-m64  -mmainkernel  -moptimize}
1197 @emph{OpenRISC Options}
1198 @gccoptlist{-mboard=@var{name}  -mnewlib  -mhard-mul  -mhard-div
1199 -msoft-mul  -msoft-div
1200 -msoft-float  -mhard-float  -mdouble-float -munordered-float
1201 -mcmov  -mror  -mrori  -msext  -msfimm  -mshftimm
1202 -mcmodel=@var{code-model}}
1204 @emph{PDP-11 Options}
1205 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10
1206 -mint32  -mno-int16  -mint16  -mno-int32
1207 -msplit  -munix-asm  -mdec-asm  -mgnu-asm  -mlra}
1209 @emph{PowerPC Options}
1210 See RS/6000 and PowerPC Options.
1212 @emph{PRU Options}
1213 @gccoptlist{-mmcu=@var{mcu}  -minrt  -mno-relax  -mloop
1214 -mabi=@var{variant}}
1216 @emph{RISC-V Options}
1217 @gccoptlist{-mbranch-cost=@var{N-instruction}
1218 -mplt  -mno-plt
1219 -mabi=@var{ABI-string}
1220 -mfdiv  -mno-fdiv
1221 -mdiv  -mno-div
1222 -misa-spec=@var{ISA-spec-string}
1223 -march=@var{ISA-string}
1224 -mtune=@var{processor-string}
1225 -mpreferred-stack-boundary=@var{num}
1226 -msmall-data-limit=@var{N-bytes}
1227 -msave-restore  -mno-save-restore
1228 -mshorten-memrefs  -mno-shorten-memrefs
1229 -mstrict-align  -mno-strict-align
1230 -mcmodel=medlow  -mcmodel=medany
1231 -mexplicit-relocs  -mno-explicit-relocs
1232 -mrelax  -mno-relax
1233 -mriscv-attribute  -mno-riscv-attribute
1234 -malign-data=@var{type}
1235 -mbig-endian  -mlittle-endian
1236 -mstack-protector-guard=@var{guard}  -mstack-protector-guard-reg=@var{reg}
1237 -mstack-protector-guard-offset=@var{offset}
1238 -mcsr-check -mno-csr-check
1239 -minline-atomics  -mno-inline-atomics
1240 -minline-strlen  -mno-inline-strlen
1241 -minline-strcmp  -mno-inline-strcmp
1242 -minline-strncmp  -mno-inline-strncmp}
1244 @emph{RL78 Options}
1245 @gccoptlist{-msim  -mmul=none  -mmul=g13  -mmul=g14  -mallregs
1246 -mcpu=g10  -mcpu=g13  -mcpu=g14  -mg10  -mg13  -mg14
1247 -m64bit-doubles  -m32bit-doubles  -msave-mduc-in-interrupts}
1249 @emph{RS/6000 and PowerPC Options}
1250 @gccoptlist{-mcpu=@var{cpu-type}
1251 -mtune=@var{cpu-type}
1252 -mcmodel=@var{code-model}
1253 -mpowerpc64
1254 -maltivec  -mno-altivec
1255 -mpowerpc-gpopt  -mno-powerpc-gpopt
1256 -mpowerpc-gfxopt  -mno-powerpc-gfxopt
1257 -mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mpopcntd  -mno-popcntd
1258 -mfprnd  -mno-fprnd
1259 -mcmpb  -mno-cmpb  -mhard-dfp  -mno-hard-dfp
1260 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc
1261 -m64  -m32  -mxl-compat  -mno-xl-compat  -mpe
1262 -malign-power  -malign-natural
1263 -msoft-float  -mhard-float  -mmultiple  -mno-multiple
1264 -mupdate  -mno-update
1265 -mavoid-indexed-addresses  -mno-avoid-indexed-addresses
1266 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align
1267 -mstrict-align  -mno-strict-align  -mrelocatable
1268 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib
1269 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian
1270 -mdynamic-no-pic  -mswdiv  -msingle-pic-base
1271 -mprioritize-restricted-insns=@var{priority}
1272 -msched-costly-dep=@var{dependence_type}
1273 -minsert-sched-nops=@var{scheme}
1274 -mcall-aixdesc  -mcall-eabi  -mcall-freebsd
1275 -mcall-linux  -mcall-netbsd  -mcall-openbsd
1276 -mcall-sysv  -mcall-sysv-eabi  -mcall-sysv-noeabi
1277 -mtraceback=@var{traceback_type}
1278 -maix-struct-return  -msvr4-struct-return
1279 -mabi=@var{abi-type}  -msecure-plt  -mbss-plt
1280 -mlongcall  -mno-longcall  -mpltseq  -mno-pltseq
1281 -mblock-move-inline-limit=@var{num}
1282 -mblock-compare-inline-limit=@var{num}
1283 -mblock-compare-inline-loop-limit=@var{num}
1284 -mno-block-ops-unaligned-vsx
1285 -mstring-compare-inline-limit=@var{num}
1286 -misel  -mno-isel
1287 -mvrsave  -mno-vrsave
1288 -mmulhw  -mno-mulhw
1289 -mdlmzb  -mno-dlmzb
1290 -mprototype  -mno-prototype
1291 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata
1292 -msdata=@var{opt}  -mreadonly-in-sdata  -mvxworks  -G @var{num}
1293 -mrecip  -mrecip=@var{opt}  -mno-recip  -mrecip-precision
1294 -mno-recip-precision
1295 -mveclibabi=@var{type}  -mfriz  -mno-friz
1296 -mpointers-to-nested-functions  -mno-pointers-to-nested-functions
1297 -msave-toc-indirect  -mno-save-toc-indirect
1298 -mpower8-fusion  -mno-mpower8-fusion  -mpower8-vector  -mno-power8-vector
1299 -mcrypto  -mno-crypto  -mhtm  -mno-htm
1300 -mquad-memory  -mno-quad-memory
1301 -mquad-memory-atomic  -mno-quad-memory-atomic
1302 -mcompat-align-parm  -mno-compat-align-parm
1303 -mfloat128  -mno-float128  -mfloat128-hardware  -mno-float128-hardware
1304 -mgnu-attribute  -mno-gnu-attribute
1305 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg}
1306 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed
1307 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
1308 -mprivileged -mno-privileged}
1310 @emph{RX Options}
1311 @gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu
1312 -mcpu=
1313 -mbig-endian-data  -mlittle-endian-data
1314 -msmall-data
1315 -msim  -mno-sim
1316 -mas100-syntax  -mno-as100-syntax
1317 -mrelax
1318 -mmax-constant-size=
1319 -mint-register=
1320 -mpid
1321 -mallow-string-insns  -mno-allow-string-insns
1322 -mjsr
1323 -mno-warn-multiple-fast-interrupts
1324 -msave-acc-in-interrupts}
1326 @emph{S/390 and zSeries Options}
1327 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type}
1328 -mhard-float  -msoft-float  -mhard-dfp  -mno-hard-dfp
1329 -mlong-double-64  -mlong-double-128
1330 -mbackchain  -mno-backchain  -mpacked-stack  -mno-packed-stack
1331 -msmall-exec  -mno-small-exec  -mmvcle  -mno-mvcle
1332 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch
1333 -mhtm  -mvx  -mzvector
1334 -mtpf-trace  -mno-tpf-trace  -mtpf-trace-skip  -mno-tpf-trace-skip
1335 -mfused-madd  -mno-fused-madd
1336 -mwarn-framesize  -mwarn-dynamicstack  -mstack-size  -mstack-guard
1337 -mhotpatch=@var{halfwords},@var{halfwords}}
1339 @emph{SH Options}
1340 @gccoptlist{-m1  -m2  -m2e
1341 -m2a-nofpu  -m2a-single-only  -m2a-single  -m2a
1342 -m3  -m3e
1343 -m4-nofpu  -m4-single-only  -m4-single  -m4
1344 -m4a-nofpu  -m4a-single-only  -m4a-single  -m4a  -m4al
1345 -mb  -ml  -mdalign  -mrelax
1346 -mbigtable  -mfmovd  -mrenesas  -mno-renesas  -mnomacsave
1347 -mieee  -mno-ieee  -mbitops  -misize  -minline-ic_invalidate  -mpadstruct
1348 -mprefergot  -musermode  -multcost=@var{number}  -mdiv=@var{strategy}
1349 -mdivsi3_libfunc=@var{name}  -mfixed-range=@var{register-range}
1350 -maccumulate-outgoing-args
1351 -matomic-model=@var{atomic-model}
1352 -mbranch-cost=@var{num}  -mzdcbranch  -mno-zdcbranch
1353 -mcbranch-force-delay-slot
1354 -mfused-madd  -mno-fused-madd  -mfsca  -mno-fsca  -mfsrra  -mno-fsrra
1355 -mpretend-cmove  -mtas}
1357 @emph{Solaris 2 Options}
1358 @gccoptlist{-mclear-hwcap  -mno-clear-hwcap  -mimpure-text  -mno-impure-text
1359 -pthreads}
1361 @emph{SPARC Options}
1362 @gccoptlist{-mcpu=@var{cpu-type}
1363 -mtune=@var{cpu-type}
1364 -mcmodel=@var{code-model}
1365 -mmemory-model=@var{mem-model}
1366 -m32  -m64  -mapp-regs  -mno-app-regs
1367 -mfaster-structs  -mno-faster-structs  -mflat  -mno-flat
1368 -mfpu  -mno-fpu  -mhard-float  -msoft-float
1369 -mhard-quad-float  -msoft-quad-float
1370 -mstack-bias  -mno-stack-bias
1371 -mstd-struct-return  -mno-std-struct-return
1372 -munaligned-doubles  -mno-unaligned-doubles
1373 -muser-mode  -mno-user-mode
1374 -mv8plus  -mno-v8plus  -mvis  -mno-vis
1375 -mvis2  -mno-vis2  -mvis3  -mno-vis3
1376 -mvis4  -mno-vis4  -mvis4b  -mno-vis4b
1377 -mcbcond  -mno-cbcond  -mfmaf  -mno-fmaf  -mfsmuld  -mno-fsmuld
1378 -mpopc  -mno-popc  -msubxc  -mno-subxc
1379 -mfix-at697f  -mfix-ut699  -mfix-ut700  -mfix-gr712rc
1380 -mlra  -mno-lra}
1382 @emph{System V Options}
1383 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
1385 @emph{V850 Options}
1386 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep
1387 -mprolog-function  -mno-prolog-function  -mspace
1388 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n}
1389 -mapp-regs  -mno-app-regs
1390 -mdisable-callt  -mno-disable-callt
1391 -mv850e2v3  -mv850e2  -mv850e1  -mv850es
1392 -mv850e  -mv850  -mv850e3v5
1393 -mloop
1394 -mrelax
1395 -mlong-jumps
1396 -msoft-float
1397 -mhard-float
1398 -mgcc-abi
1399 -mrh850-abi
1400 -mbig-switch}
1402 @emph{VAX Options}
1403 @gccoptlist{-mg  -mgnu  -munix  -mlra}
1405 @emph{Visium Options}
1406 @gccoptlist{-mdebug  -msim  -mfpu  -mno-fpu  -mhard-float  -msoft-float
1407 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type}  -msv-mode  -muser-mode}
1409 @emph{VMS Options}
1410 @gccoptlist{-mvms-return-codes  -mdebug-main=@var{prefix}  -mmalloc64
1411 -mpointer-size=@var{size}}
1413 @emph{VxWorks Options}
1414 @gccoptlist{-mrtp  -msmp  -non-static  -Bstatic  -Bdynamic
1415 -Xbind-lazy  -Xbind-now}
1417 @emph{x86 Options}
1418 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type}
1419 -mtune-ctrl=@var{feature-list}  -mdump-tune-features  -mno-default
1420 -mfpmath=@var{unit}
1421 -masm=@var{dialect}  -mno-fancy-math-387
1422 -mno-fp-ret-in-387  -m80387  -mhard-float  -msoft-float
1423 -mno-wide-multiply  -mrtd  -malign-double
1424 -mpreferred-stack-boundary=@var{num}
1425 -mincoming-stack-boundary=@var{num}
1426 -mcld  -mcx16  -msahf  -mmovbe  -mcrc32 -mmwait
1427 -mrecip  -mrecip=@var{opt}
1428 -mvzeroupper  -mprefer-avx128  -mprefer-vector-width=@var{opt}
1429 -mpartial-vector-fp-math
1430 -mmove-max=@var{bits} -mstore-max=@var{bits}
1431 -mmmx  -msse  -msse2  -msse3  -mssse3  -msse4.1  -msse4.2  -msse4  -mavx
1432 -mavx2  -mavx512f  -mavx512pf  -mavx512er  -mavx512cd  -mavx512vl
1433 -mavx512bw  -mavx512dq  -mavx512ifma  -mavx512vbmi  -msha  -maes
1434 -mpclmul  -mfsgsbase  -mrdrnd  -mf16c  -mfma  -mpconfig  -mwbnoinvd
1435 -mptwrite  -mprefetchwt1  -mclflushopt  -mclwb  -mxsavec  -mxsaves
1436 -msse4a  -m3dnow  -m3dnowa  -mpopcnt  -mabm  -mbmi  -mtbm  -mfma4  -mxop
1437 -madx  -mlzcnt  -mbmi2  -mfxsr  -mxsave  -mxsaveopt  -mrtm  -mhle  -mlwp
1438 -mmwaitx  -mclzero  -mpku  -mthreads  -mgfni  -mvaes  -mwaitpkg
1439 -mshstk -mmanual-endbr -mcet-switch -mforce-indirect-call
1440 -mavx512vbmi2 -mavx512bf16 -menqcmd
1441 -mvpclmulqdq  -mavx512bitalg  -mmovdiri  -mmovdir64b  -mavx512vpopcntdq
1442 -mavx5124fmaps  -mavx512vnni  -mavx5124vnniw  -mprfchw  -mrdpid
1443 -mrdseed  -msgx -mavx512vp2intersect -mserialize -mtsxldtrk
1444 -mamx-tile  -mamx-int8  -mamx-bf16 -muintr -mhreset -mavxvnni
1445 -mavx512fp16 -mavxifma -mavxvnniint8 -mavxneconvert -mcmpccxadd -mamx-fp16
1446 -mprefetchi -mraoint -mamx-complex -mavxvnniint16 -msm3 -msha512 -msm4
1447 -mcldemote  -mms-bitfields  -mno-align-stringops  -minline-all-stringops
1448 -minline-stringops-dynamically  -mstringop-strategy=@var{alg}
1449 -mkl -mwidekl
1450 -mmemcpy-strategy=@var{strategy}  -mmemset-strategy=@var{strategy}
1451 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double
1452 -m96bit-long-double  -mlong-double-64  -mlong-double-80  -mlong-double-128
1453 -mregparm=@var{num}  -msseregparm
1454 -mveclibabi=@var{type}  -mvect8-ret-in-mem
1455 -mpc32  -mpc64  -mpc80  -mdaz-ftz -mstackrealign
1456 -momit-leaf-frame-pointer  -mno-red-zone  -mno-tls-direct-seg-refs
1457 -mcmodel=@var{code-model}  -mabi=@var{name}  -maddress-mode=@var{mode}
1458 -m32  -m64  -mx32  -m16  -miamcu  -mlarge-data-threshold=@var{num}
1459 -msse2avx  -mfentry  -mrecord-mcount  -mnop-mcount  -m8bit-idiv
1460 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name}
1461 -mavx256-split-unaligned-load  -mavx256-split-unaligned-store
1462 -malign-data=@var{type}  -mstack-protector-guard=@var{guard}
1463 -mstack-protector-guard-reg=@var{reg}
1464 -mstack-protector-guard-offset=@var{offset}
1465 -mstack-protector-guard-symbol=@var{symbol}
1466 -mgeneral-regs-only  -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop
1467 -mindirect-branch=@var{choice}  -mfunction-return=@var{choice}
1468 -mindirect-branch-register -mharden-sls=@var{choice}
1469 -mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access
1470 -munroll-only-small-loops -mlam=@var{choice}}
1472 @emph{x86 Windows Options}
1473 @gccoptlist{-mconsole  -mcrtdll=@var{library}  -mcygwin  -mno-cygwin  -mdll
1474 -mnop-fun-dllimport  -mthread
1475 -municode  -mwin32  -mwindows  -fno-set-stack-executable}
1477 @emph{Xstormy16 Options}
1478 @gccoptlist{-msim}
1480 @emph{Xtensa Options}
1481 @gccoptlist{-mconst16  -mno-const16
1482 -mfused-madd  -mno-fused-madd
1483 -mforce-no-pic
1484 -mserialize-volatile  -mno-serialize-volatile
1485 -mtext-section-literals  -mno-text-section-literals
1486 -mauto-litpools  -mno-auto-litpools
1487 -mtarget-align  -mno-target-align
1488 -mlongcalls  -mno-longcalls
1489 -mabi=@var{abi-type}
1490 -mextra-l32r-costs=@var{cycles}
1491 -mstrict-align  -mno-strict-align}
1493 @emph{zSeries Options}
1494 See S/390 and zSeries Options.
1495 @end table
1498 @node Overall Options
1499 @section Options Controlling the Kind of Output
1501 Compilation can involve up to four stages: preprocessing, compilation
1502 proper, assembly and linking, always in that order.  GCC is capable of
1503 preprocessing and compiling several files either into several
1504 assembler input files, or into one assembler input file; then each
1505 assembler input file produces an object file, and linking combines all
1506 the object files (those newly compiled, and those specified as input)
1507 into an executable file.
1509 @cindex file name suffix
1510 For any given input file, the file name suffix determines what kind of
1511 compilation is done:
1513 @table @gcctabopt
1514 @item @var{file}.c
1515 C source code that must be preprocessed.
1517 @item @var{file}.i
1518 C source code that should not be preprocessed.
1520 @item @var{file}.ii
1521 C++ source code that should not be preprocessed.
1523 @item @var{file}.m
1524 Objective-C source code.  Note that you must link with the @file{libobjc}
1525 library to make an Objective-C program work.
1527 @item @var{file}.mi
1528 Objective-C source code that should not be preprocessed.
1530 @item @var{file}.mm
1531 @itemx @var{file}.M
1532 Objective-C++ source code.  Note that you must link with the @file{libobjc}
1533 library to make an Objective-C++ program work.  Note that @samp{.M} refers
1534 to a literal capital M@.
1536 @item @var{file}.mii
1537 Objective-C++ source code that should not be preprocessed.
1539 @item @var{file}.h
1540 C, C++, Objective-C or Objective-C++ header file to be turned into a
1541 precompiled header (default), or C, C++ header file to be turned into an
1542 Ada spec (via the @option{-fdump-ada-spec} switch).
1544 @item @var{file}.cc
1545 @itemx @var{file}.cp
1546 @itemx @var{file}.cxx
1547 @itemx @var{file}.cpp
1548 @itemx @var{file}.CPP
1549 @itemx @var{file}.c++
1550 @itemx @var{file}.C
1551 C++ source code that must be preprocessed.  Note that in @samp{.cxx},
1552 the last two letters must both be literally @samp{x}.  Likewise,
1553 @samp{.C} refers to a literal capital C@.
1555 @item @var{file}.mm
1556 @itemx @var{file}.M
1557 Objective-C++ source code that must be preprocessed.
1559 @item @var{file}.mii
1560 Objective-C++ source code that should not be preprocessed.
1562 @item @var{file}.hh
1563 @itemx @var{file}.H
1564 @itemx @var{file}.hp
1565 @itemx @var{file}.hxx
1566 @itemx @var{file}.hpp
1567 @itemx @var{file}.HPP
1568 @itemx @var{file}.h++
1569 @itemx @var{file}.tcc
1570 C++ header file to be turned into a precompiled header or Ada spec.
1572 @item @var{file}.f
1573 @itemx @var{file}.for
1574 @itemx @var{file}.ftn
1575 Fixed form Fortran source code that should not be preprocessed.
1577 @item @var{file}.F
1578 @itemx @var{file}.FOR
1579 @itemx @var{file}.fpp
1580 @itemx @var{file}.FPP
1581 @itemx @var{file}.FTN
1582 Fixed form Fortran source code that must be preprocessed (with the traditional
1583 preprocessor).
1585 @item @var{file}.f90
1586 @itemx @var{file}.f95
1587 @itemx @var{file}.f03
1588 @itemx @var{file}.f08
1589 Free form Fortran source code that should not be preprocessed.
1591 @item @var{file}.F90
1592 @itemx @var{file}.F95
1593 @itemx @var{file}.F03
1594 @itemx @var{file}.F08
1595 Free form Fortran source code that must be preprocessed (with the
1596 traditional preprocessor).
1598 @item @var{file}.go
1599 Go source code.
1601 @item @var{file}.d
1602 D source code.
1604 @item @var{file}.di
1605 D interface file.
1607 @item @var{file}.dd
1608 D documentation code (Ddoc).
1610 @item @var{file}.ads
1611 Ada source code file that contains a library unit declaration (a
1612 declaration of a package, subprogram, or generic, or a generic
1613 instantiation), or a library unit renaming declaration (a package,
1614 generic, or subprogram renaming declaration).  Such files are also
1615 called @dfn{specs}.
1617 @item @var{file}.adb
1618 Ada source code file containing a library unit body (a subprogram or
1619 package body).  Such files are also called @dfn{bodies}.
1621 @c GCC also knows about some suffixes for languages not yet included:
1622 @c Ratfor:
1623 @c @var{file}.r
1625 @item @var{file}.s
1626 Assembler code.
1628 @item @var{file}.S
1629 @itemx @var{file}.sx
1630 Assembler code that must be preprocessed.
1632 @item @var{other}
1633 An object file to be fed straight into linking.
1634 Any file name with no recognized suffix is treated this way.
1635 @end table
1637 @opindex x
1638 You can specify the input language explicitly with the @option{-x} option:
1640 @table @gcctabopt
1641 @item -x @var{language}
1642 Specify explicitly the @var{language} for the following input files
1643 (rather than letting the compiler choose a default based on the file
1644 name suffix).  This option applies to all following input files until
1645 the next @option{-x} option.  Possible values for @var{language} are:
1646 @smallexample
1647 c  c-header  cpp-output
1648 c++  c++-header  c++-system-header c++-user-header c++-cpp-output
1649 objective-c  objective-c-header  objective-c-cpp-output
1650 objective-c++ objective-c++-header objective-c++-cpp-output
1651 assembler  assembler-with-cpp
1654 f77  f77-cpp-input f95  f95-cpp-input
1656 @end smallexample
1658 @item -x none
1659 Turn off any specification of a language, so that subsequent files are
1660 handled according to their file name suffixes (as they are if @option{-x}
1661 has not been used at all).
1662 @end table
1664 If you only want some of the stages of compilation, you can use
1665 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1666 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1667 @command{gcc} is to stop.  Note that some combinations (for example,
1668 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1670 @table @gcctabopt
1671 @opindex c
1672 @item -c
1673 Compile or assemble the source files, but do not link.  The linking
1674 stage simply is not done.  The ultimate output is in the form of an
1675 object file for each source file.
1677 By default, the object file name for a source file is made by replacing
1678 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1680 Unrecognized input files, not requiring compilation or assembly, are
1681 ignored.
1683 @opindex S
1684 @item -S
1685 Stop after the stage of compilation proper; do not assemble.  The output
1686 is in the form of an assembler code file for each non-assembler input
1687 file specified.
1689 By default, the assembler file name for a source file is made by
1690 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1692 Input files that don't require compilation are ignored.
1694 @opindex E
1695 @item -E
1696 Stop after the preprocessing stage; do not run the compiler proper.  The
1697 output is in the form of preprocessed source code, which is sent to the
1698 standard output.
1700 Input files that don't require preprocessing are ignored.
1702 @cindex output file option
1703 @opindex o
1704 @item -o @var{file}
1705 Place the primary output in file @var{file}.  This applies to whatever
1706 sort of output is being produced, whether it be an executable file, an
1707 object file, an assembler file or preprocessed C code.
1709 If @option{-o} is not specified, the default is to put an executable
1710 file in @file{a.out}, the object file for
1711 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1712 assembler file in @file{@var{source}.s}, a precompiled header file in
1713 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1714 standard output.
1716 Though @option{-o} names only the primary output, it also affects the
1717 naming of auxiliary and dump outputs.  See the examples below.  Unless
1718 overridden, both auxiliary outputs and dump outputs are placed in the
1719 same directory as the primary output.  In auxiliary outputs, the suffix
1720 of the input file is replaced with that of the auxiliary output file
1721 type; in dump outputs, the suffix of the dump file is appended to the
1722 input file suffix.  In compilation commands, the base name of both
1723 auxiliary and dump outputs is that of the primary output; in compile and
1724 link commands, the primary output name, minus the executable suffix, is
1725 combined with the input file name.  If both share the same base name,
1726 disregarding the suffix, the result of the combination is that base
1727 name, otherwise, they are concatenated, separated by a dash.
1729 @smallexample
1730 gcc -c foo.c ...
1731 @end smallexample
1733 will use @file{foo.o} as the primary output, and place aux outputs and
1734 dumps next to it, e.g., aux file @file{foo.dwo} for
1735 @option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1736 @option{-fdump-rtl-final}.
1738 If a non-linker output file is explicitly specified, aux and dump files
1739 by default take the same base name:
1741 @smallexample
1742 gcc -c foo.c -o dir/foobar.o ...
1743 @end smallexample
1745 will name aux outputs @file{dir/foobar.*} and dump outputs
1746 @file{dir/foobar.c.*}.
1748 A linker output will instead prefix aux and dump outputs:
1750 @smallexample
1751 gcc foo.c bar.c -o dir/foobar ...
1752 @end smallexample
1754 will generally name aux outputs @file{dir/foobar-foo.*} and
1755 @file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1756 @file{dir/foobar-bar.c.*}.
1758 The one exception to the above is when the executable shares the base
1759 name with the single input:
1761 @smallexample
1762 gcc foo.c -o dir/foo ...
1763 @end smallexample
1765 in which case aux outputs are named @file{dir/foo.*} and dump outputs
1766 named @file{dir/foo.c.*}.
1768 The location and the names of auxiliary and dump outputs can be adjusted
1769 by the options @option{-dumpbase}, @option{-dumpbase-ext},
1770 @option{-dumpdir}, @option{-save-temps=cwd}, and
1771 @option{-save-temps=obj}.
1774 @opindex dumpbase
1775 @item -dumpbase @var{dumpbase}
1776 This option sets the base name for auxiliary and dump output files.  It
1777 does not affect the name of the primary output file.  Intermediate
1778 outputs, when preserved, are not regarded as primary outputs, but as
1779 auxiliary outputs:
1781 @smallexample
1782 gcc -save-temps -S foo.c
1783 @end smallexample
1785 saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1786 then compiles to the (implied) output file @file{foo.s}, whereas:
1788 @smallexample
1789 gcc -save-temps -dumpbase save-foo -c foo.c
1790 @end smallexample
1792 preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1793 an intermediate, thus auxiliary output), and then assembles to the
1794 (implied) output file @file{foo.o}.
1796 Absent this option, dump and aux files take their names from the input
1797 file, or from the (non-linker) output file, if one is explicitly
1798 specified: dump output files (e.g. those requested by @option{-fdump-*}
1799 options) with the input name suffix, and aux output files (those
1800 requested by other non-dump options, e.g. @code{-save-temps},
1801 @code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1803 Similar suffix differentiation of dump and aux outputs can be attained
1804 for explicitly-given @option{-dumpbase basename.suf} by also specifying
1805 @option{-dumpbase-ext .suf}.
1807 If @var{dumpbase} is explicitly specified with any directory component,
1808 any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1809 @option{-save-temps=*}) is ignored, and instead of appending to it,
1810 @var{dumpbase} fully overrides it:
1812 @smallexample
1813 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1814   -dumpdir pfx- -save-temps=cwd ...
1815 @end smallexample
1817 creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1818 @file{dir/} in @option{-o}, the @file{./} prefix implied by
1819 @option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1821 When @option{-dumpbase} is specified in a command that compiles multiple
1822 inputs, or that compiles and then links, it may be combined with
1823 @var{dumppfx}, as specified under @option{-dumpdir}.  Then, each input
1824 file is compiled using the combined @var{dumppfx}, and default values
1825 for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1826 file:
1828 @smallexample
1829 gcc foo.c bar.c -c -dumpbase main ...
1830 @end smallexample
1832 creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1833 overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1834 as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1835 and @file{main-bar.*}.
1837 An empty string specified as @var{dumpbase} avoids the influence of the
1838 output basename in the naming of auxiliary and dump outputs during
1839 compilation, computing default values :
1841 @smallexample
1842 gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1843 @end smallexample
1845 will name aux outputs @file{dir/foo.*} and dump outputs
1846 @file{dir/foo.c.*}.  Note how their basenames are taken from the input
1847 name, but the directory still defaults to that of the output.
1849 The empty-string dumpbase does not prevent the use of the output
1850 basename for outputs during linking:
1852 @smallexample
1853 gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1854 @end smallexample
1856 The compilation of the source files will name auxiliary outputs
1857 @file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1858 @file{dir/foo.c.*} and @file{dir/bar.c.*}.  LTO recompilation during
1859 linking will use @file{dir/foobar.} as the prefix for dumps and
1860 auxiliary files.
1863 @opindex dumpbase-ext
1864 @item -dumpbase-ext @var{auxdropsuf}
1865 When forming the name of an auxiliary (but not a dump) output file, drop
1866 trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1867 suffixes.  If not specified, this option defaults to the suffix of a
1868 default @var{dumpbase}, i.e., the suffix of the input file when
1869 @option{-dumpbase} is not present in the command line, or @var{dumpbase}
1870 is combined with @var{dumppfx}.
1872 @smallexample
1873 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1874 @end smallexample
1876 creates @file{dir/foo.o} as the main output, and generates auxiliary
1877 outputs in @file{dir/x-foo.*}, taking the location of the primary
1878 output, and dropping the @file{.c} suffix from the @var{dumpbase}.  Dump
1879 outputs retain the suffix: @file{dir/x-foo.c.*}.
1881 This option is disregarded if it does not match the suffix of a
1882 specified @var{dumpbase}, except as an alternative to the executable
1883 suffix when appending the linker output base name to @var{dumppfx}, as
1884 specified below:
1886 @smallexample
1887 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1888 @end smallexample
1890 creates @file{main.out} as the primary output, and avoids overwriting
1891 the auxiliary and dump outputs by using the executable name minus
1892 @var{auxdropsuf} as a prefix, creating auxiliary outputs named
1893 @file{main-foo.*} and @file{main-bar.*} and dump outputs named
1894 @file{main-foo.c.*} and @file{main-bar.c.*}.
1897 @opindex dumpdir
1898 @item -dumpdir @var{dumppfx}
1899 When forming the name of an auxiliary or dump output file, use
1900 @var{dumppfx} as a prefix:
1902 @smallexample
1903 gcc -dumpdir pfx- -c foo.c ...
1904 @end smallexample
1906 creates @file{foo.o} as the primary output, and auxiliary outputs named
1907 @file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1908 @var{dumpbase} derived from the default primary output, derived in turn
1909 from the input name.  Dump outputs also take the input name suffix:
1910 @file{pfx-foo.c.*}.
1912 If @var{dumppfx} is to be used as a directory name, it must end with a
1913 directory separator:
1915 @smallexample
1916 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1917 @end smallexample
1919 creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1920 named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1921 default @var{dumpbase} derived from the primary output name.  Dump
1922 outputs also take the input name suffix: @file{dir/bar.c.*}.
1924 It defaults to the location of the output file, unless the output
1925 file is a special file like @code{/dev/null}. Options
1926 @option{-save-temps=cwd} and @option{-save-temps=obj} override this
1927 default, just like an explicit @option{-dumpdir} option.  In case
1928 multiple such options are given, the last one prevails:
1930 @smallexample
1931 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1932 @end smallexample
1934 outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1935 @option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1936 @option{-dumpdir} option.  It does not matter that @option{=obj} is the
1937 default for @option{-save-temps}, nor that the output directory is
1938 implicitly the current directory.  Dump outputs are named
1939 @file{foo.c.*}.
1941 When compiling from multiple input files, if @option{-dumpbase} is
1942 specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1943 are appended to (or override, if containing any directory components) an
1944 explicit or defaulted @var{dumppfx}, so that each of the multiple
1945 compilations gets differently-named aux and dump outputs.
1947 @smallexample
1948 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1949 @end smallexample
1951 outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1952 @file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1953 Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1954 and @file{dir/pfx-main-bar.c.*}, respectively.  Contrast with the
1955 single-input compilation:
1957 @smallexample
1958 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1959 @end smallexample
1961 that, applying @option{-dumpbase} to a single source, does not compute
1962 and append a separate @var{dumpbase} per input file.  Its auxiliary and
1963 dump outputs go in @file{dir/pfx-main.*}.
1965 When compiling and then linking from multiple input files, a defaulted
1966 or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1967 transformation above (e.g. the compilation of @file{foo.c} and
1968 @file{bar.c} above, but without @option{-c}).  If neither
1969 @option{-dumpdir} nor @option{-dumpbase} are given, the linker output
1970 base name, minus @var{auxdropsuf}, if specified, or the executable
1971 suffix otherwise, plus a dash is appended to the default @var{dumppfx}
1972 instead.  Note, however, that unlike earlier cases of linking:
1974 @smallexample
1975 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1976 @end smallexample
1978 does not append the output name @file{main} to @var{dumppfx}, because
1979 @option{-dumpdir} is explicitly specified.  The goal is that the
1980 explicitly-specified @var{dumppfx} may contain the specified output name
1981 as part of the prefix, if desired; only an explicitly-specified
1982 @option{-dumpbase} would be combined with it, in order to avoid simply
1983 discarding a meaningful option.
1985 When compiling and then linking from a single input file, the linker
1986 output base name will only be appended to the default @var{dumppfx} as
1987 above if it does not share the base name with the single input file
1988 name.  This has been covered in single-input linking cases above, but
1989 not with an explicit @option{-dumpdir} that inhibits the combination,
1990 even if overridden by @option{-save-temps=*}:
1992 @smallexample
1993 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1994 @end smallexample
1996 Auxiliary outputs are named @file{foo.*}, and dump outputs
1997 @file{foo.c.*}, in the current working directory as ultimately requested
1998 by @option{-save-temps=cwd}.
2000 Summing it all up for an intuitive though slightly imprecise data flow:
2001 the primary output name is broken into a directory part and a basename
2002 part; @var{dumppfx} is set to the former, unless overridden by
2003 @option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
2004 to the latter, unless overriden by @option{-dumpbase}.  If there are
2005 multiple inputs or linking, this @var{dumpbase} may be combined with
2006 @var{dumppfx} and taken from each input file.  Auxiliary output names
2007 for each input are formed by combining @var{dumppfx}, @var{dumpbase}
2008 minus suffix, and the auxiliary output suffix; dump output names are
2009 only different in that the suffix from @var{dumpbase} is retained.
2011 When it comes to auxiliary and dump outputs created during LTO
2012 recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
2013 given or as derived from the linker output name but not from inputs,
2014 even in cases in which this combination would not otherwise be used as
2015 such, is passed down with a trailing period replacing the compiler-added
2016 dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
2017 being involved in linking, this program does not normally get any
2018 @option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
2020 When running sub-compilers, @command{lto-wrapper} appends LTO stage
2021 names to the received @var{dumppfx}, ensures it contains a directory
2022 component so that it overrides any @option{-dumpdir}, and passes that as
2023 @option{-dumpbase} to sub-compilers.
2025 @opindex v
2026 @item -v
2027 Print (on standard error output) the commands executed to run the stages
2028 of compilation.  Also print the version number of the compiler driver
2029 program and of the preprocessor and the compiler proper.
2031 @opindex ###
2032 @item -###
2033 Like @option{-v} except the commands are not executed and arguments
2034 are quoted unless they contain only alphanumeric characters or @code{./-_}.
2035 This is useful for shell scripts to capture the driver-generated command lines.
2037 @opindex help
2038 @item --help
2039 Print (on the standard output) a description of the command-line options
2040 understood by @command{gcc}.  If the @option{-v} option is also specified
2041 then @option{--help} is also passed on to the various processes
2042 invoked by @command{gcc}, so that they can display the command-line options
2043 they accept.  If the @option{-Wextra} option has also been specified
2044 (prior to the @option{--help} option), then command-line options that
2045 have no documentation associated with them are also displayed.
2047 @opindex target-help
2048 @item --target-help
2049 Print (on the standard output) a description of target-specific command-line
2050 options for each tool.  For some targets extra target-specific
2051 information may also be printed.
2053 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
2054 Print (on the standard output) a description of the command-line
2055 options understood by the compiler that fit into all specified classes
2056 and qualifiers.  These are the supported classes:
2058 @table @asis
2059 @item @samp{optimizers}
2060 Display all of the optimization options supported by the
2061 compiler.
2063 @item @samp{warnings}
2064 Display all of the options controlling warning messages
2065 produced by the compiler.
2067 @item @samp{target}
2068 Display target-specific options.  Unlike the
2069 @option{--target-help} option however, target-specific options of the
2070 linker and assembler are not displayed.  This is because those
2071 tools do not currently support the extended @option{--help=} syntax.
2073 @item @samp{params}
2074 Display the values recognized by the @option{--param}
2075 option.
2077 @item @var{language}
2078 Display the options supported for @var{language}, where
2079 @var{language} is the name of one of the languages supported in this
2080 version of GCC@.  If an option is supported by all languages, one needs
2081 to select @samp{common} class.
2083 @item @samp{common}
2084 Display the options that are common to all languages.
2085 @end table
2087 These are the supported qualifiers:
2089 @table @asis
2090 @item @samp{undocumented}
2091 Display only those options that are undocumented.
2093 @item @samp{joined}
2094 Display options taking an argument that appears after an equal
2095 sign in the same continuous piece of text, such as:
2096 @samp{--help=target}.
2098 @item @samp{separate}
2099 Display options taking an argument that appears as a separate word
2100 following the original option, such as: @samp{-o output-file}.
2101 @end table
2103 Thus for example to display all the undocumented target-specific
2104 switches supported by the compiler, use:
2106 @smallexample
2107 --help=target,undocumented
2108 @end smallexample
2110 The sense of a qualifier can be inverted by prefixing it with the
2111 @samp{^} character, so for example to display all binary warning
2112 options (i.e., ones that are either on or off and that do not take an
2113 argument) that have a description, use:
2115 @smallexample
2116 --help=warnings,^joined,^undocumented
2117 @end smallexample
2119 The argument to @option{--help=} should not consist solely of inverted
2120 qualifiers.
2122 Combining several classes is possible, although this usually
2123 restricts the output so much that there is nothing to display.  One
2124 case where it does work, however, is when one of the classes is
2125 @var{target}.  For example, to display all the target-specific
2126 optimization options, use:
2128 @smallexample
2129 --help=target,optimizers
2130 @end smallexample
2132 The @option{--help=} option can be repeated on the command line.  Each
2133 successive use displays its requested class of options, skipping
2134 those that have already been displayed.  If @option{--help} is also
2135 specified anywhere on the command line then this takes precedence
2136 over any @option{--help=} option.
2138 If the @option{-Q} option appears on the command line before the
2139 @option{--help=} option, then the descriptive text displayed by
2140 @option{--help=} is changed.  Instead of describing the displayed
2141 options, an indication is given as to whether the option is enabled,
2142 disabled or set to a specific value (assuming that the compiler
2143 knows this at the point where the @option{--help=} option is used).
2145 Here is a truncated example from the ARM port of @command{gcc}:
2147 @smallexample
2148   % gcc -Q -mabi=2 --help=target -c
2149   The following options are target specific:
2150   -mabi=                                2
2151   -mabort-on-noreturn                   [disabled]
2152   -mapcs                                [disabled]
2153 @end smallexample
2155 The output is sensitive to the effects of previous command-line
2156 options, so for example it is possible to find out which optimizations
2157 are enabled at @option{-O2} by using:
2159 @smallexample
2160 -Q -O2 --help=optimizers
2161 @end smallexample
2163 Alternatively you can discover which binary optimizations are enabled
2164 by @option{-O3} by using:
2166 @smallexample
2167 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2168 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2169 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2170 @end smallexample
2172 @opindex version
2173 @item --version
2174 Display the version number and copyrights of the invoked GCC@.
2176 @opindex pass-exit-codes
2177 @item -pass-exit-codes
2178 Normally the @command{gcc} program exits with the code of 1 if any
2179 phase of the compiler returns a non-success return code.  If you specify
2180 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
2181 the numerically highest error produced by any phase returning an error
2182 indication.  The C, C++, and Fortran front ends return 4 if an internal
2183 compiler error is encountered.
2185 @opindex pipe
2186 @item -pipe
2187 Use pipes rather than temporary files for communication between the
2188 various stages of compilation.  This fails to work on some systems where
2189 the assembler is unable to read from a pipe; but the GNU assembler has
2190 no trouble.
2192 @opindex specs
2193 @item -specs=@var{file}
2194 Process @var{file} after the compiler reads in the standard @file{specs}
2195 file, in order to override the defaults which the @command{gcc} driver
2196 program uses when determining what switches to pass to @command{cc1},
2197 @command{cc1plus}, @command{as}, @command{ld}, etc.  More than one
2198 @option{-specs=@var{file}} can be specified on the command line, and they
2199 are processed in order, from left to right.  @xref{Spec Files}, for
2200 information about the format of the @var{file}.
2202 @opindex wrapper
2203 @item -wrapper
2204 Invoke all subcommands under a wrapper program.  The name of the
2205 wrapper program and its parameters are passed as a comma separated
2206 list.
2208 @smallexample
2209 gcc -c t.c -wrapper gdb,--args
2210 @end smallexample
2212 @noindent
2213 This invokes all subprograms of @command{gcc} under
2214 @samp{gdb --args}, thus the invocation of @command{cc1} is
2215 @samp{gdb --args cc1 @dots{}}.
2217 @opindex ffile-prefix-map
2218 @item -ffile-prefix-map=@var{old}=@var{new}
2219 When compiling files residing in directory @file{@var{old}}, record
2220 any references to them in the result of the compilation as if the
2221 files resided in directory @file{@var{new}} instead.  Specifying this
2222 option is equivalent to specifying all the individual
2223 @option{-f*-prefix-map} options.  This can be used to make reproducible
2224 builds that are location independent.  Directories referenced by
2225 directives are not affected by these options.  See also
2226 @option{-fmacro-prefix-map}, @option{-fdebug-prefix-map},
2227 @option{-fprofile-prefix-map} and @option{-fcanon-prefix-map}.
2229 @opindex fcanon-prefix-map
2230 @item -fcanon-prefix-map
2231 For the @option{-f*-prefix-map} options normally comparison
2232 of @file{@var{old}} prefix against the filename that would be normally
2233 referenced in the result of the compilation is done using textual
2234 comparison of the prefixes, or ignoring character case for case insensitive
2235 filesystems and considering slashes and backslashes as equal on DOS based
2236 filesystems.  The @option{-fcanon-prefix-map} causes such comparisons
2237 to be done on canonicalized paths of @file{@var{old}}
2238 and the referenced filename.
2240 @opindex fplugin
2241 @item -fplugin=@var{name}.so
2242 Load the plugin code in file @var{name}.so, assumed to be a
2243 shared object to be dlopen'd by the compiler.  The base name of
2244 the shared object file is used to identify the plugin for the
2245 purposes of argument parsing (See
2246 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2247 Each plugin should define the callback functions specified in the
2248 Plugins API.
2250 @opindex fplugin-arg
2251 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
2252 Define an argument called @var{key} with a value of @var{value}
2253 for the plugin called @var{name}.
2255 @opindex fdump-ada-spec
2256 @item -fdump-ada-spec@r{[}-slim@r{]}
2257 For C and C++ source and include files, generate corresponding Ada specs.
2258 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2259 GNAT User's Guide}, which provides detailed documentation on this feature.
2261 @opindex fada-spec-parent
2262 @item -fada-spec-parent=@var{unit}
2263 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2264 Ada specs as child units of parent @var{unit}.
2266 @opindex fdump-go-spec
2267 @item -fdump-go-spec=@var{file}
2268 For input files in any language, generate corresponding Go
2269 declarations in @var{file}.  This generates Go @code{const},
2270 @code{type}, @code{var}, and @code{func} declarations which may be a
2271 useful way to start writing a Go interface to code written in some
2272 other language.
2274 @include @value{srcdir}/../libiberty/at-file.texi
2275 @end table
2277 @node Invoking G++
2278 @section Compiling C++ Programs
2280 @cindex suffixes for C++ source
2281 @cindex C++ source file suffixes
2282 C++ source files conventionally use one of the suffixes @samp{.C},
2283 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2284 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2285 @samp{.H}, or (for shared template code) @samp{.tcc}; and
2286 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
2287 files with these names and compiles them as C++ programs even if you
2288 call the compiler the same way as for compiling C programs (usually
2289 with the name @command{gcc}).
2291 @findex g++
2292 @findex c++
2293 However, the use of @command{gcc} does not add the C++ library.
2294 @command{g++} is a program that calls GCC and automatically specifies linking
2295 against the C++ library.  It treats @samp{.c},
2296 @samp{.h} and @samp{.i} files as C++ source files instead of C source
2297 files unless @option{-x} is used.  This program is also useful when
2298 precompiling a C header file with a @samp{.h} extension for use in C++
2299 compilations.  On many systems, @command{g++} is also installed with
2300 the name @command{c++}.
2302 @cindex invoking @command{g++}
2303 When you compile C++ programs, you may specify many of the same
2304 command-line options that you use for compiling programs in any
2305 language; or command-line options meaningful for C and related
2306 languages; or options that are meaningful only for C++ programs.
2307 @xref{C Dialect Options,,Options Controlling C Dialect}, for
2308 explanations of options for languages related to C@.
2309 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2310 explanations of options that are meaningful only for C++ programs.
2312 @node C Dialect Options
2313 @section Options Controlling C Dialect
2314 @cindex dialect options
2315 @cindex language dialect options
2316 @cindex options, dialect
2318 The following options control the dialect of C (or languages derived
2319 from C, such as C++, Objective-C and Objective-C++) that the compiler
2320 accepts:
2322 @table @gcctabopt
2323 @cindex ANSI support
2324 @cindex ISO support
2325 @opindex ansi
2326 @item -ansi
2327 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2328 equivalent to @option{-std=c++98}.
2330 This turns off certain features of GCC that are incompatible with ISO
2331 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2332 such as the @code{asm} and @code{typeof} keywords, and
2333 predefined macros such as @code{unix} and @code{vax} that identify the
2334 type of system you are using.  It also enables the undesirable and
2335 rarely used ISO trigraph feature.  For the C compiler,
2336 it disables recognition of C++ style @samp{//} comments as well as
2337 the @code{inline} keyword.
2339 The alternate keywords @code{__asm__}, @code{__extension__},
2340 @code{__inline__} and @code{__typeof__} continue to work despite
2341 @option{-ansi}.  You would not want to use them in an ISO C program, of
2342 course, but it is useful to put them in header files that might be included
2343 in compilations done with @option{-ansi}.  Alternate predefined macros
2344 such as @code{__unix__} and @code{__vax__} are also available, with or
2345 without @option{-ansi}.
2347 The @option{-ansi} option does not cause non-ISO programs to be
2348 rejected gratuitously.  For that, @option{-Wpedantic} is required in
2349 addition to @option{-ansi}.  @xref{Warning Options}.
2351 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2352 option is used.  Some header files may notice this macro and refrain
2353 from declaring certain functions or defining certain macros that the
2354 ISO standard doesn't call for; this is to avoid interfering with any
2355 programs that might use these names for other things.
2357 Functions that are normally built in but do not have semantics
2358 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2359 functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
2360 built-in functions provided by GCC}, for details of the functions
2361 affected.
2363 @opindex std
2364 @item -std=
2365 Determine the language standard. @xref{Standards,,Language Standards
2366 Supported by GCC}, for details of these standard versions.  This option
2367 is currently only supported when compiling C or C++.
2369 The compiler can accept several base standards, such as @samp{c90} or
2370 @samp{c++98}, and GNU dialects of those standards, such as
2371 @samp{gnu90} or @samp{gnu++98}.  When a base standard is specified, the
2372 compiler accepts all programs following that standard plus those
2373 using GNU extensions that do not contradict it.  For example,
2374 @option{-std=c90} turns off certain features of GCC that are
2375 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2376 keywords, but not other GNU extensions that do not have a meaning in
2377 ISO C90, such as omitting the middle term of a @code{?:}
2378 expression. On the other hand, when a GNU dialect of a standard is
2379 specified, all features supported by the compiler are enabled, even when
2380 those features change the meaning of the base standard.  As a result, some
2381 strict-conforming programs may be rejected.  The particular standard
2382 is used by @option{-Wpedantic} to identify which features are GNU
2383 extensions given that version of the standard. For example
2384 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2385 comments, while @option{-std=gnu99 -Wpedantic} does not.
2387 A value for this option must be provided; possible values are
2389 @table @samp
2390 @item c90
2391 @itemx c89
2392 @itemx iso9899:1990
2393 Support all ISO C90 programs (certain GNU extensions that conflict
2394 with ISO C90 are disabled). Same as @option{-ansi} for C code.
2396 @item iso9899:199409
2397 ISO C90 as modified in amendment 1.
2399 @item c99
2400 @itemx c9x
2401 @itemx iso9899:1999
2402 @itemx iso9899:199x
2403 ISO C99.  This standard is substantially completely supported, modulo
2404 bugs and floating-point issues
2405 (mainly but not entirely relating to optional C99 features from
2406 Annexes F and G).  See
2407 @w{@uref{https://gcc.gnu.org/c99status.html}} for more information.  The
2408 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2410 @item c11
2411 @itemx c1x
2412 @itemx iso9899:2011
2413 ISO C11, the 2011 revision of the ISO C standard.  This standard is
2414 substantially completely supported, modulo bugs, floating-point issues
2415 (mainly but not entirely relating to optional C11 features from
2416 Annexes F and G) and the optional Annexes K (Bounds-checking
2417 interfaces) and L (Analyzability).  The name @samp{c1x} is deprecated.
2419 @item c17
2420 @itemx c18
2421 @itemx iso9899:2017
2422 @itemx iso9899:2018
2423 ISO C17, the 2017 revision of the ISO C standard
2424 (published in 2018).  This standard is
2425 same as C11 except for corrections of defects (all of which are also
2426 applied with @option{-std=c11}) and a new value of
2427 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2429 @item c2x
2430 The next version of the ISO C standard, still under development.  The
2431 support for this version is experimental and incomplete.
2433 @item gnu90
2434 @itemx gnu89
2435 GNU dialect of ISO C90 (including some C99 features).
2437 @item gnu99
2438 @itemx gnu9x
2439 GNU dialect of ISO C99.  The name @samp{gnu9x} is deprecated.
2441 @item gnu11
2442 @itemx gnu1x
2443 GNU dialect of ISO C11.
2444 The name @samp{gnu1x} is deprecated.
2446 @item gnu17
2447 @itemx gnu18
2448 GNU dialect of ISO C17.  This is the default for C code.
2450 @item gnu2x
2451 The next version of the ISO C standard, still under development, plus
2452 GNU extensions.  The support for this version is experimental and
2453 incomplete.
2455 @item c++98
2456 @itemx c++03
2457 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2458 additional defect reports. Same as @option{-ansi} for C++ code.
2460 @item gnu++98
2461 @itemx gnu++03
2462 GNU dialect of @option{-std=c++98}.
2464 @item c++11
2465 @itemx c++0x
2466 The 2011 ISO C++ standard plus amendments.
2467 The name @samp{c++0x} is deprecated.
2469 @item gnu++11
2470 @itemx gnu++0x
2471 GNU dialect of @option{-std=c++11}.
2472 The name @samp{gnu++0x} is deprecated.
2474 @item c++14
2475 @itemx c++1y
2476 The 2014 ISO C++ standard plus amendments.
2477 The name @samp{c++1y} is deprecated.
2479 @item gnu++14
2480 @itemx gnu++1y
2481 GNU dialect of @option{-std=c++14}.
2482 The name @samp{gnu++1y} is deprecated.
2484 @item c++17
2485 @itemx c++1z
2486 The 2017 ISO C++ standard plus amendments.
2487 The name @samp{c++1z} is deprecated.
2489 @item gnu++17
2490 @itemx gnu++1z
2491 GNU dialect of @option{-std=c++17}.
2492 This is the default for C++ code.
2493 The name @samp{gnu++1z} is deprecated.
2495 @item c++20
2496 @itemx c++2a
2497 The 2020 ISO C++ standard plus amendments.
2498 Support is experimental, and could change in incompatible ways in
2499 future releases.
2500 The name @samp{c++2a} is deprecated.
2502 @item gnu++20
2503 @itemx gnu++2a
2504 GNU dialect of @option{-std=c++20}.
2505 Support is experimental, and could change in incompatible ways in
2506 future releases.
2507 The name @samp{gnu++2a} is deprecated.
2509 @item c++2b
2510 @itemx c++23
2511 The next revision of the ISO C++ standard, planned for
2512 2023.  Support is highly experimental, and will almost certainly
2513 change in incompatible ways in future releases.
2515 @item gnu++2b
2516 @itemx gnu++23
2517 GNU dialect of @option{-std=c++2b}.  Support is highly experimental,
2518 and will almost certainly change in incompatible ways in future
2519 releases.
2521 @item c++2c
2522 @itemx c++26
2523 The next revision of the ISO C++ standard, planned for
2524 2026.  Support is highly experimental, and will almost certainly
2525 change in incompatible ways in future releases.
2527 @item gnu++2c
2528 @itemx gnu++26
2529 GNU dialect of @option{-std=c++2c}.  Support is highly experimental,
2530 and will almost certainly change in incompatible ways in future
2531 releases.
2532 @end table
2534 @opindex aux-info
2535 @item -aux-info @var{filename}
2536 Output to the given filename prototyped declarations for all functions
2537 declared and/or defined in a translation unit, including those in header
2538 files.  This option is silently ignored in any language other than C@.
2540 Besides declarations, the file indicates, in comments, the origin of
2541 each declaration (source file and line), whether the declaration was
2542 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2543 @samp{O} for old, respectively, in the first character after the line
2544 number and the colon), and whether it came from a declaration or a
2545 definition (@samp{C} or @samp{F}, respectively, in the following
2546 character).  In the case of function definitions, a K&R-style list of
2547 arguments followed by their declarations is also provided, inside
2548 comments, after the declaration.
2550 @opindex fno-asm
2551 @opindex fasm
2552 @item -fno-asm
2553 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2554 keyword, so that code can use these words as identifiers.  You can use
2555 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2556 instead.  In C, @option{-ansi} implies @option{-fno-asm}.
2558 In C++, @code{inline} is a standard keyword and is not affected by
2559 this switch.  You may want to use the @option{-fno-gnu-keywords} flag
2560 instead, which disables @code{typeof} but not @code{asm} and
2561 @code{inline}.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}),
2562 this switch only affects the @code{asm} and @code{typeof} keywords,
2563 since @code{inline} is a standard keyword in ISO C99.  In C2X mode
2564 (@option{-std=c2x} or @option{-std=gnu2x}), this switch only affects
2565 the @code{asm} keyword, since @code{typeof} is a standard keyword in
2566 ISO C2X.
2568 @opindex fno-builtin
2569 @opindex fbuiltin
2570 @cindex built-in functions
2571 @item -fno-builtin
2572 @itemx -fno-builtin-@var{function}
2573 Don't recognize built-in functions that do not begin with
2574 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
2575 functions provided by GCC}, for details of the functions affected,
2576 including those which are not built-in functions when @option{-ansi} or
2577 @option{-std} options for strict ISO C conformance are used because they
2578 do not have an ISO standard meaning.
2580 GCC normally generates special code to handle certain built-in functions
2581 more efficiently; for instance, calls to @code{alloca} may become single
2582 instructions which adjust the stack directly, and calls to @code{memcpy}
2583 may become inline copy loops.  The resulting code is often both smaller
2584 and faster, but since the function calls no longer appear as such, you
2585 cannot set a breakpoint on those calls, nor can you change the behavior
2586 of the functions by linking with a different library.  In addition,
2587 when a function is recognized as a built-in function, GCC may use
2588 information about that function to warn about problems with calls to
2589 that function, or to generate more efficient code, even if the
2590 resulting code still contains calls to that function.  For example,
2591 warnings are given with @option{-Wformat} for bad calls to
2592 @code{printf} when @code{printf} is built in and @code{strlen} is
2593 known not to modify global memory.
2595 With the @option{-fno-builtin-@var{function}} option
2596 only the built-in function @var{function} is
2597 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
2598 function is named that is not built-in in this version of GCC, this
2599 option is ignored.  There is no corresponding
2600 @option{-fbuiltin-@var{function}} option; if you wish to enable
2601 built-in functions selectively when using @option{-fno-builtin} or
2602 @option{-ffreestanding}, you may define macros such as:
2604 @smallexample
2605 #define abs(n)          __builtin_abs ((n))
2606 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
2607 @end smallexample
2609 @opindex fcond-mismatch
2610 @item -fcond-mismatch
2611 Allow conditional expressions with mismatched types in the second and
2612 third arguments.  The value of such an expression is void.  This option
2613 is not supported for C++.
2615 @opindex ffreestanding
2616 @cindex hosted environment
2617 @item -ffreestanding
2619 Assert that compilation targets a freestanding environment.  This
2620 implies @option{-fno-builtin}.  A freestanding environment
2621 is one in which the standard library may not exist, and program startup may
2622 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
2623 This is equivalent to @option{-fno-hosted}.
2625 @xref{Standards,,Language Standards Supported by GCC}, for details of
2626 freestanding and hosted environments.
2628 @opindex fgimple
2629 @item -fgimple
2631 Enable parsing of function definitions marked with @code{__GIMPLE}.
2632 This is an experimental feature that allows unit testing of GIMPLE
2633 passes.
2635 @opindex fgnu-tm
2636 @item -fgnu-tm
2637 When the option @option{-fgnu-tm} is specified, the compiler
2638 generates code for the Linux variant of Intel's current Transactional
2639 Memory ABI specification document (Revision 1.1, May 6 2009).  This is
2640 an experimental feature whose interface may change in future versions
2641 of GCC, as the official specification changes.  Please note that not
2642 all architectures are supported for this feature.
2644 For more information on GCC's support for transactional memory,
2645 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2646 Transactional Memory Library}.
2648 Note that the transactional memory feature is not supported with
2649 non-call exceptions (@option{-fnon-call-exceptions}).
2651 @opindex fgnu89-inline
2652 @item -fgnu89-inline
2653 The option @option{-fgnu89-inline} tells GCC to use the traditional
2654 GNU semantics for @code{inline} functions when in C99 mode.
2655 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2656 Using this option is roughly equivalent to adding the
2657 @code{gnu_inline} function attribute to all inline functions
2658 (@pxref{Function Attributes}).
2660 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2661 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2662 specifies the default behavior).
2663 This option is not supported in @option{-std=c90} or
2664 @option{-std=gnu90} mode.
2666 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2667 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2668 in effect for @code{inline} functions.  @xref{Common Predefined
2669 Macros,,,cpp,The C Preprocessor}.
2671 @opindex fhosted
2672 @cindex hosted environment
2673 @item -fhosted
2675 Assert that compilation targets a hosted environment.  This implies
2676 @option{-fbuiltin}.  A hosted environment is one in which the
2677 entire standard library is available, and in which @code{main} has a return
2678 type of @code{int}.  Examples are nearly everything except a kernel.
2679 This is equivalent to @option{-fno-freestanding}.
2681 @opindex flax-vector-conversions
2682 @item -flax-vector-conversions
2683 Allow implicit conversions between vectors with differing numbers of
2684 elements and/or incompatible element types.  This option should not be
2685 used for new code.
2687 @opindex fms-extensions
2688 @item -fms-extensions
2689 Accept some non-standard constructs used in Microsoft header files.
2691 In C++ code, this allows member names in structures to be similar
2692 to previous types declarations.
2694 @smallexample
2695 typedef int UOW;
2696 struct ABC @{
2697   UOW UOW;
2699 @end smallexample
2701 Some cases of unnamed fields in structures and unions are only
2702 accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
2703 fields within structs/unions}, for details.
2705 Note that this option is off for all targets except for x86
2706 targets using ms-abi.
2708 @opindex foffload
2709 @cindex Offloading targets
2710 @cindex OpenACC offloading targets
2711 @cindex OpenMP offloading targets
2712 @item -foffload=disable
2713 @itemx -foffload=default
2714 @itemx -foffload=@var{target-list}
2715 Specify for which OpenMP and OpenACC offload targets code should be generated.
2716 The default behavior, equivalent to @option{-foffload=default}, is to generate
2717 code for all supported offload targets.  The @option{-foffload=disable} form
2718 generates code only for the host fallback, while
2719 @option{-foffload=@var{target-list}} generates code only for the specified
2720 comma-separated list of offload targets.
2722 Offload targets are specified in GCC's internal target-triplet format. You can
2723 run the compiler with @option{-v} to show the list of configured offload targets
2724 under @code{OFFLOAD_TARGET_NAMES}.
2726 @opindex foffload-options
2727 @cindex Offloading options
2728 @cindex OpenACC offloading options
2729 @cindex OpenMP offloading options
2730 @item -foffload-options=@var{options}
2731 @itemx -foffload-options=@var{target-triplet-list}=@var{options}
2733 With @option{-foffload-options=@var{options}}, GCC passes the specified
2734 @var{options} to the compilers for all enabled offloading targets.  You can
2735 specify options that apply only to a specific target or targets by using
2736 the @option{-foffload-options=@var{target-list}=@var{options}} form.  The
2737 @var{target-list} is a comma-separated list in the same format as for the
2738 @option{-foffload=} option.
2740 Typical command lines are
2742 @smallexample
2743 -foffload-options='-fno-math-errno -ffinite-math-only' -foffload-options=nvptx-none=-latomic
2744 -foffload-options=amdgcn-amdhsa=-march=gfx906
2745 @end smallexample
2747 @opindex fopenacc
2748 @cindex OpenACC accelerator programming
2749 @item -fopenacc
2750 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2751 @code{!$acc} in Fortran.  When @option{-fopenacc} is specified, the
2752 compiler generates accelerated code according to the OpenACC Application
2753 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}.  This option
2754 implies @option{-pthread}, and thus is only supported on targets that
2755 have support for @option{-pthread}.
2757 @opindex fopenacc-dim
2758 @cindex OpenACC accelerator programming
2759 @item -fopenacc-dim=@var{geom}
2760 Specify default compute dimensions for parallel offload regions that do
2761 not explicitly specify.  The @var{geom} value is a triple of
2762 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'.  A size
2763 can be omitted, to use a target-specific default value.
2765 @opindex fopenmp
2766 @cindex OpenMP parallel
2767 @item -fopenmp
2768 Enable handling of OpenMP directives @code{#pragma omp} in C/C++,
2769 @code{[[omp::directive(...)]]} and @code{[[omp::sequence(...)]]} in C++ and
2770 @code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
2771 compiler generates parallel code according to the OpenMP Application
2772 Program Interface v4.5 @w{@uref{https://www.openmp.org}}.  This option
2773 implies @option{-pthread}, and thus is only supported on targets that
2774 have support for @option{-pthread}. @option{-fopenmp} implies
2775 @option{-fopenmp-simd}.
2777 @opindex fopenmp-simd
2778 @cindex OpenMP SIMD
2779 @cindex SIMD
2780 @item -fopenmp-simd
2781 Enable handling of OpenMP's @code{simd}, @code{declare simd},
2782 @code{declare reduction}, @code{assume}, @code{ordered}, @code{scan},
2783 @code{loop} directives and combined or composite directives with
2784 @code{simd} as constituent with @code{#pragma omp} in C/C++,
2785 @code{[[omp::directive(...)]]} and @code{[[omp::sequence(...)]]} in C++
2786 and @code{!$omp} in Fortran.  Other OpenMP directives are ignored.
2788 @opindex fopenmp-target-simd-clone
2789 @cindex OpenMP target SIMD clone
2790 @item -fopenmp-target-simd-clone
2791 @item -fopenmp-target-simd-clone=@var{device-type}
2792 In addition to generating SIMD clones for functions marked with the
2793 @code{declare simd} directive, GCC also generates clones
2794 for functions marked with the OpenMP @code{declare target} directive
2795 that are suitable for vectorization when this option is in effect.  The
2796 @var{device-type} may be one of @code{none}, @code{host}, @code{nohost},
2797 and @code{any}, which correspond to keywords for the @code{device_type}
2798 clause of the @code{declare target} directive; clones are generated for
2799 the intersection of devices specified.
2800 @option{-fopenmp-target-simd-clone} is equivalent to
2801 @option{-fopenmp-target-simd-clone=any} and
2802 @option{-fno-openmp-target-simd-clone} is equivalent to
2803 @option{-fopenmp-target-simd-clone=none}.
2805 At @option{-O2} and higher (but not @option{-Os} or @option{-Og}) this
2806 optimization defaults to @option{-fopenmp-target-simd-clone=nohost}; otherwise
2807 it is disabled by default.
2809 @opindex fpermitted-flt-eval-methods
2810 @opindex fpermitted-flt-eval-methods=c11
2811 @opindex fpermitted-flt-eval-methods=ts-18661-3
2812 @item -fpermitted-flt-eval-methods=@var{style}
2813 ISO/IEC TS 18661-3 defines new permissible values for
2814 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2815 a semantic type that is an interchange or extended format should be
2816 evaluated to the precision and range of that type.  These new values are
2817 a superset of those permitted under C99/C11, which does not specify the
2818 meaning of other positive values of @code{FLT_EVAL_METHOD}.  As such, code
2819 conforming to C11 may not have been written expecting the possibility of
2820 the new values.
2822 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2823 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2824 or the extended set of values specified in ISO/IEC TS 18661-3.
2826 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2828 The default when in a standards compliant mode (@option{-std=c11} or similar)
2829 is @option{-fpermitted-flt-eval-methods=c11}.  The default when in a GNU
2830 dialect (@option{-std=gnu11} or similar) is
2831 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2833 @opindex fdeps-
2834 The @samp{-fdeps-*} options are used to extract structured dependency
2835 information for a source.  This involves determining what resources provided by
2836 other source files will be required to compile the source as well as what
2837 resources are provided by the source.  This information can be used to add
2838 required dependencies between compilation rules of dependent sources based on
2839 their contents rather than requiring such information be reflected within the
2840 build tools as well.
2842 @opindex fdeps-file
2843 @item -fdeps-file=@var{file}
2844 Where to write structured dependency information.
2846 @opindex fdeps-format
2847 @item -fdeps-format=@var{format}
2848 The format to use for structured dependency information. @samp{p1689r5} is the
2849 only supported format right now.  Note that when this argument is specified, the
2850 output of @samp{-MF} is stripped of some information (namely C++ modules) so
2851 that it does not use extended makefile syntax not understood by most tools.
2853 @opindex fdeps-target
2854 @item -fdeps-target=@var{file}
2855 Analogous to @option{-MT} but for structured dependency information.  This
2856 indicates the target which will ultimately need any required resources and
2857 provide any resources extracted from the source that may be required by other
2858 sources.
2860 @opindex fplan9-extensions
2861 @item -fplan9-extensions
2862 Accept some non-standard constructs used in Plan 9 code.
2864 This enables @option{-fms-extensions}, permits passing pointers to
2865 structures with anonymous fields to functions that expect pointers to
2866 elements of the type of the field, and permits referring to anonymous
2867 fields declared using a typedef.  @xref{Unnamed Fields,,Unnamed
2868 struct/union fields within structs/unions}, for details.  This is only
2869 supported for C, not C++.
2871 @opindex fsigned-bitfields
2872 @opindex funsigned-bitfields
2873 @opindex fno-signed-bitfields
2874 @opindex fno-unsigned-bitfields
2875 @item -fsigned-bitfields
2876 @itemx -funsigned-bitfields
2877 @itemx -fno-signed-bitfields
2878 @itemx -fno-unsigned-bitfields
2879 These options control whether a bit-field is signed or unsigned, when the
2880 declaration does not use either @code{signed} or @code{unsigned}.  By
2881 default, such a bit-field is signed, because this is consistent: the
2882 basic integer types such as @code{int} are signed types.
2884 @opindex fsigned-char
2885 @item -fsigned-char
2886 Let the type @code{char} be signed, like @code{signed char}.
2888 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2889 the negative form of @option{-funsigned-char}.  Likewise, the option
2890 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2892 @opindex funsigned-char
2893 @item -funsigned-char
2894 Let the type @code{char} be unsigned, like @code{unsigned char}.
2896 Each kind of machine has a default for what @code{char} should
2897 be.  It is either like @code{unsigned char} by default or like
2898 @code{signed char} by default.
2900 Ideally, a portable program should always use @code{signed char} or
2901 @code{unsigned char} when it depends on the signedness of an object.
2902 But many programs have been written to use plain @code{char} and
2903 expect it to be signed, or expect it to be unsigned, depending on the
2904 machines they were written for.  This option, and its inverse, let you
2905 make such a program work with the opposite default.
2907 The type @code{char} is always a distinct type from each of
2908 @code{signed char} or @code{unsigned char}, even though its behavior
2909 is always just like one of those two.
2911 @opindex fstrict-flex-arrays
2912 @opindex fno-strict-flex-arrays
2913 @item -fstrict-flex-arrays
2914 Control when to treat the trailing array of a structure as a flexible array
2915 member for the purpose of accessing the elements of such an array.
2916 The positive form is equivalent to @option{-fstrict-flex-arrays=3}, which is the
2917 strictest.  A trailing array is treated as a flexible array member only when it
2918 is declared as a flexible array member per C99 standard onwards.
2919 The negative form is equivalent to @option{-fstrict-flex-arrays=0}, which is the
2920 least strict.  All trailing arrays of structures are treated as flexible array
2921 members.
2923 @opindex fstrict-flex-arrays=@var{level}
2924 @item -fstrict-flex-arrays=@var{level}
2925 Control when to treat the trailing array of a structure as a flexible array
2926 member for the purpose of accessing the elements of such an array.  The value
2927 of @var{level} controls the level of strictness.
2929 The possible values of @var{level} are the same as for the
2930 @code{strict_flex_array} attribute (@pxref{Variable Attributes}).
2932 You can control this behavior for a specific trailing array field of a
2933 structure by using the variable attribute @code{strict_flex_array} attribute
2934 (@pxref{Variable Attributes}).
2936 @opindex fsso-struct
2937 @item -fsso-struct=@var{endianness}
2938 Set the default scalar storage order of structures and unions to the
2939 specified endianness.  The accepted values are @samp{big-endian},
2940 @samp{little-endian} and @samp{native} for the native endianness of
2941 the target (the default).  This option is not supported for C++.
2943 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2944 code that is not binary compatible with code generated without it if the
2945 specified endianness is not the native endianness of the target.
2946 @end table
2948 @node C++ Dialect Options
2949 @section Options Controlling C++ Dialect
2951 @cindex compiler options, C++
2952 @cindex C++ options, command-line
2953 @cindex options, C++
2954 This section describes the command-line options that are only meaningful
2955 for C++ programs.  You can also use most of the GNU compiler options
2956 regardless of what language your program is in.  For example, you
2957 might compile a file @file{firstClass.C} like this:
2959 @smallexample
2960 g++ -g -fstrict-enums -O -c firstClass.C
2961 @end smallexample
2963 @noindent
2964 In this example, only @option{-fstrict-enums} is an option meant
2965 only for C++ programs; you can use the other options with any
2966 language supported by GCC@.
2968 Some options for compiling C programs, such as @option{-std}, are also
2969 relevant for C++ programs.
2970 @xref{C Dialect Options,,Options Controlling C Dialect}.
2972 Here is a list of options that are @emph{only} for compiling C++ programs:
2974 @table @gcctabopt
2976 @opindex fabi-version
2977 @item -fabi-version=@var{n}
2978 Use version @var{n} of the C++ ABI@.  The default is version 0.
2980 Version 0 refers to the version conforming most closely to
2981 the C++ ABI specification.  Therefore, the ABI obtained using version 0
2982 will change in different versions of G++ as ABI bugs are fixed.
2984 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2986 Version 2 is the version of the C++ ABI that first appeared in G++
2987 3.4, and was the default through G++ 4.9.
2989 Version 3 corrects an error in mangling a constant address as a
2990 template argument.
2992 Version 4, which first appeared in G++ 4.5, implements a standard
2993 mangling for vector types.
2995 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2996 attribute const/volatile on function pointer types, decltype of a
2997 plain decl, and use of a function parameter in the declaration of
2998 another parameter.
3000 Version 6, which first appeared in G++ 4.7, corrects the promotion
3001 behavior of C++11 scoped enums and the mangling of template argument
3002 packs, const/static_cast, prefix ++ and --, and a class scope function
3003 used as a template argument.
3005 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
3006 builtin type and corrects the mangling of lambdas in default argument
3007 scope.
3009 Version 8, which first appeared in G++ 4.9, corrects the substitution
3010 behavior of function types with function-cv-qualifiers.
3012 Version 9, which first appeared in G++ 5.2, corrects the alignment of
3013 @code{nullptr_t}.
3015 Version 10, which first appeared in G++ 6.1, adds mangling of
3016 attributes that affect type identity, such as ia32 calling convention
3017 attributes (e.g.@: @samp{stdcall}).
3019 Version 11, which first appeared in G++ 7, corrects the mangling of
3020 sizeof... expressions and operator names.  For multiple entities with
3021 the same name within a function, that are declared in different scopes,
3022 the mangling now changes starting with the twelfth occurrence.  It also
3023 implies @option{-fnew-inheriting-ctors}.
3025 Version 12, which first appeared in G++ 8, corrects the calling
3026 conventions for empty classes on the x86_64 target and for classes
3027 with only deleted copy/move constructors.  It accidentally changes the
3028 calling convention for classes with a deleted copy constructor and a
3029 trivial move constructor.
3031 Version 13, which first appeared in G++ 8.2, fixes the accidental
3032 change in version 12.
3034 Version 14, which first appeared in G++ 10, corrects the mangling of
3035 the nullptr expression.
3037 Version 15, which first appeared in G++ 10.3, corrects G++ 10 ABI
3038 tag regression.
3040 Version 16, which first appeared in G++ 11, changes the mangling of
3041 @code{__alignof__} to be distinct from that of @code{alignof}, and
3042 dependent operator names.
3044 Version 17, which first appeared in G++ 12, fixes layout of classes
3045 that inherit from aggregate classes with default member initializers
3046 in C++14 and up.
3048 Version 18, which first appeard in G++ 13, fixes manglings of lambdas
3049 that have additional context.
3051 Version 19, which first appeard in G++ 14, fixes manglings of structured
3052 bindings to include ABI tags.
3054 See also @option{-Wabi}.
3056 @opindex fabi-compat-version
3057 @item -fabi-compat-version=@var{n}
3058 On targets that support strong aliases, G++
3059 works around mangling changes by creating an alias with the correct
3060 mangled name when defining a symbol with an incorrect mangled name.
3061 This switch specifies which ABI version to use for the alias.
3063 With @option{-fabi-version=0} (the default), this defaults to 13 (GCC 8.2
3064 compatibility).  If another ABI version is explicitly selected, this
3065 defaults to 0.  For compatibility with GCC versions 3.2 through 4.9,
3066 use @option{-fabi-compat-version=2}.
3068 If this option is not provided but @option{-Wabi=@var{n}} is, that
3069 version is used for compatibility aliases.  If this option is provided
3070 along with @option{-Wabi} (without the version), the version from this
3071 option is used for the warning.
3073 @opindex fno-access-control
3074 @opindex faccess-control
3075 @item -fno-access-control
3076 Turn off all access checking.  This switch is mainly useful for working
3077 around bugs in the access control code.
3079 @opindex faligned-new
3080 @item -faligned-new
3081 Enable support for C++17 @code{new} of types that require more
3082 alignment than @code{void* ::operator new(std::size_t)} provides.  A
3083 numeric argument such as @code{-faligned-new=32} can be used to
3084 specify how much alignment (in bytes) is provided by that function,
3085 but few users will need to override the default of
3086 @code{alignof(std::max_align_t)}.
3088 This flag is enabled by default for @option{-std=c++17}.
3090 @opindex fchar8_t
3091 @opindex fno-char8_t
3092 @item -fchar8_t
3093 @itemx -fno-char8_t
3094 Enable support for @code{char8_t} as adopted for C++20.  This includes
3095 the addition of a new @code{char8_t} fundamental type, changes to the
3096 types of UTF-8 string and character literals, new signatures for
3097 user-defined literals, associated standard library updates, and new
3098 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
3100 This option enables functions to be overloaded for ordinary and UTF-8
3101 strings:
3103 @smallexample
3104 int f(const char *);    // #1
3105 int f(const char8_t *); // #2
3106 int v1 = f("text");     // Calls #1
3107 int v2 = f(u8"text");   // Calls #2
3108 @end smallexample
3110 @noindent
3111 and introduces new signatures for user-defined literals:
3113 @smallexample
3114 int operator""_udl1(char8_t);
3115 int v3 = u8'x'_udl1;
3116 int operator""_udl2(const char8_t*, std::size_t);
3117 int v4 = u8"text"_udl2;
3118 template<typename T, T...> int operator""_udl3();
3119 int v5 = u8"text"_udl3;
3120 @end smallexample
3122 @noindent
3123 The change to the types of UTF-8 string and character literals introduces
3124 incompatibilities with ISO C++11 and later standards.  For example, the
3125 following code is well-formed under ISO C++11, but is ill-formed when
3126 @option{-fchar8_t} is specified.
3128 @smallexample
3129 const char *cp = u8"xx";// error: invalid conversion from
3130                         //        `const char8_t*' to `const char*'
3131 int f(const char*);
3132 auto v = f(u8"xx");     // error: invalid conversion from
3133                         //        `const char8_t*' to `const char*'
3134 std::string s@{u8"xx"@};  // error: no matching function for call to
3135                         //        `std::basic_string<char>::basic_string()'
3136 using namespace std::literals;
3137 s = u8"xx"s;            // error: conversion from
3138                         //        `basic_string<char8_t>' to non-scalar
3139                         //        type `basic_string<char>' requested
3140 @end smallexample
3142 @opindex fcheck-new
3143 @item -fcheck-new
3144 Check that the pointer returned by @code{operator new} is non-null
3145 before attempting to modify the storage allocated.  This check is
3146 normally unnecessary because the C++ standard specifies that
3147 @code{operator new} only returns @code{0} if it is declared
3148 @code{throw()}, in which case the compiler always checks the
3149 return value even without this option.  In all other cases, when
3150 @code{operator new} has a non-empty exception specification, memory
3151 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
3152 @samp{new (nothrow)}.
3154 @opindex fconcepts
3155 @opindex fconcepts-ts
3156 @item -fconcepts
3157 @itemx -fconcepts-ts
3158 Enable support for the C++ Concepts feature for constraining template
3159 arguments.  With @option{-std=c++20} and above, Concepts are part of
3160 the language standard, so @option{-fconcepts} defaults to on.
3162 Some constructs that were allowed by the earlier C++ Extensions for
3163 Concepts Technical Specification, ISO 19217 (2015), but didn't make it
3164 into the standard, can additionally be enabled by
3165 @option{-fconcepts-ts}.
3167 @opindex fconstexpr-depth
3168 @item -fconstexpr-depth=@var{n}
3169 Set the maximum nested evaluation depth for C++11 constexpr functions
3170 to @var{n}.  A limit is needed to detect endless recursion during
3171 constant expression evaluation.  The minimum specified by the standard
3172 is 512.
3174 @opindex fconstexpr-cache-depth
3175 @item -fconstexpr-cache-depth=@var{n}
3176 Set the maximum level of nested evaluation depth for C++11 constexpr
3177 functions that will be cached to @var{n}.  This is a heuristic that
3178 trades off compilation speed (when the cache avoids repeated
3179 calculations) against memory consumption (when the cache grows very
3180 large from highly recursive evaluations).  The default is 8.  Very few
3181 users are likely to want to adjust it, but if your code does heavy
3182 constexpr calculations you might want to experiment to find which
3183 value works best for you.
3185 @opindex fconstexpr-fp-except
3186 @item -fconstexpr-fp-except
3187 Annex F of the C standard specifies that IEC559 floating point
3188 exceptions encountered at compile time should not stop compilation.
3189 C++ compilers have historically not followed this guidance, instead
3190 treating floating point division by zero as non-constant even though
3191 it has a well defined value.  This flag tells the compiler to give
3192 Annex F priority over other rules saying that a particular operation
3193 is undefined.
3195 @smallexample
3196 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
3197 @end smallexample
3199 @opindex fconstexpr-loop-limit
3200 @item -fconstexpr-loop-limit=@var{n}
3201 Set the maximum number of iterations for a loop in C++14 constexpr functions
3202 to @var{n}.  A limit is needed to detect infinite loops during
3203 constant expression evaluation.  The default is 262144 (1<<18).
3205 @opindex fconstexpr-ops-limit
3206 @item -fconstexpr-ops-limit=@var{n}
3207 Set the maximum number of operations during a single constexpr evaluation.
3208 Even when number of iterations of a single loop is limited with the above limit,
3209 if there are several nested loops and each of them has many iterations but still
3210 smaller than the above limit, or if in a body of some loop or even outside
3211 of a loop too many expressions need to be evaluated, the resulting constexpr
3212 evaluation might take too long.
3213 The default is 33554432 (1<<25).
3215 @opindex fcontracts
3216 @item -fcontracts
3217 Enable experimental support for the C++ Contracts feature, as briefly
3218 added to and then removed from the C++20 working paper (N4820).  The
3219 implementation also includes proposed enhancements from papers P1290,
3220 P1332, and P1429.  This functionality is intended mostly for those
3221 interested in experimentation towards refining the feature to get it
3222 into shape for a future C++ standard.
3224 On violation of a checked contract, the violation handler is called.
3225 Users can replace the violation handler by defining
3226 @smallexample
3227 void
3228 handle_contract_violation (const std::experimental::contract_violation&);
3229 @end smallexample
3231 There are different sets of additional flags that can be used together
3232 to specify which contracts will be checked and how, for N4820
3233 contracts, P1332 contracts, or P1429 contracts; these sets cannot be
3234 used together.
3236 @table @gcctabopt
3237 @opindex fcontract-mode
3238 @item -fcontract-mode=[on|off]
3239 Control whether any contracts have any semantics at all.  Defaults to on.
3241 @opindex fcontract-assumption-mode
3242 @item -fcontract-assumption-mode=[on|off]
3243 [N4820] Control whether contracts with level @samp{axiom}
3244 should have the assume semantic.  Defaults to on.
3246 @opindex fcontract-build-level
3247 @item -fcontract-build-level=[off|default|audit]
3248 [N4820] Specify which level of contracts to generate checks
3249 for.  Defaults to @samp{default}.
3251 @opindex fcontract-continuation-mode
3252 @item -fcontract-continuation-mode=[on|off]
3253 [N4820] Control whether to allow the program to continue executing
3254 after a contract violation.  That is, do checked contracts have the
3255 @samp{maybe} semantic described below rather than the @samp{never}
3256 semantic.  Defaults to off.
3258 @opindex fcontract-role
3259 @item -fcontract-role=<name>:<default>,<audit>,<axiom>
3260 [P1332] Specify the concrete semantics for each contract level
3261 of a particular contract role.
3263 @item -fcontract-semantic=[default|audit|axiom]:<semantic>
3264 [P1429] Specify the concrete semantic for a particular
3265 contract level.
3267 @opindex fcontract-strict-declarations
3268 @item -fcontract-strict-declarations=[on|off]
3269 Control whether to reject adding contracts to a function after its
3270 first declaration.  Defaults to off.
3271 @end table
3273 The possible concrete semantics for that can be specified with
3274 @samp{-fcontract-role} or @samp{-fcontract-semantic} are:
3276 @table @code
3277 @item ignore
3278 This contract has no effect.
3280 @item assume
3281 This contract is treated like C++23 @code{[[assume]]}.
3283 @item check_never_continue
3284 @itemx never
3285 @itemx abort
3286 This contract is checked.  If it fails, the violation handler is
3287 called.  If the handler returns, @code{std::terminate} is called.
3289 @item check_maybe_continue
3290 @itemx maybe
3291 This contract is checked.  If it fails, the violation handler is
3292 called.  If the handler returns, execution continues normally.
3293 @end table
3295 @opindex fcoroutines
3296 @item -fcoroutines
3297 Enable support for the C++ coroutines extension (experimental).
3299 @opindex fno-elide-constructors
3300 @opindex felide-constructors
3301 @item -fno-elide-constructors
3302 The C++ standard allows an implementation to omit creating a temporary
3303 that is only used to initialize another object of the same type.
3304 Specifying this option disables that optimization, and forces G++ to
3305 call the copy constructor in all cases.  This option also causes G++
3306 to call trivial member functions which otherwise would be expanded inline.
3308 In C++17, the compiler is required to omit these temporaries, but this
3309 option still affects trivial member functions.
3311 @opindex fno-enforce-eh-specs
3312 @opindex fenforce-eh-specs
3313 @item -fno-enforce-eh-specs
3314 Don't generate code to check for violation of exception specifications
3315 at run time.  This option violates the C++ standard, but may be useful
3316 for reducing code size in production builds, much like defining
3317 @code{NDEBUG}.  This does not give user code permission to throw
3318 exceptions in violation of the exception specifications; the compiler
3319 still optimizes based on the specifications, so throwing an
3320 unexpected exception results in undefined behavior at run time.
3322 @opindex fextern-tls-init
3323 @opindex fno-extern-tls-init
3324 @item -fextern-tls-init
3325 @itemx -fno-extern-tls-init
3326 The C++11 and OpenMP standards allow @code{thread_local} and
3327 @code{threadprivate} variables to have dynamic (runtime)
3328 initialization.  To support this, any use of such a variable goes
3329 through a wrapper function that performs any necessary initialization.
3330 When the use and definition of the variable are in the same
3331 translation unit, this overhead can be optimized away, but when the
3332 use is in a different translation unit there is significant overhead
3333 even if the variable doesn't actually need dynamic initialization.  If
3334 the programmer can be sure that no use of the variable in a
3335 non-defining TU needs to trigger dynamic initialization (either
3336 because the variable is statically initialized, or a use of the
3337 variable in the defining TU will be executed before any uses in
3338 another TU), they can avoid this overhead with the
3339 @option{-fno-extern-tls-init} option.
3341 On targets that support symbol aliases, the default is
3342 @option{-fextern-tls-init}.  On targets that do not support symbol
3343 aliases, the default is @option{-fno-extern-tls-init}.
3345 @opindex ffold-simple-inlines
3346 @opindex fno-fold-simple-inlines
3347 @item -ffold-simple-inlines
3348 @itemx -fno-fold-simple-inlines
3349 Permit the C++ frontend to fold calls to @code{std::move}, @code{std::forward},
3350 @code{std::addressof} and @code{std::as_const}.  In contrast to inlining, this
3351 means no debug information will be generated for such calls.  Since these
3352 functions are rarely interesting to debug, this flag is enabled by default
3353 unless @option{-fno-inline} is active.
3355 @opindex fno-gnu-keywords
3356 @opindex fgnu-keywords
3357 @item -fno-gnu-keywords
3358 Do not recognize @code{typeof} as a keyword, so that code can use this
3359 word as an identifier.  You can use the keyword @code{__typeof__} instead.
3360 This option is implied by the strict ISO C++ dialects: @option{-ansi},
3361 @option{-std=c++98}, @option{-std=c++11}, etc.
3363 @opindex fimplicit-constexpr
3364 @item -fimplicit-constexpr
3365 Make inline functions implicitly constexpr, if they satisfy the
3366 requirements for a constexpr function.  This option can be used in
3367 C++14 mode or later.  This can result in initialization changing from
3368 dynamic to static and other optimizations.
3370 @opindex fno-implicit-templates
3371 @opindex fimplicit-templates
3372 @item -fno-implicit-templates
3373 Never emit code for non-inline templates that are instantiated
3374 implicitly (i.e.@: by use); only emit code for explicit instantiations.
3375 If you use this option, you must take care to structure your code to
3376 include all the necessary explicit instantiations to avoid getting
3377 undefined symbols at link time.
3378 @xref{Template Instantiation}, for more information.
3380 @opindex fno-implicit-inline-templates
3381 @opindex fimplicit-inline-templates
3382 @item -fno-implicit-inline-templates
3383 Don't emit code for implicit instantiations of inline templates, either.
3384 The default is to handle inlines differently so that compiles with and
3385 without optimization need the same set of explicit instantiations.
3387 @opindex fno-implement-inlines
3388 @opindex fimplement-inlines
3389 @item -fno-implement-inlines
3390 To save space, do not emit out-of-line copies of inline functions
3391 controlled by @code{#pragma implementation}.  This causes linker
3392 errors if these functions are not inlined everywhere they are called.
3394 @opindex fmodules-ts
3395 @opindex fno-modules-ts
3396 @item -fmodules-ts
3397 @itemx -fno-modules-ts
3398 Enable support for C++20 modules (@pxref{C++ Modules}).  The
3399 @option{-fno-modules-ts} is usually not needed, as that is the
3400 default.  Even though this is a C++20 feature, it is not currently
3401 implicitly enabled by selecting that standard version.
3403 @opindex fmodule-header
3404 @item -fmodule-header
3405 @itemx -fmodule-header=user
3406 @itemx -fmodule-header=system
3407 Compile a header file to create an importable header unit.
3409 @opindex fmodule-implicit-inline
3410 @item -fmodule-implicit-inline
3411 Member functions defined in their class definitions are not implicitly
3412 inline for modular code.  This is different to traditional C++
3413 behavior, for good reasons.  However, it may result in a difficulty
3414 during code porting.  This option makes such function definitions
3415 implicitly inline.  It does however generate an ABI incompatibility,
3416 so you must use it everywhere or nowhere.  (Such definitions outside
3417 of a named module remain implicitly inline, regardless.)
3419 @opindex fno-module-lazy
3420 @opindex fmodule-lazy
3421 @item -fno-module-lazy
3422 Disable lazy module importing and module mapper creation.
3424 @vindex CXX_MODULE_MAPPER @r{environment variable}
3425 @opindex fmodule-mapper
3426 @item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
3427 @itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...}
3428 @itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]}
3429 @itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]}
3430 @itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]}
3431 @itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]}
3432 An oracle to query for module name to filename mappings.  If
3433 unspecified the @env{CXX_MODULE_MAPPER} environment variable is used,
3434 and if that is unset, an in-process default is provided.
3436 @opindex fmodule-only
3437 @item -fmodule-only
3438 Only emit the Compiled Module Interface, inhibiting any object file.
3440 @opindex fms-extensions
3441 @item -fms-extensions
3442 Disable Wpedantic warnings about constructs used in MFC, such as implicit
3443 int and getting a pointer to member function via non-standard syntax.
3445 @opindex fnew-inheriting-ctors
3446 @item -fnew-inheriting-ctors
3447 Enable the P0136 adjustment to the semantics of C++11 constructor
3448 inheritance.  This is part of C++17 but also considered to be a Defect
3449 Report against C++11 and C++14.  This flag is enabled by default
3450 unless @option{-fabi-version=10} or lower is specified.
3452 @opindex fnew-ttp-matching
3453 @item -fnew-ttp-matching
3454 Enable the P0522 resolution to Core issue 150, template template
3455 parameters and default arguments: this allows a template with default
3456 template arguments as an argument for a template template parameter
3457 with fewer template parameters.  This flag is enabled by default for
3458 @option{-std=c++17}.
3460 @opindex fno-nonansi-builtins
3461 @opindex fnonansi-builtins
3462 @item -fno-nonansi-builtins
3463 Disable built-in declarations of functions that are not mandated by
3464 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
3465 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
3467 @opindex fnothrow-opt
3468 @item -fnothrow-opt
3469 Treat a @code{throw()} exception specification as if it were a
3470 @code{noexcept} specification to reduce or eliminate the text size
3471 overhead relative to a function with no exception specification.  If
3472 the function has local variables of types with non-trivial
3473 destructors, the exception specification actually makes the
3474 function smaller because the EH cleanups for those variables can be
3475 optimized away.  The semantic effect is that an exception thrown out of
3476 a function with such an exception specification results in a call
3477 to @code{terminate} rather than @code{unexpected}.
3479 @opindex fno-operator-names
3480 @opindex foperator-names
3481 @item -fno-operator-names
3482 Do not treat the operator name keywords @code{and}, @code{bitand},
3483 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3484 synonyms as keywords.
3486 @opindex fno-optional-diags
3487 @opindex foptional-diags
3488 @item -fno-optional-diags
3489 Disable diagnostics that the standard says a compiler does not need to
3490 issue.  Currently, the only such diagnostic issued by G++ is the one for
3491 a name having multiple meanings within a class.
3493 @opindex fpermissive
3494 @item -fpermissive
3495 Downgrade some diagnostics about nonconformant code from errors to
3496 warnings.  Thus, using @option{-fpermissive} allows some
3497 nonconforming code to compile.
3499 @opindex fno-pretty-templates
3500 @opindex fpretty-templates
3501 @item -fno-pretty-templates
3502 When an error message refers to a specialization of a function
3503 template, the compiler normally prints the signature of the
3504 template followed by the template arguments and any typedefs or
3505 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3506 rather than @code{void f(int)}) so that it's clear which template is
3507 involved.  When an error message refers to a specialization of a class
3508 template, the compiler omits any template arguments that match
3509 the default template arguments for that template.  If either of these
3510 behaviors make it harder to understand the error message rather than
3511 easier, you can use @option{-fno-pretty-templates} to disable them.
3513 @opindex fno-rtti
3514 @opindex frtti
3515 @item -fno-rtti
3516 Disable generation of information about every class with virtual
3517 functions for use by the C++ run-time type identification features
3518 (@code{dynamic_cast} and @code{typeid}).  If you don't use those parts
3519 of the language, you can save some space by using this flag.  Note that
3520 exception handling uses the same information, but G++ generates it as
3521 needed. The @code{dynamic_cast} operator can still be used for casts that
3522 do not require run-time type information, i.e.@: casts to @code{void *} or to
3523 unambiguous base classes.
3525 Mixing code compiled with @option{-frtti} with that compiled with
3526 @option{-fno-rtti} may not work.  For example, programs may
3527 fail to link if a class compiled with @option{-fno-rtti} is used as a base 
3528 for a class compiled with @option{-frtti}.  
3530 @opindex fsized-deallocation
3531 @item -fsized-deallocation
3532 Enable the built-in global declarations
3533 @smallexample
3534 void operator delete (void *, std::size_t) noexcept;
3535 void operator delete[] (void *, std::size_t) noexcept;
3536 @end smallexample
3537 as introduced in C++14.  This is useful for user-defined replacement
3538 deallocation functions that, for example, use the size of the object
3539 to make deallocation faster.  Enabled by default under
3540 @option{-std=c++14} and above.  The flag @option{-Wsized-deallocation}
3541 warns about places that might want to add a definition.
3543 @opindex fstrict-enums
3544 @item -fstrict-enums
3545 Allow the compiler to optimize using the assumption that a value of
3546 enumerated type can only be one of the values of the enumeration (as
3547 defined in the C++ standard; basically, a value that can be
3548 represented in the minimum number of bits needed to represent all the
3549 enumerators).  This assumption may not be valid if the program uses a
3550 cast to convert an arbitrary integer value to the enumerated type.
3551 This option has no effect for an enumeration type with a fixed underlying
3552 type.
3554 @opindex fstrong-eval-order
3555 @item -fstrong-eval-order
3556 Evaluate member access, array subscripting, and shift expressions in
3557 left-to-right order, and evaluate assignment in right-to-left order,
3558 as adopted for C++17.  Enabled by default with @option{-std=c++17}.
3559 @option{-fstrong-eval-order=some} enables just the ordering of member
3560 access and shift expressions, and is the default without
3561 @option{-std=c++17}.
3563 @opindex ftemplate-backtrace-limit
3564 @item -ftemplate-backtrace-limit=@var{n}
3565 Set the maximum number of template instantiation notes for a single
3566 warning or error to @var{n}.  The default value is 10.
3568 @opindex ftemplate-depth
3569 @item -ftemplate-depth=@var{n}
3570 Set the maximum instantiation depth for template classes to @var{n}.
3571 A limit on the template instantiation depth is needed to detect
3572 endless recursions during template class instantiation.  ANSI/ISO C++
3573 conforming programs must not rely on a maximum depth greater than 17
3574 (changed to 1024 in C++11).  The default value is 900, as the compiler
3575 can run out of stack space before hitting 1024 in some situations.
3577 @opindex fno-threadsafe-statics
3578 @opindex fthreadsafe-statics
3579 @item -fno-threadsafe-statics
3580 Do not emit the extra code to use the routines specified in the C++
3581 ABI for thread-safe initialization of local statics.  You can use this
3582 option to reduce code size slightly in code that doesn't need to be
3583 thread-safe.
3585 @opindex fuse-cxa-atexit
3586 @item -fuse-cxa-atexit
3587 Register destructors for objects with static storage duration with the
3588 @code{__cxa_atexit} function rather than the @code{atexit} function.
3589 This option is required for fully standards-compliant handling of static
3590 destructors, but only works if your C library supports
3591 @code{__cxa_atexit}.
3593 @opindex fno-use-cxa-get-exception-ptr
3594 @opindex fuse-cxa-get-exception-ptr
3595 @item -fno-use-cxa-get-exception-ptr
3596 Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
3597 causes @code{std::uncaught_exception} to be incorrect, but is necessary
3598 if the runtime routine is not available.
3600 @opindex fvisibility-inlines-hidden
3601 @item -fvisibility-inlines-hidden
3602 This switch declares that the user does not attempt to compare
3603 pointers to inline functions or methods where the addresses of the two functions
3604 are taken in different shared objects.
3606 The effect of this is that GCC may, effectively, mark inline methods with
3607 @code{__attribute__ ((visibility ("hidden")))} so that they do not
3608 appear in the export table of a DSO and do not require a PLT indirection
3609 when used within the DSO@.  Enabling this option can have a dramatic effect
3610 on load and link times of a DSO as it massively reduces the size of the
3611 dynamic export table when the library makes heavy use of templates.
3613 The behavior of this switch is not quite the same as marking the
3614 methods as hidden directly, because it does not affect static variables
3615 local to the function or cause the compiler to deduce that
3616 the function is defined in only one shared object.
3618 You may mark a method as having a visibility explicitly to negate the
3619 effect of the switch for that method.  For example, if you do want to
3620 compare pointers to a particular inline method, you might mark it as
3621 having default visibility.  Marking the enclosing class with explicit
3622 visibility has no effect.
3624 Explicitly instantiated inline methods are unaffected by this option
3625 as their linkage might otherwise cross a shared library boundary.
3626 @xref{Template Instantiation}.
3628 @opindex fvisibility-ms-compat
3629 @item -fvisibility-ms-compat
3630 This flag attempts to use visibility settings to make GCC's C++
3631 linkage model compatible with that of Microsoft Visual Studio.
3633 The flag makes these changes to GCC's linkage model:
3635 @enumerate
3636 @item
3637 It sets the default visibility to @code{hidden}, like
3638 @option{-fvisibility=hidden}.
3640 @item
3641 Types, but not their members, are not hidden by default.
3643 @item
3644 The One Definition Rule is relaxed for types without explicit
3645 visibility specifications that are defined in more than one
3646 shared object: those declarations are permitted if they are
3647 permitted when this option is not used.
3648 @end enumerate
3650 In new code it is better to use @option{-fvisibility=hidden} and
3651 export those classes that are intended to be externally visible.
3652 Unfortunately it is possible for code to rely, perhaps accidentally,
3653 on the Visual Studio behavior.
3655 Among the consequences of these changes are that static data members
3656 of the same type with the same name but defined in different shared
3657 objects are different, so changing one does not change the other;
3658 and that pointers to function members defined in different shared
3659 objects may not compare equal.  When this flag is given, it is a
3660 violation of the ODR to define types with the same name differently.
3662 @opindex fno-weak
3663 @opindex fweak
3664 @item -fno-weak
3665 Do not use weak symbol support, even if it is provided by the linker.
3666 By default, G++ uses weak symbols if they are available.  This
3667 option exists only for testing, and should not be used by end-users;
3668 it results in inferior code and has no benefits.  This option may
3669 be removed in a future release of G++.
3671 @opindex fext-numeric-literals
3672 @opindex fno-ext-numeric-literals
3673 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3674 Accept imaginary, fixed-point, or machine-defined
3675 literal number suffixes as GNU extensions.
3676 When this option is turned off these suffixes are treated
3677 as C++11 user-defined literal numeric suffixes.
3678 This is on by default for all pre-C++11 dialects and all GNU dialects:
3679 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3680 @option{-std=gnu++14}.
3681 This option is off by default
3682 for ISO C++11 onwards (@option{-std=c++11}, ...).
3684 @opindex nostdinc++
3685 @item -nostdinc++
3686 Do not search for header files in the standard directories specific to
3687 C++, but do still search the other standard directories.  (This option
3688 is used when building the C++ library.)
3690 @opindex flang-info-include-translate
3691 @opindex flang-info-include-translate-not
3692 @item -flang-info-include-translate
3693 @itemx -flang-info-include-translate-not
3694 @itemx -flang-info-include-translate=@var{header}
3695 Inform of include translation events.  The first will note accepted
3696 include translations, the second will note declined include
3697 translations.  The @var{header} form will inform of include
3698 translations relating to that specific header.  If @var{header} is of
3699 the form @code{"user"} or @code{<system>} it will be resolved to a
3700 specific user or system header using the include path.
3702 @opindex flang-info-module-cmi
3703 @item -flang-info-module-cmi
3704 @itemx -flang-info-module-cmi=@var{module}
3705 Inform of Compiled Module Interface pathnames.  The first will note
3706 all read CMI pathnames.  The @var{module} form will not reading a
3707 specific module's CMI.  @var{module} may be a named module or a
3708 header-unit (the latter indicated by either being a pathname containing
3709 directory separators or enclosed in @code{<>} or @code{""}).
3711 @opindex stdlib
3712 @item -stdlib=@var{libstdc++,libc++}
3713 When G++ is configured to support this option, it allows specification of
3714 alternate C++ runtime libraries.  Two options are available: @var{libstdc++}
3715 (the default, native C++ runtime for G++) and @var{libc++} which is the
3716 C++ runtime installed on some operating systems (e.g. Darwin versions from
3717 Darwin11 onwards).  The option switches G++ to use the headers from the
3718 specified library and to emit @code{-lstdc++} or @code{-lc++} respectively,
3719 when a C++ runtime is required for linking.
3720 @end table
3722 In addition, these warning options have meanings only for C++ programs:
3724 @table @gcctabopt
3725 @opindex Wabi-tag
3726 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3727 Warn when a type with an ABI tag is used in a context that does not
3728 have that ABI tag.  See @ref{C++ Attributes} for more information
3729 about ABI tags.
3731 @opindex Wcomma-subscript
3732 @opindex Wno-comma-subscript
3733 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3734 Warn about uses of a comma expression within a subscripting expression.
3735 This usage was deprecated in C++20 and is going to be removed in C++23.
3736 However, a comma expression wrapped in @code{( )} is not deprecated.  Example:
3738 @smallexample
3739 @group
3740 void f(int *a, int b, int c) @{
3741     a[b,c];     // deprecated in C++20, invalid in C++23
3742     a[(b,c)];   // OK
3744 @end group
3745 @end smallexample
3747 In C++23 it is valid to have comma separated expressions in a subscript
3748 when an overloaded subscript operator is found and supports the right
3749 number and types of arguments.  G++ will accept the formerly valid syntax
3750 for code that is not valid in C++23 but used to be valid but deprecated
3751 in C++20 with a pedantic warning that can be disabled with
3752 @option{-Wno-comma-subscript}.
3754 Enabled by default with @option{-std=c++20} unless @option{-Wno-deprecated},
3755 and with @option{-std=c++23} regardless of @option{-Wno-deprecated}.
3757 This warning is upgraded to an error by @option{-pedantic-errors} in
3758 C++23 mode or later.
3760 @opindex Wctad-maybe-unsupported
3761 @opindex Wno-ctad-maybe-unsupported
3762 @item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)}
3763 Warn when performing class template argument deduction (CTAD) on a type with
3764 no explicitly written deduction guides.  This warning will point out cases
3765 where CTAD succeeded only because the compiler synthesized the implicit
3766 deduction guides, which might not be what the programmer intended.  Certain
3767 style guides allow CTAD only on types that specifically "opt-in"; i.e., on
3768 types that are designed to support CTAD.  This warning can be suppressed with
3769 the following pattern:
3771 @smallexample
3772 struct allow_ctad_t; // any name works
3773 template <typename T> struct S @{
3774   S(T) @{ @}
3776 // Guide with incomplete parameter type will never be considered.
3777 S(allow_ctad_t) -> S<void>;
3778 @end smallexample
3780 @opindex Wctor-dtor-privacy
3781 @opindex Wno-ctor-dtor-privacy
3782 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3783 Warn when a class seems unusable because all the constructors or
3784 destructors in that class are private, and it has neither friends nor
3785 public static member functions.  Also warn if there are no non-private
3786 methods, and there's at least one private member function that isn't
3787 a constructor or destructor.
3789 @opindex Wdangling-reference
3790 @opindex Wno-dangling-reference
3791 @item -Wdangling-reference @r{(C++ and Objective-C++ only)}
3792 Warn when a reference is bound to a temporary whose lifetime has ended.
3793 For example:
3795 @smallexample
3796 int n = 1;
3797 const int& r = std::max(n - 1, n + 1); // r is dangling
3798 @end smallexample
3800 In the example above, two temporaries are created, one for each
3801 argument, and a reference to one of the temporaries is returned.
3802 However, both temporaries are destroyed at the end of the full
3803 expression, so the reference @code{r} is dangling.  This warning
3804 also detects dangling references in member initializer lists:
3806 @smallexample
3807 const int& f(const int& i) @{ return i; @}
3808 struct S @{
3809   const int &r; // r is dangling
3810   S() : r(f(10)) @{ @}
3812 @end smallexample
3814 Member functions are checked as well, but only their object argument:
3816 @smallexample
3817 struct S @{
3818    const S& self () @{ return *this; @}
3820 const S& s = S().self(); // s is dangling
3821 @end smallexample
3823 Certain functions are safe in this respect, for example @code{std::use_facet}:
3824 they take and return a reference, but they don't return one of its arguments,
3825 which can fool the warning.  Such functions can be excluded from the warning
3826 by wrapping them in a @code{#pragma}:
3828 @smallexample
3829 #pragma GCC diagnostic push
3830 #pragma GCC diagnostic ignored "-Wdangling-reference"
3831 const T& foo (const T&) @{ @dots{} @}
3832 #pragma GCC diagnostic pop
3833 @end smallexample
3835 @option{-Wdangling-reference} also warns about code like
3837 @smallexample
3838 auto p = std::minmax(1, 2);
3839 @end smallexample
3841 where @code{std::minmax} returns @code{std::pair<const int&, const int&>}, and
3842 both references dangle after the end of the full expression that contains
3843 the call to @code{std::minmax}.
3845 This warning is enabled by @option{-Wall}.
3847 @opindex Wdelete-non-virtual-dtor
3848 @opindex Wno-delete-non-virtual-dtor
3849 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3850 Warn when @code{delete} is used to destroy an instance of a class that
3851 has virtual functions and non-virtual destructor. It is unsafe to delete
3852 an instance of a derived class through a pointer to a base class if the
3853 base class does not have a virtual destructor.  This warning is enabled
3854 by @option{-Wall}.
3856 @opindex Wdeprecated-copy
3857 @opindex Wno-deprecated-copy
3858 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3859 Warn that the implicit declaration of a copy constructor or copy
3860 assignment operator is deprecated if the class has a user-provided
3861 copy constructor or copy assignment operator, in C++11 and up.  This
3862 warning is enabled by @option{-Wextra}.  With
3863 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3864 user-provided destructor.
3866 @opindex Wdeprecated-enum-enum-conversion
3867 @opindex Wno-deprecated-enum-enum-conversion
3868 @item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)}
3869 Disable the warning about the case when the usual arithmetic conversions
3870 are applied on operands where one is of enumeration type and the other is
3871 of a different enumeration type.  This conversion was deprecated in C++20.
3872 For example:
3874 @smallexample
3875 enum E1 @{ e @};
3876 enum E2 @{ f @};
3877 int k = f - e;
3878 @end smallexample
3880 @option{-Wdeprecated-enum-enum-conversion} is enabled by default with
3881 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3882 by @option{-Wenum-conversion}.
3884 @opindex Wdeprecated-enum-float-conversion
3885 @opindex Wno-deprecated-enum-float-conversion
3886 @item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)}
3887 Disable the warning about the case when the usual arithmetic conversions
3888 are applied on operands where one is of enumeration type and the other is
3889 of a floating-point type.  This conversion was deprecated in C++20.  For
3890 example:
3892 @smallexample
3893 enum E1 @{ e @};
3894 enum E2 @{ f @};
3895 bool b = e <= 3.7;
3896 @end smallexample
3898 @option{-Wdeprecated-enum-float-conversion} is enabled by default with
3899 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3900 by @option{-Wenum-conversion}.
3902 @opindex Welaborated-enum-base
3903 @opindex Wno-elaborated-enum-base
3904 @item -Wno-elaborated-enum-base
3905 For C++11 and above, warn if an (invalid) additional enum-base is used
3906 in an elaborated-type-specifier.  That is, if an enum with given
3907 underlying type and no enumerator list is used in a declaration other
3908 than just a standalone declaration of the enum.  Enabled by default.  This
3909 warning is upgraded to an error with -pedantic-errors.
3911 @opindex Winit-list-lifetime
3912 @opindex Wno-init-list-lifetime
3913 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3914 Do not warn about uses of @code{std::initializer_list} that are likely
3915 to result in dangling pointers.  Since the underlying array for an
3916 @code{initializer_list} is handled like a normal C++ temporary object,
3917 it is easy to inadvertently keep a pointer to the array past the end
3918 of the array's lifetime.  For example:
3920 @itemize @bullet
3921 @item
3922 If a function returns a temporary @code{initializer_list}, or a local
3923 @code{initializer_list} variable, the array's lifetime ends at the end
3924 of the return statement, so the value returned has a dangling pointer.
3926 @item
3927 If a new-expression creates an @code{initializer_list}, the array only
3928 lives until the end of the enclosing full-expression, so the
3929 @code{initializer_list} in the heap has a dangling pointer.
3931 @item
3932 When an @code{initializer_list} variable is assigned from a
3933 brace-enclosed initializer list, the temporary array created for the
3934 right side of the assignment only lives until the end of the
3935 full-expression, so at the next statement the @code{initializer_list}
3936 variable has a dangling pointer.
3938 @smallexample
3939 // li's initial underlying array lives as long as li
3940 std::initializer_list<int> li = @{ 1,2,3 @};
3941 // assignment changes li to point to a temporary array
3942 li = @{ 4, 5 @};
3943 // now the temporary is gone and li has a dangling pointer
3944 int i = li.begin()[0] // undefined behavior
3945 @end smallexample
3947 @item
3948 When a list constructor stores the @code{begin} pointer from the
3949 @code{initializer_list} argument, this doesn't extend the lifetime of
3950 the array, so if a class variable is constructed from a temporary
3951 @code{initializer_list}, the pointer is left dangling by the end of
3952 the variable declaration statement.
3954 @end itemize
3956 @opindex Winvalid-constexpr
3957 @opindex Wno-invalid-constexpr
3958 @item -Winvalid-constexpr
3960 Warn when a function never produces a constant expression.  In C++20
3961 and earlier, for every @code{constexpr} function and function template,
3962 there must be at least one set of function arguments in at least one
3963 instantiation such that an invocation of the function or constructor
3964 could be an evaluated subexpression of a core constant expression.
3965 C++23 removed this restriction, so it's possible to have a function
3966 or a function template marked @code{constexpr} for which no invocation
3967 satisfies the requirements of a core constant expression.
3969 This warning is enabled as a pedantic warning by default in C++20 and
3970 earlier.  In C++23, @option{-Winvalid-constexpr} can be turned on, in
3971 which case it will be an ordinary warning.  For example:
3973 @smallexample
3974 void f (int& i);
3975 constexpr void
3976 g (int& i)
3978   // Warns by default in C++20, in C++23 only with -Winvalid-constexpr.
3979   f(i);
3981 @end smallexample
3983 @opindex Winvalid-imported-macros
3984 @opindex Wno-invalid-imported-macros
3985 @item -Winvalid-imported-macros
3986 Verify all imported macro definitions are valid at the end of
3987 compilation.  This is not enabled by default, as it requires
3988 additional processing to determine.  It may be useful when preparing
3989 sets of header-units to ensure consistent macros.
3991 @opindex Wliteral-suffix
3992 @opindex Wno-literal-suffix
3993 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
3994 Do not warn when a string or character literal is followed by a
3995 ud-suffix which does not begin with an underscore.  As a conforming
3996 extension, GCC treats such suffixes as separate preprocessing tokens
3997 in order to maintain backwards compatibility with code that uses
3998 formatting macros from @code{<inttypes.h>}.  For example:
4000 @smallexample
4001 #define __STDC_FORMAT_MACROS
4002 #include <inttypes.h>
4003 #include <stdio.h>
4005 int main() @{
4006   int64_t i64 = 123;
4007   printf("My int64: %" PRId64"\n", i64);
4009 @end smallexample
4011 In this case, @code{PRId64} is treated as a separate preprocessing token.
4013 This option also controls warnings when a user-defined literal
4014 operator is declared with a literal suffix identifier that doesn't
4015 begin with an underscore. Literal suffix identifiers that don't begin
4016 with an underscore are reserved for future standardization.
4018 These warnings are enabled by default.
4020 @opindex Wnarrowing
4021 @opindex Wno-narrowing
4022 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
4023 For C++11 and later standards, narrowing conversions are diagnosed by default,
4024 as required by the standard.  A narrowing conversion from a constant produces
4025 an error, and a narrowing conversion from a non-constant produces a warning,
4026 but @option{-Wno-narrowing} suppresses the diagnostic.
4027 Note that this does not affect the meaning of well-formed code;
4028 narrowing conversions are still considered ill-formed in SFINAE contexts.
4030 With @option{-Wnarrowing} in C++98, warn when a narrowing
4031 conversion prohibited by C++11 occurs within
4032 @samp{@{ @}}, e.g.
4034 @smallexample
4035 int i = @{ 2.2 @}; // error: narrowing from double to int
4036 @end smallexample
4038 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
4040 @opindex Wnoexcept
4041 @opindex Wno-noexcept
4042 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
4043 Warn when a noexcept-expression evaluates to false because of a call
4044 to a function that does not have a non-throwing exception
4045 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
4046 the compiler to never throw an exception.
4048 @opindex Wnoexcept-type
4049 @opindex Wno-noexcept-type
4050 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
4051 Warn if the C++17 feature making @code{noexcept} part of a function
4052 type changes the mangled name of a symbol relative to C++14.  Enabled
4053 by @option{-Wabi} and @option{-Wc++17-compat}.
4055 As an example:
4057 @smallexample
4058 template <class T> void f(T t) @{ t(); @};
4059 void g() noexcept;
4060 void h() @{ f(g); @} 
4061 @end smallexample
4063 @noindent
4064 In C++14, @code{f} calls @code{f<void(*)()>}, but in
4065 C++17 it calls @code{f<void(*)()noexcept>}.
4067 @opindex Wclass-memaccess
4068 @opindex Wno-class-memaccess
4069 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
4070 Warn when the destination of a call to a raw memory function such as
4071 @code{memset} or @code{memcpy} is an object of class type, and when writing
4072 into such an object might bypass the class non-trivial or deleted constructor
4073 or copy assignment, violate const-correctness or encapsulation, or corrupt
4074 virtual table pointers.  Modifying the representation of such objects may
4075 violate invariants maintained by member functions of the class.  For example,
4076 the call to @code{memset} below is undefined because it modifies a non-trivial
4077 class object and is, therefore, diagnosed.  The safe way to either initialize
4078 or clear the storage of objects of such types is by using the appropriate
4079 constructor or assignment operator, if one is available.
4080 @smallexample
4081 std::string str = "abc";
4082 memset (&str, 0, sizeof str);
4083 @end smallexample
4084 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
4085 Explicitly casting the pointer to the class object to @code{void *} or
4086 to a type that can be safely accessed by the raw memory function suppresses
4087 the warning.
4089 @opindex Wnon-virtual-dtor
4090 @opindex Wno-non-virtual-dtor
4091 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
4092 Warn when a class has virtual functions and an accessible non-virtual
4093 destructor itself or in an accessible polymorphic base class, in which
4094 case it is possible but unsafe to delete an instance of a derived
4095 class through a pointer to the class itself or base class.  This
4096 warning is automatically enabled if @option{-Weffc++} is specified.
4097 The @option{-Wdelete-non-virtual-dtor} option (enabled by @option{-Wall})
4098 should be preferred because it warns about the unsafe cases without false
4099 positives.
4101 @opindex Wregister
4102 @opindex Wno-register
4103 @item -Wregister @r{(C++ and Objective-C++ only)}
4104 Warn on uses of the @code{register} storage class specifier, except
4105 when it is part of the GNU @ref{Explicit Register Variables} extension.
4106 The use of the @code{register} keyword as storage class specifier has
4107 been deprecated in C++11 and removed in C++17.
4108 Enabled by default with @option{-std=c++17}.
4110 @opindex Wreorder
4111 @opindex Wno-reorder
4112 @cindex reordering, warning
4113 @cindex warning for reordering of member initializers
4114 @item -Wreorder @r{(C++ and Objective-C++ only)}
4115 Warn when the order of member initializers given in the code does not
4116 match the order in which they must be executed.  For instance:
4118 @smallexample
4119 struct A @{
4120   int i;
4121   int j;
4122   A(): j (0), i (1) @{ @}
4124 @end smallexample
4126 @noindent
4127 The compiler rearranges the member initializers for @code{i}
4128 and @code{j} to match the declaration order of the members, emitting
4129 a warning to that effect.  This warning is enabled by @option{-Wall}.
4131 @opindex Wpessimizing-move
4132 @opindex Wno-pessimizing-move
4133 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
4134 This warning warns when a call to @code{std::move} prevents copy
4135 elision.  A typical scenario when copy elision can occur is when returning in
4136 a function with a class return type, when the expression being returned is the
4137 name of a non-volatile automatic object, and is not a function parameter, and
4138 has the same type as the function return type.
4140 @smallexample
4141 struct T @{
4142 @dots{}
4144 T fn()
4146   T t;
4147   @dots{}
4148   return std::move (t);
4150 @end smallexample
4152 But in this example, the @code{std::move} call prevents copy elision.
4154 This warning is enabled by @option{-Wall}.
4156 @opindex Wredundant-move
4157 @opindex Wno-redundant-move
4158 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
4159 This warning warns about redundant calls to @code{std::move}; that is, when
4160 a move operation would have been performed even without the @code{std::move}
4161 call.  This happens because the compiler is forced to treat the object as if
4162 it were an rvalue in certain situations such as returning a local variable,
4163 where copy elision isn't applicable.  Consider:
4165 @smallexample
4166 struct T @{
4167 @dots{}
4169 T fn(T t)
4171   @dots{}
4172   return std::move (t);
4174 @end smallexample
4176 Here, the @code{std::move} call is redundant.  Because G++ implements Core
4177 Issue 1579, another example is:
4179 @smallexample
4180 struct T @{ // convertible to U
4181 @dots{}
4183 struct U @{
4184 @dots{}
4186 U fn()
4188   T t;
4189   @dots{}
4190   return std::move (t);
4192 @end smallexample
4193 In this example, copy elision isn't applicable because the type of the
4194 expression being returned and the function return type differ, yet G++
4195 treats the return value as if it were designated by an rvalue.
4197 This warning is enabled by @option{-Wextra}.
4199 @opindex Wrange-loop-construct
4200 @opindex Wno-range-loop-construct
4201 @item -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
4202 This warning warns when a C++ range-based for-loop is creating an unnecessary
4203 copy.  This can happen when the range declaration is not a reference, but
4204 probably should be.  For example:
4206 @smallexample
4207 struct S @{ char arr[128]; @};
4208 void fn () @{
4209   S arr[5];
4210   for (const auto x : arr) @{ @dots{} @}
4212 @end smallexample
4214 It does not warn when the type being copied is a trivially-copyable type whose
4215 size is less than 64 bytes.
4217 This warning also warns when a loop variable in a range-based for-loop is
4218 initialized with a value of a different type resulting in a copy.  For example:
4220 @smallexample
4221 void fn() @{
4222   int arr[10];
4223   for (const double &x : arr) @{ @dots{} @}
4225 @end smallexample
4227 In the example above, in every iteration of the loop a temporary value of
4228 type @code{double} is created and destroyed, to which the reference
4229 @code{const double &} is bound.
4231 This warning is enabled by @option{-Wall}.
4233 @opindex Wredundant-tags
4234 @opindex Wno-redundant-tags
4235 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
4236 Warn about redundant class-key and enum-key in references to class types
4237 and enumerated types in contexts where the key can be eliminated without
4238 causing an ambiguity.  For example:
4240 @smallexample
4241 struct foo;
4242 struct foo *p;   // warn that keyword struct can be eliminated
4243 @end smallexample
4245 @noindent
4246 On the other hand, in this example there is no warning:
4248 @smallexample
4249 struct foo;
4250 void foo ();   // "hides" struct foo
4251 void bar (struct foo&);  // no warning, keyword struct is necessary
4252 @end smallexample
4254 @opindex Wsubobject-linkage
4255 @opindex Wno-subobject-linkage
4256 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
4257 Do not warn
4258 if a class type has a base or a field whose type uses the anonymous
4259 namespace or depends on a type with no linkage.  If a type A depends on
4260 a type B with no or internal linkage, defining it in multiple
4261 translation units would be an ODR violation because the meaning of B
4262 is different in each translation unit.  If A only appears in a single
4263 translation unit, the best way to silence the warning is to give it
4264 internal linkage by putting it in an anonymous namespace as well.  The
4265 compiler doesn't give this warning for types defined in the main .C
4266 file, as those are unlikely to have multiple definitions.
4267 @option{-Wsubobject-linkage} is enabled by default.
4269 @opindex Weffc++
4270 @opindex Wno-effc++
4271 @item -Weffc++ @r{(C++ and Objective-C++ only)}
4272 Warn about violations of the following style guidelines from Scott Meyers'
4273 @cite{Effective C++} series of books:
4275 @itemize @bullet
4276 @item
4277 Define a copy constructor and an assignment operator for classes
4278 with dynamically-allocated memory.
4280 @item
4281 Prefer initialization to assignment in constructors.
4283 @item
4284 Have @code{operator=} return a reference to @code{*this}.
4286 @item
4287 Don't try to return a reference when you must return an object.
4289 @item
4290 Distinguish between prefix and postfix forms of increment and
4291 decrement operators.
4293 @item
4294 Never overload @code{&&}, @code{||}, or @code{,}.
4296 @end itemize
4298 This option also enables @option{-Wnon-virtual-dtor}, which is also
4299 one of the effective C++ recommendations.  However, the check is
4300 extended to warn about the lack of virtual destructor in accessible
4301 non-polymorphic bases classes too.
4303 When selecting this option, be aware that the standard library
4304 headers do not obey all of these guidelines; use @samp{grep -v}
4305 to filter out those warnings.
4307 @opindex Wexceptions
4308 @opindex Wno-exceptions
4309 @item -Wno-exceptions @r{(C++ and Objective-C++ only)}
4310 Disable the warning about the case when an exception handler is shadowed by
4311 another handler, which can point out a wrong ordering of exception handlers.
4313 @opindex Wstrict-null-sentinel
4314 @opindex Wno-strict-null-sentinel
4315 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
4316 Warn about the use of an uncasted @code{NULL} as sentinel.  When
4317 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
4318 to @code{__null}.  Although it is a null pointer constant rather than a
4319 null pointer, it is guaranteed to be of the same size as a pointer.
4320 But this use is not portable across different compilers.
4322 @opindex Wno-non-template-friend
4323 @opindex Wnon-template-friend
4324 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
4325 Disable warnings when non-template friend functions are declared
4326 within a template.  In very old versions of GCC that predate implementation
4327 of the ISO standard, declarations such as 
4328 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
4329 could be interpreted as a particular specialization of a template
4330 function; the warning exists to diagnose compatibility problems, 
4331 and is enabled by default.
4333 @opindex Wold-style-cast
4334 @opindex Wno-old-style-cast
4335 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
4336 Warn if an old-style (C-style) cast to a non-void type is used within
4337 a C++ program.  The new-style casts (@code{dynamic_cast},
4338 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
4339 less vulnerable to unintended effects and much easier to search for.
4341 @opindex Woverloaded-virtual
4342 @opindex Wno-overloaded-virtual
4343 @cindex overloaded virtual function, warning
4344 @cindex warning for overloaded virtual function
4345 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
4346 @itemx -Woverloaded-virtual=@var{n}
4347 Warn when a function declaration hides virtual functions from a
4348 base class.  For example, in:
4350 @smallexample
4351 struct A @{
4352   virtual void f();
4355 struct B: public A @{
4356   void f(int); // does not override
4358 @end smallexample
4360 the @code{A} class version of @code{f} is hidden in @code{B}, and code
4361 like:
4363 @smallexample
4364 B* b;
4365 b->f();
4366 @end smallexample
4368 @noindent
4369 fails to compile.
4371 In cases where the different signatures are not an accident, the
4372 simplest solution is to add a using-declaration to the derived class
4373 to un-hide the base function, e.g. add @code{using A::f;} to @code{B}.
4375 The optional level suffix controls the behavior when all the
4376 declarations in the derived class override virtual functions in the
4377 base class, even if not all of the base functions are overridden:
4379 @smallexample
4380 struct C @{
4381   virtual void f();
4382   virtual void f(int);
4385 struct D: public C @{
4386   void f(int); // does override
4388 @end smallexample
4390 This pattern is less likely to be a mistake; if D is only used
4391 virtually, the user might have decided that the base class semantics
4392 for some of the overloads are fine.
4394 At level 1, this case does not warn; at level 2, it does.
4395 @option{-Woverloaded-virtual} by itself selects level 2.  Level 1 is
4396 included in @option{-Wall}.
4398 @opindex Wno-pmf-conversions
4399 @opindex Wpmf-conversions
4400 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
4401 Disable the diagnostic for converting a bound pointer to member function
4402 to a plain pointer.
4404 @opindex Wsign-promo
4405 @opindex Wno-sign-promo
4406 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
4407 Warn when overload resolution chooses a promotion from unsigned or
4408 enumerated type to a signed type, over a conversion to an unsigned type of
4409 the same size.  Previous versions of G++ tried to preserve
4410 unsignedness, but the standard mandates the current behavior.
4412 @opindex Wtemplates
4413 @opindex Wno-templates
4414 @item -Wtemplates @r{(C++ and Objective-C++ only)}
4415 Warn when a primary template declaration is encountered.  Some coding
4416 rules disallow templates, and this may be used to enforce that rule.
4417 The warning is inactive inside a system header file, such as the STL, so
4418 one can still use the STL.  One may also instantiate or specialize
4419 templates.
4421 @opindex Wmismatched-new-delete
4422 @opindex Wno-mismatched-new-delete
4423 @item -Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
4424 Warn for mismatches between calls to @code{operator new} or @code{operator
4425 delete} and the corresponding call to the allocation or deallocation function.
4426 This includes invocations of C++ @code{operator delete} with pointers
4427 returned from either mismatched forms of @code{operator new}, or from other
4428 functions that allocate objects for which the @code{operator delete} isn't
4429 a suitable deallocator, as well as calls to other deallocation functions
4430 with pointers returned from @code{operator new} for which the deallocation
4431 function isn't suitable.
4433 For example, the @code{delete} expression in the function below is diagnosed
4434 because it doesn't match the array form of the @code{new} expression
4435 the pointer argument was returned from.  Similarly, the call to @code{free}
4436 is also diagnosed.
4438 @smallexample
4439 void f ()
4441   int *a = new int[n];
4442   delete a;   // warning: mismatch in array forms of expressions
4444   char *p = new char[n];
4445   free (p);   // warning: mismatch between new and free
4447 @end smallexample
4449 The related option @option{-Wmismatched-dealloc} diagnoses mismatches
4450 involving allocation and deallocation functions other than @code{operator
4451 new} and @code{operator delete}.
4453 @option{-Wmismatched-new-delete} is included in @option{-Wall}.
4455 @opindex Wmismatched-tags
4456 @opindex Wno-mismatched-tags
4457 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
4458 Warn for declarations of structs, classes, and class templates and their
4459 specializations with a class-key that does not match either the definition
4460 or the first declaration if no definition is provided.
4462 For example, the declaration of @code{struct Object} in the argument list
4463 of @code{draw} triggers the warning.  To avoid it, either remove the redundant
4464 class-key @code{struct} or replace it with @code{class} to match its definition.
4465 @smallexample
4466 class Object @{
4467 public:
4468   virtual ~Object () = 0;
4470 void draw (struct Object*);
4471 @end smallexample
4473 It is not wrong to declare a class with the class-key @code{struct} as
4474 the example above shows.  The @option{-Wmismatched-tags} option is intended
4475 to help achieve a consistent style of class declarations.  In code that is
4476 intended to be portable to Windows-based compilers the warning helps prevent
4477 unresolved references due to the difference in the mangling of symbols
4478 declared with different class-keys.  The option can be used either on its
4479 own or in conjunction with @option{-Wredundant-tags}.
4481 @opindex Wmultiple-inheritance
4482 @opindex Wno-multiple-inheritance
4483 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
4484 Warn when a class is defined with multiple direct base classes.  Some
4485 coding rules disallow multiple inheritance, and this may be used to
4486 enforce that rule.  The warning is inactive inside a system header file,
4487 such as the STL, so one can still use the STL.  One may also define
4488 classes that indirectly use multiple inheritance.
4490 @opindex Wvirtual-inheritance
4491 @opindex Wno-virtual-inheritance
4492 @item -Wvirtual-inheritance
4493 Warn when a class is defined with a virtual direct base class.  Some
4494 coding rules disallow multiple inheritance, and this may be used to
4495 enforce that rule.  The warning is inactive inside a system header file,
4496 such as the STL, so one can still use the STL.  One may also define
4497 classes that indirectly use virtual inheritance.
4499 @opindex Wvirtual-move-assign
4500 @opindex Wno-virtual-move-assign
4501 @item -Wno-virtual-move-assign
4502 Suppress warnings about inheriting from a virtual base with a
4503 non-trivial C++11 move assignment operator.  This is dangerous because
4504 if the virtual base is reachable along more than one path, it is
4505 moved multiple times, which can mean both objects end up in the
4506 moved-from state.  If the move assignment operator is written to avoid
4507 moving from a moved-from object, this warning can be disabled.
4509 @opindex Wnamespaces
4510 @opindex Wno-namespaces
4511 @item -Wnamespaces
4512 Warn when a namespace definition is opened.  Some coding rules disallow
4513 namespaces, and this may be used to enforce that rule.  The warning is
4514 inactive inside a system header file, such as the STL, so one can still
4515 use the STL.  One may also use using directives and qualified names.
4517 @opindex Wterminate
4518 @opindex Wno-terminate
4519 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
4520 Disable the warning about a throw-expression that will immediately
4521 result in a call to @code{terminate}.
4523 @opindex Wvexing-parse
4524 @opindex Wno-vexing-parse
4525 @item -Wno-vexing-parse @r{(C++ and Objective-C++ only)}
4526 Warn about the most vexing parse syntactic ambiguity.  This warns about
4527 the cases when a declaration looks like a variable definition, but the
4528 C++ language requires it to be interpreted as a function declaration.
4529 For instance:
4531 @smallexample
4532 void f(double a) @{
4533   int i();        // extern int i (void);
4534   int n(int(a));  // extern int n (int);
4536 @end smallexample
4538 Another example:
4540 @smallexample
4541 struct S @{ S(int); @};
4542 void f(double a) @{
4543   S x(int(a));   // extern struct S x (int);
4544   S y(int());    // extern struct S y (int (*) (void));
4545   S z();         // extern struct S z (void);
4547 @end smallexample
4549 The warning will suggest options how to deal with such an ambiguity; e.g.,
4550 it can suggest removing the parentheses or using braces instead.
4552 This warning is enabled by default.
4554 @opindex Wno-class-conversion
4555 @opindex Wclass-conversion
4556 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
4557 Do not warn when a conversion function converts an
4558 object to the same type, to a base class of that type, or to void; such
4559 a conversion function will never be called.
4561 @opindex Wvolatile
4562 @opindex Wno-volatile
4563 @item -Wvolatile @r{(C++ and Objective-C++ only)}
4564 Warn about deprecated uses of the @code{volatile} qualifier.  This includes
4565 postfix and prefix @code{++} and @code{--} expressions of
4566 @code{volatile}-qualified types, using simple assignments where the left
4567 operand is a @code{volatile}-qualified non-class type for their value,
4568 compound assignments where the left operand is a @code{volatile}-qualified
4569 non-class type, @code{volatile}-qualified function return type,
4570 @code{volatile}-qualified parameter type, and structured bindings of a
4571 @code{volatile}-qualified type.  This usage was deprecated in C++20.
4573 Enabled by default with @option{-std=c++20}.
4575 @opindex Wzero-as-null-pointer-constant
4576 @opindex Wno-zero-as-null-pointer-constant
4577 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4578 Warn when a literal @samp{0} is used as null pointer constant.  This can
4579 be useful to facilitate the conversion to @code{nullptr} in C++11.
4581 @opindex Waligned-new
4582 @opindex Wno-aligned-new
4583 @item -Waligned-new
4584 Warn about a new-expression of a type that requires greater alignment
4585 than the @code{alignof(std::max_align_t)} but uses an allocation
4586 function without an explicit alignment parameter. This option is
4587 enabled by @option{-Wall}.
4589 Normally this only warns about global allocation functions, but
4590 @option{-Waligned-new=all} also warns about class member allocation
4591 functions.
4593 @opindex Wplacement-new
4594 @opindex Wno-placement-new
4595 @item -Wno-placement-new
4596 @itemx -Wplacement-new=@var{n}
4597 Warn about placement new expressions with undefined behavior, such as
4598 constructing an object in a buffer that is smaller than the type of
4599 the object.  For example, the placement new expression below is diagnosed
4600 because it attempts to construct an array of 64 integers in a buffer only
4601 64 bytes large.
4602 @smallexample
4603 char buf [64];
4604 new (buf) int[64];
4605 @end smallexample
4606 This warning is enabled by default.
4608 @table @gcctabopt
4609 @item -Wplacement-new=1
4610 This is the default warning level of @option{-Wplacement-new}.  At this
4611 level the warning is not issued for some strictly undefined constructs that
4612 GCC allows as extensions for compatibility with legacy code.  For example,
4613 the following @code{new} expression is not diagnosed at this level even
4614 though it has undefined behavior according to the C++ standard because
4615 it writes past the end of the one-element array.
4616 @smallexample
4617 struct S @{ int n, a[1]; @};
4618 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4619 new (s->a)int [32]();
4620 @end smallexample
4622 @item -Wplacement-new=2
4623 At this level, in addition to diagnosing all the same constructs as at level
4624 1, a diagnostic is also issued for placement new expressions that construct
4625 an object in the last member of structure whose type is an array of a single
4626 element and whose size is less than the size of the object being constructed.
4627 While the previous example would be diagnosed, the following construct makes
4628 use of the flexible member array extension to avoid the warning at level 2.
4629 @smallexample
4630 struct S @{ int n, a[]; @};
4631 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4632 new (s->a)int [32]();
4633 @end smallexample
4635 @end table
4637 @opindex Wcatch-value
4638 @opindex Wno-catch-value
4639 @item -Wcatch-value
4640 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
4641 Warn about catch handlers that do not catch via reference.
4642 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
4643 warn about polymorphic class types that are caught by value.
4644 With @option{-Wcatch-value=2} warn about all class types that are caught
4645 by value. With @option{-Wcatch-value=3} warn about all types that are
4646 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
4648 @opindex Wconditionally-supported
4649 @opindex Wno-conditionally-supported
4650 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4651 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4653 @opindex Wdelete-incomplete
4654 @opindex Wno-delete-incomplete
4655 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
4656 Do not warn when deleting a pointer to incomplete type, which may cause
4657 undefined behavior at runtime.  This warning is enabled by default.
4659 @opindex Wextra-semi
4660 @opindex Wno-extra-semi
4661 @item -Wextra-semi @r{(C++, Objective-C++ only)}
4662 Warn about redundant semicolons after in-class function definitions.
4664 @opindex Winaccessible-base
4665 @opindex Wno-inaccessible-base
4666 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
4667 This option controls warnings
4668 when a base class is inaccessible in a class derived from it due to
4669 ambiguity.  The warning is enabled by default.
4670 Note that the warning for ambiguous virtual
4671 bases is enabled by the @option{-Wextra} option.
4672 @smallexample
4673 @group
4674 struct A @{ int a; @};
4676 struct B : A @{ @};
4678 struct C : B, A @{ @};
4679 @end group
4680 @end smallexample
4682 @opindex Winherited-variadic-ctor
4683 @opindex Wno-inherited-variadic-ctor
4684 @item -Wno-inherited-variadic-ctor
4685 Suppress warnings about use of C++11 inheriting constructors when the
4686 base class inherited from has a C variadic constructor; the warning is
4687 on by default because the ellipsis is not inherited.
4689 @opindex Wno-invalid-offsetof
4690 @opindex Winvalid-offsetof
4691 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4692 Suppress warnings from applying the @code{offsetof} macro to a non-POD
4693 type.  According to the 2014 ISO C++ standard, applying @code{offsetof}
4694 to a non-standard-layout type is undefined.  In existing C++ implementations,
4695 however, @code{offsetof} typically gives meaningful results.
4696 This flag is for users who are aware that they are
4697 writing nonportable code and who have deliberately chosen to ignore the
4698 warning about it.
4700 The restrictions on @code{offsetof} may be relaxed in a future version
4701 of the C++ standard.
4703 @opindex Wsized-deallocation
4704 @opindex Wno-sized-deallocation
4705 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
4706 Warn about a definition of an unsized deallocation function
4707 @smallexample
4708 void operator delete (void *) noexcept;
4709 void operator delete[] (void *) noexcept;
4710 @end smallexample
4711 without a definition of the corresponding sized deallocation function
4712 @smallexample
4713 void operator delete (void *, std::size_t) noexcept;
4714 void operator delete[] (void *, std::size_t) noexcept;
4715 @end smallexample
4716 or vice versa.  Enabled by @option{-Wextra} along with
4717 @option{-fsized-deallocation}.
4719 @opindex Wno-suggest-final-types
4720 @opindex Wsuggest-final-types
4721 @item -Wsuggest-final-types
4722 Warn about types with virtual methods where code quality would be improved
4723 if the type were declared with the C++11 @code{final} specifier,
4724 or, if possible,
4725 declared in an anonymous namespace. This allows GCC to more aggressively
4726 devirtualize the polymorphic calls. This warning is more effective with
4727 link-time optimization,
4728 where the information about the class hierarchy graph is
4729 more complete.
4731 @opindex Wno-suggest-final-methods
4732 @opindex Wsuggest-final-methods
4733 @item -Wsuggest-final-methods
4734 Warn about virtual methods where code quality would be improved if the method
4735 were declared with the C++11 @code{final} specifier,
4736 or, if possible, its type were
4737 declared in an anonymous namespace or with the @code{final} specifier.
4738 This warning is
4739 more effective with link-time optimization, where the information about the
4740 class hierarchy graph is more complete. It is recommended to first consider
4741 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4742 annotations.
4744 @opindex Wsuggest-override
4745 @opindex Wno-suggest-override
4746 @item -Wsuggest-override
4747 Warn about overriding virtual functions that are not marked with the
4748 @code{override} keyword.
4750 @opindex Wuse-after-free
4751 @opindex Wno-use-after-free
4752 @item -Wuse-after-free
4753 @itemx -Wuse-after-free=@var{n}
4754 Warn about uses of pointers to dynamically allocated objects that have
4755 been rendered indeterminate by a call to a deallocation function.
4756 The warning is enabled at all optimization levels but may yield different
4757 results with optimization than without.
4759 @table @gcctabopt
4760 @item -Wuse-after-free=1
4761 At level 1 the warning attempts to diagnose only unconditional uses
4762 of pointers made indeterminate by a deallocation call or a successful
4763 call to @code{realloc}, regardless of whether or not the call resulted
4764 in an actual reallocatio of memory.  This includes double-@code{free}
4765 calls as well as uses in arithmetic and relational expressions.  Although
4766 undefined, uses of indeterminate pointers in equality (or inequality)
4767 expressions are not diagnosed at this level.
4768 @item -Wuse-after-free=2
4769 At level 2, in addition to unconditional uses, the warning also diagnoses
4770 conditional uses of pointers made indeterminate by a deallocation call.
4771 As at level 2, uses in equality (or inequality) expressions are not
4772 diagnosed.  For example, the second call to @code{free} in the following
4773 function is diagnosed at this level:
4774 @smallexample
4775 struct A @{ int refcount; void *data; @};
4777 void release (struct A *p)
4779   int refcount = --p->refcount;
4780   free (p);
4781   if (refcount == 0)
4782     free (p->data);   // warning: p may be used after free
4784 @end smallexample
4785 @item -Wuse-after-free=3
4786 At level 3, the warning also diagnoses uses of indeterminate pointers in
4787 equality expressions.  All uses of indeterminate pointers are undefined
4788 but equality tests sometimes appear after calls to @code{realloc} as
4789 an attempt to determine whether the call resulted in relocating the object
4790 to a different address.  They are diagnosed at a separate level to aid
4791 legacy code gradually transition to safe alternatives.  For example,
4792 the equality test in the function below is diagnosed at this level:
4793 @smallexample
4794 void adjust_pointers (int**, int);
4796 void grow (int **p, int n)
4798   int **q = (int**)realloc (p, n *= 2);
4799   if (q == p)
4800     return;
4801   adjust_pointers ((int**)q, n);
4803 @end smallexample
4804 To avoid the warning at this level, store offsets into allocated memory
4805 instead of pointers.  This approach obviates needing to adjust the stored
4806 pointers after reallocation.
4807 @end table
4809 @option{-Wuse-after-free=2} is included in @option{-Wall}.
4811 @opindex Wuseless-cast
4812 @opindex Wno-useless-cast
4813 @item -Wuseless-cast @r{(C, Objective-C, C++ and Objective-C++ only)}
4814 Warn when an expression is cast to its own type.  This warning does not
4815 occur when a class object is converted to a non-reference type as that
4816 is a way to create a temporary:
4818 @smallexample
4819 struct S @{ @};
4820 void g (S&&);
4821 void f (S&& arg)
4823   g (S(arg)); // make arg prvalue so that it can bind to S&&
4825 @end smallexample
4827 @opindex Wconversion-null
4828 @opindex Wno-conversion-null
4829 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4830 Do not warn for conversions between @code{NULL} and non-pointer
4831 types. @option{-Wconversion-null} is enabled by default.
4833 @end table
4835 @node Objective-C and Objective-C++ Dialect Options
4836 @section Options Controlling Objective-C and Objective-C++ Dialects
4838 @cindex compiler options, Objective-C and Objective-C++
4839 @cindex Objective-C and Objective-C++ options, command-line
4840 @cindex options, Objective-C and Objective-C++
4841 (NOTE: This manual does not describe the Objective-C and Objective-C++
4842 languages themselves.  @xref{Standards,,Language Standards
4843 Supported by GCC}, for references.)
4845 This section describes the command-line options that are only meaningful
4846 for Objective-C and Objective-C++ programs.  You can also use most of
4847 the language-independent GNU compiler options.
4848 For example, you might compile a file @file{some_class.m} like this:
4850 @smallexample
4851 gcc -g -fgnu-runtime -O -c some_class.m
4852 @end smallexample
4854 @noindent
4855 In this example, @option{-fgnu-runtime} is an option meant only for
4856 Objective-C and Objective-C++ programs; you can use the other options with
4857 any language supported by GCC@.
4859 Note that since Objective-C is an extension of the C language, Objective-C
4860 compilations may also use options specific to the C front-end (e.g.,
4861 @option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
4862 C++-specific options (e.g., @option{-Wabi}).
4864 Here is a list of options that are @emph{only} for compiling Objective-C
4865 and Objective-C++ programs:
4867 @table @gcctabopt
4868 @opindex fconstant-string-class
4869 @item -fconstant-string-class=@var{class-name}
4870 Use @var{class-name} as the name of the class to instantiate for each
4871 literal string specified with the syntax @code{@@"@dots{}"}.  The default
4872 class name is @code{NXConstantString} if the GNU runtime is being used, and
4873 @code{NSConstantString} if the NeXT runtime is being used (see below).  On
4874 Darwin / macOS platforms, the @option{-fconstant-cfstrings} option, if
4875 also present, overrides the @option{-fconstant-string-class} setting and cause
4876 @code{@@"@dots{}"} literals to be laid out as constant CoreFoundation strings.
4877 Note that @option{-fconstant-cfstrings} is an alias for the target-specific
4878 @option{-mconstant-cfstrings} equivalent.
4880 @opindex fgnu-runtime
4881 @item -fgnu-runtime
4882 Generate object code compatible with the standard GNU Objective-C
4883 runtime.  This is the default for most types of systems.
4885 @opindex fnext-runtime
4886 @item -fnext-runtime
4887 Generate output compatible with the NeXT runtime.  This is the default
4888 for NeXT-based systems, including Darwin / macOS.  The macro
4889 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
4890 used.
4892 @opindex fno-nil-receivers
4893 @opindex fnil-receivers
4894 @item -fno-nil-receivers
4895 Assume that all Objective-C message dispatches (@code{[receiver
4896 message:arg]}) in this translation unit ensure that the receiver is
4897 not @code{nil}.  This allows for more efficient entry points in the
4898 runtime to be used.  This option is only available in conjunction with
4899 the NeXT runtime and ABI version 0 or 1.
4901 @opindex fobjc-abi-version
4902 @item -fobjc-abi-version=@var{n}
4903 Use version @var{n} of the Objective-C ABI for the selected runtime.
4904 This option is currently supported only for the NeXT runtime.  In that
4905 case, Version 0 is the traditional (32-bit) ABI without support for
4906 properties and other Objective-C 2.0 additions.  Version 1 is the
4907 traditional (32-bit) ABI with support for properties and other
4908 Objective-C 2.0 additions.  Version 2 is the modern (64-bit) ABI.  If
4909 nothing is specified, the default is Version 0 on 32-bit target
4910 machines, and Version 2 on 64-bit target machines.
4912 @opindex fobjc-call-cxx-cdtors
4913 @item -fobjc-call-cxx-cdtors
4914 For each Objective-C class, check if any of its instance variables is a
4915 C++ object with a non-trivial default constructor.  If so, synthesize a
4916 special @code{- (id) .cxx_construct} instance method which runs
4917 non-trivial default constructors on any such instance variables, in order,
4918 and then return @code{self}.  Similarly, check if any instance variable
4919 is a C++ object with a non-trivial destructor, and if so, synthesize a
4920 special @code{- (void) .cxx_destruct} method which runs
4921 all such default destructors, in reverse order.
4923 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
4924 methods thusly generated only operate on instance variables
4925 declared in the current Objective-C class, and not those inherited
4926 from superclasses.  It is the responsibility of the Objective-C
4927 runtime to invoke all such methods in an object's inheritance
4928 hierarchy.  The @code{- (id) .cxx_construct} methods are invoked
4929 by the runtime immediately after a new object instance is allocated;
4930 the @code{- (void) .cxx_destruct} methods are invoked immediately
4931 before the runtime deallocates an object instance.
4933 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
4934 support for invoking the @code{- (id) .cxx_construct} and
4935 @code{- (void) .cxx_destruct} methods.
4937 @opindex fobjc-direct-dispatch
4938 @item -fobjc-direct-dispatch
4939 Allow fast jumps to the message dispatcher.  On Darwin this is
4940 accomplished via the comm page.
4942 @opindex fobjc-exceptions
4943 @item -fobjc-exceptions
4944 Enable syntactic support for structured exception handling in
4945 Objective-C, similar to what is offered by C++.  This option
4946 is required to use the Objective-C keywords @code{@@try},
4947 @code{@@throw}, @code{@@catch}, @code{@@finally} and
4948 @code{@@synchronized}.  This option is available with both the GNU
4949 runtime and the NeXT runtime (but not available in conjunction with
4950 the NeXT runtime on Mac OS X 10.2 and earlier).
4952 @opindex fobjc-gc
4953 @item -fobjc-gc
4954 Enable garbage collection (GC) in Objective-C and Objective-C++
4955 programs.  This option is only available with the NeXT runtime; the
4956 GNU runtime has a different garbage collection implementation that
4957 does not require special compiler flags.
4959 @opindex fobjc-nilcheck
4960 @item -fobjc-nilcheck
4961 For the NeXT runtime with version 2 of the ABI, check for a nil
4962 receiver in method invocations before doing the actual method call.
4963 This is the default and can be disabled using
4964 @option{-fno-objc-nilcheck}.  Class methods and super calls are never
4965 checked for nil in this way no matter what this flag is set to.
4966 Currently this flag does nothing when the GNU runtime, or an older
4967 version of the NeXT runtime ABI, is used.
4969 @opindex fobjc-std
4970 @item -fobjc-std=objc1
4971 Conform to the language syntax of Objective-C 1.0, the language
4972 recognized by GCC 4.0.  This only affects the Objective-C additions to
4973 the C/C++ language; it does not affect conformance to C/C++ standards,
4974 which is controlled by the separate C/C++ dialect option flags.  When
4975 this option is used with the Objective-C or Objective-C++ compiler,
4976 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
4977 This is useful if you need to make sure that your Objective-C code can
4978 be compiled with older versions of GCC@.
4980 @opindex freplace-objc-classes
4981 @item -freplace-objc-classes
4982 Emit a special marker instructing @command{ld(1)} not to statically link in
4983 the resulting object file, and allow @command{dyld(1)} to load it in at
4984 run time instead.  This is used in conjunction with the Fix-and-Continue
4985 debugging mode, where the object file in question may be recompiled and
4986 dynamically reloaded in the course of program execution, without the need
4987 to restart the program itself.  Currently, Fix-and-Continue functionality
4988 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
4989 and later.
4991 @opindex fzero-link
4992 @item -fzero-link
4993 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
4994 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
4995 compile time) with static class references that get initialized at load time,
4996 which improves run-time performance.  Specifying the @option{-fzero-link} flag
4997 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
4998 to be retained.  This is useful in Zero-Link debugging mode, since it allows
4999 for individual class implementations to be modified during program execution.
5000 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
5001 regardless of command-line options.
5003 @opindex fno-local-ivars
5004 @opindex flocal-ivars
5005 @item -fno-local-ivars
5006 By default instance variables in Objective-C can be accessed as if
5007 they were local variables from within the methods of the class they're
5008 declared in.  This can lead to shadowing between instance variables
5009 and other variables declared either locally inside a class method or
5010 globally with the same name.  Specifying the @option{-fno-local-ivars}
5011 flag disables this behavior thus avoiding variable shadowing issues.
5013 @opindex fivar-visibility
5014 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
5015 Set the default instance variable visibility to the specified option
5016 so that instance variables declared outside the scope of any access
5017 modifier directives default to the specified visibility.
5019 @opindex gen-decls
5020 @item -gen-decls
5021 Dump interface declarations for all classes seen in the source file to a
5022 file named @file{@var{sourcename}.decl}.
5024 @opindex Wassign-intercept
5025 @opindex Wno-assign-intercept
5026 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
5027 Warn whenever an Objective-C assignment is being intercepted by the
5028 garbage collector.
5030 @opindex Wproperty-assign-default
5031 @opindex Wno-property-assign-default
5032 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
5033 Do not warn if a property for an Objective-C object has no assign
5034 semantics specified.
5036 @opindex Wno-protocol
5037 @opindex Wprotocol
5038 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
5039 If a class is declared to implement a protocol, a warning is issued for
5040 every method in the protocol that is not implemented by the class.  The
5041 default behavior is to issue a warning for every method not explicitly
5042 implemented in the class, even if a method implementation is inherited
5043 from the superclass.  If you use the @option{-Wno-protocol} option, then
5044 methods inherited from the superclass are considered to be implemented,
5045 and no warning is issued for them.
5047 @opindex Wobjc-root-class
5048 @item -Wobjc-root-class @r{(Objective-C and Objective-C++ only)}
5049 Warn if a class interface lacks a superclass. Most classes will inherit
5050 from @code{NSObject} (or @code{Object}) for example.  When declaring
5051 classes intended to be root classes, the warning can be suppressed by
5052 marking their interfaces with @code{__attribute__((objc_root_class))}.
5054 @opindex Wselector
5055 @opindex Wno-selector
5056 @item -Wselector @r{(Objective-C and Objective-C++ only)}
5057 Warn if multiple methods of different types for the same selector are
5058 found during compilation.  The check is performed on the list of methods
5059 in the final stage of compilation.  Additionally, a check is performed
5060 for each selector appearing in a @code{@@selector(@dots{})}
5061 expression, and a corresponding method for that selector has been found
5062 during compilation.  Because these checks scan the method table only at
5063 the end of compilation, these warnings are not produced if the final
5064 stage of compilation is not reached, for example because an error is
5065 found during compilation, or because the @option{-fsyntax-only} option is
5066 being used.
5068 @opindex Wstrict-selector-match
5069 @opindex Wno-strict-selector-match
5070 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
5071 Warn if multiple methods with differing argument and/or return types are
5072 found for a given selector when attempting to send a message using this
5073 selector to a receiver of type @code{id} or @code{Class}.  When this flag
5074 is off (which is the default behavior), the compiler omits such warnings
5075 if any differences found are confined to types that share the same size
5076 and alignment.
5078 @opindex Wundeclared-selector
5079 @opindex Wno-undeclared-selector
5080 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
5081 Warn if a @code{@@selector(@dots{})} expression referring to an
5082 undeclared selector is found.  A selector is considered undeclared if no
5083 method with that name has been declared before the
5084 @code{@@selector(@dots{})} expression, either explicitly in an
5085 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
5086 an @code{@@implementation} section.  This option always performs its
5087 checks as soon as a @code{@@selector(@dots{})} expression is found,
5088 while @option{-Wselector} only performs its checks in the final stage of
5089 compilation.  This also enforces the coding style convention
5090 that methods and selectors must be declared before being used.
5092 @opindex print-objc-runtime-info
5093 @item -print-objc-runtime-info
5094 Generate C header describing the largest structure that is passed by
5095 value, if any.
5097 @end table
5099 @node Diagnostic Message Formatting Options
5100 @section Options to Control Diagnostic Messages Formatting
5101 @cindex options to control diagnostics formatting
5102 @cindex diagnostic messages
5103 @cindex message formatting
5105 Traditionally, diagnostic messages have been formatted irrespective of
5106 the output device's aspect (e.g.@: its width, @dots{}).  You can use the
5107 options described below
5108 to control the formatting algorithm for diagnostic messages, 
5109 e.g.@: how many characters per line, how often source location
5110 information should be reported.  Note that some language front ends may not
5111 honor these options.
5113 @table @gcctabopt
5114 @opindex fmessage-length
5115 @item -fmessage-length=@var{n}
5116 Try to format error messages so that they fit on lines of about
5117 @var{n} characters.  If @var{n} is zero, then no line-wrapping is
5118 done; each error message appears on a single line.  This is the
5119 default for all front ends.
5121 Note - this option also affects the display of the @samp{#error} and
5122 @samp{#warning} pre-processor directives, and the @samp{deprecated}
5123 function/type/variable attribute.  It does not however affect the
5124 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
5126 @item -fdiagnostics-plain-output
5127 This option requests that diagnostic output look as plain as possible, which
5128 may be useful when running @command{dejagnu} or other utilities that need to
5129 parse diagnostics output and prefer that it remain more stable over time.
5130 @option{-fdiagnostics-plain-output} is currently equivalent to the following
5131 options:
5132 @gccoptlist{-fno-diagnostics-show-caret
5133 -fno-diagnostics-show-line-numbers
5134 -fdiagnostics-color=never
5135 -fdiagnostics-urls=never
5136 -fdiagnostics-path-format=separate-events
5137 -fdiagnostics-text-art-charset=none}
5138 In the future, if GCC changes the default appearance of its diagnostics, the
5139 corresponding option to disable the new behavior will be added to this list.
5141 @opindex fdiagnostics-show-location
5142 @item -fdiagnostics-show-location=once
5143 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
5144 reporter to emit source location information @emph{once}; that is, in
5145 case the message is too long to fit on a single physical line and has to
5146 be wrapped, the source location won't be emitted (as prefix) again,
5147 over and over, in subsequent continuation lines.  This is the default
5148 behavior.
5150 @item -fdiagnostics-show-location=every-line
5151 Only meaningful in line-wrapping mode.  Instructs the diagnostic
5152 messages reporter to emit the same source location information (as
5153 prefix) for physical lines that result from the process of breaking
5154 a message which is too long to fit on a single line.
5156 @opindex fdiagnostics-color
5157 @cindex highlight, color
5158 @vindex GCC_COLORS @r{environment variable}
5159 @item -fdiagnostics-color[=@var{WHEN}]
5160 @itemx -fno-diagnostics-color
5161 Use color in diagnostics.  @var{WHEN} is @samp{never}, @samp{always},
5162 or @samp{auto}.  The default depends on how the compiler has been configured,
5163 it can be any of the above @var{WHEN} options or also @samp{never}
5164 if @env{GCC_COLORS} environment variable isn't present in the environment,
5165 and @samp{auto} otherwise.
5166 @samp{auto} makes GCC use color only when the standard error is a terminal,
5167 and when not executing in an emacs shell.
5168 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
5169 aliases for @option{-fdiagnostics-color=always} and
5170 @option{-fdiagnostics-color=never}, respectively.
5172 The colors are defined by the environment variable @env{GCC_COLORS}.
5173 Its value is a colon-separated list of capabilities and Select Graphic
5174 Rendition (SGR) substrings. SGR commands are interpreted by the
5175 terminal or terminal emulator.  (See the section in the documentation
5176 of your text terminal for permitted values and their meanings as
5177 character attributes.)  These substring values are integers in decimal
5178 representation and can be concatenated with semicolons.
5179 Common values to concatenate include
5180 @samp{1} for bold,
5181 @samp{4} for underline,
5182 @samp{5} for blink,
5183 @samp{7} for inverse,
5184 @samp{39} for default foreground color,
5185 @samp{30} to @samp{37} for foreground colors,
5186 @samp{90} to @samp{97} for 16-color mode foreground colors,
5187 @samp{38;5;0} to @samp{38;5;255}
5188 for 88-color and 256-color modes foreground colors,
5189 @samp{49} for default background color,
5190 @samp{40} to @samp{47} for background colors,
5191 @samp{100} to @samp{107} for 16-color mode background colors,
5192 and @samp{48;5;0} to @samp{48;5;255}
5193 for 88-color and 256-color modes background colors.
5195 The default @env{GCC_COLORS} is
5196 @smallexample
5197 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
5198 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
5199 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
5200 type-diff=01;32:fnname=01;32:targs=35
5201 @end smallexample
5202 @noindent
5203 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
5204 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
5205 @samp{01} is bold, and @samp{31} is red.
5206 Setting @env{GCC_COLORS} to the empty string disables colors.
5207 Supported capabilities are as follows.
5209 @table @code
5210 @vindex error GCC_COLORS @r{capability}
5211 @item error=
5212 SGR substring for error: markers.
5214 @vindex warning GCC_COLORS @r{capability}
5215 @item warning=
5216 SGR substring for warning: markers.
5218 @vindex note GCC_COLORS @r{capability}
5219 @item note=
5220 SGR substring for note: markers.
5222 @vindex path GCC_COLORS @r{capability}
5223 @item path=
5224 SGR substring for colorizing paths of control-flow events as printed
5225 via @option{-fdiagnostics-path-format=}, such as the identifiers of
5226 individual events and lines indicating interprocedural calls and returns.
5228 @vindex range1 GCC_COLORS @r{capability}
5229 @item range1=
5230 SGR substring for first additional range.
5232 @vindex range2 GCC_COLORS @r{capability}
5233 @item range2=
5234 SGR substring for second additional range.
5236 @vindex locus GCC_COLORS @r{capability}
5237 @item locus=
5238 SGR substring for location information, @samp{file:line} or
5239 @samp{file:line:column} etc.
5241 @vindex quote GCC_COLORS @r{capability}
5242 @item quote=
5243 SGR substring for information printed within quotes.
5245 @vindex fnname GCC_COLORS @r{capability}
5246 @item fnname=
5247 SGR substring for names of C++ functions.
5249 @vindex targs GCC_COLORS @r{capability}
5250 @item targs=
5251 SGR substring for C++ function template parameter bindings.
5253 @vindex fixit-insert GCC_COLORS @r{capability}
5254 @item fixit-insert=
5255 SGR substring for fix-it hints suggesting text to
5256 be inserted or replaced.
5258 @vindex fixit-delete GCC_COLORS @r{capability}
5259 @item fixit-delete=
5260 SGR substring for fix-it hints suggesting text to
5261 be deleted.
5263 @vindex diff-filename GCC_COLORS @r{capability}
5264 @item diff-filename=
5265 SGR substring for filename headers within generated patches.
5267 @vindex diff-hunk GCC_COLORS @r{capability}
5268 @item diff-hunk=
5269 SGR substring for the starts of hunks within generated patches.
5271 @vindex diff-delete GCC_COLORS @r{capability}
5272 @item diff-delete=
5273 SGR substring for deleted lines within generated patches.
5275 @vindex diff-insert GCC_COLORS @r{capability}
5276 @item diff-insert=
5277 SGR substring for inserted lines within generated patches.
5279 @vindex type-diff GCC_COLORS @r{capability}
5280 @item type-diff=
5281 SGR substring for highlighting mismatching types within template
5282 arguments in the C++ frontend.
5283 @end table
5285 @opindex fdiagnostics-urls
5286 @cindex urls
5287 @vindex GCC_URLS @r{environment variable}
5288 @vindex TERM_URLS @r{environment variable}
5289 @item -fdiagnostics-urls[=@var{WHEN}]
5290 Use escape sequences to embed URLs in diagnostics.  For example, when
5291 @option{-fdiagnostics-show-option} emits text showing the command-line
5292 option controlling a diagnostic, embed a URL for documentation of that
5293 option.
5295 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
5296 @samp{auto} makes GCC use URL escape sequences only when the standard error
5297 is a terminal, and when not executing in an emacs shell or any graphical
5298 terminal which is known to be incompatible with this feature, see below.
5300 The default depends on how the compiler has been configured.
5301 It can be any of the above @var{WHEN} options.
5303 GCC can also be configured (via the
5304 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
5305 so that the default is affected by environment variables.
5306 Under such a configuration, GCC defaults to using @samp{auto}
5307 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
5308 present and non-empty in the environment of the compiler, or @samp{never}
5309 if neither are.
5311 However, even with @option{-fdiagnostics-urls=always} the behavior is
5312 dependent on those environment variables:
5313 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
5314 diagnostics.  If set to @samp{st}, URLs use ST escape sequences.
5315 If set to @samp{bel}, the default, URLs use BEL escape sequences.
5316 Any other non-empty value enables the feature.
5317 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
5318 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
5319 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
5321 At this time GCC tries to detect also a few terminals that are known to
5322 not implement the URL feature, and have bugs or at least had bugs in
5323 some versions that are still in use, where the URL escapes are likely
5324 to misbehave, i.e. print garbage on the screen.
5325 That list is currently xfce4-terminal, certain known to be buggy
5326 gnome-terminal versions, the linux console, and mingw.
5327 This check can be skipped with the @option{-fdiagnostics-urls=always}.
5329 @opindex fno-diagnostics-show-option
5330 @opindex fdiagnostics-show-option
5331 @item -fno-diagnostics-show-option
5332 By default, each diagnostic emitted includes text indicating the
5333 command-line option that directly controls the diagnostic (if such an
5334 option is known to the diagnostic machinery).  Specifying the
5335 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
5337 @opindex fno-diagnostics-show-caret
5338 @opindex fdiagnostics-show-caret
5339 @item -fno-diagnostics-show-caret
5340 By default, each diagnostic emitted includes the original source line
5341 and a caret @samp{^} indicating the column.  This option suppresses this
5342 information.  The source line is truncated to @var{n} characters, if
5343 the @option{-fmessage-length=n} option is given.  When the output is done
5344 to the terminal, the width is limited to the width given by the
5345 @env{COLUMNS} environment variable or, if not set, to the terminal width.
5347 @opindex fno-diagnostics-show-labels
5348 @opindex fdiagnostics-show-labels
5349 @item -fno-diagnostics-show-labels
5350 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5351 diagnostics can label ranges of source code with pertinent information, such
5352 as the types of expressions:
5354 @smallexample
5355     printf ("foo %s bar", long_i + long_j);
5356                  ~^       ~~~~~~~~~~~~~~~
5357                   |              |
5358                   char *         long int
5359 @end smallexample
5361 This option suppresses the printing of these labels (in the example above,
5362 the vertical bars and the ``char *'' and ``long int'' text).
5364 @opindex fno-diagnostics-show-cwe
5365 @opindex fdiagnostics-show-cwe
5366 @item -fno-diagnostics-show-cwe
5367 Diagnostic messages can optionally have an associated
5368 @uref{https://cwe.mitre.org/index.html, CWE} identifier.
5369 GCC itself only provides such metadata for some of the @option{-fanalyzer}
5370 diagnostics.  GCC plugins may also provide diagnostics with such metadata.
5371 By default, if this information is present, it will be printed with
5372 the diagnostic.  This option suppresses the printing of this metadata.
5374 @opindex fno-diagnostics-show-rules
5375 @opindex fdiagnostics-show-rules
5376 @item -fno-diagnostics-show-rules
5377 Diagnostic messages can optionally have rules associated with them, such
5378 as from a coding standard, or a specification.
5379 GCC itself does not do this for any of its diagnostics, but plugins may do so.
5380 By default, if this information is present, it will be printed with
5381 the diagnostic.  This option suppresses the printing of this metadata.
5383 @opindex fno-diagnostics-show-line-numbers
5384 @opindex fdiagnostics-show-line-numbers
5385 @item -fno-diagnostics-show-line-numbers
5386 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5387 a left margin is printed, showing line numbers.  This option suppresses this
5388 left margin.
5390 @opindex fdiagnostics-minimum-margin-width
5391 @item -fdiagnostics-minimum-margin-width=@var{width}
5392 This option controls the minimum width of the left margin printed by
5393 @option{-fdiagnostics-show-line-numbers}.  It defaults to 6.
5395 @opindex fdiagnostics-parseable-fixits
5396 @item -fdiagnostics-parseable-fixits
5397 Emit fix-it hints in a machine-parseable format, suitable for consumption
5398 by IDEs.  For each fix-it, a line will be printed after the relevant
5399 diagnostic, starting with the string ``fix-it:''.  For example:
5401 @smallexample
5402 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
5403 @end smallexample
5405 The location is expressed as a half-open range, expressed as a count of
5406 bytes, starting at byte 1 for the initial column.  In the above example,
5407 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
5408 given string:
5410 @smallexample
5411 00000000011111111112222222222
5412 12345678901234567890123456789
5413   gtk_widget_showall (dlg);
5414   ^^^^^^^^^^^^^^^^^^
5415   gtk_widget_show_all
5416 @end smallexample
5418 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
5419 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
5420 (e.g. vertical tab as ``\013'').
5422 An empty replacement string indicates that the given range is to be removed.
5423 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
5424 be inserted at the given position.
5426 @opindex fdiagnostics-generate-patch
5427 @item -fdiagnostics-generate-patch
5428 Print fix-it hints to stderr in unified diff format, after any diagnostics
5429 are printed.  For example:
5431 @smallexample
5432 --- test.c
5433 +++ test.c
5434 @@ -42,5 +42,5 @@
5436  void show_cb(GtkDialog *dlg)
5437  @{
5438 -  gtk_widget_showall(dlg);
5439 +  gtk_widget_show_all(dlg);
5440  @}
5442 @end smallexample
5444 The diff may or may not be colorized, following the same rules
5445 as for diagnostics (see @option{-fdiagnostics-color}).
5447 @opindex fdiagnostics-show-template-tree
5448 @item -fdiagnostics-show-template-tree
5450 In the C++ frontend, when printing diagnostics showing mismatching
5451 template types, such as:
5453 @smallexample
5454   could not convert 'std::map<int, std::vector<double> >()'
5455     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5456 @end smallexample
5458 the @option{-fdiagnostics-show-template-tree} flag enables printing a
5459 tree-like structure showing the common and differing parts of the types,
5460 such as:
5462 @smallexample
5463   map<
5464     [...],
5465     vector<
5466       [double != float]>>
5467 @end smallexample
5469 The parts that differ are highlighted with color (``double'' and
5470 ``float'' in this case).
5472 @opindex fno-elide-type
5473 @opindex felide-type
5474 @item -fno-elide-type
5475 By default when the C++ frontend prints diagnostics showing mismatching
5476 template types, common parts of the types are printed as ``[...]'' to
5477 simplify the error message.  For example:
5479 @smallexample
5480   could not convert 'std::map<int, std::vector<double> >()'
5481     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5482 @end smallexample
5484 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
5485 This flag also affects the output of the
5486 @option{-fdiagnostics-show-template-tree} flag.
5488 @opindex fdiagnostics-path-format
5489 @item -fdiagnostics-path-format=@var{KIND}
5490 Specify how to print paths of control-flow events for diagnostics that
5491 have such a path associated with them.
5493 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
5494 the default.
5496 @samp{none} means to not print diagnostic paths.
5498 @samp{separate-events} means to print a separate ``note'' diagnostic for
5499 each event within the diagnostic.  For example:
5501 @smallexample
5502 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
5503 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
5504 test.c:27:3: note: (2) when 'i < count'
5505 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5506 @end smallexample
5508 @samp{inline-events} means to print the events ``inline'' within the source
5509 code.  This view attempts to consolidate the events into runs of
5510 sufficiently-close events, printing them as labelled ranges within the source.
5512 For example, the same events as above might be printed as:
5514 @smallexample
5515   'test': events 1-3
5516     |
5517     |   25 |   list = PyList_New(0);
5518     |      |          ^~~~~~~~~~~~~
5519     |      |          |
5520     |      |          (1) when 'PyList_New' fails, returning NULL
5521     |   26 |
5522     |   27 |   for (i = 0; i < count; i++) @{
5523     |      |   ~~~
5524     |      |   |
5525     |      |   (2) when 'i < count'
5526     |   28 |     item = PyLong_FromLong(random());
5527     |   29 |     PyList_Append(list, item);
5528     |      |     ~~~~~~~~~~~~~~~~~~~~~~~~~
5529     |      |     |
5530     |      |     (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5531     |
5532 @end smallexample
5534 Interprocedural control flow is shown by grouping the events by stack frame,
5535 and using indentation to show how stack frames are nested, pushed, and popped.
5537 For example:
5539 @smallexample
5540   'test': events 1-2
5541     |
5542     |  133 | @{
5543     |      | ^
5544     |      | |
5545     |      | (1) entering 'test'
5546     |  134 |   boxed_int *obj = make_boxed_int (i);
5547     |      |                    ~~~~~~~~~~~~~~~~~~
5548     |      |                    |
5549     |      |                    (2) calling 'make_boxed_int'
5550     |
5551     +--> 'make_boxed_int': events 3-4
5552            |
5553            |  120 | @{
5554            |      | ^
5555            |      | |
5556            |      | (3) entering 'make_boxed_int'
5557            |  121 |   boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
5558            |      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5559            |      |                                    |
5560            |      |                                    (4) calling 'wrapped_malloc'
5561            |
5562            +--> 'wrapped_malloc': events 5-6
5563                   |
5564                   |    7 | @{
5565                   |      | ^
5566                   |      | |
5567                   |      | (5) entering 'wrapped_malloc'
5568                   |    8 |   return malloc (size);
5569                   |      |          ~~~~~~~~~~~~~
5570                   |      |          |
5571                   |      |          (6) calling 'malloc'
5572                   |
5573     <-------------+
5574     |
5575  'test': event 7
5576     |
5577     |  138 |   free_boxed_int (obj);
5578     |      |   ^~~~~~~~~~~~~~~~~~~~
5579     |      |   |
5580     |      |   (7) calling 'free_boxed_int'
5581     |
5582 (etc)
5583 @end smallexample
5585 @opindex fdiagnostics-show-path-depths
5586 @item -fdiagnostics-show-path-depths
5587 This option provides additional information when printing control-flow paths
5588 associated with a diagnostic.
5590 If this is option is provided then the stack depth will be printed for
5591 each run of events within @option{-fdiagnostics-path-format=inline-events}.
5592 If provided with @option{-fdiagnostics-path-format=separate-events}, then
5593 the stack depth and function declaration will be appended when printing
5594 each event.
5596 This is intended for use by GCC developers and plugin developers when
5597 debugging diagnostics that report interprocedural control flow.
5599 @opindex fno-show-column
5600 @opindex fshow-column
5601 @item -fno-show-column
5602 Do not print column numbers in diagnostics.  This may be necessary if
5603 diagnostics are being scanned by a program that does not understand the
5604 column numbers, such as @command{dejagnu}.
5606 @opindex fdiagnostics-column-unit
5607 @item -fdiagnostics-column-unit=@var{UNIT}
5608 Select the units for the column number.  This affects traditional diagnostics
5609 (in the absence of @option{-fno-show-column}), as well as JSON format
5610 diagnostics if requested.
5612 The default @var{UNIT}, @samp{display}, considers the number of display
5613 columns occupied by each character.  This may be larger than the number
5614 of bytes required to encode the character, in the case of tab
5615 characters, or it may be smaller, in the case of multibyte characters.
5616 For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one
5617 display column, and its UTF-8 encoding requires two bytes; the character
5618 ``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and
5619 its UTF-8 encoding requires four bytes.
5621 Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte
5622 count in all cases, as was traditionally output by GCC prior to version 11.1.0.
5624 @opindex fdiagnostics-column-origin
5625 @item -fdiagnostics-column-origin=@var{ORIGIN}
5626 Select the origin for column numbers, i.e. the column number assigned to the
5627 first column.  The default value of 1 corresponds to traditional GCC
5628 behavior and to the GNU style guide.  Some utilities may perform better with an
5629 origin of 0; any non-negative value may be specified.
5631 @opindex fdiagnostics-escape-format
5632 @item -fdiagnostics-escape-format=@var{FORMAT}
5633 When GCC prints pertinent source lines for a diagnostic it normally attempts
5634 to print the source bytes directly.  However, some diagnostics relate to encoding
5635 issues in the source file, such as malformed UTF-8, or issues with Unicode
5636 normalization.  These diagnostics are flagged so that GCC will escape bytes
5637 that are not printable ASCII when printing their pertinent source lines.
5639 This option controls how such bytes should be escaped.
5641 The default @var{FORMAT}, @samp{unicode} displays Unicode characters that
5642 are not printable ASCII in the form @samp{<U+XXXX>}, and bytes that do not
5643 correspond to a Unicode character validly-encoded in UTF-8-encoded will be
5644 displayed as hexadecimal in the form @samp{<XX>}.
5646 For example, a source line containing the string @samp{before} followed by the
5647 Unicode character U+03C0 (``GREEK SMALL LETTER PI'', with UTF-8 encoding
5648 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by
5649 the string @samp{after} will be printed for such a diagnostic as:
5651 @smallexample
5652  before<U+03C0><BF>after
5653 @end smallexample
5655 Setting @var{FORMAT} to @samp{bytes} will display all non-printable-ASCII bytes
5656 in the form @samp{<XX>}, thus showing the underlying encoding of non-ASCII
5657 Unicode characters.  For the example above, the following will be printed:
5659 @smallexample
5660  before<CF><80><BF>after
5661 @end smallexample
5663 @opindex fdiagnostics-text-art-charset
5664 @item -fdiagnostics-text-art-charset=@var{CHARSET}
5665 Some diagnostics can contain ``text art'' diagrams: visualizations created
5666 from text, intended to be viewed in a monospaced font.
5668 This option selects which characters should be used for printing such
5669 diagrams, if any.  @var{CHARSET} is @samp{none}, @samp{ascii}, @samp{unicode},
5670 or @samp{emoji}.
5672 The @samp{none} value suppresses the printing of such diagrams.
5673 The @samp{ascii} value will ensure that such diagrams are pure ASCII
5674 (``ASCII art'').  The @samp{unicode} value will allow for conservative use of
5675 unicode drawing characters (such as box-drawing characters).  The @samp{emoji}
5676 value further adds the possibility of emoji in the output (such as emitting
5677 U+26A0 WARNING SIGN followed by U+FE0F VARIATION SELECTOR-16 to select the
5678 emoji variant of the character).
5680 The default is @samp{emoji}.
5682 @opindex fdiagnostics-format
5683 @item -fdiagnostics-format=@var{FORMAT}
5684 Select a different format for printing diagnostics.
5685 @var{FORMAT} is @samp{text}, @samp{sarif-stderr}, @samp{sarif-file},
5686 @samp{json}, @samp{json-stderr}, or @samp{json-file}.
5688 The default is @samp{text}.
5690 The @samp{sarif-stderr} and @samp{sarif-file} formats both emit
5691 diagnostics in SARIF Version 2.1.0 format, either to stderr, or to a file
5692 named @file{@var{source}.sarif}, respectively.
5694 The @samp{json} format is a synonym for @samp{json-stderr}.
5695 The @samp{json-stderr} and @samp{json-file} formats are identical, apart from
5696 where the JSON is emitted to - with the former, the JSON is emitted to stderr,
5697 whereas with @samp{json-file} it is written to @file{@var{source}.gcc.json}.
5699 The emitted JSON consists of a top-level JSON array containing JSON objects
5700 representing the diagnostics.  The JSON is emitted as one line, without
5701 formatting; the examples below have been formatted for clarity.
5703 Diagnostics can have child diagnostics.  For example, this error and note:
5705 @smallexample
5706 misleading-indentation.c:15:3: warning: this 'if' clause does not
5707   guard... [-Wmisleading-indentation]
5708    15 |   if (flag)
5709       |   ^~
5710 misleading-indentation.c:17:5: note: ...this statement, but the latter
5711   is misleadingly indented as if it were guarded by the 'if'
5712    17 |     y = 2;
5713       |     ^
5714 @end smallexample
5716 @noindent
5717 might be printed in JSON form (after formatting) like this:
5719 @smallexample
5721     @{
5722         "kind": "warning",
5723         "locations": [
5724             @{
5725                 "caret": @{
5726                     "display-column": 3,
5727                     "byte-column": 3,
5728                     "column": 3,
5729                     "file": "misleading-indentation.c",
5730                     "line": 15
5731                 @},
5732                 "finish": @{
5733                     "display-column": 4,
5734                     "byte-column": 4,
5735                     "column": 4,
5736                     "file": "misleading-indentation.c",
5737                     "line": 15
5738                 @}
5739             @}
5740         ],
5741         "message": "this \u2018if\u2019 clause does not guard...",
5742         "option": "-Wmisleading-indentation",
5743         "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
5744         "children": [
5745             @{
5746                 "kind": "note",
5747                 "locations": [
5748                     @{
5749                         "caret": @{
5750                             "display-column": 5,
5751                             "byte-column": 5,
5752                             "column": 5,
5753                             "file": "misleading-indentation.c",
5754                             "line": 17
5755                         @}
5756                     @}
5757                 ],
5758                 "escape-source": false,
5759                 "message": "...this statement, but the latter is @dots{}"
5760             @}
5761         ]
5762         "escape-source": false,
5763         "column-origin": 1,
5764     @}
5766 @end smallexample
5768 @noindent
5769 where the @code{note} is a child of the @code{warning}.
5771 A diagnostic has a @code{kind}.  If this is @code{warning}, then there is
5772 an @code{option} key describing the command-line option controlling the
5773 warning.
5775 A diagnostic can contain zero or more locations.  Each location has an
5776 optional @code{label} string and up to three positions within it: a
5777 @code{caret} position and optional @code{start} and @code{finish} positions.
5778 A position is described by a @code{file} name, a @code{line} number, and
5779 three numbers indicating a column position:
5780 @itemize @bullet
5782 @item
5783 @code{display-column} counts display columns, accounting for tabs and
5784 multibyte characters.
5786 @item
5787 @code{byte-column} counts raw bytes.
5789 @item
5790 @code{column} is equal to one of
5791 the previous two, as dictated by the @option{-fdiagnostics-column-unit}
5792 option.
5794 @end itemize
5795 All three columns are relative to the origin specified by
5796 @option{-fdiagnostics-column-origin}, which is typically equal to 1 but may
5797 be set, for instance, to 0 for compatibility with other utilities that
5798 number columns from 0.  The column origin is recorded in the JSON output in
5799 the @code{column-origin} tag.  In the remaining examples below, the extra
5800 column number outputs have been omitted for brevity.
5802 For example, this error:
5804 @smallexample
5805 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
5806    'struct s'@} and 'T' @{aka 'struct t'@})
5807    64 |   return callee_4a () + callee_4b ();
5808       |          ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
5809       |          |              |
5810       |          |              T @{aka struct t@}
5811       |          S @{aka struct s@}
5812 @end smallexample
5814 @noindent
5815 has three locations.  Its primary location is at the ``+'' token at column
5816 23.  It has two secondary locations, describing the left and right-hand sides
5817 of the expression, which have labels.  It might be printed in JSON form as:
5819 @smallexample
5820     @{
5821         "children": [],
5822         "kind": "error",
5823         "locations": [
5824             @{
5825                 "caret": @{
5826                     "column": 23, "file": "bad-binary-ops.c", "line": 64
5827                 @}
5828             @},
5829             @{
5830                 "caret": @{
5831                     "column": 10, "file": "bad-binary-ops.c", "line": 64
5832                 @},
5833                 "finish": @{
5834                     "column": 21, "file": "bad-binary-ops.c", "line": 64
5835                 @},
5836                 "label": "S @{aka struct s@}"
5837             @},
5838             @{
5839                 "caret": @{
5840                     "column": 25, "file": "bad-binary-ops.c", "line": 64
5841                 @},
5842                 "finish": @{
5843                     "column": 36, "file": "bad-binary-ops.c", "line": 64
5844                 @},
5845                 "label": "T @{aka struct t@}"
5846             @}
5847         ],
5848         "escape-source": false,
5849         "message": "invalid operands to binary + @dots{}"
5850     @}
5851 @end smallexample
5853 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
5854 consisting of half-open intervals, similar to the output of
5855 @option{-fdiagnostics-parseable-fixits}.  For example, this diagnostic
5856 with a replacement fix-it hint:
5858 @smallexample
5859 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
5860   mean 'color'?
5861     8 |   return ptr->colour;
5862       |               ^~~~~~
5863       |               color
5864 @end smallexample
5866 @noindent
5867 might be printed in JSON form as:
5869 @smallexample
5870     @{
5871         "children": [],
5872         "fixits": [
5873             @{
5874                 "next": @{
5875                     "column": 21,
5876                     "file": "demo.c",
5877                     "line": 8
5878                 @},
5879                 "start": @{
5880                     "column": 15,
5881                     "file": "demo.c",
5882                     "line": 8
5883                 @},
5884                 "string": "color"
5885             @}
5886         ],
5887         "kind": "error",
5888         "locations": [
5889             @{
5890                 "caret": @{
5891                     "column": 15,
5892                     "file": "demo.c",
5893                     "line": 8
5894                 @},
5895                 "finish": @{
5896                     "column": 20,
5897                     "file": "demo.c",
5898                     "line": 8
5899                 @}
5900             @}
5901         ],
5902         "escape-source": false,
5903         "message": "\u2018struct s\u2019 has no member named @dots{}"
5904     @}
5905 @end smallexample
5907 @noindent
5908 where the fix-it hint suggests replacing the text from @code{start} up
5909 to but not including @code{next} with @code{string}'s value.  Deletions
5910 are expressed via an empty value for @code{string}, insertions by
5911 having @code{start} equal @code{next}.
5913 If the diagnostic has a path of control-flow events associated with it,
5914 it has a @code{path} array of objects representing the events.  Each
5915 event object has a @code{description} string, a @code{location} object,
5916 along with a @code{function} string and a @code{depth} number for
5917 representing interprocedural paths.  The @code{function} represents the
5918 current function at that event, and the @code{depth} represents the
5919 stack depth relative to some baseline: the higher, the more frames are
5920 within the stack.
5922 For example, the intraprocedural example shown for
5923 @option{-fdiagnostics-path-format=} might have this JSON for its path:
5925 @smallexample
5926     "path": [
5927         @{
5928             "depth": 0,
5929             "description": "when 'PyList_New' fails, returning NULL",
5930             "function": "test",
5931             "location": @{
5932                 "column": 10,
5933                 "file": "test.c",
5934                 "line": 25
5935             @}
5936         @},
5937         @{
5938             "depth": 0,
5939             "description": "when 'i < count'",
5940             "function": "test",
5941             "location": @{
5942                 "column": 3,
5943                 "file": "test.c",
5944                 "line": 27
5945             @}
5946         @},
5947         @{
5948             "depth": 0,
5949             "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
5950             "function": "test",
5951             "location": @{
5952                 "column": 5,
5953                 "file": "test.c",
5954                 "line": 29
5955             @}
5956         @}
5957     ]
5958 @end smallexample
5960 Diagnostics have a boolean attribute @code{escape-source}, hinting whether
5961 non-ASCII bytes should be escaped when printing the pertinent lines of
5962 source code (@code{true} for diagnostics involving source encoding issues).
5964 @end table
5966 @node Warning Options
5967 @section Options to Request or Suppress Warnings
5968 @cindex options to control warnings
5969 @cindex warning messages
5970 @cindex messages, warning
5971 @cindex suppressing warnings
5973 Warnings are diagnostic messages that report constructions that
5974 are not inherently erroneous but that are risky or suggest there
5975 may have been an error.
5977 The following language-independent options do not enable specific
5978 warnings but control the kinds of diagnostics produced by GCC@.
5980 @table @gcctabopt
5981 @cindex syntax checking
5982 @opindex fsyntax-only
5983 @item -fsyntax-only
5984 Check the code for syntax errors, but don't do anything beyond that.
5986 @opindex fmax-errors
5987 @item -fmax-errors=@var{n}
5988 Limits the maximum number of error messages to @var{n}, at which point
5989 GCC bails out rather than attempting to continue processing the source
5990 code.  If @var{n} is 0 (the default), there is no limit on the number
5991 of error messages produced.  If @option{-Wfatal-errors} is also
5992 specified, then @option{-Wfatal-errors} takes precedence over this
5993 option.
5995 @opindex w
5996 @item -w
5997 Inhibit all warning messages.
5999 @opindex Werror
6000 @opindex Wno-error
6001 @item -Werror
6002 Make all warnings into errors.
6004 @opindex Werror=
6005 @opindex Wno-error=
6006 @item -Werror=
6007 Make the specified warning into an error.  The specifier for a warning
6008 is appended; for example @option{-Werror=switch} turns the warnings
6009 controlled by @option{-Wswitch} into errors.  This switch takes a
6010 negative form, to be used to negate @option{-Werror} for specific
6011 warnings; for example @option{-Wno-error=switch} makes
6012 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
6013 is in effect.
6015 The warning message for each controllable warning includes the
6016 option that controls the warning.  That option can then be used with
6017 @option{-Werror=} and @option{-Wno-error=} as described above.
6018 (Printing of the option in the warning message can be disabled using the
6019 @option{-fno-diagnostics-show-option} flag.)
6021 Note that specifying @option{-Werror=}@var{foo} automatically implies
6022 @option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
6023 imply anything.
6025 @opindex Wfatal-errors
6026 @opindex Wno-fatal-errors
6027 @item -Wfatal-errors
6028 This option causes the compiler to abort compilation on the first error
6029 occurred rather than trying to keep going and printing further error
6030 messages.
6032 @end table
6034 You can request many specific warnings with options beginning with
6035 @samp{-W}, for example @option{-Wimplicit} to request warnings on
6036 implicit declarations.  Each of these specific warning options also
6037 has a negative form beginning @samp{-Wno-} to turn off warnings; for
6038 example, @option{-Wno-implicit}.  This manual lists only one of the
6039 two forms, whichever is not the default.  For further
6040 language-specific options also refer to @ref{C++ Dialect Options} and
6041 @ref{Objective-C and Objective-C++ Dialect Options}.
6042 Additional warnings can be produced by enabling the static analyzer;
6043 @xref{Static Analyzer Options}.
6045 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
6046 options, such as @option{-Wunused}, which may turn on further options,
6047 such as @option{-Wunused-value}. The combined effect of positive and
6048 negative forms is that more specific options have priority over less
6049 specific ones, independently of their position in the command-line. For
6050 options of the same specificity, the last one takes effect. Options
6051 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
6052 as if they appeared at the end of the command-line.
6054 When an unrecognized warning option is requested (e.g.,
6055 @option{-Wunknown-warning}), GCC emits a diagnostic stating
6056 that the option is not recognized.  However, if the @option{-Wno-} form
6057 is used, the behavior is slightly different: no diagnostic is
6058 produced for @option{-Wno-unknown-warning} unless other diagnostics
6059 are being produced.  This allows the use of new @option{-Wno-} options
6060 with old compilers, but if something goes wrong, the compiler
6061 warns that an unrecognized option is present.
6063 The effectiveness of some warnings depends on optimizations also being
6064 enabled. For example @option{-Wsuggest-final-types} is more effective
6065 with link-time optimization and some instances of other warnings may
6066 not be issued at all unless optimization is enabled.  While optimization
6067 in general improves the efficacy of control and data flow sensitive
6068 warnings, in some cases it may also cause false positives.
6070 @table @gcctabopt
6071 @opindex pedantic
6072 @opindex Wpedantic
6073 @opindex Wno-pedantic
6074 @item -Wpedantic
6075 @itemx -pedantic
6076 Issue all the warnings demanded by strict ISO C and ISO C++;
6077 diagnose all programs that use forbidden extensions, and some other
6078 programs that do not follow ISO C and ISO C++.  This follows the version
6079 of the ISO C or C++ standard specified by any @option{-std} option used.
6081 Valid ISO C and ISO C++ programs should compile properly with or without
6082 this option (though a rare few require @option{-ansi} or a
6083 @option{-std} option specifying the version of the standard)@.  However,
6084 without this option, certain GNU extensions and traditional C and C++
6085 features are supported as well.  With this option, they are diagnosed
6086 (or rejected with @option{-pedantic-errors}).
6088 @option{-Wpedantic} does not cause warning messages for use of the
6089 alternate keywords whose names begin and end with @samp{__}.  This alternate
6090 format can also be used to disable warnings for non-ISO @samp{__intN} types,
6091 i.e. @samp{__intN__}.
6092 Pedantic warnings are also disabled in the expression that follows
6093 @code{__extension__}.  However, only system header files should use
6094 these escape routes; application programs should avoid them.
6095 @xref{Alternate Keywords}.
6097 Some warnings about non-conforming programs are controlled by options
6098 other than @option{-Wpedantic}; in many cases they are implied by
6099 @option{-Wpedantic} but can be disabled separately by their specific
6100 option, e.g. @option{-Wpedantic -Wno-pointer-sign}.
6102 Where the standard specified with @option{-std} represents a GNU
6103 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
6104 corresponding @dfn{base standard}, the version of ISO C on which the GNU
6105 extended dialect is based.  Warnings from @option{-Wpedantic} are given
6106 where they are required by the base standard.  (It does not make sense
6107 for such warnings to be given only for features not in the specified GNU
6108 C dialect, since by definition the GNU dialects of C include all
6109 features the compiler supports with the given option, and there would be
6110 nothing to warn about.)
6112 @opindex pedantic-errors
6113 @item -pedantic-errors
6114 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
6115 requires a diagnostic, in some cases where there is undefined behavior
6116 at compile-time and in some other cases that do not prevent compilation
6117 of programs that are valid according to the standard. This is not
6118 equivalent to @option{-Werror=pedantic}: the latter option is unlikely to be
6119 useful, as it only makes errors of the diagnostics that are controlled by
6120 @option{-Wpedantic}, whereas this option also affects required diagnostics that
6121 are always enabled or controlled by options other than @option{-Wpedantic}.
6123 If you want the required diagnostics that are warnings by default to
6124 be errors instead, but don't also want to enable the @option{-Wpedantic}
6125 diagnostics, you can specify @option{-pedantic-errors -Wno-pedantic}
6126 (or @option{-pedantic-errors -Wno-error=pedantic} to enable them but
6127 only as warnings).
6129 Some required diagnostics are errors by default, but can be reduced to
6130 warnings using @option{-fpermissive} or their specific warning option,
6131 e.g. @option{-Wno-error=narrowing}.
6133 Some diagnostics for non-ISO practices are controlled by specific
6134 warning options other than @option{-Wpedantic}, but are also made
6135 errors by @option{-pedantic-errors}.  For instance:
6137 @gccoptlist{
6138 -Wattributes @r{(for standard attributes)}
6139 -Wchanges-meaning @r{(C++)}
6140 -Wcomma-subscript @r{(C++23 or later)}
6141 -Wdeclaration-after-statement @r{(C90 or earlier)}
6142 -Welaborated-enum-base @r{(C++11 or later)}
6143 -Wimplicit-int @r{(C99 or later)}
6144 -Wimplicit-function-declaration @r{(C99 or later)}
6145 -Wincompatible-pointer-types
6146 -Wint-conversion
6147 -Wlong-long @r{(C90 or earlier)}
6148 -Wmain
6149 -Wnarrowing @r{(C++11 or later)}
6150 -Wpointer-arith
6151 -Wpointer-sign
6152 -Wincompatible-pointer-types
6153 -Wregister @r{(C++17 or later)}
6154 -Wvla @r{(C90 or earlier)}
6155 -Wwrite-strings @r{(C++11 or later)}
6158 @opindex Wall
6159 @opindex Wno-all
6160 @item -Wall
6161 This enables all the warnings about constructions that some users
6162 consider questionable, and that are easy to avoid (or modify to
6163 prevent the warning), even in conjunction with macros.  This also
6164 enables some language-specific warnings described in @ref{C++ Dialect
6165 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
6167 @option{-Wall} turns on the following warning flags:
6169 @gccoptlist{-Waddress
6170 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)}
6171 -Warray-compare
6172 -Warray-parameter=2 @r{(C and Objective-C only)}
6173 -Wbool-compare
6174 -Wbool-operation
6175 -Wc++11-compat  -Wc++14-compat
6176 -Wcatch-value @r{(C++ and Objective-C++ only)}
6177 -Wchar-subscripts
6178 -Wcomment
6179 -Wdangling-pointer=2
6180 -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6181 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)}
6182 -Wenum-int-mismatch @r{(C and Objective-C only)}
6183 -Wformat
6184 -Wformat-overflow
6185 -Wformat-truncation
6186 -Wint-in-bool-context
6187 -Wimplicit @r{(C and Objective-C only)}
6188 -Wimplicit-int @r{(C and Objective-C only)}
6189 -Wimplicit-function-declaration @r{(C and Objective-C only)}
6190 -Winit-self @r{(only for C++)}
6191 -Wlogical-not-parentheses
6192 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}
6193 -Wmaybe-uninitialized
6194 -Wmemset-elt-size
6195 -Wmemset-transposed-args
6196 -Wmisleading-indentation @r{(only for C/C++)}
6197 -Wmismatched-dealloc
6198 -Wmismatched-new-delete @r{(only for C/C++)}
6199 -Wmissing-attributes
6200 -Wmissing-braces @r{(only for C/ObjC)}
6201 -Wmultistatement-macros
6202 -Wnarrowing @r{(only for C++)}
6203 -Wnonnull
6204 -Wnonnull-compare
6205 -Wopenmp-simd
6206 -Wparentheses
6207 -Wpessimizing-move @r{(only for C++)}
6208 -Wpointer-sign
6209 -Wrange-loop-construct @r{(only for C++)}
6210 -Wreorder
6211 -Wrestrict
6212 -Wreturn-type
6213 -Wself-move @r{(only for C++)}
6214 -Wsequence-point
6215 -Wsign-compare @r{(only in C++)}
6216 -Wsizeof-array-div
6217 -Wsizeof-pointer-div
6218 -Wsizeof-pointer-memaccess
6219 -Wstrict-aliasing
6220 -Wstrict-overflow=1
6221 -Wswitch
6222 -Wtautological-compare
6223 -Wtrigraphs
6224 -Wuninitialized
6225 -Wunknown-pragmas
6226 -Wunused-function
6227 -Wunused-label
6228 -Wunused-value
6229 -Wunused-variable
6230 -Wuse-after-free=2
6231 -Wvla-parameter @r{(C and Objective-C only)}
6232 -Wvolatile-register-var
6233 -Wzero-length-bounds}
6235 Note that some warning flags are not implied by @option{-Wall}.  Some of
6236 them warn about constructions that users generally do not consider
6237 questionable, but which occasionally you might wish to check for;
6238 others warn about constructions that are necessary or hard to avoid in
6239 some cases, and there is no simple way to modify the code to suppress
6240 the warning. Some of them are enabled by @option{-Wextra} but many of
6241 them must be enabled individually.
6243 @opindex W
6244 @opindex Wextra
6245 @opindex Wno-extra
6246 @item -Wextra
6247 This enables some extra warning flags that are not enabled by
6248 @option{-Wall}. (This option used to be called @option{-W}.  The older
6249 name is still supported, but the newer name is more descriptive.)
6251 @gccoptlist{-Wclobbered
6252 -Wcast-function-type
6253 -Wdeprecated-copy @r{(C++ only)}
6254 -Wempty-body
6255 -Wenum-conversion @r{(C only)}
6256 -Wignored-qualifiers
6257 -Wimplicit-fallthrough=3
6258 -Wmissing-field-initializers
6259 -Wmissing-parameter-type @r{(C only)}
6260 -Wold-style-declaration @r{(C only)}
6261 -Woverride-init
6262 -Wsign-compare @r{(C only)}
6263 -Wstring-compare
6264 -Wredundant-move @r{(only for C++)}
6265 -Wtype-limits
6266 -Wuninitialized
6267 -Wshift-negative-value @r{(in C++11 to C++17 and in C99 and newer)}
6268 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}
6269 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
6272 The option @option{-Wextra} also prints warning messages for the
6273 following cases:
6275 @itemize @bullet
6277 @item
6278 A pointer is compared against integer zero with @code{<}, @code{<=},
6279 @code{>}, or @code{>=}.
6281 @item
6282 (C++ only) An enumerator and a non-enumerator both appear in a
6283 conditional expression.
6285 @item
6286 (C++ only) Ambiguous virtual bases.
6288 @item
6289 (C++ only) Subscripting an array that has been declared @code{register}.
6291 @item
6292 (C++ only) Taking the address of a variable that has been declared
6293 @code{register}.
6295 @item
6296 (C++ only) A base class is not initialized in the copy constructor
6297 of a derived class.
6299 @end itemize
6301 @opindex Wabi
6302 @opindex Wno-abi
6303 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
6305 Warn about code affected by ABI changes.  This includes code that may
6306 not be compatible with the vendor-neutral C++ ABI as well as the psABI
6307 for the particular target.
6309 Since G++ now defaults to updating the ABI with each major release,
6310 normally @option{-Wabi} warns only about C++ ABI compatibility
6311 problems if there is a check added later in a release series for an
6312 ABI issue discovered since the initial release.  @option{-Wabi} warns
6313 about more things if an older ABI version is selected (with
6314 @option{-fabi-version=@var{n}}).
6316 @option{-Wabi} can also be used with an explicit version number to
6317 warn about C++ ABI compatibility with a particular @option{-fabi-version}
6318 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
6319 @option{-fabi-version=2}.
6321 If an explicit version number is provided and
6322 @option{-fabi-compat-version} is not specified, the version number
6323 from this option is used for compatibility aliases.  If no explicit
6324 version number is provided with this option, but
6325 @option{-fabi-compat-version} is specified, that version number is
6326 used for C++ ABI warnings.
6328 Although an effort has been made to warn about
6329 all such cases, there are probably some cases that are not warned about,
6330 even though G++ is generating incompatible code.  There may also be
6331 cases where warnings are emitted even though the code that is generated
6332 is compatible.
6334 You should rewrite your code to avoid these warnings if you are
6335 concerned about the fact that code generated by G++ may not be binary
6336 compatible with code generated by other compilers.
6338 Known incompatibilities in @option{-fabi-version=2} (which was the
6339 default from GCC 3.4 to 4.9) include:
6341 @itemize @bullet
6343 @item
6344 A template with a non-type template parameter of reference type was
6345 mangled incorrectly:
6346 @smallexample
6347 extern int N;
6348 template <int &> struct S @{@};
6349 void n (S<N>) @{2@}
6350 @end smallexample
6352 This was fixed in @option{-fabi-version=3}.
6354 @item
6355 SIMD vector types declared using @code{__attribute ((vector_size))} were
6356 mangled in a non-standard way that does not allow for overloading of
6357 functions taking vectors of different sizes.
6359 The mangling was changed in @option{-fabi-version=4}.
6361 @item
6362 @code{__attribute ((const))} and @code{noreturn} were mangled as type
6363 qualifiers, and @code{decltype} of a plain declaration was folded away.
6365 These mangling issues were fixed in @option{-fabi-version=5}.
6367 @item
6368 Scoped enumerators passed as arguments to a variadic function are
6369 promoted like unscoped enumerators, causing @code{va_arg} to complain.
6370 On most targets this does not actually affect the parameter passing
6371 ABI, as there is no way to pass an argument smaller than @code{int}.
6373 Also, the ABI changed the mangling of template argument packs,
6374 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
6375 a class scope function used as a template argument.
6377 These issues were corrected in @option{-fabi-version=6}.
6379 @item
6380 Lambdas in default argument scope were mangled incorrectly, and the
6381 ABI changed the mangling of @code{nullptr_t}.
6383 These issues were corrected in @option{-fabi-version=7}.
6385 @item
6386 When mangling a function type with function-cv-qualifiers, the
6387 un-qualified function type was incorrectly treated as a substitution
6388 candidate.
6390 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
6392 @item
6393 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
6394 unaligned accesses.  Note that this did not affect the ABI of a
6395 function with a @code{nullptr_t} parameter, as parameters have a
6396 minimum alignment.
6398 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
6400 @item
6401 Target-specific attributes that affect the identity of a type, such as
6402 ia32 calling conventions on a function type (stdcall, regparm, etc.),
6403 did not affect the mangled name, leading to name collisions when
6404 function pointers were used as template arguments.
6406 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
6408 @end itemize
6410 This option also enables warnings about psABI-related changes.
6411 The known psABI changes at this point include:
6413 @itemize @bullet
6415 @item
6416 For SysV/x86-64, unions with @code{long double} members are
6417 passed in memory as specified in psABI.  Prior to GCC 4.4, this was not
6418 the case.  For example:
6420 @smallexample
6421 union U @{
6422   long double ld;
6423   int i;
6425 @end smallexample
6427 @noindent
6428 @code{union U} is now always passed in memory.
6430 @end itemize
6432 @item -Wno-changes-meaning @r{(C++ and Objective-C++ only)}
6433 C++ requires that unqualified uses of a name within a class have the
6434 same meaning in the complete scope of the class, so declaring the name
6435 after using it is ill-formed:
6436 @smallexample
6437 struct A;
6438 struct B1 @{ A a; typedef A A; @}; // warning, 'A' changes meaning
6439 struct B2 @{ A a; struct A @{ @}; @}; // error, 'A' changes meaning
6440 @end smallexample
6441 By default, the B1 case is only a warning because the two declarations
6442 have the same type, while the B2 case is an error.  Both diagnostics
6443 can be disabled with @option{-Wno-changes-meaning}.  Alternately, the
6444 error case can be reduced to a warning with
6445 @option{-Wno-error=changes-meaning} or @option{-fpermissive}.
6447 Both diagnostics are also suppressed by @option{-fms-extensions}.
6449 @opindex Wchar-subscripts
6450 @opindex Wno-char-subscripts
6451 @item -Wchar-subscripts
6452 Warn if an array subscript has type @code{char}.  This is a common cause
6453 of error, as programmers often forget that this type is signed on some
6454 machines.
6455 This warning is enabled by @option{-Wall}.
6457 @opindex Wno-coverage-mismatch
6458 @opindex Wcoverage-mismatch
6459 @item -Wno-coverage-mismatch
6460 Warn if feedback profiles do not match when using the
6461 @option{-fprofile-use} option.
6462 If a source file is changed between compiling with @option{-fprofile-generate}
6463 and with @option{-fprofile-use}, the files with the profile feedback can fail
6464 to match the source file and GCC cannot use the profile feedback
6465 information.  By default, this warning is enabled and is treated as an
6466 error.  @option{-Wno-coverage-mismatch} can be used to disable the
6467 warning or @option{-Wno-error=coverage-mismatch} can be used to
6468 disable the error.  Disabling the error for this warning can result in
6469 poorly optimized code and is useful only in the
6470 case of very minor changes such as bug fixes to an existing code-base.
6471 Completely disabling the warning is not recommended.
6473 @opindex Wno-coverage-invalid-line-number
6474 @opindex Wcoverage-invalid-line-number
6475 @item -Wno-coverage-invalid-line-number
6476 Warn in case a function ends earlier than it begins due
6477 to an invalid linenum macros.  The warning is emitted only
6478 with @option{--coverage} enabled.
6480 By default, this warning is enabled and is treated as an
6481 error.  @option{-Wno-coverage-invalid-line-number} can be used to disable the
6482 warning or @option{-Wno-error=coverage-invalid-line-number} can be used to
6483 disable the error.
6485 @opindex Wno-cpp
6486 @opindex Wcpp
6487 @item -Wno-cpp @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
6488 Suppress warning messages emitted by @code{#warning} directives.
6490 @opindex Wdouble-promotion
6491 @opindex Wno-double-promotion
6492 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
6493 Give a warning when a value of type @code{float} is implicitly
6494 promoted to @code{double}.  CPUs with a 32-bit ``single-precision''
6495 floating-point unit implement @code{float} in hardware, but emulate
6496 @code{double} in software.  On such a machine, doing computations
6497 using @code{double} values is much more expensive because of the
6498 overhead required for software emulation.
6500 It is easy to accidentally do computations with @code{double} because
6501 floating-point literals are implicitly of type @code{double}.  For
6502 example, in:
6503 @smallexample
6504 @group
6505 float area(float radius)
6507    return 3.14159 * radius * radius;
6509 @end group
6510 @end smallexample
6511 the compiler performs the entire computation with @code{double}
6512 because the floating-point literal is a @code{double}.
6514 @opindex Wduplicate-decl-specifier
6515 @opindex Wno-duplicate-decl-specifier
6516 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6517 Warn if a declaration has duplicate @code{const}, @code{volatile},
6518 @code{restrict} or @code{_Atomic} specifier.  This warning is enabled by
6519 @option{-Wall}.
6521 @opindex Wformat
6522 @opindex Wno-format
6523 @opindex ffreestanding
6524 @opindex fno-builtin
6525 @opindex Wformat=
6526 @item -Wformat
6527 @itemx -Wformat=@var{n}
6528 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
6529 the arguments supplied have types appropriate to the format string
6530 specified, and that the conversions specified in the format string make
6531 sense.  This includes standard functions, and others specified by format
6532 attributes (@pxref{Function Attributes}), in the @code{printf},
6533 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
6534 not in the C standard) families (or other target-specific families).
6535 Which functions are checked without format attributes having been
6536 specified depends on the standard version selected, and such checks of
6537 functions without the attribute specified are disabled by
6538 @option{-ffreestanding} or @option{-fno-builtin}.
6540 The formats are checked against the format features supported by GNU
6541 libc version 2.2.  These include all ISO C90 and C99 features, as well
6542 as features from the Single Unix Specification and some BSD and GNU
6543 extensions.  Other library implementations may not support all these
6544 features; GCC does not support warning about features that go beyond a
6545 particular library's limitations.  However, if @option{-Wpedantic} is used
6546 with @option{-Wformat}, warnings are given about format features not
6547 in the selected standard version (but not for @code{strfmon} formats,
6548 since those are not in any version of the C standard).  @xref{C Dialect
6549 Options,,Options Controlling C Dialect}.
6551 @table @gcctabopt
6552 @opindex Wformat
6553 @opindex Wformat=1
6554 @item -Wformat=1
6555 @itemx -Wformat
6556 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
6557 @option{-Wno-format} is equivalent to @option{-Wformat=0}.  Since
6558 @option{-Wformat} also checks for null format arguments for several
6559 functions, @option{-Wformat} also implies @option{-Wnonnull}.  Some
6560 aspects of this level of format checking can be disabled by the
6561 options: @option{-Wno-format-contains-nul},
6562 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
6563 @option{-Wformat} is enabled by @option{-Wall}.
6565 @opindex Wformat=2
6566 @item -Wformat=2
6567 Enable @option{-Wformat} plus additional format checks.  Currently
6568 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
6569 -Wformat-y2k}.
6570 @end table
6572 @opindex Wno-format-contains-nul
6573 @opindex Wformat-contains-nul
6574 @item -Wno-format-contains-nul
6575 If @option{-Wformat} is specified, do not warn about format strings that
6576 contain NUL bytes.
6578 @opindex Wno-format-extra-args
6579 @opindex Wformat-extra-args
6580 @item -Wno-format-extra-args
6581 If @option{-Wformat} is specified, do not warn about excess arguments to a
6582 @code{printf} or @code{scanf} format function.  The C standard specifies
6583 that such arguments are ignored.
6585 Where the unused arguments lie between used arguments that are
6586 specified with @samp{$} operand number specifications, normally
6587 warnings are still given, since the implementation could not know what
6588 type to pass to @code{va_arg} to skip the unused arguments.  However,
6589 in the case of @code{scanf} formats, this option suppresses the
6590 warning if the unused arguments are all pointers, since the Single
6591 Unix Specification says that such unused arguments are allowed.
6593 @opindex Wformat-overflow
6594 @opindex Wno-format-overflow
6595 @item -Wformat-overflow
6596 @itemx -Wformat-overflow=@var{level}
6597 Warn about calls to formatted input/output functions such as @code{sprintf}
6598 and @code{vsprintf} that might overflow the destination buffer.  When the
6599 exact number of bytes written by a format directive cannot be determined
6600 at compile-time it is estimated based on heuristics that depend on the
6601 @var{level} argument and on optimization.  While enabling optimization
6602 will in most cases improve the accuracy of the warning, it may also
6603 result in false positives.
6605 @table @gcctabopt
6606 @opindex Wformat-overflow
6607 @opindex Wno-format-overflow
6608 @item -Wformat-overflow
6609 @itemx -Wformat-overflow=1
6610 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
6611 employs a conservative approach that warns only about calls that most
6612 likely overflow the buffer.  At this level, numeric arguments to format
6613 directives with unknown values are assumed to have the value of one, and
6614 strings of unknown length to be empty.  Numeric arguments that are known
6615 to be bounded to a subrange of their type, or string arguments whose output
6616 is bounded either by their directive's precision or by a finite set of
6617 string literals, are assumed to take on the value within the range that
6618 results in the most bytes on output.  For example, the call to @code{sprintf}
6619 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
6620 the terminating NUL character (@code{'\0'}) appended by the function
6621 to the destination buffer will be written past its end.  Increasing
6622 the size of the buffer by a single byte is sufficient to avoid the
6623 warning, though it may not be sufficient to avoid the overflow.
6625 @smallexample
6626 void f (int a, int b)
6628   char buf [13];
6629   sprintf (buf, "a = %i, b = %i\n", a, b);
6631 @end smallexample
6633 @item -Wformat-overflow=2
6634 Level @var{2} warns also about calls that might overflow the destination
6635 buffer given an argument of sufficient length or magnitude.  At level
6636 @var{2}, unknown numeric arguments are assumed to have the minimum
6637 representable value for signed types with a precision greater than 1, and
6638 the maximum representable value otherwise.  Unknown string arguments whose
6639 length cannot be assumed to be bounded either by the directive's precision,
6640 or by a finite set of string literals they may evaluate to, or the character
6641 array they may point to, are assumed to be 1 character long.
6643 At level @var{2}, the call in the example above is again diagnosed, but
6644 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
6645 @code{%i} directive will write some of its digits beyond the end of
6646 the destination buffer.  To make the call safe regardless of the values
6647 of the two variables, the size of the destination buffer must be increased
6648 to at least 34 bytes.  GCC includes the minimum size of the buffer in
6649 an informational note following the warning.
6651 An alternative to increasing the size of the destination buffer is to
6652 constrain the range of formatted values.  The maximum length of string
6653 arguments can be bounded by specifying the precision in the format
6654 directive.  When numeric arguments of format directives can be assumed
6655 to be bounded by less than the precision of their type, choosing
6656 an appropriate length modifier to the format specifier will reduce
6657 the required buffer size.  For example, if @var{a} and @var{b} in the
6658 example above can be assumed to be within the precision of
6659 the @code{short int} type then using either the @code{%hi} format
6660 directive or casting the argument to @code{short} reduces the maximum
6661 required size of the buffer to 24 bytes.
6663 @smallexample
6664 void f (int a, int b)
6666   char buf [23];
6667   sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
6669 @end smallexample
6670 @end table
6672 @opindex Wno-format-zero-length
6673 @opindex Wformat-zero-length
6674 @item -Wno-format-zero-length
6675 If @option{-Wformat} is specified, do not warn about zero-length formats.
6676 The C standard specifies that zero-length formats are allowed.
6678 @opindex Wformat-nonliteral
6679 @opindex Wno-format-nonliteral
6680 @item -Wformat-nonliteral
6681 If @option{-Wformat} is specified, also warn if the format string is not a
6682 string literal and so cannot be checked, unless the format function
6683 takes its format arguments as a @code{va_list}.
6685 @opindex Wformat-security
6686 @opindex Wno-format-security
6687 @item -Wformat-security
6688 If @option{-Wformat} is specified, also warn about uses of format
6689 functions that represent possible security problems.  At present, this
6690 warns about calls to @code{printf} and @code{scanf} functions where the
6691 format string is not a string literal and there are no format arguments,
6692 as in @code{printf (foo);}.  This may be a security hole if the format
6693 string came from untrusted input and contains @samp{%n}.  (This is
6694 currently a subset of what @option{-Wformat-nonliteral} warns about, but
6695 in future warnings may be added to @option{-Wformat-security} that are not
6696 included in @option{-Wformat-nonliteral}.)
6698 @opindex Wformat-signedness
6699 @opindex Wno-format-signedness
6700 @item -Wformat-signedness
6701 If @option{-Wformat} is specified, also warn if the format string
6702 requires an unsigned argument and the argument is signed and vice versa.
6704 @opindex Wformat-truncation
6705 @opindex Wno-format-truncation
6706 @item -Wformat-truncation
6707 @itemx -Wformat-truncation=@var{level}
6708 Warn about calls to formatted input/output functions such as @code{snprintf}
6709 and @code{vsnprintf} that might result in output truncation.  When the exact
6710 number of bytes written by a format directive cannot be determined at
6711 compile-time it is estimated based on heuristics that depend on
6712 the @var{level} argument and on optimization.  While enabling optimization
6713 will in most cases improve the accuracy of the warning, it may also result
6714 in false positives.  Except as noted otherwise, the option uses the same
6715 logic @option{-Wformat-overflow}.
6717 @table @gcctabopt
6718 @opindex Wformat-truncation
6719 @opindex Wno-format-truncation
6720 @item -Wformat-truncation
6721 @itemx -Wformat-truncation=1
6722 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
6723 employs a conservative approach that warns only about calls to bounded
6724 functions whose return value is unused and that will most likely result
6725 in output truncation.
6727 @item -Wformat-truncation=2
6728 Level @var{2} warns also about calls to bounded functions whose return
6729 value is used and that might result in truncation given an argument of
6730 sufficient length or magnitude.
6731 @end table
6733 @opindex Wformat-y2k
6734 @opindex Wno-format-y2k
6735 @item -Wformat-y2k
6736 If @option{-Wformat} is specified, also warn about @code{strftime}
6737 formats that may yield only a two-digit year.
6739 @opindex Wnonnull
6740 @opindex Wno-nonnull
6741 @item -Wnonnull
6742 Warn about passing a null pointer for arguments marked as
6743 requiring a non-null value by the @code{nonnull} function attribute.
6745 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
6746 can be disabled with the @option{-Wno-nonnull} option.
6748 @opindex Wnonnull-compare
6749 @opindex Wno-nonnull-compare
6750 @item -Wnonnull-compare
6751 Warn when comparing an argument marked with the @code{nonnull}
6752 function attribute against null inside the function.
6754 @option{-Wnonnull-compare} is included in @option{-Wall}.  It
6755 can be disabled with the @option{-Wno-nonnull-compare} option.
6757 @opindex Wnull-dereference
6758 @opindex Wno-null-dereference
6759 @item -Wnull-dereference
6760 Warn if the compiler detects paths that trigger erroneous or
6761 undefined behavior due to dereferencing a null pointer.  This option
6762 is only active when @option{-fdelete-null-pointer-checks} is active,
6763 which is enabled by optimizations in most targets.  The precision of
6764 the warnings depends on the optimization options used.
6766 @opindex Wnrvo
6767 @opindex Wno-nrvo
6768 @item -Wnrvo @r{(C++ and Objective-C++ only)}
6769 Warn if the compiler does not elide the copy from a local variable to
6770 the return value of a function in a context where it is allowed by
6771 [class.copy.elision].  This elision is commonly known as the Named
6772 Return Value Optimization.  For instance, in the example below the
6773 compiler cannot elide copies from both v1 and v2, so it elides neither.
6775 @smallexample
6776 std::vector<int> f()
6778   std::vector<int> v1, v2;
6779   // ...
6780   if (cond) return v1;
6781   else return v2; // warning: not eliding copy
6783 @end smallexample
6785 @opindex Winfinite-recursion
6786 @opindex Wno-infinite-recursion
6787 @item -Winfinite-recursion
6788 Warn about infinitely recursive calls.  The warning is effective at all
6789 optimization levels but requires optimization in order to detect infinite
6790 recursion in calls between two or more functions.
6791 @option{-Winfinite-recursion} is included in @option{-Wall}.
6793 Compare with @option{-Wanalyzer-infinite-recursion} which provides a
6794 similar diagnostic, but is implemented in a different way (as part of
6795 @option{-fanalyzer}).
6797 @opindex Winit-self
6798 @opindex Wno-init-self
6799 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
6800 Warn about uninitialized variables that are initialized with themselves.
6801 Note this option can only be used with the @option{-Wuninitialized} option.
6803 For example, GCC warns about @code{i} being uninitialized in the
6804 following snippet only when @option{-Winit-self} has been specified:
6805 @smallexample
6806 @group
6807 int f()
6809   int i = i;
6810   return i;
6812 @end group
6813 @end smallexample
6815 This warning is enabled by @option{-Wall} in C++.
6817 @opindex Wimplicit-int
6818 @opindex Wno-implicit-int
6819 @item -Wno-implicit-int @r{(C and Objective-C only)}
6820 This option controls warnings when a declaration does not specify a type.
6821 This warning is enabled by default in C99 and later dialects of C,
6822 and also by @option{-Wall}.
6824 This warning is upgraded to an error by @option{-pedantic-errors}.
6826 @opindex Wimplicit-function-declaration
6827 @opindex Wno-implicit-function-declaration
6828 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
6829 This option controls warnings when a function is used before being declared.
6830 This warning is enabled by default in C99 and later dialects of C,
6831 and also by @option{-Wall}.
6833 This warning is upgraded to an error by @option{-pedantic-errors}.
6835 @opindex Wimplicit
6836 @opindex Wno-implicit
6837 @item -Wimplicit @r{(C and Objective-C only)}
6838 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
6839 This warning is enabled by @option{-Wall}.
6841 @opindex Wimplicit-fallthrough
6842 @opindex Wno-implicit-fallthrough
6843 @item -Wimplicit-fallthrough
6844 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
6845 and @option{-Wno-implicit-fallthrough} is the same as
6846 @option{-Wimplicit-fallthrough=0}.
6848 @opindex Wimplicit-fallthrough=
6849 @item -Wimplicit-fallthrough=@var{n}
6850 Warn when a switch case falls through.  For example:
6852 @smallexample
6853 @group
6854 switch (cond)
6855   @{
6856   case 1:
6857     a = 1;
6858     break;
6859   case 2:
6860     a = 2;
6861   case 3:
6862     a = 3;
6863     break;
6864   @}
6865 @end group
6866 @end smallexample
6868 This warning does not warn when the last statement of a case cannot
6869 fall through, e.g. when there is a return statement or a call to function
6870 declared with the noreturn attribute.  @option{-Wimplicit-fallthrough=}
6871 also takes into account control flow statements, such as ifs, and only
6872 warns when appropriate.  E.g.@:
6874 @smallexample
6875 @group
6876 switch (cond)
6877   @{
6878   case 1:
6879     if (i > 3) @{
6880       bar (5);
6881       break;
6882     @} else if (i < 1) @{
6883       bar (0);
6884     @} else
6885       return;
6886   default:
6887     @dots{}
6888   @}
6889 @end group
6890 @end smallexample
6892 Since there are occasions where a switch case fall through is desirable,
6893 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
6894 to be used along with a null statement to suppress this warning that
6895 would normally occur:
6897 @smallexample
6898 @group
6899 switch (cond)
6900   @{
6901   case 1:
6902     bar (0);
6903     __attribute__ ((fallthrough));
6904   default:
6905     @dots{}
6906   @}
6907 @end group
6908 @end smallexample
6910 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
6911 warning using @code{[[fallthrough]];} instead of the GNU attribute.  In C++11
6912 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
6913 Instead of these attributes, it is also possible to add a fallthrough comment
6914 to silence the warning.  The whole body of the C or C++ style comment should
6915 match the given regular expressions listed below.  The option argument @var{n}
6916 specifies what kind of comments are accepted:
6918 @itemize @bullet
6920 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
6922 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
6923 expression, any comment is used as fallthrough comment.
6925 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
6926 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
6928 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
6929 following regular expressions:
6931 @itemize @bullet
6933 @item @code{-fallthrough}
6935 @item @code{@@fallthrough@@}
6937 @item @code{lint -fallthrough[ \t]*}
6939 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
6941 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6943 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6945 @end itemize
6947 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
6948 following regular expressions:
6950 @itemize @bullet
6952 @item @code{-fallthrough}
6954 @item @code{@@fallthrough@@}
6956 @item @code{lint -fallthrough[ \t]*}
6958 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
6960 @end itemize
6962 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
6963 fallthrough comments, only attributes disable the warning.
6965 @end itemize
6967 The comment needs to be followed after optional whitespace and other comments
6968 by @code{case} or @code{default} keywords or by a user label that precedes some
6969 @code{case} or @code{default} label.
6971 @smallexample
6972 @group
6973 switch (cond)
6974   @{
6975   case 1:
6976     bar (0);
6977     /* FALLTHRU */
6978   default:
6979     @dots{}
6980   @}
6981 @end group
6982 @end smallexample
6984 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
6986 @opindex Wif-not-aligned
6987 @opindex Wno-if-not-aligned
6988 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6989 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
6990 should be issued.  These warnings are enabled by default.
6992 @opindex Wignored-qualifiers
6993 @opindex Wno-ignored-qualifiers
6994 @item -Wignored-qualifiers @r{(C and C++ only)}
6995 Warn if the return type of a function has a type qualifier
6996 such as @code{const}.  For ISO C such a type qualifier has no effect,
6997 since the value returned by a function is not an lvalue.
6998 For C++, the warning is only emitted for scalar types or @code{void}.
6999 ISO C prohibits qualified @code{void} return types on function
7000 definitions, so such return types always receive a warning
7001 even without this option.
7003 This warning is also enabled by @option{-Wextra}.
7005 @opindex Wignored-attributes
7006 @opindex Wno-ignored-attributes
7007 @item -Wno-ignored-attributes @r{(C and C++ only)}
7008 This option controls warnings when an attribute is ignored.
7009 This is different from the
7010 @option{-Wattributes} option in that it warns whenever the compiler decides
7011 to drop an attribute, not that the attribute is either unknown, used in a
7012 wrong place, etc.  This warning is enabled by default.
7014 @opindex Wmain
7015 @opindex Wno-main
7016 @item -Wmain
7017 Warn if the type of @code{main} is suspicious.  @code{main} should be
7018 a function with external linkage, returning int, taking either zero
7019 arguments, two, or three arguments of appropriate types.  This warning
7020 is enabled by default in C++ and is enabled by either @option{-Wall}
7021 or @option{-Wpedantic}.
7023 This warning is upgraded to an error by @option{-pedantic-errors}.
7025 @opindex Wmisleading-indentation
7026 @opindex Wno-misleading-indentation
7027 @item -Wmisleading-indentation @r{(C and C++ only)}
7028 Warn when the indentation of the code does not reflect the block structure.
7029 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
7030 @code{for} clauses with a guarded statement that does not use braces,
7031 followed by an unguarded statement with the same indentation.
7033 In the following example, the call to ``bar'' is misleadingly indented as
7034 if it were guarded by the ``if'' conditional.
7036 @smallexample
7037   if (some_condition ())
7038     foo ();
7039     bar ();  /* Gotcha: this is not guarded by the "if".  */
7040 @end smallexample
7042 In the case of mixed tabs and spaces, the warning uses the
7043 @option{-ftabstop=} option to determine if the statements line up
7044 (defaulting to 8).
7046 The warning is not issued for code involving multiline preprocessor logic
7047 such as the following example.
7049 @smallexample
7050   if (flagA)
7051     foo (0);
7052 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
7053   if (flagB)
7054 #endif
7055     foo (1);
7056 @end smallexample
7058 The warning is not issued after a @code{#line} directive, since this
7059 typically indicates autogenerated code, and no assumptions can be made
7060 about the layout of the file that the directive references.
7062 This warning is enabled by @option{-Wall} in C and C++.
7064 @opindex Wmissing-attributes
7065 @opindex Wno-missing-attributes
7066 @item -Wmissing-attributes
7067 Warn when a declaration of a function is missing one or more attributes
7068 that a related function is declared with and whose absence may adversely
7069 affect the correctness or efficiency of generated code.  For example,
7070 the warning is issued for declarations of aliases that use attributes
7071 to specify less restrictive requirements than those of their targets.
7072 This typically represents a potential optimization opportunity.
7073 By contrast, the @option{-Wattribute-alias=2} option controls warnings
7074 issued when the alias is more restrictive than the target, which could
7075 lead to incorrect code generation.
7076 Attributes considered include @code{alloc_align}, @code{alloc_size},
7077 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
7078 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
7079 @code{returns_nonnull}, and @code{returns_twice}.
7081 In C++, the warning is issued when an explicit specialization of a primary
7082 template declared with attribute @code{alloc_align}, @code{alloc_size},
7083 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
7084 or @code{nonnull} is declared without it.  Attributes @code{deprecated},
7085 @code{error}, and @code{warning} suppress the warning.
7086 (@pxref{Function Attributes}).
7088 You can use the @code{copy} attribute to apply the same
7089 set of attributes to a declaration as that on another declaration without
7090 explicitly enumerating the attributes. This attribute can be applied
7091 to declarations of functions (@pxref{Common Function Attributes}),
7092 variables (@pxref{Common Variable Attributes}), or types
7093 (@pxref{Common Type Attributes}).
7095 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
7097 For example, since the declaration of the primary function template
7098 below makes use of both attribute @code{malloc} and @code{alloc_size}
7099 the declaration of the explicit specialization of the template is
7100 diagnosed because it is missing one of the attributes.
7102 @smallexample
7103 template <class T>
7104 T* __attribute__ ((malloc, alloc_size (1)))
7105 allocate (size_t);
7107 template <>
7108 void* __attribute__ ((malloc))   // missing alloc_size
7109 allocate<void> (size_t);
7110 @end smallexample
7112 @opindex Wmissing-braces
7113 @opindex Wno-missing-braces
7114 @item -Wmissing-braces
7115 Warn if an aggregate or union initializer is not fully bracketed.  In
7116 the following example, the initializer for @code{a} is not fully
7117 bracketed, but that for @code{b} is fully bracketed.
7119 @smallexample
7120 int a[2][2] = @{ 0, 1, 2, 3 @};
7121 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
7122 @end smallexample
7124 This warning is enabled by @option{-Wall}.
7126 @opindex Wmissing-include-dirs
7127 @opindex Wno-missing-include-dirs
7128 @item -Wmissing-include-dirs @r{(C, C++, Objective-C, Objective-C++ and Fortran only)}
7129 Warn if a user-supplied include directory does not exist. This option is disabled
7130 by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially
7131 enabled by default by warning for -I and -J, only.
7133 @opindex Wmissing-profile
7134 @opindex Wno-missing-profile
7135 @item -Wno-missing-profile
7136 This option controls warnings if feedback profiles are missing when using the
7137 @option{-fprofile-use} option.
7138 This option diagnoses those cases where a new function or a new file is added
7139 between compiling with @option{-fprofile-generate} and with
7140 @option{-fprofile-use}, without regenerating the profiles.
7141 In these cases, the profile feedback data files do not contain any
7142 profile feedback information for
7143 the newly added function or file respectively.  Also, in the case when profile
7144 count data (.gcda) files are removed, GCC cannot use any profile feedback
7145 information.  In all these cases, warnings are issued to inform you that a
7146 profile generation step is due.
7147 Ignoring the warning can result in poorly optimized code.
7148 @option{-Wno-missing-profile} can be used to
7149 disable the warning, but this is not recommended and should be done only
7150 when non-existent profile data is justified.
7152 @opindex Wmismatched-dealloc
7153 @opindex Wno-mismatched-dealloc
7154 @item -Wmismatched-dealloc
7156 Warn for calls to deallocation functions with pointer arguments returned
7157 from from allocations functions for which the former isn't a suitable
7158 deallocator.  A pair of functions can be associated as matching allocators
7159 and deallocators by use of attribute @code{malloc}.  Unless disabled by
7160 the @option{-fno-builtin} option the standard functions @code{calloc},
7161 @code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding
7162 forms of C++ @code{operator new} and @code{operator delete} are implicitly
7163 associated as matching allocators and deallocators.  In the following
7164 example @code{mydealloc} is the deallocator for pointers returned from
7165 @code{myalloc}.
7167 @smallexample
7168 void mydealloc (void*);
7170 __attribute__ ((malloc (mydealloc, 1))) void*
7171 myalloc (size_t);
7173 void f (void)
7175   void *p = myalloc (32);
7176   // @dots{}use p@dots{}
7177   free (p);   // warning: not a matching deallocator for myalloc
7178   mydealloc (p);   // ok
7180 @end smallexample
7182 In C++, the related option @option{-Wmismatched-new-delete} diagnoses
7183 mismatches involving either @code{operator new} or @code{operator delete}.
7185 Option @option{-Wmismatched-dealloc} is included in @option{-Wall}.
7187 @opindex Wmultistatement-macros
7188 @opindex Wno-multistatement-macros
7189 @item -Wmultistatement-macros
7190 Warn about unsafe multiple statement macros that appear to be guarded
7191 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
7192 @code{while}, in which only the first statement is actually guarded after
7193 the macro is expanded.
7195 For example:
7197 @smallexample
7198 #define DOIT x++; y++
7199 if (c)
7200   DOIT;
7201 @end smallexample
7203 will increment @code{y} unconditionally, not just when @code{c} holds.
7204 The can usually be fixed by wrapping the macro in a do-while loop:
7205 @smallexample
7206 #define DOIT do @{ x++; y++; @} while (0)
7207 if (c)
7208   DOIT;
7209 @end smallexample
7211 This warning is enabled by @option{-Wall} in C and C++.
7213 @opindex Wparentheses
7214 @opindex Wno-parentheses
7215 @item -Wparentheses
7216 Warn if parentheses are omitted in certain contexts, such
7217 as when there is an assignment in a context where a truth value
7218 is expected, or when operators are nested whose precedence people
7219 often get confused about.
7221 Also warn if a comparison like @code{x<=y<=z} appears; this is
7222 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
7223 interpretation from that of ordinary mathematical notation.
7225 Also warn for dangerous uses of the GNU extension to
7226 @code{?:} with omitted middle operand. When the condition
7227 in the @code{?}: operator is a boolean expression, the omitted value is
7228 always 1.  Often programmers expect it to be a value computed
7229 inside the conditional expression instead.
7231 For C++ this also warns for some cases of unnecessary parentheses in
7232 declarations, which can indicate an attempt at a function call instead
7233 of a declaration:
7234 @smallexample
7236   // Declares a local variable called mymutex.
7237   std::unique_lock<std::mutex> (mymutex);
7238   // User meant std::unique_lock<std::mutex> lock (mymutex);
7240 @end smallexample
7242 This warning is enabled by @option{-Wall}.
7244 @opindex Wself-move
7245 @opindex Wno-self-move
7246 @item -Wno-self-move @r{(C++ and Objective-C++ only)}
7247 This warning warns when a value is moved to itself with @code{std::move}.
7248 Such a @code{std::move} typically has no effect.
7250 @smallexample
7251 struct T @{
7252 @dots{}
7254 void fn()
7256   T t;
7257   @dots{}
7258   t = std::move (t);
7260 @end smallexample
7262 This warning is enabled by @option{-Wall}.
7264 @opindex Wsequence-point
7265 @opindex Wno-sequence-point
7266 @item -Wsequence-point
7267 Warn about code that may have undefined semantics because of violations
7268 of sequence point rules in the C and C++ standards.
7270 The C and C++ standards define the order in which expressions in a C/C++
7271 program are evaluated in terms of @dfn{sequence points}, which represent
7272 a partial ordering between the execution of parts of the program: those
7273 executed before the sequence point, and those executed after it.  These
7274 occur after the evaluation of a full expression (one which is not part
7275 of a larger expression), after the evaluation of the first operand of a
7276 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
7277 function is called (but after the evaluation of its arguments and the
7278 expression denoting the called function), and in certain other places.
7279 Other than as expressed by the sequence point rules, the order of
7280 evaluation of subexpressions of an expression is not specified.  All
7281 these rules describe only a partial order rather than a total order,
7282 since, for example, if two functions are called within one expression
7283 with no sequence point between them, the order in which the functions
7284 are called is not specified.  However, the standards committee have
7285 ruled that function calls do not overlap.
7287 It is not specified when between sequence points modifications to the
7288 values of objects take effect.  Programs whose behavior depends on this
7289 have undefined behavior; the C and C++ standards specify that ``Between
7290 the previous and next sequence point an object shall have its stored
7291 value modified at most once by the evaluation of an expression.
7292 Furthermore, the prior value shall be read only to determine the value
7293 to be stored.''.  If a program breaks these rules, the results on any
7294 particular implementation are entirely unpredictable.
7296 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
7297 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
7298 diagnosed by this option, and it may give an occasional false positive
7299 result, but in general it has been found fairly effective at detecting
7300 this sort of problem in programs.
7302 The C++17 standard will define the order of evaluation of operands in
7303 more cases: in particular it requires that the right-hand side of an
7304 assignment be evaluated before the left-hand side, so the above
7305 examples are no longer undefined.  But this option will still warn
7306 about them, to help people avoid writing code that is undefined in C
7307 and earlier revisions of C++.
7309 The standard is worded confusingly, therefore there is some debate
7310 over the precise meaning of the sequence point rules in subtle cases.
7311 Links to discussions of the problem, including proposed formal
7312 definitions, may be found on the GCC readings page, at
7313 @uref{https://gcc.gnu.org/@/readings.html}.
7315 This warning is enabled by @option{-Wall} for C and C++.
7317 @opindex Wno-return-local-addr
7318 @opindex Wreturn-local-addr
7319 @item -Wno-return-local-addr
7320 Do not warn about returning a pointer (or in C++, a reference) to a
7321 variable that goes out of scope after the function returns.
7323 @opindex Wreturn-type
7324 @opindex Wno-return-type
7325 @item -Wreturn-type
7326 Warn whenever a function is defined with a return type that defaults
7327 to @code{int}.  Also warn about any @code{return} statement with no
7328 return value in a function whose return type is not @code{void}
7329 (falling off the end of the function body is considered returning
7330 without a value).
7332 For C only, warn about a @code{return} statement with an expression in a
7333 function whose return type is @code{void}, unless the expression type is
7334 also @code{void}.  As a GNU extension, the latter case is accepted
7335 without a warning unless @option{-Wpedantic} is used.  Attempting
7336 to use the return value of a non-@code{void} function other than @code{main}
7337 that flows off the end by reaching the closing curly brace that terminates
7338 the function is undefined.
7340 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
7341 than @code{main} results in undefined behavior even when the value of
7342 the function is not used.
7344 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
7346 @opindex Wshift-count-negative
7347 @opindex Wno-shift-count-negative
7348 @item -Wno-shift-count-negative
7349 Controls warnings if a shift count is negative.
7350 This warning is enabled by default.
7352 @opindex Wshift-count-overflow
7353 @opindex Wno-shift-count-overflow
7354 @item -Wno-shift-count-overflow
7355 Controls warnings if a shift count is greater than or equal to the bit width
7356 of the type.  This warning is enabled by default.
7358 @opindex Wshift-negative-value
7359 @opindex Wno-shift-negative-value
7360 @item -Wshift-negative-value
7361 Warn if left shifting a negative value.  This warning is enabled by
7362 @option{-Wextra} in C99 (and newer) and C++11 to C++17 modes.
7364 @opindex Wshift-overflow
7365 @opindex Wno-shift-overflow
7366 @item -Wno-shift-overflow
7367 @itemx -Wshift-overflow=@var{n}
7368 These options control warnings about left shift overflows.
7370 @table @gcctabopt
7371 @item -Wshift-overflow=1
7372 This is the warning level of @option{-Wshift-overflow} and is enabled
7373 by default in C99 and C++11 modes (and newer).  This warning level does
7374 not warn about left-shifting 1 into the sign bit.  (However, in C, such
7375 an overflow is still rejected in contexts where an integer constant expression
7376 is required.)  No warning is emitted in C++20 mode (and newer), as signed left
7377 shifts always wrap.
7379 @item -Wshift-overflow=2
7380 This warning level also warns about left-shifting 1 into the sign bit,
7381 unless C++14 mode (or newer) is active.
7382 @end table
7384 @opindex Wswitch
7385 @opindex Wno-switch
7386 @item -Wswitch
7387 Warn whenever a @code{switch} statement has an index of enumerated type
7388 and lacks a @code{case} for one or more of the named codes of that
7389 enumeration.  (The presence of a @code{default} label prevents this
7390 warning.)  @code{case} labels outside the enumeration range also
7391 provoke warnings when this option is used (even if there is a
7392 @code{default} label).
7393 This warning is enabled by @option{-Wall}.
7395 @opindex Wswitch-default
7396 @opindex Wno-switch-default
7397 @item -Wswitch-default
7398 Warn whenever a @code{switch} statement does not have a @code{default}
7399 case.
7401 @opindex Wswitch-enum
7402 @opindex Wno-switch-enum
7403 @item -Wswitch-enum
7404 Warn whenever a @code{switch} statement has an index of enumerated type
7405 and lacks a @code{case} for one or more of the named codes of that
7406 enumeration.  @code{case} labels outside the enumeration range also
7407 provoke warnings when this option is used.  The only difference
7408 between @option{-Wswitch} and this option is that this option gives a
7409 warning about an omitted enumeration code even if there is a
7410 @code{default} label.
7412 @opindex Wswitch-bool
7413 @opindex Wno-switch-bool
7414 @item -Wno-switch-bool
7415 Do not warn when a @code{switch} statement has an index of boolean type
7416 and the case values are outside the range of a boolean type.
7417 It is possible to suppress this warning by casting the controlling
7418 expression to a type other than @code{bool}.  For example:
7419 @smallexample
7420 @group
7421 switch ((int) (a == 4))
7422   @{
7423   @dots{}
7424   @}
7425 @end group
7426 @end smallexample
7427 This warning is enabled by default for C and C++ programs.
7429 @opindex Wswitch-outside-range
7430 @opindex Wno-switch-outside-range
7431 @item -Wno-switch-outside-range
7432 This option controls warnings when a @code{switch} case has a value
7433 that is outside of its
7434 respective type range.  This warning is enabled by default for
7435 C and C++ programs.
7437 @opindex Wswitch-unreachable
7438 @opindex Wno-switch-unreachable
7439 @item -Wno-switch-unreachable
7440 Do not warn when a @code{switch} statement contains statements between the
7441 controlling expression and the first case label, which will never be
7442 executed.  For example:
7443 @smallexample
7444 @group
7445 switch (cond)
7446   @{
7447    i = 15;
7448   @dots{}
7449    case 5:
7450   @dots{}
7451   @}
7452 @end group
7453 @end smallexample
7454 @option{-Wswitch-unreachable} does not warn if the statement between the
7455 controlling expression and the first case label is just a declaration:
7456 @smallexample
7457 @group
7458 switch (cond)
7459   @{
7460    int i;
7461   @dots{}
7462    case 5:
7463    i = 5;
7464   @dots{}
7465   @}
7466 @end group
7467 @end smallexample
7468 This warning is enabled by default for C and C++ programs.
7470 @opindex Wsync-nand
7471 @opindex Wno-sync-nand
7472 @item -Wsync-nand @r{(C and C++ only)}
7473 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
7474 built-in functions are used.  These functions changed semantics in GCC 4.4.
7476 @opindex Wtrivial-auto-var-init
7477 @opindex Wno-trivial-auto-var-init
7478 @item -Wtrivial-auto-var-init
7479 Warn when @code{-ftrivial-auto-var-init} cannot initialize the automatic
7480 variable.  A common situation is an automatic variable that is declared
7481 between the controlling expression and the first case label of a @code{switch}
7482 statement.
7484 @opindex Wunused-but-set-parameter
7485 @opindex Wno-unused-but-set-parameter
7486 @item -Wunused-but-set-parameter
7487 Warn whenever a function parameter is assigned to, but otherwise unused
7488 (aside from its declaration).
7490 To suppress this warning use the @code{unused} attribute
7491 (@pxref{Variable Attributes}).
7493 This warning is also enabled by @option{-Wunused} together with
7494 @option{-Wextra}.
7496 @opindex Wunused-but-set-variable
7497 @opindex Wno-unused-but-set-variable
7498 @item -Wunused-but-set-variable
7499 Warn whenever a local variable is assigned to, but otherwise unused
7500 (aside from its declaration).
7501 This warning is enabled by @option{-Wall}.
7503 To suppress this warning use the @code{unused} attribute
7504 (@pxref{Variable Attributes}).
7506 This warning is also enabled by @option{-Wunused}, which is enabled
7507 by @option{-Wall}.
7509 @opindex Wunused-function
7510 @opindex Wno-unused-function
7511 @item -Wunused-function
7512 Warn whenever a static function is declared but not defined or a
7513 non-inline static function is unused.
7514 This warning is enabled by @option{-Wall}.
7516 @opindex Wunused-label
7517 @opindex Wno-unused-label
7518 @item -Wunused-label
7519 Warn whenever a label is declared but not used.
7520 This warning is enabled by @option{-Wall}.
7522 To suppress this warning use the @code{unused} attribute
7523 (@pxref{Variable Attributes}).
7525 @opindex Wunused-local-typedefs
7526 @opindex Wno-unused-local-typedefs
7527 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
7528 Warn when a typedef locally defined in a function is not used.
7529 This warning is enabled by @option{-Wall}.
7531 @opindex Wunused-parameter
7532 @opindex Wno-unused-parameter
7533 @item -Wunused-parameter
7534 Warn whenever a function parameter is unused aside from its declaration.
7536 To suppress this warning use the @code{unused} attribute
7537 (@pxref{Variable Attributes}).
7539 @opindex Wunused-result
7540 @opindex Wno-unused-result
7541 @item -Wno-unused-result
7542 Do not warn if a caller of a function marked with attribute
7543 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
7544 its return value. The default is @option{-Wunused-result}.
7546 @opindex Wunused-variable
7547 @opindex Wno-unused-variable
7548 @item -Wunused-variable
7549 Warn whenever a local or static variable is unused aside from its
7550 declaration. This option implies @option{-Wunused-const-variable=1} for C,
7551 but not for C++. This warning is enabled by @option{-Wall}.
7553 To suppress this warning use the @code{unused} attribute
7554 (@pxref{Variable Attributes}).
7556 @opindex Wunused-const-variable
7557 @opindex Wno-unused-const-variable
7558 @item -Wunused-const-variable
7559 @itemx -Wunused-const-variable=@var{n}
7560 Warn whenever a constant static variable is unused aside from its declaration.
7561 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
7562 for C, but not for C++. In C this declares variable storage, but in C++ this
7563 is not an error since const variables take the place of @code{#define}s.
7565 To suppress this warning use the @code{unused} attribute
7566 (@pxref{Variable Attributes}).
7568 @table @gcctabopt
7569 @item -Wunused-const-variable=1
7570 This is the warning level that is enabled by @option{-Wunused-variable} for
7571 C.  It warns only about unused static const variables defined in the main
7572 compilation unit, but not about static const variables declared in any
7573 header included.
7575 @item -Wunused-const-variable=2
7576 This warning level also warns for unused constant static variables in
7577 headers (excluding system headers).  This is the warning level of
7578 @option{-Wunused-const-variable} and must be explicitly requested since
7579 in C++ this isn't an error and in C it might be harder to clean up all
7580 headers included.
7581 @end table
7583 @opindex Wunused-value
7584 @opindex Wno-unused-value
7585 @item -Wunused-value
7586 Warn whenever a statement computes a result that is explicitly not
7587 used. To suppress this warning cast the unused expression to
7588 @code{void}. This includes an expression-statement or the left-hand
7589 side of a comma expression that contains no side effects. For example,
7590 an expression such as @code{x[i,j]} causes a warning, while
7591 @code{x[(void)i,j]} does not.
7593 This warning is enabled by @option{-Wall}.
7595 @opindex Wunused
7596 @opindex Wno-unused
7597 @item -Wunused
7598 All the above @option{-Wunused} options combined.
7600 In order to get a warning about an unused function parameter, you must
7601 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
7602 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
7604 @opindex Wuninitialized
7605 @opindex Wno-uninitialized
7606 @item -Wuninitialized
7607 Warn if an object with automatic or allocated storage duration is used
7608 without having been initialized.  In C++, also warn if a non-static
7609 reference or non-static @code{const} member appears in a class without
7610 constructors.
7612 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7613 object to a @code{const}-qualified argument of a built-in function known to
7614 read the object is also diagnosed by this warning.
7615 (@option{-Wmaybe-uninitialized} is issued for ordinary functions.)
7617 If you want to warn about code that uses the uninitialized value of the
7618 variable in its own initializer, use the @option{-Winit-self} option.
7620 These warnings occur for individual uninitialized elements of
7621 structure, union or array variables as well as for variables that are
7622 uninitialized as a whole.  They do not occur for variables or elements
7623 declared @code{volatile}.  Because these warnings depend on
7624 optimization, the exact variables or elements for which there are
7625 warnings depend on the precise optimization options and version of GCC
7626 used.
7628 Note that there may be no warning about a variable that is used only
7629 to compute a value that itself is never used, because such
7630 computations may be deleted by data flow analysis before the warnings
7631 are printed.
7633 In C++, this warning also warns about using uninitialized objects in
7634 member-initializer-lists.  For example, GCC warns about @code{b} being
7635 uninitialized in the following snippet:
7637 @smallexample
7638 struct A @{
7639   int a;
7640   int b;
7641   A() : a(b) @{ @}
7643 @end smallexample
7645 @opindex Winvalid-memory-model
7646 @opindex Wno-invalid-memory-model
7647 @item -Wno-invalid-memory-model
7648 This option controls warnings
7649 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
7650 and the C11 atomic generic functions with a memory consistency argument
7651 that is either invalid for the operation or outside the range of values
7652 of the @code{memory_order} enumeration.  For example, since the
7653 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
7654 defined for the relaxed, release, and sequentially consistent memory
7655 orders the following code is diagnosed:
7657 @smallexample
7658 void store (int *i)
7660   __atomic_store_n (i, 0, memory_order_consume);
7662 @end smallexample
7664 @option{-Winvalid-memory-model} is enabled by default.
7666 @opindex Wmaybe-uninitialized
7667 @opindex Wno-maybe-uninitialized
7668 @item -Wmaybe-uninitialized
7669 For an object with automatic or allocated storage duration, if there exists
7670 a path from the function entry to a use of the object that is initialized,
7671 but there exist some other paths for which the object is not initialized,
7672 the compiler emits a warning if it cannot prove the uninitialized paths
7673 are not executed at run time.
7675 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7676 object to a @code{const}-qualified function argument is also diagnosed by
7677 this warning.  (@option{-Wuninitialized} is issued for built-in functions
7678 known to read the object.)  Annotating the function with attribute
7679 @code{access (none)} indicates that the argument isn't used to access
7680 the object and avoids the warning (@pxref{Common Function Attributes}).
7682 These warnings are only possible in optimizing compilation, because otherwise
7683 GCC does not keep track of the state of variables.
7685 These warnings are made optional because GCC may not be able to determine when
7686 the code is correct in spite of appearing to have an error.  Here is one
7687 example of how this can happen:
7689 @smallexample
7690 @group
7692   int x;
7693   switch (y)
7694     @{
7695     case 1: x = 1;
7696       break;
7697     case 2: x = 4;
7698       break;
7699     case 3: x = 5;
7700     @}
7701   foo (x);
7703 @end group
7704 @end smallexample
7706 @noindent
7707 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
7708 always initialized, but GCC doesn't know this. To suppress the
7709 warning, you need to provide a default case with assert(0) or
7710 similar code.
7712 @cindex @code{longjmp} warnings
7713 This option also warns when a non-volatile automatic variable might be
7714 changed by a call to @code{longjmp}.
7715 The compiler sees only the calls to @code{setjmp}.  It cannot know
7716 where @code{longjmp} will be called; in fact, a signal handler could
7717 call it at any point in the code.  As a result, you may get a warning
7718 even when there is in fact no problem because @code{longjmp} cannot
7719 in fact be called at the place that would cause a problem.
7721 Some spurious warnings can be avoided if you declare all the functions
7722 you use that never return as @code{noreturn}.  @xref{Function
7723 Attributes}.
7725 This warning is enabled by @option{-Wall} or @option{-Wextra}.
7727 @opindex Wunknown-pragmas
7728 @opindex Wno-unknown-pragmas
7729 @cindex warning for unknown pragmas
7730 @cindex unknown pragmas, warning
7731 @cindex pragmas, warning of unknown
7732 @item -Wunknown-pragmas
7733 Warn when a @code{#pragma} directive is encountered that is not understood by 
7734 GCC@.  If this command-line option is used, warnings are even issued
7735 for unknown pragmas in system header files.  This is not the case if
7736 the warnings are only enabled by the @option{-Wall} command-line option.
7738 @opindex Wno-pragmas
7739 @opindex Wpragmas
7740 @item -Wno-pragmas
7741 Do not warn about misuses of pragmas, such as incorrect parameters,
7742 invalid syntax, or conflicts between pragmas.  See also
7743 @option{-Wunknown-pragmas}.
7745 @opindex Wno-prio-ctor-dtor
7746 @opindex Wprio-ctor-dtor
7747 @item -Wno-prio-ctor-dtor
7748 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
7749 The use of constructor and destructor attributes allow you to assign a
7750 priority to the constructor/destructor to control its order of execution
7751 before @code{main} is called or after it returns.  The priority values must be
7752 greater than 100 as the compiler reserves priority values between 0--100 for
7753 the implementation.
7755 @opindex Wstrict-aliasing
7756 @opindex Wno-strict-aliasing
7757 @item -Wstrict-aliasing
7758 This option is only active when @option{-fstrict-aliasing} is active.
7759 It warns about code that might break the strict aliasing rules that the
7760 compiler is using for optimization.  The warning does not catch all
7761 cases, but does attempt to catch the more common pitfalls.  It is
7762 included in @option{-Wall}.
7763 It is equivalent to @option{-Wstrict-aliasing=3}
7765 @opindex Wstrict-aliasing=n
7766 @item -Wstrict-aliasing=n
7767 This option is only active when @option{-fstrict-aliasing} is active.
7768 It warns about code that might break the strict aliasing rules that the
7769 compiler is using for optimization.
7770 Higher levels correspond to higher accuracy (fewer false positives).
7771 Higher levels also correspond to more effort, similar to the way @option{-O} 
7772 works.
7773 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
7775 Level 1: Most aggressive, quick, least accurate.
7776 Possibly useful when higher levels
7777 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
7778 false negatives.  However, it has many false positives.
7779 Warns for all pointer conversions between possibly incompatible types,
7780 even if never dereferenced.  Runs in the front end only.
7782 Level 2: Aggressive, quick, not too precise.
7783 May still have many false positives (not as many as level 1 though),
7784 and few false negatives (but possibly more than level 1).
7785 Unlike level 1, it only warns when an address is taken.  Warns about
7786 incomplete types.  Runs in the front end only.
7788 Level 3 (default for @option{-Wstrict-aliasing}):
7789 Should have very few false positives and few false
7790 negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
7791 Takes care of the common pun+dereference pattern in the front end:
7792 @code{*(int*)&some_float}.
7793 If optimization is enabled, it also runs in the back end, where it deals
7794 with multiple statement cases using flow-sensitive points-to information.
7795 Only warns when the converted pointer is dereferenced.
7796 Does not warn about incomplete types.
7798 @opindex Wstrict-overflow
7799 @opindex Wno-strict-overflow
7800 @item -Wstrict-overflow
7801 @itemx -Wstrict-overflow=@var{n}
7802 This option is only active when signed overflow is undefined.
7803 It warns about cases where the compiler optimizes based on the
7804 assumption that signed overflow does not occur.  Note that it does not
7805 warn about all cases where the code might overflow: it only warns
7806 about cases where the compiler implements some optimization.  Thus
7807 this warning depends on the optimization level.
7809 An optimization that assumes that signed overflow does not occur is
7810 perfectly safe if the values of the variables involved are such that
7811 overflow never does, in fact, occur.  Therefore this warning can
7812 easily give a false positive: a warning about code that is not
7813 actually a problem.  To help focus on important issues, several
7814 warning levels are defined.  No warnings are issued for the use of
7815 undefined signed overflow when estimating how many iterations a loop
7816 requires, in particular when determining whether a loop will be
7817 executed at all.
7819 @table @gcctabopt
7820 @item -Wstrict-overflow=1
7821 Warn about cases that are both questionable and easy to avoid.  For
7822 example the compiler simplifies
7823 @code{x + 1 > x} to @code{1}.  This level of
7824 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
7825 are not, and must be explicitly requested.
7827 @item -Wstrict-overflow=2
7828 Also warn about other cases where a comparison is simplified to a
7829 constant.  For example: @code{abs (x) >= 0}.  This can only be
7830 simplified when signed integer overflow is undefined, because
7831 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
7832 zero.  @option{-Wstrict-overflow} (with no level) is the same as
7833 @option{-Wstrict-overflow=2}.
7835 @item -Wstrict-overflow=3
7836 Also warn about other cases where a comparison is simplified.  For
7837 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
7839 @item -Wstrict-overflow=4
7840 Also warn about other simplifications not covered by the above cases.
7841 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
7843 @item -Wstrict-overflow=5
7844 Also warn about cases where the compiler reduces the magnitude of a
7845 constant involved in a comparison.  For example: @code{x + 2 > y} is
7846 simplified to @code{x + 1 >= y}.  This is reported only at the
7847 highest warning level because this simplification applies to many
7848 comparisons, so this warning level gives a very large number of
7849 false positives.
7850 @end table
7852 @opindex Wstring-compare
7853 @opindex Wno-string-compare
7854 @item -Wstring-compare
7855 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
7856 determined to be either zero or non-zero in tests for such equality
7857 owing to the length of one argument being greater than the size of
7858 the array the other argument is stored in (or the bound in the case
7859 of @code{strncmp}).  Such calls could be mistakes.  For example,
7860 the call to @code{strcmp} below is diagnosed because its result is
7861 necessarily non-zero irrespective of the contents of the array @code{a}.
7863 @smallexample
7864 extern char a[4];
7865 void f (char *d)
7867   strcpy (d, "string");
7868   @dots{}
7869   if (0 == strcmp (a, d))   // cannot be true
7870     puts ("a and d are the same");
7872 @end smallexample
7874 @option{-Wstring-compare} is enabled by @option{-Wextra}.
7876 @opindex Wstringop-overflow
7877 @opindex Wno-stringop-overflow
7878 @item -Wno-stringop-overflow
7879 @item -Wstringop-overflow
7880 @itemx -Wstringop-overflow=@var{type}
7881 Warn for calls to string manipulation functions such as @code{memcpy} and
7882 @code{strcpy} that are determined to overflow the destination buffer.  The
7883 optional argument is one greater than the type of Object Size Checking to
7884 perform to determine the size of the destination.  @xref{Object Size Checking}.
7885 The argument is meaningful only for functions that operate on character arrays
7886 but not for raw memory functions like @code{memcpy} which always make use
7887 of Object Size type-0.  The option also warns for calls that specify a size
7888 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
7889 The option produces the best results with optimization enabled but can detect
7890 a small subset of simple buffer overflows even without optimization in
7891 calls to the GCC built-in functions like @code{__builtin_memcpy} that
7892 correspond to the standard functions.  In any case, the option warns about
7893 just a subset of buffer overflows detected by the corresponding overflow
7894 checking built-ins.  For example, the option issues a warning for
7895 the @code{strcpy} call below because it copies at least 5 characters
7896 (the string @code{"blue"} including the terminating NUL) into the buffer
7897 of size 4.
7899 @smallexample
7900 enum Color @{ blue, purple, yellow @};
7901 const char* f (enum Color clr)
7903   static char buf [4];
7904   const char *str;
7905   switch (clr)
7906     @{
7907       case blue: str = "blue"; break;
7908       case purple: str = "purple"; break;
7909       case yellow: str = "yellow"; break;
7910     @}
7912   return strcpy (buf, str);   // warning here
7914 @end smallexample
7916 Option @option{-Wstringop-overflow=2} is enabled by default.
7918 @table @gcctabopt
7919 @opindex Wstringop-overflow
7920 @opindex Wno-stringop-overflow
7921 @item -Wstringop-overflow
7922 @itemx -Wstringop-overflow=1
7923 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
7924 to determine the sizes of destination objects.  At this setting the option
7925 does not warn for writes past the end of subobjects of larger objects accessed
7926 by pointers unless the size of the largest surrounding object is known.  When
7927 the destination may be one of several objects it is assumed to be the largest
7928 one of them.  On Linux systems, when optimization is enabled at this setting
7929 the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
7930 is defined to a non-zero value.
7932 @item -Wstringop-overflow=2
7933 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
7934 to determine the sizes of destination objects.  At this setting the option
7935 warns about overflows when writing to members of the largest complete
7936 objects whose exact size is known.  However, it does not warn for excessive
7937 writes to the same members of unknown objects referenced by pointers since
7938 they may point to arrays containing unknown numbers of elements.  This is
7939 the default setting of the option.
7941 @item -Wstringop-overflow=3
7942 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
7943 to determine the sizes of destination objects.  At this setting the option
7944 warns about overflowing the smallest object or data member.  This is the
7945 most restrictive setting of the option that may result in warnings for safe
7946 code.
7948 @item -Wstringop-overflow=4
7949 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
7950 to determine the sizes of destination objects.  At this setting the option
7951 warns about overflowing any data members, and when the destination is
7952 one of several objects it uses the size of the largest of them to decide
7953 whether to issue a warning.  Similarly to @option{-Wstringop-overflow=3} this
7954 setting of the option may result in warnings for benign code.
7955 @end table
7957 @opindex Wstringop-overread
7958 @opindex Wno-stringop-overread
7959 @item -Wno-stringop-overread
7960 Warn for calls to string manipulation functions such as @code{memchr}, or
7961 @code{strcpy} that are determined to read past the end of the source
7962 sequence.
7964 Option @option{-Wstringop-overread} is enabled by default.
7966 @opindex Wstringop-truncation
7967 @opindex Wno-stringop-truncation
7968 @item -Wno-stringop-truncation
7969 Do not warn for calls to bounded string manipulation functions
7970 such as @code{strncat},
7971 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
7972 or leave the destination unchanged.
7974 In the following example, the call to @code{strncat} specifies a bound that
7975 is less than the length of the source string.  As a result, the copy of
7976 the source will be truncated and so the call is diagnosed.  To avoid the
7977 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
7979 @smallexample
7980 void append (char *buf, size_t bufsize)
7982   strncat (buf, ".txt", 3);
7984 @end smallexample
7986 As another example, the following call to @code{strncpy} results in copying
7987 to @code{d} just the characters preceding the terminating NUL, without
7988 appending the NUL to the end.  Assuming the result of @code{strncpy} is
7989 necessarily a NUL-terminated string is a common mistake, and so the call
7990 is diagnosed.  To avoid the warning when the result is not expected to be
7991 NUL-terminated, call @code{memcpy} instead.
7993 @smallexample
7994 void copy (char *d, const char *s)
7996   strncpy (d, s, strlen (s));
7998 @end smallexample
8000 In the following example, the call to @code{strncpy} specifies the size
8001 of the destination buffer as the bound.  If the length of the source
8002 string is equal to or greater than this size the result of the copy will
8003 not be NUL-terminated.  Therefore, the call is also diagnosed.  To avoid
8004 the warning, specify @code{sizeof buf - 1} as the bound and set the last
8005 element of the buffer to @code{NUL}.
8007 @smallexample
8008 void copy (const char *s)
8010   char buf[80];
8011   strncpy (buf, s, sizeof buf);
8012   @dots{}
8014 @end smallexample
8016 In situations where a character array is intended to store a sequence
8017 of bytes with no terminating @code{NUL} such an array may be annotated
8018 with attribute @code{nonstring} to avoid this warning.  Such arrays,
8019 however, are not suitable arguments to functions that expect
8020 @code{NUL}-terminated strings.  To help detect accidental misuses of
8021 such arrays GCC issues warnings unless it can prove that the use is
8022 safe.  @xref{Common Variable Attributes}.
8024 @opindex Wstrict-flex-arrays
8025 @opindex Wno-strict-flex-arrays
8026 @item -Wstrict-flex-arrays
8027 Warn about inproper usages of flexible array members
8028 according to the @var{level} of the @code{strict_flex_array (@var{level})}
8029 attribute attached to the trailing array field of a structure if it's
8030 available, otherwise according to the @var{level} of the option
8031 @option{-fstrict-flex-arrays=@var{level}}.
8033 This option is effective only when @var{level} is bigger than 0.  Otherwise,
8034 it will be ignored with a warning.
8036 when @var{level}=1, warnings will be issued for a trailing array reference
8037 of a structure that have 2 or more elements if the trailing array is referenced
8038 as a flexible array member.
8040 when @var{level}=2, in addition to @var{level}=1, additional warnings will be
8041 issued for a trailing one-element array reference of a structure
8042 if the array is referenced as a flexible array member.
8044 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
8045 issued for a trailing zero-length array reference of a structure
8046 if the array is referenced as a flexible array member.
8049 @opindex Wsuggest-attribute=
8050 @opindex Wno-suggest-attribute=
8051 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
8052 Warn for cases where adding an attribute may be beneficial. The
8053 attributes currently supported are listed below.
8055 @table @gcctabopt
8056 @opindex Wsuggest-attribute=pure
8057 @opindex Wno-suggest-attribute=pure
8058 @opindex Wsuggest-attribute=const
8059 @opindex Wno-suggest-attribute=const
8060 @opindex Wsuggest-attribute=noreturn
8061 @opindex Wno-suggest-attribute=noreturn
8062 @opindex Wmissing-noreturn
8063 @opindex Wno-missing-noreturn
8064 @opindex Wsuggest-attribute=malloc
8065 @opindex Wno-suggest-attribute=malloc
8066 @item -Wsuggest-attribute=pure
8067 @itemx -Wsuggest-attribute=const
8068 @itemx -Wsuggest-attribute=noreturn
8069 @itemx -Wmissing-noreturn
8070 @itemx -Wsuggest-attribute=malloc
8072 Warn about functions that might be candidates for attributes
8073 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
8074 only warns for functions visible in other compilation units or (in the case of
8075 @code{pure} and @code{const}) if it cannot prove that the function returns
8076 normally. A function returns normally if it doesn't contain an infinite loop or
8077 return abnormally by throwing, calling @code{abort} or trapping.  This analysis
8078 requires option @option{-fipa-pure-const}, which is enabled by default at
8079 @option{-O} and higher.  Higher optimization levels improve the accuracy
8080 of the analysis.
8082 @opindex Wsuggest-attribute=format
8083 @opindex Wmissing-format-attribute
8084 @opindex Wno-suggest-attribute=format
8085 @opindex Wno-missing-format-attribute
8086 @opindex Wformat
8087 @opindex Wno-format
8088 @item -Wsuggest-attribute=format
8089 @itemx -Wmissing-format-attribute
8091 Warn about function pointers that might be candidates for @code{format}
8092 attributes.  Note these are only possible candidates, not absolute ones.
8093 GCC guesses that function pointers with @code{format} attributes that
8094 are used in assignment, initialization, parameter passing or return
8095 statements should have a corresponding @code{format} attribute in the
8096 resulting type.  I.e.@: the left-hand side of the assignment or
8097 initialization, the type of the parameter variable, or the return type
8098 of the containing function respectively should also have a @code{format}
8099 attribute to avoid the warning.
8101 GCC also warns about function definitions that might be
8102 candidates for @code{format} attributes.  Again, these are only
8103 possible candidates.  GCC guesses that @code{format} attributes
8104 might be appropriate for any function that calls a function like
8105 @code{vprintf} or @code{vscanf}, but this might not always be the
8106 case, and some functions for which @code{format} attributes are
8107 appropriate may not be detected.
8109 @opindex Wsuggest-attribute=cold
8110 @opindex Wno-suggest-attribute=cold
8111 @item -Wsuggest-attribute=cold
8113 Warn about functions that might be candidates for @code{cold} attribute.  This
8114 is based on static detection and generally only warns about functions which
8115 always leads to a call to another @code{cold} function such as wrappers of
8116 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
8117 @end table
8119 @opindex Wno-alloc-zero
8120 @opindex Walloc-zero
8121 @item -Walloc-zero
8122 Warn about calls to allocation functions decorated with attribute
8123 @code{alloc_size} that specify zero bytes, including those to the built-in
8124 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
8125 @code{malloc}, and @code{realloc}.  Because the behavior of these functions
8126 when called with a zero size differs among implementations (and in the case
8127 of @code{realloc} has been deprecated) relying on it may result in subtle
8128 portability bugs and should be avoided.
8130 @opindex Walloc-size-larger-than=
8131 @opindex Wno-alloc-size-larger-than
8132 @item -Walloc-size-larger-than=@var{byte-size}
8133 Warn about calls to functions decorated with attribute @code{alloc_size}
8134 that attempt to allocate objects larger than the specified number of bytes,
8135 or where the result of the size computation in an integer type with infinite
8136 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
8137 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8138 Warnings controlled by the option can be disabled either by specifying
8139 @var{byte-size} of @samp{SIZE_MAX} or more or by
8140 @option{-Wno-alloc-size-larger-than}.
8141 @xref{Function Attributes}.
8143 @opindex Wno-alloc-size-larger-than
8144 @item -Wno-alloc-size-larger-than
8145 Disable @option{-Walloc-size-larger-than=} warnings.  The option is
8146 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
8147 larger.
8149 @opindex Wno-alloca
8150 @opindex Walloca
8151 @item -Walloca
8152 This option warns on all uses of @code{alloca} in the source.
8154 @opindex Walloca-larger-than=
8155 @opindex Wno-alloca-larger-than
8156 @item -Walloca-larger-than=@var{byte-size}
8157 This option warns on calls to @code{alloca} with an integer argument whose
8158 value is either zero, or that is not bounded by a controlling predicate
8159 that limits its value to at most @var{byte-size}.  It also warns for calls
8160 to @code{alloca} where the bound value is unknown.  Arguments of non-integer
8161 types are considered unbounded even if they appear to be constrained to
8162 the expected range.
8164 For example, a bounded case of @code{alloca} could be:
8166 @smallexample
8167 void func (size_t n)
8169   void *p;
8170   if (n <= 1000)
8171     p = alloca (n);
8172   else
8173     p = malloc (n);
8174   f (p);
8176 @end smallexample
8178 In the above example, passing @code{-Walloca-larger-than=1000} would not
8179 issue a warning because the call to @code{alloca} is known to be at most
8180 1000 bytes.  However, if @code{-Walloca-larger-than=500} were passed,
8181 the compiler would emit a warning.
8183 Unbounded uses, on the other hand, are uses of @code{alloca} with no
8184 controlling predicate constraining its integer argument.  For example:
8186 @smallexample
8187 void func ()
8189   void *p = alloca (n);
8190   f (p);
8192 @end smallexample
8194 If @code{-Walloca-larger-than=500} were passed, the above would trigger
8195 a warning, but this time because of the lack of bounds checking.
8197 Note, that even seemingly correct code involving signed integers could
8198 cause a warning:
8200 @smallexample
8201 void func (signed int n)
8203   if (n < 500)
8204     @{
8205       p = alloca (n);
8206       f (p);
8207     @}
8209 @end smallexample
8211 In the above example, @var{n} could be negative, causing a larger than
8212 expected argument to be implicitly cast into the @code{alloca} call.
8214 This option also warns when @code{alloca} is used in a loop.
8216 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
8217 but is usually only effective  when @option{-ftree-vrp} is active (default
8218 for @option{-O2} and above).
8220 See also @option{-Wvla-larger-than=}@samp{byte-size}.
8222 @opindex Wno-alloca-larger-than
8223 @item -Wno-alloca-larger-than
8224 Disable @option{-Walloca-larger-than=} warnings.  The option is
8225 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
8227 @opindex Warith-conversion
8228 @opindex Wno-arith-conversion
8229 @item -Warith-conversion
8230 Do warn about implicit conversions from arithmetic operations even
8231 when conversion of the operands to the same type cannot change their
8232 values.  This affects warnings from @option{-Wconversion},
8233 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
8235 @smallexample
8236 @group
8237 void f (char c, int i)
8239   c = c + i; // warns with @option{-Wconversion}
8240   c = c + 1; // only warns with @option{-Warith-conversion}
8242 @end group
8243 @end smallexample
8245 @opindex Wno-array-bounds
8246 @opindex Warray-bounds
8247 @item -Warray-bounds
8248 @itemx -Warray-bounds=@var{n}
8249 Warn about out of bounds subscripts or offsets into arrays.  This warning
8250 is enabled by @option{-Wall}.  It is more effective when @option{-ftree-vrp}
8251 is active (the default for @option{-O2} and above) but a subset of instances
8252 are issued even without optimization.
8254 By default, the trailing array of a structure will be treated as a flexible
8255 array member by @option{-Warray-bounds} or @option{-Warray-bounds=@var{n}}
8256 if it is declared as either a flexible array member per C99 standard onwards
8257 (@samp{[]}), a GCC zero-length array extension (@samp{[0]}), or an one-element
8258 array (@samp{[1]}). As a result, out of bounds subscripts or offsets into
8259 zero-length arrays or one-element arrays are not warned by default.
8261 You can add the option @option{-fstrict-flex-arrays} or
8262 @option{-fstrict-flex-arrays=@var{level}} to control how this
8263 option treat trailing array of a structure as a flexible array member:
8265 when @var{level}<=1, no change to the default behavior.
8267 when @var{level}=2, additional warnings will be issued for out of bounds
8268 subscripts or offsets into one-element arrays;
8270 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
8271 issued for out of bounds subscripts or offsets into zero-length arrays.
8273 @table @gcctabopt
8274 @item -Warray-bounds=1
8275 This is the default warning level of @option{-Warray-bounds} and is enabled
8276 by @option{-Wall}; higher levels are not, and must be explicitly requested.
8278 @item -Warray-bounds=2
8279 This warning level also warns about the intermediate results of pointer
8280 arithmetic that may yield out of bounds values. This warning level may
8281 give a larger number of false positives and is deactivated by default.
8282 @end table
8284 @opindex Warray-compare
8285 @opindex Wno-array-compare
8286 @item -Warray-compare
8287 Warn about equality and relational comparisons between two operands of array
8288 type.  This comparison was deprecated in C++20.  For example:
8290 @smallexample
8291 int arr1[5];
8292 int arr2[5];
8293 bool same = arr1 == arr2;
8294 @end smallexample
8296 @option{-Warray-compare} is enabled by @option{-Wall}.
8298 @opindex Wno-array-parameter
8299 @item -Warray-parameter
8300 @itemx -Warray-parameter=@var{n}
8301 Warn about redeclarations of functions involving arguments of array or
8302 pointer types of inconsistent kinds or forms, and enable the detection
8303 of out-of-bounds accesses to such parameters by warnings such as
8304 @option{-Warray-bounds}.
8306 If the first function declaration uses the array form the bound specified
8307 in the array is assumed to be the minimum number of elements expected to
8308 be provided in calls to the function and the maximum number of elements
8309 accessed by it.  Failing to provide arguments of sufficient size or accessing
8310 more than the maximum number of elements may be diagnosed by warnings such
8311 as @option{-Warray-bounds}.  At level 1 the warning diagnoses inconsistencies
8312 involving array parameters declared using the @code{T[static N]} form.
8314 For example, the warning triggers for the following redeclarations because
8315 the first one allows an array of any size to be passed to @code{f} while
8316 the second one with the keyword @code{static} specifies that the array
8317 argument must have at least four elements.
8319 @smallexample
8320 void f (int[static 4]);
8321 void f (int[]);           // warning (inconsistent array form)
8323 void g (void)
8325   int *p = (int *)malloc (4);
8326   f (p);                  // warning (array too small)
8327   @dots{}
8329 @end smallexample
8331 At level 2 the warning also triggers for redeclarations involving any other
8332 inconsistency in array or pointer argument forms denoting array sizes.
8333 Pointers and arrays of unspecified bound are considered equivalent and do
8334 not trigger a warning.
8336 @smallexample
8337 void g (int*);
8338 void g (int[]);     // no warning
8339 void g (int[8]);    // warning (inconsistent array bound)
8340 @end smallexample
8342 @option{-Warray-parameter=2} is included in @option{-Wall}.  The
8343 @option{-Wvla-parameter} option triggers warnings for similar inconsistencies
8344 involving Variable Length Array arguments.
8346 @opindex Wattribute-alias
8347 @opindex Wno-attribute-alias
8348 @item -Wattribute-alias=@var{n}
8349 @itemx -Wno-attribute-alias
8350 Warn about declarations using the @code{alias} and similar attributes whose
8351 target is incompatible with the type of the alias.
8352 @xref{Function Attributes,,Declaring Attributes of Functions}.
8354 @table @gcctabopt
8355 @item -Wattribute-alias=1
8356 The default warning level of the @option{-Wattribute-alias} option diagnoses
8357 incompatibilities between the type of the alias declaration and that of its
8358 target.  Such incompatibilities are typically indicative of bugs.
8360 @item -Wattribute-alias=2
8362 At this level @option{-Wattribute-alias} also diagnoses cases where
8363 the attributes of the alias declaration are more restrictive than the
8364 attributes applied to its target.  These mismatches can potentially
8365 result in incorrect code generation.  In other cases they may be
8366 benign and could be resolved simply by adding the missing attribute to
8367 the target.  For comparison, see the @option{-Wmissing-attributes}
8368 option, which controls diagnostics when the alias declaration is less
8369 restrictive than the target, rather than more restrictive.
8371 Attributes considered include @code{alloc_align}, @code{alloc_size},
8372 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
8373 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
8374 @code{returns_nonnull}, and @code{returns_twice}.
8375 @end table
8377 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
8378 This is the default.  You can disable these warnings with either
8379 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
8381 @opindex Wbidi-chars=
8382 @opindex Wbidi-chars
8383 @opindex Wno-bidi-chars
8384 @item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
8385 Warn about possibly misleading UTF-8 bidirectional control characters in
8386 comments, string literals, character constants, and identifiers.  Such
8387 characters can change left-to-right writing direction into right-to-left
8388 (and vice versa), which can cause confusion between the logical order and
8389 visual order.  This may be dangerous; for instance, it may seem that a piece
8390 of code is not commented out, whereas it in fact is.
8392 There are three levels of warning supported by GCC@.  The default is
8393 @option{-Wbidi-chars=unpaired}, which warns about improperly terminated
8394 bidi contexts.  @option{-Wbidi-chars=none} turns the warning off.
8395 @option{-Wbidi-chars=any} warns about any use of bidirectional control
8396 characters.
8398 By default, this warning does not warn about UCNs.  It is, however, possible
8399 to turn on such checking by using @option{-Wbidi-chars=unpaired,ucn} or
8400 @option{-Wbidi-chars=any,ucn}.  Using @option{-Wbidi-chars=ucn} is valid,
8401 and is equivalent to @option{-Wbidi-chars=unpaired,ucn}, if no previous
8402 @option{-Wbidi-chars=any} was specified.
8404 @opindex Wno-bool-compare
8405 @opindex Wbool-compare
8406 @item -Wbool-compare
8407 Warn about boolean expression compared with an integer value different from
8408 @code{true}/@code{false}.  For instance, the following comparison is
8409 always false:
8410 @smallexample
8411 int n = 5;
8412 @dots{}
8413 if ((n > 1) == 2) @{ @dots{} @}
8414 @end smallexample
8415 This warning is enabled by @option{-Wall}.
8417 @opindex Wno-bool-operation
8418 @opindex Wbool-operation
8419 @item -Wbool-operation
8420 Warn about suspicious operations on expressions of a boolean type.  For
8421 instance, bitwise negation of a boolean is very likely a bug in the program.
8422 For C, this warning also warns about incrementing or decrementing a boolean,
8423 which rarely makes sense.  (In C++, decrementing a boolean is always invalid.
8424 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
8426 This warning is enabled by @option{-Wall}.
8428 @opindex Wno-duplicated-branches
8429 @opindex Wduplicated-branches
8430 @item -Wduplicated-branches
8431 Warn when an if-else has identical branches.  This warning detects cases like
8432 @smallexample
8433 if (p != NULL)
8434   return 0;
8435 else
8436   return 0;
8437 @end smallexample
8438 It doesn't warn when both branches contain just a null statement.  This warning
8439 also warn for conditional operators:
8440 @smallexample
8441   int i = x ? *p : *p;
8442 @end smallexample
8444 @opindex Wno-duplicated-cond
8445 @opindex Wduplicated-cond
8446 @item -Wduplicated-cond
8447 Warn about duplicated conditions in an if-else-if chain.  For instance,
8448 warn for the following code:
8449 @smallexample
8450 if (p->q != NULL) @{ @dots{} @}
8451 else if (p->q != NULL) @{ @dots{} @}
8452 @end smallexample
8454 @opindex Wno-frame-address
8455 @opindex Wframe-address
8456 @item -Wframe-address
8457 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
8458 is called with an argument greater than 0.  Such calls may return indeterminate
8459 values or crash the program.  The warning is included in @option{-Wall}.
8461 @opindex Wno-discarded-qualifiers
8462 @opindex Wdiscarded-qualifiers
8463 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
8464 Do not warn if type qualifiers on pointers are being discarded.
8465 Typically, the compiler warns if a @code{const char *} variable is
8466 passed to a function that takes a @code{char *} parameter.  This option
8467 can be used to suppress such a warning.
8469 @opindex Wno-discarded-array-qualifiers
8470 @opindex Wdiscarded-array-qualifiers
8471 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
8472 Do not warn if type qualifiers on arrays which are pointer targets
8473 are being discarded.  Typically, the compiler warns if a
8474 @code{const int (*)[]} variable is passed to a function that
8475 takes a @code{int (*)[]} parameter.  This option can be used to
8476 suppress such a warning.
8478 @opindex Wno-incompatible-pointer-types
8479 @opindex Wincompatible-pointer-types
8480 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
8481 Do not warn when there is a conversion between pointers that have incompatible
8482 types.  This warning is for cases not covered by @option{-Wno-pointer-sign},
8483 which warns for pointer argument passing or assignment with different
8484 signedness.
8486 This warning is upgraded to an error by @option{-pedantic-errors}.
8488 @opindex Wno-int-conversion
8489 @opindex Wint-conversion
8490 @item -Wno-int-conversion @r{(C and Objective-C only)}
8491 Do not warn about incompatible integer to pointer and pointer to integer
8492 conversions.  This warning is about implicit conversions; for explicit
8493 conversions the warnings @option{-Wno-int-to-pointer-cast} and
8494 @option{-Wno-pointer-to-int-cast} may be used.
8496 This warning is upgraded to an error by @option{-pedantic-errors}.
8498 @opindex Wzero-length-bounds
8499 @opindex Wzero-length-bounds
8500 @item -Wzero-length-bounds
8501 Warn about accesses to elements of zero-length array members that might
8502 overlap other members of the same object.  Declaring interior zero-length
8503 arrays is discouraged because accesses to them are undefined.
8504 @xref{Zero Length}.
8506 For example, the first two stores in function @code{bad} are diagnosed
8507 because the array elements overlap the subsequent members @code{b} and
8508 @code{c}.  The third store is diagnosed by @option{-Warray-bounds}
8509 because it is beyond the bounds of the enclosing object.
8511 @smallexample
8512 struct X @{ int a[0]; int b, c; @};
8513 struct X x;
8515 void bad (void)
8517   x.a[0] = 0;   // -Wzero-length-bounds
8518   x.a[1] = 1;   // -Wzero-length-bounds
8519   x.a[2] = 2;   // -Warray-bounds
8521 @end smallexample
8523 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
8525 @opindex Wno-div-by-zero
8526 @opindex Wdiv-by-zero
8527 @item -Wno-div-by-zero
8528 Do not warn about compile-time integer division by zero.  Floating-point
8529 division by zero is not warned about, as it can be a legitimate way of
8530 obtaining infinities and NaNs.
8532 @opindex Wsystem-headers
8533 @opindex Wno-system-headers
8534 @cindex warnings from system headers
8535 @cindex system headers, warnings from
8536 @item -Wsystem-headers
8537 Print warning messages for constructs found in system header files.
8538 Warnings from system headers are normally suppressed, on the assumption
8539 that they usually do not indicate real problems and would only make the
8540 compiler output harder to read.  Using this command-line option tells
8541 GCC to emit warnings from system headers as if they occurred in user
8542 code.  However, note that using @option{-Wall} in conjunction with this
8543 option does @emph{not} warn about unknown pragmas in system
8544 headers---for that, @option{-Wunknown-pragmas} must also be used.
8546 @opindex Wtautological-compare
8547 @opindex Wno-tautological-compare
8548 @item -Wtautological-compare
8549 Warn if a self-comparison always evaluates to true or false.  This
8550 warning detects various mistakes such as:
8551 @smallexample
8552 int i = 1;
8553 @dots{}
8554 if (i > i) @{ @dots{} @}
8555 @end smallexample
8557 This warning also warns about bitwise comparisons that always evaluate
8558 to true or false, for instance:
8559 @smallexample
8560 if ((a & 16) == 10) @{ @dots{} @}
8561 @end smallexample
8562 will always be false.
8564 This warning is enabled by @option{-Wall}.
8566 @opindex Wtrampolines
8567 @opindex Wno-trampolines
8568 @item -Wtrampolines
8569 Warn about trampolines generated for pointers to nested functions.
8570 A trampoline is a small piece of data or code that is created at run
8571 time on the stack when the address of a nested function is taken, and is
8572 used to call the nested function indirectly.  For some targets, it is
8573 made up of data only and thus requires no special treatment.  But, for
8574 most targets, it is made up of code and thus requires the stack to be
8575 made executable in order for the program to work properly.
8577 @opindex Wfloat-equal
8578 @opindex Wno-float-equal
8579 @item -Wfloat-equal
8580 Warn if floating-point values are used in equality comparisons.
8582 The idea behind this is that sometimes it is convenient (for the
8583 programmer) to consider floating-point values as approximations to
8584 infinitely precise real numbers.  If you are doing this, then you need
8585 to compute (by analyzing the code, or in some other way) the maximum or
8586 likely maximum error that the computation introduces, and allow for it
8587 when performing comparisons (and when producing output, but that's a
8588 different problem).  In particular, instead of testing for equality, you
8589 should check to see whether the two values have ranges that overlap; and
8590 this is done with the relational operators, so equality comparisons are
8591 probably mistaken.
8593 @opindex Wtraditional
8594 @opindex Wno-traditional
8595 @item -Wtraditional @r{(C and Objective-C only)}
8596 Warn about certain constructs that behave differently in traditional and
8597 ISO C@.  Also warn about ISO C constructs that have no traditional C
8598 equivalent, and/or problematic constructs that should be avoided.
8600 @itemize @bullet
8601 @item
8602 Macro parameters that appear within string literals in the macro body.
8603 In traditional C macro replacement takes place within string literals,
8604 but in ISO C it does not.
8606 @item
8607 In traditional C, some preprocessor directives did not exist.
8608 Traditional preprocessors only considered a line to be a directive
8609 if the @samp{#} appeared in column 1 on the line.  Therefore
8610 @option{-Wtraditional} warns about directives that traditional C
8611 understands but ignores because the @samp{#} does not appear as the
8612 first character on the line.  It also suggests you hide directives like
8613 @code{#pragma} not understood by traditional C by indenting them.  Some
8614 traditional implementations do not recognize @code{#elif}, so this option
8615 suggests avoiding it altogether.
8617 @item
8618 A function-like macro that appears without arguments.
8620 @item
8621 The unary plus operator.
8623 @item
8624 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
8625 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
8626 constants.)  Note, these suffixes appear in macros defined in the system
8627 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
8628 Use of these macros in user code might normally lead to spurious
8629 warnings, however GCC's integrated preprocessor has enough context to
8630 avoid warning in these cases.
8632 @item
8633 A function declared external in one block and then used after the end of
8634 the block.
8636 @item
8637 A @code{switch} statement has an operand of type @code{long}.
8639 @item
8640 A non-@code{static} function declaration follows a @code{static} one.
8641 This construct is not accepted by some traditional C compilers.
8643 @item
8644 The ISO type of an integer constant has a different width or
8645 signedness from its traditional type.  This warning is only issued if
8646 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
8647 typically represent bit patterns, are not warned about.
8649 @item
8650 Usage of ISO string concatenation is detected.
8652 @item
8653 Initialization of automatic aggregates.
8655 @item
8656 Identifier conflicts with labels.  Traditional C lacks a separate
8657 namespace for labels.
8659 @item
8660 Initialization of unions.  If the initializer is zero, the warning is
8661 omitted.  This is done under the assumption that the zero initializer in
8662 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
8663 initializer warnings and relies on default initialization to zero in the
8664 traditional C case.
8666 @item
8667 Conversions by prototypes between fixed/floating-point values and vice
8668 versa.  The absence of these prototypes when compiling with traditional
8669 C causes serious problems.  This is a subset of the possible
8670 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
8672 @item
8673 Use of ISO C style function definitions.  This warning intentionally is
8674 @emph{not} issued for prototype declarations or variadic functions
8675 because these ISO C features appear in your code when using
8676 libiberty's traditional C compatibility macros, @code{PARAMS} and
8677 @code{VPARAMS}.  This warning is also bypassed for nested functions
8678 because that feature is already a GCC extension and thus not relevant to
8679 traditional C compatibility.
8680 @end itemize
8682 @opindex Wtraditional-conversion
8683 @opindex Wno-traditional-conversion
8684 @item -Wtraditional-conversion @r{(C and Objective-C only)}
8685 Warn if a prototype causes a type conversion that is different from what
8686 would happen to the same argument in the absence of a prototype.  This
8687 includes conversions of fixed point to floating and vice versa, and
8688 conversions changing the width or signedness of a fixed-point argument
8689 except when the same as the default promotion.
8691 @opindex Wdeclaration-after-statement
8692 @opindex Wno-declaration-after-statement
8693 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
8694 Warn when a declaration is found after a statement in a block.  This
8695 construct, known from C++, was introduced with ISO C99 and is by default
8696 allowed in GCC@.  It is not supported by ISO C90.  @xref{Mixed Labels and Declarations}.
8698 This warning is upgraded to an error by @option{-pedantic-errors}.
8700 @opindex Wshadow
8701 @opindex Wno-shadow
8702 @item -Wshadow
8703 Warn whenever a local variable or type declaration shadows another
8704 variable, parameter, type, class member (in C++), or instance variable
8705 (in Objective-C) or whenever a built-in function is shadowed.  Note
8706 that in C++, the compiler warns if a local variable shadows an
8707 explicit typedef, but not if it shadows a struct/class/enum.
8708 If this warning is enabled, it includes also all instances of
8709 local shadowing.  This means that @option{-Wno-shadow=local}
8710 and @option{-Wno-shadow=compatible-local} are ignored when
8711 @option{-Wshadow} is used.
8712 Same as @option{-Wshadow=global}.
8714 @opindex Wno-shadow-ivar
8715 @opindex Wshadow-ivar
8716 @item -Wno-shadow-ivar @r{(Objective-C only)}
8717 Do not warn whenever a local variable shadows an instance variable in an
8718 Objective-C method.
8720 @opindex Wshadow=global
8721 @item -Wshadow=global
8722 Warn for any shadowing.
8723 Same as @option{-Wshadow}.
8725 @opindex Wshadow=local
8726 @item -Wshadow=local
8727 Warn when a local variable shadows another local variable or parameter.
8729 @opindex Wshadow=compatible-local
8730 @item -Wshadow=compatible-local
8731 Warn when a local variable shadows another local variable or parameter
8732 whose type is compatible with that of the shadowing variable.  In C++,
8733 type compatibility here means the type of the shadowing variable can be
8734 converted to that of the shadowed variable.  The creation of this flag
8735 (in addition to @option{-Wshadow=local}) is based on the idea that when
8736 a local variable shadows another one of incompatible type, it is most
8737 likely intentional, not a bug or typo, as shown in the following example:
8739 @smallexample
8740 @group
8741 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
8743   for (int i = 0; i < N; ++i)
8744   @{
8745     ...
8746   @}
8747   ...
8749 @end group
8750 @end smallexample
8752 Since the two variable @code{i} in the example above have incompatible types,
8753 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
8754 Because their types are incompatible, if a programmer accidentally uses one
8755 in place of the other, type checking is expected to catch that and emit an
8756 error or warning.  Use of this flag instead of @option{-Wshadow=local} can
8757 possibly reduce the number of warnings triggered by intentional shadowing.
8758 Note that this also means that shadowing @code{const char *i} by
8759 @code{char *i} does not emit a warning.
8761 This warning is also enabled by @option{-Wshadow=local}.
8763 @opindex Wlarger-than=
8764 @opindex Wlarger-than-@var{byte-size}
8765 @item -Wlarger-than=@var{byte-size}
8766 Warn whenever an object is defined whose size exceeds @var{byte-size}.
8767 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8768 Warnings controlled by the option can be disabled either by specifying
8769 @var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
8771 Also warn for calls to bounded functions such as @code{memchr} or
8772 @code{strnlen} that specify a bound greater than the largest possible
8773 object, which is @samp{PTRDIFF_MAX} bytes by default.  These warnings
8774 can only be disabled by @option{-Wno-larger-than}.
8776 @opindex Wno-larger-than
8777 @item -Wno-larger-than
8778 Disable @option{-Wlarger-than=} warnings.  The option is equivalent
8779 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
8781 @opindex Wframe-larger-than=
8782 @opindex Wno-frame-larger-than
8783 @item -Wframe-larger-than=@var{byte-size}
8784 Warn if the size of a function frame exceeds @var{byte-size}.
8785 The computation done to determine the stack frame size is approximate
8786 and not conservative.
8787 The actual requirements may be somewhat greater than @var{byte-size}
8788 even if you do not get a warning.  In addition, any space allocated
8789 via @code{alloca}, variable-length arrays, or related constructs
8790 is not included by the compiler when determining
8791 whether or not to issue a warning.
8792 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8793 Warnings controlled by the option can be disabled either by specifying
8794 @var{byte-size} of @samp{SIZE_MAX} or more or by
8795 @option{-Wno-frame-larger-than}.
8797 @opindex Wno-frame-larger-than
8798 @item -Wno-frame-larger-than
8799 Disable @option{-Wframe-larger-than=} warnings.  The option is equivalent
8800 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
8802 @opindex Wfree-nonheap-object
8803 @opindex Wno-free-nonheap-object
8804 @item -Wfree-nonheap-object
8805 Warn when attempting to deallocate an object that was either not allocated
8806 on the heap, or by using a pointer that was not returned from a prior call
8807 to the corresponding allocation function.  For example, because the call
8808 to @code{stpcpy} returns a pointer to the terminating nul character and
8809 not to the beginning of the object, the call to @code{free} below is
8810 diagnosed.
8812 @smallexample
8813 void f (char *p)
8815   p = stpcpy (p, "abc");
8816   // ...
8817   free (p);   // warning
8819 @end smallexample
8821 @option{-Wfree-nonheap-object} is included in @option{-Wall}.
8823 @opindex Wstack-usage
8824 @opindex Wno-stack-usage
8825 @item -Wstack-usage=@var{byte-size}
8826 Warn if the stack usage of a function might exceed @var{byte-size}.
8827 The computation done to determine the stack usage is conservative.
8828 Any space allocated via @code{alloca}, variable-length arrays, or related
8829 constructs is included by the compiler when determining whether or not to
8830 issue a warning.
8832 The message is in keeping with the output of @option{-fstack-usage}.
8834 @itemize
8835 @item
8836 If the stack usage is fully static but exceeds the specified amount, it's:
8838 @smallexample
8839   warning: stack usage is 1120 bytes
8840 @end smallexample
8841 @item
8842 If the stack usage is (partly) dynamic but bounded, it's:
8844 @smallexample
8845   warning: stack usage might be 1648 bytes
8846 @end smallexample
8847 @item
8848 If the stack usage is (partly) dynamic and not bounded, it's:
8850 @smallexample
8851   warning: stack usage might be unbounded
8852 @end smallexample
8853 @end itemize
8855 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
8856 Warnings controlled by the option can be disabled either by specifying
8857 @var{byte-size} of @samp{SIZE_MAX} or more or by
8858 @option{-Wno-stack-usage}.
8860 @opindex Wno-stack-usage
8861 @item -Wno-stack-usage
8862 Disable @option{-Wstack-usage=} warnings.  The option is equivalent
8863 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
8865 @opindex Wunsafe-loop-optimizations
8866 @opindex Wno-unsafe-loop-optimizations
8867 @item -Wunsafe-loop-optimizations
8868 Warn if the loop cannot be optimized because the compiler cannot
8869 assume anything on the bounds of the loop indices.  With
8870 @option{-funsafe-loop-optimizations} warn if the compiler makes
8871 such assumptions.
8873 @opindex Wno-pedantic-ms-format
8874 @opindex Wpedantic-ms-format
8875 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
8876 When used in combination with @option{-Wformat}
8877 and @option{-pedantic} without GNU extensions, this option
8878 disables the warnings about non-ISO @code{printf} / @code{scanf} format
8879 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
8880 which depend on the MS runtime.
8882 @opindex Wpointer-arith
8883 @opindex Wno-pointer-arith
8884 @item -Wpointer-arith
8885 Warn about anything that depends on the ``size of'' a function type or
8886 of @code{void}.  GNU C assigns these types a size of 1, for
8887 convenience in calculations with @code{void *} pointers and pointers
8888 to functions.  In C++, warn also when an arithmetic operation involves
8889 @code{NULL}.  This warning is also enabled by @option{-Wpedantic}.
8891 This warning is upgraded to an error by @option{-pedantic-errors}.
8893 @opindex Wpointer-compare
8894 @opindex Wno-pointer-compare
8895 @item -Wno-pointer-compare
8896 Do not warn if a pointer is compared with a zero character constant.
8897 This usually
8898 means that the pointer was meant to be dereferenced.  For example:
8900 @smallexample
8901 const char *p = foo ();
8902 if (p == '\0')
8903   return 42;
8904 @end smallexample
8906 Note that the code above is invalid in C++11.
8908 This warning is enabled by default.
8910 @opindex Wtsan
8911 @opindex Wno-tsan
8912 @item -Wtsan
8913 Warn about unsupported features in ThreadSanitizer.
8915 ThreadSanitizer does not support @code{std::atomic_thread_fence} and
8916 can report false positives.
8918 This warning is enabled by default.
8920 @opindex Wtype-limits
8921 @opindex Wno-type-limits
8922 @item -Wtype-limits
8923 Warn if a comparison is always true or always false due to the limited
8924 range of the data type, but do not warn for constant expressions.  For
8925 example, warn if an unsigned variable is compared against zero with
8926 @code{<} or @code{>=}.  This warning is also enabled by
8927 @option{-Wextra}.
8929 @opindex Wabsolute-value
8930 @opindex Wno-absolute-value
8931 @item -Wabsolute-value @r{(C and Objective-C only)}
8932 Warn for calls to standard functions that compute the absolute value
8933 of an argument when a more appropriate standard function is available.
8934 For example, calling @code{abs(3.14)} triggers the warning because the
8935 appropriate function to call to compute the absolute value of a double
8936 argument is @code{fabs}.  The option also triggers warnings when the
8937 argument in a call to such a function has an unsigned type.  This
8938 warning can be suppressed with an explicit type cast and it is also
8939 enabled by @option{-Wextra}.
8941 @include cppwarnopts.texi
8943 @opindex Wbad-function-cast
8944 @opindex Wno-bad-function-cast
8945 @item -Wbad-function-cast @r{(C and Objective-C only)}
8946 Warn when a function call is cast to a non-matching type.
8947 For example, warn if a call to a function returning an integer type 
8948 is cast to a pointer type.
8950 @opindex Wc90-c99-compat
8951 @opindex Wno-c90-c99-compat
8952 @item -Wc90-c99-compat @r{(C and Objective-C only)}
8953 Warn about features not present in ISO C90, but present in ISO C99.
8954 For instance, warn about use of variable length arrays, @code{long long}
8955 type, @code{bool} type, compound literals, designated initializers, and so
8956 on.  This option is independent of the standards mode.  Warnings are disabled
8957 in the expression that follows @code{__extension__}.
8959 @opindex Wc99-c11-compat
8960 @opindex Wno-c99-c11-compat
8961 @item -Wc99-c11-compat @r{(C and Objective-C only)}
8962 Warn about features not present in ISO C99, but present in ISO C11.
8963 For instance, warn about use of anonymous structures and unions,
8964 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
8965 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
8966 and so on.  This option is independent of the standards mode.  Warnings are
8967 disabled in the expression that follows @code{__extension__}.
8969 @opindex Wc11-c2x-compat
8970 @opindex Wno-c11-c2x-compat
8971 @item -Wc11-c2x-compat @r{(C and Objective-C only)}
8972 Warn about features not present in ISO C11, but present in ISO C2X.
8973 For instance, warn about omitting the string in @code{_Static_assert},
8974 use of @samp{[[]]} syntax for attributes, use of decimal
8975 floating-point types, and so on.  This option is independent of the
8976 standards mode.  Warnings are disabled in the expression that follows
8977 @code{__extension__}.
8979 When not compiling in C2X mode, these warnings are upgraded to errors
8980 by @option{-pedantic-errors}.
8982 @opindex Wc++-compat
8983 @opindex Wno-c++-compat
8984 @item -Wc++-compat @r{(C and Objective-C only)}
8985 Warn about ISO C constructs that are outside of the common subset of
8986 ISO C and ISO C++, e.g.@: request for implicit conversion from
8987 @code{void *} to a pointer to non-@code{void} type.
8989 @opindex Wc++11-compat
8990 @opindex Wno-c++11-compat
8991 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
8992 Warn about C++ constructs whose meaning differs between ISO C++ 1998
8993 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
8994 in ISO C++ 2011.  This warning turns on @option{-Wnarrowing} and is
8995 enabled by @option{-Wall}.
8997 @opindex Wc++14-compat
8998 @opindex Wno-c++14-compat
8999 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
9000 Warn about C++ constructs whose meaning differs between ISO C++ 2011
9001 and ISO C++ 2014.  This warning is enabled by @option{-Wall}.
9003 @opindex Wc++17-compat
9004 @opindex Wno-c++17-compat
9005 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
9006 Warn about C++ constructs whose meaning differs between ISO C++ 2014
9007 and ISO C++ 2017.  This warning is enabled by @option{-Wall}.
9009 @opindex Wc++20-compat
9010 @opindex Wno-c++20-compat
9011 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
9012 Warn about C++ constructs whose meaning differs between ISO C++ 2017
9013 and ISO C++ 2020.  This warning is enabled by @option{-Wall}.
9015 @opindex Wc++11-extensions
9016 @opindex Wno-c++11-extensions
9017 @item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)}
9018 Do not warn about C++11 constructs in code being compiled using
9019 an older C++ standard.  Even without this option, some C++11 constructs
9020 will only be diagnosed if @option{-Wpedantic} is used.
9022 @opindex Wc++14-extensions
9023 @opindex Wno-c++14-extensions
9024 @item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)}
9025 Do not warn about C++14 constructs in code being compiled using
9026 an older C++ standard.  Even without this option, some C++14 constructs
9027 will only be diagnosed if @option{-Wpedantic} is used.
9029 @opindex Wc++17-extensions
9030 @opindex Wno-c++17-extensions
9031 @item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)}
9032 Do not warn about C++17 constructs in code being compiled using
9033 an older C++ standard.  Even without this option, some C++17 constructs
9034 will only be diagnosed if @option{-Wpedantic} is used.
9036 @opindex Wc++20-extensions
9037 @opindex Wno-c++20-extensions
9038 @item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)}
9039 Do not warn about C++20 constructs in code being compiled using
9040 an older C++ standard.  Even without this option, some C++20 constructs
9041 will only be diagnosed if @option{-Wpedantic} is used.
9043 @opindex Wc++23-extensions
9044 @opindex Wno-c++23-extensions
9045 @item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)}
9046 Do not warn about C++23 constructs in code being compiled using
9047 an older C++ standard.  Even without this option, some C++23 constructs
9048 will only be diagnosed if @option{-Wpedantic} is used.
9050 @opindex Wcast-qual
9051 @opindex Wno-cast-qual
9052 @item -Wcast-qual
9053 Warn whenever a pointer is cast so as to remove a type qualifier from
9054 the target type.  For example, warn if a @code{const char *} is cast
9055 to an ordinary @code{char *}.
9057 Also warn when making a cast that introduces a type qualifier in an
9058 unsafe way.  For example, casting @code{char **} to @code{const char **}
9059 is unsafe, as in this example:
9061 @smallexample
9062   /* p is char ** value.  */
9063   const char **q = (const char **) p;
9064   /* Assignment of readonly string to const char * is OK.  */
9065   *q = "string";
9066   /* Now char** pointer points to read-only memory.  */
9067   **p = 'b';
9068 @end smallexample
9070 @opindex Wcast-align
9071 @opindex Wno-cast-align
9072 @item -Wcast-align
9073 Warn whenever a pointer is cast such that the required alignment of the
9074 target is increased.  For example, warn if a @code{char *} is cast to
9075 an @code{int *} on machines where integers can only be accessed at
9076 two- or four-byte boundaries.
9078 @opindex Wcast-align=strict
9079 @item -Wcast-align=strict
9080 Warn whenever a pointer is cast such that the required alignment of the
9081 target is increased.  For example, warn if a @code{char *} is cast to
9082 an @code{int *} regardless of the target machine.
9084 @opindex Wcast-function-type
9085 @opindex Wno-cast-function-type
9086 @item -Wcast-function-type
9087 Warn when a function pointer is cast to an incompatible function pointer.
9088 In a cast involving function types with a variable argument list only
9089 the types of initial arguments that are provided are considered.
9090 Any parameter of pointer-type matches any other pointer-type.  Any benign
9091 differences in integral types are ignored, like @code{int} vs.@: @code{long}
9092 on ILP32 targets.  Likewise type qualifiers are ignored.  The function
9093 type @code{void (*) (void)} is special and matches everything, which can
9094 be used to suppress this warning.
9095 In a cast involving pointer to member types this warning warns whenever
9096 the type cast is changing the pointer to member type.
9097 This warning is enabled by @option{-Wextra}.
9099 @opindex Wwrite-strings
9100 @opindex Wno-write-strings
9101 @item -Wwrite-strings
9102 When compiling C, give string constants the type @code{const
9103 char[@var{length}]} so that copying the address of one into a
9104 non-@code{const} @code{char *} pointer produces a warning.  These
9105 warnings help you find at compile time code that can try to write
9106 into a string constant, but only if you have been very careful about
9107 using @code{const} in declarations and prototypes.  Otherwise, it is
9108 just a nuisance. This is why we did not make @option{-Wall} request
9109 these warnings.
9111 When compiling C++, warn about the deprecated conversion from string
9112 literals to @code{char *}.  This warning is enabled by default for C++
9113 programs.
9115 This warning is upgraded to an error by @option{-pedantic-errors} in
9116 C++11 mode or later.
9118 @opindex Wclobbered
9119 @opindex Wno-clobbered
9120 @item -Wclobbered
9121 Warn for variables that might be changed by @code{longjmp} or
9122 @code{vfork}.  This warning is also enabled by @option{-Wextra}.
9124 @opindex Wcomplain-wrong-lang
9125 @opindex Wno-complain-wrong-lang
9126 @item -Wno-complain-wrong-lang
9127 By default, language front ends complain when a command-line option is
9128 valid, but not applicable to that front end.
9129 This may be disabled with @option{-Wno-complain-wrong-lang},
9130 which is mostly useful when invoking a single compiler driver for
9131 multiple source files written in different languages, for example:
9133 @smallexample
9134 $ g++ -fno-rtti a.cc b.f90
9135 @end smallexample
9137 The driver @file{g++} invokes the C++ front end to compile @file{a.cc}
9138 and the Fortran front end to compile @file{b.f90}.
9139 The latter front end diagnoses
9140 @samp{f951: Warning: command-line option '-fno-rtti' is valid for C++/D/ObjC++ but not for Fortran},
9141 which may be disabled with @option{-Wno-complain-wrong-lang}.
9143 @opindex Wcompare-distinct-pointer-types
9144 @item -Wcompare-distinct-pointer-types @r{(C and Objective-C only)}
9145 Warn if pointers of distinct types are compared without a cast.  This
9146 warning is enabled by default.
9148 @opindex Wconversion
9149 @opindex Wno-conversion
9150 @item -Wconversion
9151 Warn for implicit conversions that may alter a value. This includes
9152 conversions between real and integer, like @code{abs (x)} when
9153 @code{x} is @code{double}; conversions between signed and unsigned,
9154 like @code{unsigned ui = -1}; and conversions to smaller types, like
9155 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
9156 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
9157 changed by the conversion like in @code{abs (2.0)}.  Warnings about
9158 conversions between signed and unsigned integers can be disabled by
9159 using @option{-Wno-sign-conversion}.
9161 For C++, also warn for confusing overload resolution for user-defined
9162 conversions; and conversions that never use a type conversion
9163 operator: conversions to @code{void}, the same type, a base class or a
9164 reference to them. Warnings about conversions between signed and
9165 unsigned integers are disabled by default in C++ unless
9166 @option{-Wsign-conversion} is explicitly enabled.
9168 Warnings about conversion from arithmetic on a small type back to that
9169 type are only given with @option{-Warith-conversion}.
9171 @opindex Wdangling-else
9172 @opindex Wno-dangling-else
9173 @item -Wdangling-else
9174 Warn about constructions where there may be confusion to which
9175 @code{if} statement an @code{else} branch belongs.  Here is an example of
9176 such a case:
9178 @smallexample
9179 @group
9181   if (a)
9182     if (b)
9183       foo ();
9184   else
9185     bar ();
9187 @end group
9188 @end smallexample
9190 In C/C++, every @code{else} branch belongs to the innermost possible
9191 @code{if} statement, which in this example is @code{if (b)}.  This is
9192 often not what the programmer expected, as illustrated in the above
9193 example by indentation the programmer chose.  When there is the
9194 potential for this confusion, GCC issues a warning when this flag
9195 is specified.  To eliminate the warning, add explicit braces around
9196 the innermost @code{if} statement so there is no way the @code{else}
9197 can belong to the enclosing @code{if}.  The resulting code
9198 looks like this:
9200 @smallexample
9201 @group
9203   if (a)
9204     @{
9205       if (b)
9206         foo ();
9207       else
9208         bar ();
9209     @}
9211 @end group
9212 @end smallexample
9214 This warning is enabled by @option{-Wparentheses}.
9216 @opindex Wdangling-pointer
9217 @opindex Wno-dangling-pointer
9218 @item -Wdangling-pointer
9219 @itemx -Wdangling-pointer=@var{n}
9220 Warn about uses of pointers (or C++ references) to objects with automatic
9221 storage duration after their lifetime has ended.  This includes local
9222 variables declared in nested blocks, compound literals and other unnamed
9223 temporary objects.  In addition, warn about storing the address of such
9224 objects in escaped pointers.  The warning is enabled at all optimization
9225 levels but may yield different results with optimization than without.
9227 @table @gcctabopt
9228 @item -Wdangling-pointer=1
9229 At level 1 the warning diagnoses only unconditional uses of dangling pointers.
9230 For example
9231 @smallexample
9232 int f (int c1, int c2, x)
9234   char *p = strchr ((char[])@{ c1, c2 @}, c3);
9235   // warning: dangling pointer to a compound literal
9236   return p ? *p : 'x';
9238 @end smallexample
9239 In the following function the store of the address of the local variable
9240 @code{x} in the escaped pointer @code{*p} also triggers the warning.
9241 @smallexample
9242 void g (int **p)
9244   int x = 7;
9245   // warning: storing the address of a local variable in *p
9246   *p = &x;
9248 @end smallexample
9250 @item -Wdangling-pointer=2
9251 At level 2, in addition to unconditional uses the warning also diagnoses
9252 conditional uses of dangling pointers.
9254 For example, because the array @var{a} in the following function is out of
9255 scope when the pointer @var{s} that was set to point is used, the warning
9256 triggers at this level.
9258 @smallexample
9259 void f (char *s)
9261   if (!s)
9262     @{
9263       char a[12] = "tmpname";
9264       s = a;
9265     @}
9266   // warning: dangling pointer to a may be used
9267   strcat (s, ".tmp");
9268   ...
9270 @end smallexample
9271 @end table
9273 @option{-Wdangling-pointer=2} is included in @option{-Wall}.
9275 @opindex Wdate-time
9276 @opindex Wno-date-time
9277 @item -Wdate-time
9278 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
9279 are encountered as they might prevent bit-wise-identical reproducible
9280 compilations.
9282 @opindex Wempty-body
9283 @opindex Wno-empty-body
9284 @item -Wempty-body
9285 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
9286 while} statement.  This warning is also enabled by @option{-Wextra}.
9288 @opindex Wendif-labels
9289 @opindex Wno-endif-labels
9290 @item -Wno-endif-labels
9291 Do not warn about stray tokens after @code{#else} and @code{#endif}.
9293 @opindex Wenum-compare
9294 @opindex Wno-enum-compare
9295 @item -Wenum-compare
9296 Warn about a comparison between values of different enumerated types.
9297 In C++ enumerated type mismatches in conditional expressions are also
9298 diagnosed and the warning is enabled by default.  In C this warning is 
9299 enabled by @option{-Wall}.
9301 @opindex Wenum-conversion
9302 @opindex Wno-enum-conversion
9303 @item -Wenum-conversion
9304 Warn when a value of enumerated type is implicitly converted to a 
9305 different enumerated type.  This warning is enabled by @option{-Wextra}
9306 in C@.
9308 @opindex Wenum-int-mismatch
9309 @opindex Wno-enum-int-mismatch
9310 @item -Wenum-int-mismatch @r{(C and Objective-C only)}
9311 Warn about mismatches between an enumerated type and an integer type in
9312 declarations.  For example:
9314 @smallexample
9315 enum E @{ l = -1, z = 0, g = 1 @};
9316 int foo(void);
9317 enum E foo(void);
9318 @end smallexample
9320 In C, an enumerated type is compatible with @code{char}, a signed
9321 integer type, or an unsigned integer type.  However, since the choice
9322 of the underlying type of an enumerated type is implementation-defined,
9323 such mismatches may cause portability issues.  In C++, such mismatches
9324 are an error.  In C, this warning is enabled by @option{-Wall} and
9325 @option{-Wc++-compat}.
9327 @opindex Wjump-misses-init
9328 @opindex Wno-jump-misses-init
9329 @item -Wjump-misses-init @r{(C, Objective-C only)}
9330 Warn if a @code{goto} statement or a @code{switch} statement jumps
9331 forward across the initialization of a variable, or jumps backward to a
9332 label after the variable has been initialized.  This only warns about
9333 variables that are initialized when they are declared.  This warning is
9334 only supported for C and Objective-C; in C++ this sort of branch is an
9335 error in any case.
9337 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
9338 can be disabled with the @option{-Wno-jump-misses-init} option.
9340 @opindex Wsign-compare
9341 @opindex Wno-sign-compare
9342 @cindex warning for comparison of signed and unsigned values
9343 @cindex comparison of signed and unsigned values, warning
9344 @cindex signed and unsigned values, comparison warning
9345 @item -Wsign-compare
9346 Warn when a comparison between signed and unsigned values could produce
9347 an incorrect result when the signed value is converted to unsigned.
9348 In C++, this warning is also enabled by @option{-Wall}.  In C, it is
9349 also enabled by @option{-Wextra}.
9351 @opindex Wsign-conversion
9352 @opindex Wno-sign-conversion
9353 @item -Wsign-conversion
9354 Warn for implicit conversions that may change the sign of an integer
9355 value, like assigning a signed integer expression to an unsigned
9356 integer variable. An explicit cast silences the warning. In C, this
9357 option is enabled also by @option{-Wconversion}.
9359 @opindex Wflex-array-member-not-at-end
9360 @opindex Wno-flex-array-member-not-at-end
9361 @item -Wflex-array-member-not-at-end @r{(C and C++ only)}
9362 Warn when a structure containing a C99 flexible array member as the last
9363 field is not at the end of another structure.
9364 This warning warns e.g. about
9366 @smallexample
9367 struct flex  @{ int length; char data[]; @};
9368 struct mid_flex @{ int m; struct flex flex_data; int n; @};
9369 @end smallexample
9371 @opindex Wfloat-conversion
9372 @opindex Wno-float-conversion
9373 @item -Wfloat-conversion
9374 Warn for implicit conversions that reduce the precision of a real value.
9375 This includes conversions from real to integer, and from higher precision
9376 real to lower precision real values.  This option is also enabled by
9377 @option{-Wconversion}.
9379 @opindex Wno-scalar-storage-order
9380 @opindex Wscalar-storage-order
9381 @item -Wno-scalar-storage-order
9382 Do not warn on suspicious constructs involving reverse scalar storage order.
9384 @opindex Wsizeof-array-div
9385 @opindex Wno-sizeof-array-div
9386 @item -Wsizeof-array-div
9387 Warn about divisions of two sizeof operators when the first one is applied
9388 to an array and the divisor does not equal the size of the array element.
9389 In such a case, the computation will not yield the number of elements in the
9390 array, which is likely what the user intended.  This warning warns e.g. about
9391 @smallexample
9392 int fn ()
9394   int arr[10];
9395   return sizeof (arr) / sizeof (short);
9397 @end smallexample
9399 This warning is enabled by @option{-Wall}.
9401 @opindex Wsizeof-pointer-div
9402 @opindex Wno-sizeof-pointer-div
9403 @item -Wsizeof-pointer-div
9404 Warn for suspicious divisions of two sizeof expressions that divide
9405 the pointer size by the element size, which is the usual way to compute
9406 the array size but won't work out correctly with pointers.  This warning
9407 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
9408 not an array, but a pointer.  This warning is enabled by @option{-Wall}.
9410 @opindex Wsizeof-pointer-memaccess
9411 @opindex Wno-sizeof-pointer-memaccess
9412 @item -Wsizeof-pointer-memaccess
9413 Warn for suspicious length parameters to certain string and memory built-in
9414 functions if the argument uses @code{sizeof}.  This warning triggers for
9415 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
9416 an array, but a pointer, and suggests a possible fix, or about
9417 @code{memcpy (&foo, ptr, sizeof (&foo));}.  @option{-Wsizeof-pointer-memaccess}
9418 also warns about calls to bounded string copy functions like @code{strncat}
9419 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
9420 the source array.  For example, in the following function the call to
9421 @code{strncat} specifies the size of the source string as the bound.  That
9422 is almost certainly a mistake and so the call is diagnosed.
9423 @smallexample
9424 void make_file (const char *name)
9426   char path[PATH_MAX];
9427   strncpy (path, name, sizeof path - 1);
9428   strncat (path, ".text", sizeof ".text");
9429   @dots{}
9431 @end smallexample
9433 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
9435 @opindex Wsizeof-array-argument
9436 @opindex Wno-sizeof-array-argument
9437 @item -Wno-sizeof-array-argument
9438 Do not warn when the @code{sizeof} operator is applied to a parameter that is
9439 declared as an array in a function definition.  This warning is enabled by
9440 default for C and C++ programs.
9442 @opindex Wmemset-elt-size
9443 @opindex Wno-memset-elt-size
9444 @item -Wmemset-elt-size
9445 Warn for suspicious calls to the @code{memset} built-in function, if the
9446 first argument references an array, and the third argument is a number
9447 equal to the number of elements, but not equal to the size of the array
9448 in memory.  This indicates that the user has omitted a multiplication by
9449 the element size.  This warning is enabled by @option{-Wall}.
9451 @opindex Wmemset-transposed-args
9452 @opindex Wno-memset-transposed-args
9453 @item -Wmemset-transposed-args
9454 Warn for suspicious calls to the @code{memset} built-in function where
9455 the second argument is not zero and the third argument is zero.  For
9456 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
9457 @code{memset (buf, 0, sizeof buf)} was meant instead.  The diagnostic
9458 is only emitted if the third argument is a literal zero.  Otherwise, if
9459 it is an expression that is folded to zero, or a cast of zero to some
9460 type, it is far less likely that the arguments have been mistakenly
9461 transposed and no warning is emitted.  This warning is enabled
9462 by @option{-Wall}.
9464 @opindex Waddress
9465 @opindex Wno-address
9466 @item -Waddress
9467 Warn about suspicious uses of address expressions. These include comparing
9468 the address of a function or a declared object to the null pointer constant
9469 such as in
9470 @smallexample
9471 void f (void);
9472 void g (void)
9474   if (!f)   // warning: expression evaluates to false
9475     abort ();
9477 @end smallexample
9478 comparisons of a pointer to a string literal, such as in
9479 @smallexample
9480 void f (const char *x)
9482   if (x == "abc")   // warning: expression evaluates to false
9483     puts ("equal");
9485 @end smallexample
9486 and tests of the results of pointer addition or subtraction for equality
9487 to null, such as in
9488 @smallexample
9489 void f (const int *p, int i)
9491   return p + i == NULL;
9493 @end smallexample
9494 Such uses typically indicate a programmer error: the address of most
9495 functions and objects necessarily evaluates to true (the exception are
9496 weak symbols), so their use in a conditional might indicate missing
9497 parentheses in a function call or a missing dereference in an array
9498 expression.  The subset of the warning for object pointers can be
9499 suppressed by casting the pointer operand to an integer type such
9500 as @code{intptr_t} or @code{uintptr_t}.
9501 Comparisons against string literals result in unspecified behavior
9502 and are not portable, and suggest the intent was to call @code{strcmp}.
9503 The warning is suppressed if the suspicious expression is the result
9504 of macro expansion.
9505 @option{-Waddress} warning is enabled by @option{-Wall}.
9507 @opindex Waddress-of-packed-member
9508 @opindex Wno-address-of-packed-member
9509 @item -Wno-address-of-packed-member
9510 Do not warn when the address of packed member of struct or union is taken,
9511 which usually results in an unaligned pointer value.  This is
9512 enabled by default.
9514 @opindex Wlogical-op
9515 @opindex Wno-logical-op
9516 @item -Wlogical-op
9517 Warn about suspicious uses of logical operators in expressions.
9518 This includes using logical operators in contexts where a
9519 bit-wise operator is likely to be expected.  Also warns when
9520 the operands of a logical operator are the same:
9521 @smallexample
9522 extern int a;
9523 if (a < 0 && a < 0) @{ @dots{} @}
9524 @end smallexample
9526 @opindex Wlogical-not-parentheses
9527 @opindex Wno-logical-not-parentheses
9528 @item -Wlogical-not-parentheses
9529 Warn about logical not used on the left hand side operand of a comparison.
9530 This option does not warn if the right operand is considered to be a boolean
9531 expression.  Its purpose is to detect suspicious code like the following:
9532 @smallexample
9533 int a;
9534 @dots{}
9535 if (!a > 1) @{ @dots{} @}
9536 @end smallexample
9538 It is possible to suppress the warning by wrapping the LHS into
9539 parentheses:
9540 @smallexample
9541 if ((!a) > 1) @{ @dots{} @}
9542 @end smallexample
9544 This warning is enabled by @option{-Wall}.
9546 @opindex Waggregate-return
9547 @opindex Wno-aggregate-return
9548 @item -Waggregate-return
9549 Warn if any functions that return structures or unions are defined or
9550 called.  (In languages where you can return an array, this also elicits
9551 a warning.)
9553 @opindex Wno-aggressive-loop-optimizations
9554 @opindex Waggressive-loop-optimizations
9555 @item -Wno-aggressive-loop-optimizations
9556 Warn if in a loop with constant number of iterations the compiler detects
9557 undefined behavior in some statement during one or more of the iterations.
9559 @opindex Wno-attributes
9560 @opindex Wattributes
9561 @item -Wno-attributes
9562 Do not warn if an unexpected @code{__attribute__} is used, such as
9563 unrecognized attributes, function attributes applied to variables,
9564 etc.  This does not stop errors for incorrect use of supported
9565 attributes.
9567 Warnings about ill-formed uses of standard attributes are upgraded to
9568 errors by @option{-pedantic-errors}.
9570 Additionally, using @option{-Wno-attributes=}, it is possible to suppress
9571 warnings about unknown scoped attributes (in C++11 and C2X).  For example,
9572 @option{-Wno-attributes=vendor::attr} disables warning about the following
9573 declaration:
9575 @smallexample
9576 [[vendor::attr]] void f();
9577 @end smallexample
9579 It is also possible to disable warning about all attributes in a namespace
9580 using @option{-Wno-attributes=vendor::} which prevents warning about both
9581 of these declarations:
9583 @smallexample
9584 [[vendor::safe]] void f();
9585 [[vendor::unsafe]] void f2();
9586 @end smallexample
9588 Note that @option{-Wno-attributes=} does not imply @option{-Wno-attributes}.
9590 @opindex Wno-builtin-declaration-mismatch
9591 @opindex Wbuiltin-declaration-mismatch
9592 @item -Wno-builtin-declaration-mismatch
9593 Warn if a built-in function is declared with an incompatible signature
9594 or as a non-function, or when a built-in function declared with a type
9595 that does not include a prototype is called with arguments whose promoted
9596 types do not match those expected by the function.  When @option{-Wextra}
9597 is specified, also warn when a built-in function that takes arguments is
9598 declared without a prototype.  The @option{-Wbuiltin-declaration-mismatch}
9599 warning is enabled by default.  To avoid the warning include the appropriate
9600 header to bring the prototypes of built-in functions into scope.
9602 For example, the call to @code{memset} below is diagnosed by the warning
9603 because the function expects a value of type @code{size_t} as its argument
9604 but the type of @code{32} is @code{int}.  With @option{-Wextra},
9605 the declaration of the function is diagnosed as well.
9606 @smallexample
9607 extern void* memset ();
9608 void f (void *d)
9610   memset (d, '\0', 32);
9612 @end smallexample
9614 @opindex Wno-builtin-macro-redefined
9615 @opindex Wbuiltin-macro-redefined
9616 @item -Wno-builtin-macro-redefined
9617 Do not warn if certain built-in macros are redefined.  This suppresses
9618 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
9619 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
9621 @opindex Wstrict-prototypes
9622 @opindex Wno-strict-prototypes
9623 @item -Wstrict-prototypes @r{(C and Objective-C only)}
9624 Warn if a function is declared or defined without specifying the
9625 argument types.  (An old-style function definition is permitted without
9626 a warning if preceded by a declaration that specifies the argument
9627 types.)
9629 @opindex Wold-style-declaration
9630 @opindex Wno-old-style-declaration
9631 @item -Wold-style-declaration @r{(C and Objective-C only)}
9632 Warn for obsolescent usages, according to the C Standard, in a
9633 declaration. For example, warn if storage-class specifiers like
9634 @code{static} are not the first things in a declaration.  This warning
9635 is also enabled by @option{-Wextra}.
9637 @opindex Wold-style-definition
9638 @opindex Wno-old-style-definition
9639 @item -Wold-style-definition @r{(C and Objective-C only)}
9640 Warn if an old-style function definition is used.  A warning is given
9641 even if there is a previous prototype.  A definition using @samp{()}
9642 is not considered an old-style definition in C2X mode, because it is
9643 equivalent to @samp{(void)} in that case, but is considered an
9644 old-style definition for older standards.
9646 @opindex Wmissing-parameter-type
9647 @opindex Wno-missing-parameter-type
9648 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
9649 A function parameter is declared without a type specifier in K&R-style
9650 functions:
9652 @smallexample
9653 void foo(bar) @{ @}
9654 @end smallexample
9656 This warning is also enabled by @option{-Wextra}.
9658 @opindex Wmissing-prototypes
9659 @opindex Wno-missing-prototypes
9660 @item -Wmissing-prototypes @r{(C and Objective-C only)}
9661 Warn if a global function is defined without a previous prototype
9662 declaration.  This warning is issued even if the definition itself
9663 provides a prototype.  Use this option to detect global functions
9664 that do not have a matching prototype declaration in a header file.
9665 This option is not valid for C++ because all function declarations
9666 provide prototypes and a non-matching declaration declares an
9667 overload rather than conflict with an earlier declaration.
9668 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
9670 @opindex Wmissing-variable-declarations
9671 @opindex Wno-missing-variable-declarations
9672 @item -Wmissing-variable-declarations @r{(C and Objective-C only)}
9673 Warn if a global variable is defined without a previous declaration.
9674 Use this option to detect global variables that do not have a matching
9675 extern declaration in a header file.
9677 @opindex Wmissing-declarations
9678 @opindex Wno-missing-declarations
9679 @item -Wmissing-declarations
9680 Warn if a global function is defined without a previous declaration.
9681 Do so even if the definition itself provides a prototype.
9682 Use this option to detect global functions that are not declared in
9683 header files.  In C, no warnings are issued for functions with previous
9684 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
9685 missing prototypes.  In C++, no warnings are issued for function templates,
9686 or for inline functions, or for functions in anonymous namespaces.
9688 @opindex Wmissing-field-initializers
9689 @opindex Wno-missing-field-initializers
9690 @opindex W
9691 @opindex Wextra
9692 @opindex Wno-extra
9693 @item -Wmissing-field-initializers
9694 Warn if a structure's initializer has some fields missing.  For
9695 example, the following code causes such a warning, because
9696 @code{x.h} is implicitly zero:
9698 @smallexample
9699 struct s @{ int f, g, h; @};
9700 struct s x = @{ 3, 4 @};
9701 @end smallexample
9703 @c It's unclear if this behavior is desirable.  See PR39589 and PR96868.
9704 In C this option does not warn about designated initializers, so the
9705 following modification does not trigger a warning:
9707 @smallexample
9708 struct s @{ int f, g, h; @};
9709 struct s x = @{ .f = 3, .g = 4 @};
9710 @end smallexample
9712 In C this option does not warn about the universal zero initializer
9713 @samp{@{ 0 @}}:
9715 @smallexample
9716 struct s @{ int f, g, h; @};
9717 struct s x = @{ 0 @};
9718 @end smallexample
9720 Likewise, in C++ this option does not warn about the empty @{ @}
9721 initializer, for example:
9723 @smallexample
9724 struct s @{ int f, g, h; @};
9725 s x = @{ @};
9726 @end smallexample
9728 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
9729 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
9731 @opindex Wmissing-requires
9732 @opindex Wno-missing-requires
9733 @item -Wno-missing-requires
9735 By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement:
9737 @smallexample
9738 bool satisfied = requires @{ C<T> @};
9739 @end smallexample
9741 Here @samp{satisfied} will be true if @samp{C<T>} is a valid
9742 expression, which it is for all T.  Presumably the user meant to write
9744 @smallexample
9745 bool satisfied = requires @{ requires C<T> @};
9746 @end smallexample
9748 so @samp{satisfied} is only true if concept @samp{C} is satisfied for
9749 type @samp{T}.
9751 This warning can be disabled with @option{-Wno-missing-requires}.
9753 @opindex Wmissing-template-keyword
9754 @opindex Wno-missing-template-keyword
9755 @item -Wno-missing-template-keyword
9757 The member access tokens ., -> and :: must be followed by the @code{template}
9758 keyword if the parent object is dependent and the member being named is a
9759 template.
9761 @smallexample
9762 template <class X>
9763 void DoStuff (X x)
9765   x.template DoSomeOtherStuff<X>(); // Good.
9766   x.DoMoreStuff<X>(); // Warning, x is dependent.
9768 @end smallexample
9770 In rare cases it is possible to get false positives. To silence this, wrap
9771 the expression in parentheses. For example, the following is treated as a
9772 template, even where m and N are integers:
9774 @smallexample
9775 void NotATemplate (my_class t)
9777   int N = 5;
9779   bool test = t.m < N > (0); // Treated as a template.
9780   test = (t.m < N) > (0); // Same meaning, but not treated as a template.
9782 @end smallexample
9784 This warning can be disabled with @option{-Wno-missing-template-keyword}.
9786 @opindex Wno-multichar
9787 @opindex Wmultichar
9788 @item -Wno-multichar
9789 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
9790 Usually they indicate a typo in the user's code, as they have
9791 implementation-defined values, and should not be used in portable code.
9793 @opindex Wnormalized=
9794 @opindex Wnormalized
9795 @opindex Wno-normalized
9796 @cindex NFC
9797 @cindex NFKC
9798 @cindex character set, input normalization
9799 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
9800 In ISO C and ISO C++, two identifiers are different if they are
9801 different sequences of characters.  However, sometimes when characters
9802 outside the basic ASCII character set are used, you can have two
9803 different character sequences that look the same.  To avoid confusion,
9804 the ISO 10646 standard sets out some @dfn{normalization rules} which
9805 when applied ensure that two sequences that look the same are turned into
9806 the same sequence.  GCC can warn you if you are using identifiers that
9807 have not been normalized; this option controls that warning.
9809 There are four levels of warning supported by GCC@.  The default is
9810 @option{-Wnormalized=nfc}, which warns about any identifier that is
9811 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
9812 recommended form for most uses.  It is equivalent to
9813 @option{-Wnormalized}.
9815 Unfortunately, there are some characters allowed in identifiers by
9816 ISO C and ISO C++ that, when turned into NFC, are not allowed in 
9817 identifiers.  That is, there's no way to use these symbols in portable
9818 ISO C or C++ and have all your identifiers in NFC@.
9819 @option{-Wnormalized=id} suppresses the warning for these characters.
9820 It is hoped that future versions of the standards involved will correct
9821 this, which is why this option is not the default.
9823 You can switch the warning off for all characters by writing
9824 @option{-Wnormalized=none} or @option{-Wno-normalized}.  You should
9825 only do this if you are using some other normalization scheme (like
9826 ``D''), because otherwise you can easily create bugs that are
9827 literally impossible to see.
9829 Some characters in ISO 10646 have distinct meanings but look identical
9830 in some fonts or display methodologies, especially once formatting has
9831 been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
9832 LETTER N'', displays just like a regular @code{n} that has been
9833 placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
9834 normalization scheme to convert all these into a standard form as
9835 well, and GCC warns if your code is not in NFKC if you use
9836 @option{-Wnormalized=nfkc}.  This warning is comparable to warning
9837 about every identifier that contains the letter O because it might be
9838 confused with the digit 0, and so is not the default, but may be
9839 useful as a local coding convention if the programming environment 
9840 cannot be fixed to display these characters distinctly.
9842 @opindex Wno-attribute-warning
9843 @opindex Wattribute-warning
9844 @item -Wno-attribute-warning
9845 Do not warn about usage of functions (@pxref{Function Attributes})
9846 declared with @code{warning} attribute.  By default, this warning is
9847 enabled.  @option{-Wno-attribute-warning} can be used to disable the
9848 warning or @option{-Wno-error=attribute-warning} can be used to
9849 disable the error when compiled with @option{-Werror} flag.
9851 @opindex Wno-deprecated
9852 @opindex Wdeprecated
9853 @item -Wno-deprecated
9854 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
9856 @opindex Wno-deprecated-declarations
9857 @opindex Wdeprecated-declarations
9858 @item -Wno-deprecated-declarations
9859 Do not warn about uses of functions (@pxref{Function Attributes}),
9860 variables (@pxref{Variable Attributes}), and types (@pxref{Type
9861 Attributes}) marked as deprecated by using the @code{deprecated}
9862 attribute.
9864 @opindex Wno-overflow
9865 @opindex Woverflow
9866 @item -Wno-overflow
9867 Do not warn about compile-time overflow in constant expressions.
9869 @opindex Wno-odr
9870 @opindex Wodr
9871 @item -Wno-odr
9872 Warn about One Definition Rule violations during link-time optimization.
9873 Enabled by default.
9875 @opindex Wopenacc-parallelism
9876 @opindex Wno-openacc-parallelism
9877 @cindex OpenACC accelerator programming
9878 @item -Wopenacc-parallelism
9879 Warn about potentially suboptimal choices related to OpenACC parallelism.
9881 @opindex Wopenmp-simd
9882 @opindex Wno-openmp-simd
9883 @item -Wopenmp-simd
9884 Warn if the vectorizer cost model overrides the OpenMP
9885 simd directive set by user.  The @option{-fsimd-cost-model=unlimited}
9886 option can be used to relax the cost model.
9888 @opindex Woverride-init
9889 @opindex Wno-override-init
9890 @opindex W
9891 @opindex Wextra
9892 @opindex Wno-extra
9893 @item -Woverride-init @r{(C and Objective-C only)}
9894 Warn if an initialized field without side effects is overridden when
9895 using designated initializers (@pxref{Designated Inits, , Designated
9896 Initializers}).
9898 This warning is included in @option{-Wextra}.  To get other
9899 @option{-Wextra} warnings without this one, use @option{-Wextra
9900 -Wno-override-init}.
9902 @opindex Woverride-init-side-effects
9903 @opindex Wno-override-init-side-effects
9904 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
9905 Do not warn if an initialized field with side effects is overridden when
9906 using designated initializers (@pxref{Designated Inits, , Designated
9907 Initializers}).  This warning is enabled by default.
9909 @opindex Wpacked
9910 @opindex Wno-packed
9911 @item -Wpacked
9912 Warn if a structure is given the packed attribute, but the packed
9913 attribute has no effect on the layout or size of the structure.
9914 Such structures may be mis-aligned for little benefit.  For
9915 instance, in this code, the variable @code{f.x} in @code{struct bar}
9916 is misaligned even though @code{struct bar} does not itself
9917 have the packed attribute:
9919 @smallexample
9920 @group
9921 struct foo @{
9922   int x;
9923   char a, b, c, d;
9924 @} __attribute__((packed));
9925 struct bar @{
9926   char z;
9927   struct foo f;
9929 @end group
9930 @end smallexample
9932 @opindex Wpacked-bitfield-compat
9933 @opindex Wno-packed-bitfield-compat
9934 @item -Wnopacked-bitfield-compat
9935 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
9936 on bit-fields of type @code{char}.  This was fixed in GCC 4.4 but
9937 the change can lead to differences in the structure layout.  GCC
9938 informs you when the offset of such a field has changed in GCC 4.4.
9939 For example there is no longer a 4-bit padding between field @code{a}
9940 and @code{b} in this structure:
9942 @smallexample
9943 struct foo
9945   char a:4;
9946   char b:8;
9947 @} __attribute__ ((packed));
9948 @end smallexample
9950 This warning is enabled by default.  Use
9951 @option{-Wno-packed-bitfield-compat} to disable this warning.
9953 @opindex Wpacked-not-aligned
9954 @opindex Wno-packed-not-aligned
9955 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
9956 Warn if a structure field with explicitly specified alignment in a
9957 packed struct or union is misaligned.  For example, a warning will
9958 be issued on @code{struct S}, like, @code{warning: alignment 1 of
9959 'struct S' is less than 8}, in this code:
9961 @smallexample
9962 @group
9963 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
9964 struct __attribute__ ((packed)) S @{
9965   struct S8 s8;
9967 @end group
9968 @end smallexample
9970 This warning is enabled by @option{-Wall}.
9972 @opindex Wpadded
9973 @opindex Wno-padded
9974 @item -Wpadded
9975 Warn if padding is included in a structure, either to align an element
9976 of the structure or to align the whole structure.  Sometimes when this
9977 happens it is possible to rearrange the fields of the structure to
9978 reduce the padding and so make the structure smaller.
9980 @opindex Wredundant-decls
9981 @opindex Wno-redundant-decls
9982 @item -Wredundant-decls
9983 Warn if anything is declared more than once in the same scope, even in
9984 cases where multiple declaration is valid and changes nothing.
9986 @opindex Wrestrict
9987 @opindex Wno-restrict
9988 @item -Wrestrict
9989 Warn when an object referenced by a @code{restrict}-qualified parameter
9990 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
9991 argument, or when copies between such objects overlap.  For example,
9992 the call to the @code{strcpy} function below attempts to truncate the string
9993 by replacing its initial characters with the last four.  However, because
9994 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
9995 the call is diagnosed.
9997 @smallexample
9998 void foo (void)
10000   char a[] = "abcd1234";
10001   strcpy (a, a + 4);
10002   @dots{}
10004 @end smallexample
10005 The @option{-Wrestrict} option detects some instances of simple overlap
10006 even without optimization but works best at @option{-O2} and above.  It
10007 is included in @option{-Wall}.
10009 @opindex Wnested-externs
10010 @opindex Wno-nested-externs
10011 @item -Wnested-externs @r{(C and Objective-C only)}
10012 Warn if an @code{extern} declaration is encountered within a function.
10014 @opindex Winline
10015 @opindex Wno-inline
10016 @item -Winline
10017 Warn if a function that is declared as inline cannot be inlined.
10018 Even with this option, the compiler does not warn about failures to
10019 inline functions declared in system headers.
10021 The compiler uses a variety of heuristics to determine whether or not
10022 to inline a function.  For example, the compiler takes into account
10023 the size of the function being inlined and the amount of inlining
10024 that has already been done in the current function.  Therefore,
10025 seemingly insignificant changes in the source program can cause the
10026 warnings produced by @option{-Winline} to appear or disappear.
10028 @opindex Winterference-size
10029 @item -Winterference-size
10030 Warn about use of C++17 @code{std::hardware_destructive_interference_size}
10031 without specifying its value with @option{--param destructive-interference-size}.
10032 Also warn about questionable values for that option.
10034 This variable is intended to be used for controlling class layout, to
10035 avoid false sharing in concurrent code:
10037 @smallexample
10038 struct independent_fields @{
10039   alignas(std::hardware_destructive_interference_size)
10040     std::atomic<int> one;
10041   alignas(std::hardware_destructive_interference_size)
10042     std::atomic<int> two;
10044 @end smallexample
10046 Here @samp{one} and @samp{two} are intended to be far enough apart
10047 that stores to one won't require accesses to the other to reload the
10048 cache line.
10050 By default, @option{--param destructive-interference-size} and
10051 @option{--param constructive-interference-size} are set based on the
10052 current @option{-mtune} option, typically to the L1 cache line size
10053 for the particular target CPU, sometimes to a range if tuning for a
10054 generic target.  So all translation units that depend on ABI
10055 compatibility for the use of these variables must be compiled with
10056 the same @option{-mtune} (or @option{-mcpu}).
10058 If ABI stability is important, such as if the use is in a header for a
10059 library, you should probably not use the hardware interference size
10060 variables at all.  Alternatively, you can force a particular value
10061 with @option{--param}.
10063 If you are confident that your use of the variable does not affect ABI
10064 outside a single build of your project, you can turn off the warning
10065 with @option{-Wno-interference-size}.
10067 @opindex Wint-in-bool-context
10068 @opindex Wno-int-in-bool-context
10069 @item -Wint-in-bool-context
10070 Warn for suspicious use of integer values where boolean values are expected,
10071 such as conditional expressions (?:) using non-boolean integer constants in
10072 boolean context, like @code{if (a <= b ? 2 : 3)}.  Or left shifting of signed
10073 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}.  Likewise
10074 for all kinds of multiplications regardless of the data type.
10075 This warning is enabled by @option{-Wall}.
10077 @opindex Wno-int-to-pointer-cast
10078 @opindex Wint-to-pointer-cast
10079 @item -Wno-int-to-pointer-cast
10080 Suppress warnings from casts to pointer type of an integer of a
10081 different size. In C++, casting to a pointer type of smaller size is
10082 an error. @option{Wint-to-pointer-cast} is enabled by default.
10085 @opindex Wno-pointer-to-int-cast
10086 @opindex Wpointer-to-int-cast
10087 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
10088 Suppress warnings from casts from a pointer to an integer type of a
10089 different size.
10091 @opindex Winvalid-pch
10092 @opindex Wno-invalid-pch
10093 @item -Winvalid-pch
10094 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
10095 the search path but cannot be used.
10097 @opindex Winvalid-utf8
10098 @opindex Wno-invalid-utf8
10099 @item -Winvalid-utf8
10100 Warn if an invalid UTF-8 character is found.
10101 This warning is on by default for C++23 if @option{-finput-charset=UTF-8}
10102 is used and turned into error with @option{-pedantic-errors}.
10104 @opindex Wunicode
10105 @opindex Wno-unicode
10106 @item -Wno-unicode
10107 Don't diagnose invalid forms of delimited or named escape sequences which are
10108 treated as separate tokens.  @option{Wunicode} is enabled by default.
10110 @opindex Wlong-long
10111 @opindex Wno-long-long
10112 @item -Wlong-long
10113 Warn if @code{long long} type is used.  This is enabled by either
10114 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
10115 modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
10117 This warning is upgraded to an error by @option{-pedantic-errors}.
10119 @opindex Wvariadic-macros
10120 @opindex Wno-variadic-macros
10121 @item -Wvariadic-macros
10122 Warn if variadic macros are used in ISO C90 mode, or if the GNU
10123 alternate syntax is used in ISO C99 mode.  This is enabled by either
10124 @option{-Wpedantic} or @option{-Wtraditional}.  To inhibit the warning
10125 messages, use @option{-Wno-variadic-macros}.
10127 @opindex Wvarargs
10128 @opindex Wno-varargs
10129 @item -Wno-varargs
10130 Do not warn upon questionable usage of the macros used to handle variable
10131 arguments like @code{va_start}.  These warnings are enabled by default.
10133 @opindex Wvector-operation-performance
10134 @opindex Wno-vector-operation-performance
10135 @item -Wvector-operation-performance
10136 Warn if vector operation is not implemented via SIMD capabilities of the
10137 architecture.  Mainly useful for the performance tuning.
10138 Vector operation can be implemented @code{piecewise}, which means that the
10139 scalar operation is performed on every vector element; 
10140 @code{in parallel}, which means that the vector operation is implemented
10141 using scalars of wider type, which normally is more performance efficient;
10142 and @code{as a single scalar}, which means that vector fits into a
10143 scalar type.
10145 @opindex Wvla
10146 @opindex Wno-vla
10147 @item -Wvla
10148 Warn if a variable-length array is used in the code.
10149 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
10150 the variable-length array.
10152 This warning is upgraded to an error by @option{-pedantic-errors}.
10154 @opindex Wvla-larger-than=
10155 @opindex Wno-vla-larger-than
10156 @item -Wvla-larger-than=@var{byte-size}
10157 If this option is used, the compiler warns for declarations of
10158 variable-length arrays whose size is either unbounded, or bounded
10159 by an argument that allows the array size to exceed @var{byte-size}
10160 bytes.  This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
10161 works, but with variable-length arrays.
10163 Note that GCC may optimize small variable-length arrays of a known
10164 value into plain arrays, so this warning may not get triggered for
10165 such arrays.
10167 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
10168 is typically only effective when @option{-ftree-vrp} is active (default
10169 for @option{-O2} and above).
10171 See also @option{-Walloca-larger-than=@var{byte-size}}.
10173 @opindex Wno-vla-larger-than
10174 @item -Wno-vla-larger-than
10175 Disable @option{-Wvla-larger-than=} warnings.  The option is equivalent
10176 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
10178 @opindex Wno-vla-parameter
10179 @item -Wvla-parameter
10180 Warn about redeclarations of functions involving arguments of Variable
10181 Length Array types of inconsistent kinds or forms, and enable the detection
10182 of out-of-bounds accesses to such parameters by warnings such as
10183 @option{-Warray-bounds}.
10185 If the first function declaration uses the VLA form the bound specified
10186 in the array is assumed to be the minimum number of elements expected to
10187 be provided in calls to the function and the maximum number of elements
10188 accessed by it.  Failing to provide arguments of sufficient size or
10189 accessing more than the maximum number of elements may be diagnosed.
10191 For example, the warning triggers for the following redeclarations because
10192 the first one allows an array of any size to be passed to @code{f} while
10193 the second one specifies that the array argument must have at least @code{n}
10194 elements.  In addition, calling @code{f} with the associated VLA bound
10195 parameter in excess of the actual VLA bound triggers a warning as well.
10197 @smallexample
10198 void f (int n, int[n]);
10199 // warning: argument 2 previously declared as a VLA
10200 void f (int, int[]);
10202 void g (int n)
10204     if (n > 4)
10205       return;
10206     int a[n];
10207     // warning: access to a by f may be out of bounds
10208     f (sizeof a, a);
10209   @dots{}
10212 @end smallexample
10214 @option{-Wvla-parameter} is included in @option{-Wall}.  The
10215 @option{-Warray-parameter} option triggers warnings for similar problems
10216 involving ordinary array arguments.
10218 @opindex Wvolatile-register-var
10219 @opindex Wno-volatile-register-var
10220 @item -Wvolatile-register-var
10221 Warn if a register variable is declared volatile.  The volatile
10222 modifier does not inhibit all optimizations that may eliminate reads
10223 and/or writes to register variables.  This warning is enabled by
10224 @option{-Wall}.
10226 @opindex Wxor-used-as-pow
10227 @opindex Wno-xor-used-as-pow
10228 @item -Wxor-used-as-pow @r{(C, C++, Objective-C and Objective-C++ only)}
10229 Warn about uses of @code{^}, the exclusive or operator, where it appears
10230 the user meant exponentiation.  Specifically, the warning occurs when the
10231 left-hand side is the decimal constant 2 or 10 and the right-hand side
10232 is also a decimal constant.
10234 In C and C++, @code{^} means exclusive or, whereas in some other languages
10235 (e.g. TeX and some versions of BASIC) it means exponentiation.
10237 This warning is enabled by default.  It can be silenced by converting one
10238 of the operands to hexadecimal.
10240 @opindex Wdisabled-optimization
10241 @opindex Wno-disabled-optimization
10242 @item -Wdisabled-optimization
10243 Warn if a requested optimization pass is disabled.  This warning does
10244 not generally indicate that there is anything wrong with your code; it
10245 merely indicates that GCC's optimizers are unable to handle the code
10246 effectively.  Often, the problem is that your code is too big or too
10247 complex; GCC refuses to optimize programs when the optimization
10248 itself is likely to take inordinate amounts of time.
10250 @opindex Wpointer-sign
10251 @opindex Wno-pointer-sign
10252 @item -Wpointer-sign @r{(C and Objective-C only)}
10253 Warn for pointer argument passing or assignment with different signedness.
10254 This option is only supported for C and Objective-C@.  It is implied by
10255 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
10256 @option{-Wno-pointer-sign}.
10258 This warning is upgraded to an error by @option{-pedantic-errors}.
10260 @opindex Wstack-protector
10261 @opindex Wno-stack-protector
10262 @item -Wstack-protector
10263 This option is only active when @option{-fstack-protector} is active.  It
10264 warns about functions that are not protected against stack smashing.
10266 @opindex Woverlength-strings
10267 @opindex Wno-overlength-strings
10268 @item -Woverlength-strings
10269 Warn about string constants that are longer than the ``minimum
10270 maximum'' length specified in the C standard.  Modern compilers
10271 generally allow string constants that are much longer than the
10272 standard's minimum limit, but very portable programs should avoid
10273 using longer strings.
10275 The limit applies @emph{after} string constant concatenation, and does
10276 not count the trailing NUL@.  In C90, the limit was 509 characters; in
10277 C99, it was raised to 4095.  C++98 does not specify a normative
10278 minimum maximum, so we do not diagnose overlength strings in C++@.
10280 This option is implied by @option{-Wpedantic}, and can be disabled with
10281 @option{-Wno-overlength-strings}.
10283 @opindex Wunsuffixed-float-constants
10284 @opindex Wno-unsuffixed-float-constants
10285 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
10287 Issue a warning for any floating constant that does not have
10288 a suffix.  When used together with @option{-Wsystem-headers} it
10289 warns about such constants in system header files.  This can be useful
10290 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
10291 from the decimal floating-point extension to C99.
10293 @opindex Wlto-type-mismatch
10294 @opindex Wno-lto-type-mismatch
10295 @item -Wno-lto-type-mismatch
10297 During the link-time optimization, do not warn about type mismatches in
10298 global declarations from different compilation units.
10299 Requires @option{-flto} to be enabled.  Enabled by default.
10301 @opindex Wdesignated-init
10302 @opindex Wno-designated-init
10303 @item -Wno-designated-init @r{(C and Objective-C only)}
10304 Suppress warnings when a positional initializer is used to initialize
10305 a structure that has been marked with the @code{designated_init}
10306 attribute.
10308 @end table
10310 @node Static Analyzer Options
10311 @section Options That Control Static Analysis
10313 @table @gcctabopt
10314 @opindex analyzer
10315 @opindex fanalyzer
10316 @opindex fno-analyzer
10317 @item -fanalyzer
10318 This option enables an static analysis of program flow which looks
10319 for ``interesting'' interprocedural paths through the
10320 code, and issues warnings for problems found on them.
10322 This analysis is much more expensive than other GCC warnings.
10324 In technical terms, it performs coverage-guided symbolic execution of
10325 the code being compiled.  It is neither sound nor complete: it can
10326 have false positives and false negatives.  It is a bug-finding tool,
10327 rather than a tool for proving program correctness.
10329 The analyzer is only suitable for use on C code in this release.
10331 Enabling this option effectively enables the following warnings:
10333 @gccoptlist{
10334 -Wanalyzer-allocation-size
10335 -Wanalyzer-deref-before-check
10336 -Wanalyzer-double-fclose
10337 -Wanalyzer-double-free
10338 -Wanalyzer-exposure-through-output-file
10339 -Wanalyzer-exposure-through-uninit-copy
10340 -Wanalyzer-fd-access-mode-mismatch
10341 -Wanalyzer-fd-double-close
10342 -Wanalyzer-fd-leak
10343 -Wanalyzer-fd-phase-mismatch
10344 -Wanalyzer-fd-type-mismatch
10345 -Wanalyzer-fd-use-after-close
10346 -Wanalyzer-fd-use-without-check
10347 -Wanalyzer-file-leak
10348 -Wanalyzer-free-of-non-heap
10349 -Wanalyzer-imprecise-fp-arithmetic
10350 -Wanalyzer-infinite-recursion
10351 -Wanalyzer-jump-through-null
10352 -Wanalyzer-malloc-leak
10353 -Wanalyzer-mismatching-deallocation
10354 -Wanalyzer-null-argument
10355 -Wanalyzer-null-dereference
10356 -Wanalyzer-out-of-bounds
10357 -Wanalyzer-overlapping-buffers
10358 -Wanalyzer-possible-null-argument
10359 -Wanalyzer-possible-null-dereference
10360 -Wanalyzer-putenv-of-auto-var
10361 -Wanalyzer-shift-count-negative
10362 -Wanalyzer-shift-count-overflow
10363 -Wanalyzer-stale-setjmp-buffer
10364 -Wanalyzer-unsafe-call-within-signal-handler
10365 -Wanalyzer-use-after-free
10366 -Wanalyzer-use-of-pointer-in-stale-stack-frame
10367 -Wanalyzer-use-of-uninitialized-value
10368 -Wanalyzer-va-arg-type-mismatch
10369 -Wanalyzer-va-list-exhausted
10370 -Wanalyzer-va-list-leak
10371 -Wanalyzer-va-list-use-after-va-end
10372 -Wanalyzer-write-to-const
10373 -Wanalyzer-write-to-string-literal
10375 @ignore
10376 -Wanalyzer-tainted-allocation-size
10377 -Wanalyzer-tainted-array-index
10378 -Wanalyzer-tainted-divisor
10379 -Wanalyzer-tainted-offset
10380 -Wanalyzer-tainted-size
10381 @end ignore
10383 This option is only available if GCC was configured with analyzer
10384 support enabled.
10386 @opindex Wanalyzer-too-complex
10387 @opindex Wno-analyzer-too-complex
10388 @item -Wanalyzer-too-complex
10389 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
10390 to attempt to explore the control flow and data flow in the program,
10391 but these can be defeated by sufficiently complicated code.
10393 By default, the analysis silently stops if the code is too
10394 complicated for the analyzer to fully explore and it reaches an internal
10395 limit.  The @option{-Wanalyzer-too-complex} option warns if this occurs.
10397 @opindex Wanalyzer-allocation-size
10398 @opindex Wno-analyzer-allocation-size
10399 @item -Wno-analyzer-allocation-size
10400 This warning requires @option{-fanalyzer}, which enables it;
10401 to disable it, use @option{-Wno-analyzer-allocation-size}.
10403 This diagnostic warns for paths through the code in which a pointer to
10404 a buffer is assigned to point at a buffer with a size that is not a
10405 multiple of @code{sizeof (*pointer)}.
10407 See @uref{https://cwe.mitre.org/data/definitions/131.html, CWE-131: Incorrect Calculation of Buffer Size}.
10409 @opindex Wanalyzer-deref-before-check
10410 @opindex Wno-analyzer-deref-before-check
10411 @item -Wno-analyzer-deref-before-check
10412 This warning requires @option{-fanalyzer}, which enables it; use
10413 @option{-Wno-analyzer-deref-before-check}
10414 to disable it.
10416 This diagnostic warns for paths through the code in which a pointer
10417 is checked for @code{NULL} *after* it has already been
10418 dereferenced, suggesting that the pointer could have been NULL.
10419 Such cases suggest that the check for NULL is either redundant,
10420 or that it needs to be moved to before the pointer is dereferenced.
10422 This diagnostic also considers values passed to a function argument
10423 marked with @code{__attribute__((nonnull))} as requiring a non-NULL
10424 value, and thus will complain if such values are checked for @code{NULL}
10425 after returning from such a function call.
10427 This diagnostic is unlikely to be reported when any level of optimization
10428 is enabled, as GCC's optimization logic will typically consider such
10429 checks for NULL as being redundant, and optimize them away before the
10430 analyzer "sees" them.  Hence optimization should be disabled when
10431 attempting to trigger this diagnostic.
10433 @opindex Wanalyzer-double-fclose
10434 @opindex Wno-analyzer-double-fclose
10435 @item -Wno-analyzer-double-fclose
10436 This warning requires @option{-fanalyzer}, which enables it; use
10437 @option{-Wno-analyzer-double-fclose} to disable it.
10439 This diagnostic warns for paths through the code in which a @code{FILE *}
10440 can have @code{fclose} called on it more than once.
10442 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10444 @opindex Wanalyzer-double-free
10445 @opindex Wno-analyzer-double-free
10446 @item -Wno-analyzer-double-free
10447 This warning requires @option{-fanalyzer}, which enables it; use
10448 @option{-Wno-analyzer-double-free} to disable it.
10450 This diagnostic warns for paths through the code in which a pointer
10451 can have a deallocator called on it more than once, either @code{free},
10452 or a deallocator referenced by attribute @code{malloc}.
10454 See @uref{https://cwe.mitre.org/data/definitions/415.html, CWE-415: Double Free}.
10456 @opindex Wanalyzer-exposure-through-output-file
10457 @opindex Wno-analyzer-exposure-through-output-file
10458 @item -Wno-analyzer-exposure-through-output-file
10459 This warning requires @option{-fanalyzer}, which enables it; use
10460 @option{-Wno-analyzer-exposure-through-output-file}
10461 to disable it.
10463 This diagnostic warns for paths through the code in which a
10464 security-sensitive value is written to an output file
10465 (such as writing a password to a log file).
10467 See @uref{https://cwe.mitre.org/data/definitions/532.html, CWE-532: Information Exposure Through Log Files}.
10469 @opindex Wanalyzer-exposure-through-uninit-copy
10470 @opindex Wno-analyzer-exposure-through-uninit-copy
10471 @item -Wanalyzer-exposure-through-uninit-copy
10472 This warning requires both @option{-fanalyzer} and the use of a plugin
10473 to specify a function that copies across a ``trust boundary''.  Use
10474 @option{-Wno-analyzer-exposure-through-uninit-copy} to disable it.
10476 This diagnostic warns for ``infoleaks'' - paths through the code in which
10477 uninitialized values are copied across a security boundary
10478 (such as code within an OS kernel that copies a partially-initialized
10479 struct on the stack to user space).
10481 See @uref{https://cwe.mitre.org/data/definitions/200.html, CWE-200: Exposure of Sensitive Information to an Unauthorized Actor}.
10483 @opindex Wanalyzer-fd-access-mode-mismatch
10484 @opindex Wno-analyzer-fd-access-mode-mismatch
10485 @item -Wno-analyzer-fd-access-mode-mismatch
10486 This warning requires @option{-fanalyzer}, which enables it; use
10487 @option{-Wno-analyzer-fd-access-mode-mismatch}
10488 to disable it.
10490 This diagnostic warns for paths through code in which a
10491 @code{read} on a write-only file descriptor is attempted, or vice versa.
10493 This diagnostic also warns for code paths in a which a function with attribute
10494 @code{fd_arg_read (N)} is called with a file descriptor opened with
10495 @code{O_WRONLY} at referenced argument @code{N} or a function with attribute
10496 @code{fd_arg_write (N)} is called with a file descriptor opened with
10497 @code{O_RDONLY} at referenced argument @var{N}.
10499 @opindex Wanalyzer-fd-double-close
10500 @opindex Wno-analyzer-fd-double-close
10501 @item -Wno-analyzer-fd-double-close
10502 This warning requires @option{-fanalyzer}, which enables it; use
10503 @option{-Wno-analyzer-fd-double-close}
10504 to disable it.
10506 This diagnostic warns for paths through code in which a
10507 file descriptor can be closed more than once.
10509 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10511 @opindex Wanalyzer-fd-leak
10512 @opindex Wno-analyzer-fd-leak
10513 @item -Wno-analyzer-fd-leak
10514 This warning requires @option{-fanalyzer}, which enables it; use
10515 @option{-Wno-analyzer-fd-leak}
10516 to disable it.
10518 This diagnostic warns for paths through code in which an
10519 open file descriptor is leaked.
10521 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10523 @opindex Wanalyzer-fd-phase-mismatch
10524 @opindex Wno-analyzer-fd-phase-mismatch
10525 @item -Wno-analyzer-fd-phase-mismatch
10526 This warning requires @option{-fanalyzer}, which enables it; use
10527 @option{-Wno-analyzer-fd-phase-mismatch}
10528 to disable it.
10530 This diagnostic warns for paths through code in which an operation is
10531 attempted in the wrong phase of a file descriptor's lifetime.
10532 For example, it will warn on attempts to call @code{accept} on a stream
10533 socket that has not yet had @code{listen} successfully called on it.
10535 See @uref{https://cwe.mitre.org/data/definitions/666.html, CWE-666: Operation on Resource in Wrong Phase of Lifetime}.
10537 @opindex Wanalyzer-fd-type-mismatch
10538 @opindex Wno-analyzer-fd-type-mismatch
10539 @item -Wno-analyzer-fd-type-mismatch
10540 This warning requires @option{-fanalyzer}, which enables it; use
10541 @option{-Wno-analyzer-fd-type-mismatch}
10542 to disable it.
10544 This diagnostic warns for paths through code in which an
10545 operation is attempted on the wrong type of file descriptor.
10546 For example, it will warn on attempts to use socket operations
10547 on a file descriptor obtained via @code{open}, or when attempting
10548 to use a stream socket operation on a datagram socket.
10550 @opindex Wanalyzer-fd-use-after-close
10551 @opindex Wno-analyzer-fd-use-after-close
10552 @item -Wno-analyzer-fd-use-after-close
10553 This warning requires @option{-fanalyzer}, which enables it; use
10554 @option{-Wno-analyzer-fd-use-after-close}
10555 to disable it.
10557 This diagnostic warns for paths through code in which a
10558 read or write is called on a closed file descriptor.
10560 This diagnostic also warns for paths through code in which
10561 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10562 or @code{fd_arg_write (N)} is called with a closed file descriptor at
10563 referenced argument @code{N}.
10565 @opindex Wanalyzer-fd-use-without-check
10566 @opindex Wno-analyzer-fd-use-without-check
10567 @item -Wno-analyzer-fd-use-without-check
10568 This warning requires @option{-fanalyzer}, which enables it; use
10569 @option{-Wno-analyzer-fd-use-without-check}
10570 to disable it.
10572 This diagnostic warns for paths through code in which a
10573 file descriptor is used without being checked for validity.
10575 This diagnostic also warns for paths through code in which
10576 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10577 or @code{fd_arg_write (N)} is called with a file descriptor, at referenced
10578 argument @code{N}, without being checked for validity.
10580 @opindex Wanalyzer-file-leak
10581 @opindex Wno-analyzer-file-leak
10582 @item -Wno-analyzer-file-leak
10583 This warning requires @option{-fanalyzer}, which enables it; use
10584 @option{-Wno-analyzer-file-leak}
10585 to disable it.
10587 This diagnostic warns for paths through the code in which a
10588 @code{<stdio.h>} @code{FILE *} stream object is leaked.
10590 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10592 @opindex Wanalyzer-free-of-non-heap
10593 @opindex Wno-analyzer-free-of-non-heap
10594 @item -Wno-analyzer-free-of-non-heap
10595 This warning requires @option{-fanalyzer}, which enables it; use
10596 @option{-Wno-analyzer-free-of-non-heap}
10597 to disable it.
10599 This diagnostic warns for paths through the code in which @code{free}
10600 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
10602 See @uref{https://cwe.mitre.org/data/definitions/590.html, CWE-590: Free of Memory not on the Heap}.
10604 @opindex Wanalyzer-imprecise-fp-arithmetic
10605 @opindex Wno-analyzer-imprecise-fp-arithmetic
10606 @item -Wno-analyzer-imprecise-fp-arithmetic
10607 This warning requires @option{-fanalyzer}, which enables it; use
10608 @option{-Wno-analyzer-imprecise-fp-arithmetic}
10609 to disable it.
10611 This diagnostic warns for paths through the code in which floating-point
10612 arithmetic is used in locations where precise computation is needed.  This
10613 diagnostic only warns on use of floating-point operands inside the
10614 calculation of an allocation size at the moment.
10616 @opindex Wanalyzer-infinite-recursion
10617 @opindex Wno-analyzer-infinite-recursion
10618 @item -Wno-analyzer-infinite-recursion
10619 This warning requires @option{-fanalyzer}, which enables it; use
10620 @option{-Wno-analyzer-infinite-recursion} to disable it.
10622 This diagnostics warns for paths through the code which appear to
10623 lead to infinite recursion.
10625 Specifically, when the analyzer "sees" a recursive call, it will compare
10626 the state of memory at the entry to the new frame with that at the entry
10627 to the previous frame of that function on the stack.  The warning is
10628 issued if nothing in memory appears to be changing; any changes observed
10629 to parameters or globals are assumed to lead to termination of the
10630 recursion and thus suppress the warning.
10632 This diagnostic is likely to miss cases of infinite recursion that
10633 are convered to iteration by the optimizer before the analyzer "sees"
10634 them.  Hence optimization should be disabled when attempting to trigger
10635 this diagnostic.
10637 Compare with @option{-Winfinite-recursion}, which provides a similar
10638 diagnostic, but is implemented in a different way.
10640 @opindex Wanalyzer-jump-through-null
10641 @opindex Wno-analyzer-jump-through-null
10642 @item -Wno-analyzer-jump-through-null
10643 This warning requires @option{-fanalyzer}, which enables it; use
10644 @option{-Wno-analyzer-jump-through-null}
10645 to disable it.
10647 This diagnostic warns for paths through the code in which a @code{NULL}
10648 function pointer is called.
10650 @opindex Wanalyzer-malloc-leak
10651 @opindex Wno-analyzer-malloc-leak
10652 @item -Wno-analyzer-malloc-leak
10653 This warning requires @option{-fanalyzer}, which enables it; use
10654 @option{-Wno-analyzer-malloc-leak}
10655 to disable it.
10657 This diagnostic warns for paths through the code in which a
10658 pointer allocated via an allocator is leaked: either @code{malloc},
10659 or a function marked with attribute @code{malloc}.
10661 See @uref{https://cwe.mitre.org/data/definitions/401.html, CWE-401: Missing Release of Memory after Effective Lifetime}.
10663 @opindex Wanalyzer-mismatching-deallocation
10664 @opindex Wno-analyzer-mismatching-deallocation
10665 @item -Wno-analyzer-mismatching-deallocation
10666 This warning requires @option{-fanalyzer}, which enables it; use
10667 @option{-Wno-analyzer-mismatching-deallocation}
10668 to disable it.
10670 This diagnostic warns for paths through the code in which the
10671 wrong deallocation function is called on a pointer value, based on
10672 which function was used to allocate the pointer value.  The diagnostic
10673 will warn about mismatches between @code{free}, scalar @code{delete}
10674 and vector @code{delete[]}, and those marked as allocator/deallocator
10675 pairs using attribute @code{malloc}.
10677 See @uref{https://cwe.mitre.org/data/definitions/762.html, CWE-762: Mismatched Memory Management Routines}.
10679 @opindex Wanalyzer-out-of-bounds
10680 @opindex Wno-analyzer-out-of-bounds
10681 @item -Wno-analyzer-out-of-bounds
10682 This warning requires @option{-fanalyzer}, which enables it; use
10683 @option{-Wno-analyzer-out-of-bounds} to disable it.
10685 This diagnostic warns for paths through the code in which a buffer is
10686 definitely read or written out-of-bounds.  The diagnostic applies for
10687 cases where the analyzer is able to determine a constant offset and for
10688 accesses past the end of a buffer, also a constant capacity.  Further,
10689 the diagnostic does limited checking for accesses past the end when the
10690 offset as well as the capacity is symbolic.
10692 See @uref{https://cwe.mitre.org/data/definitions/119.html, CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer}.
10694 For cases where the analyzer is able, it will emit a text art diagram
10695 visualizing the spatial relationship between the memory region that the
10696 analyzer predicts would be accessed, versus the range of memory that is
10697 valid to access: whether they overlap, are touching, are close or far
10698 apart; which one is before or after in memory, the relative sizes
10699 involved, the direction of the access (read vs write), and, in some
10700 cases, the values of data involved.  This diagram can be suppressed
10701 using @option{-fdiagnostics-text-art-charset=none}.
10703 @opindex Wanalyzer-overlapping-buffers
10704 @opindex Wno-analyzer-overlapping-buffers
10705 @item -Wno-analyzer-overlapping-buffers
10706 This warning requires @option{-fanalyzer}, which enables it; use
10707 @option{-Wno-analyzer-overlapping-buffers} to disable it.
10709 This diagnostic warns for paths through the code in which overlapping
10710 buffers are passed to an API for which the behavior on such buffers
10711 is undefined.
10713 Specifically, the diagnostic occurs on calls to the following functions
10714 @itemize @bullet
10715 @item @code{memcpy}
10716 @item @code{strcat}
10717 @item @code{strcpy}
10718 @end itemize
10719 for cases where the buffers are known to overlap.
10721 @opindex Wanalyzer-possible-null-argument
10722 @opindex Wno-analyzer-possible-null-argument
10723 @item -Wno-analyzer-possible-null-argument
10724 This warning requires @option{-fanalyzer}, which enables it; use
10725 @option{-Wno-analyzer-possible-null-argument} to disable it.
10727 This diagnostic warns for paths through the code in which a
10728 possibly-NULL value is passed to a function argument marked
10729 with @code{__attribute__((nonnull))} as requiring a non-NULL
10730 value.
10732 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10734 @opindex Wanalyzer-possible-null-dereference
10735 @opindex Wno-analyzer-possible-null-dereference
10736 @item -Wno-analyzer-possible-null-dereference
10737 This warning requires @option{-fanalyzer}, which enables it; use
10738 @option{-Wno-analyzer-possible-null-dereference} to disable it.
10740 This diagnostic warns for paths through the code in which a
10741 possibly-NULL value is dereferenced.
10743 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10745 @opindex Wanalyzer-null-argument
10746 @opindex Wno-analyzer-null-argument
10747 @item -Wno-analyzer-null-argument
10748 This warning requires @option{-fanalyzer}, which enables it; use
10749 @option{-Wno-analyzer-null-argument} to disable it.
10751 This diagnostic warns for paths through the code in which a
10752 value known to be NULL is passed to a function argument marked
10753 with @code{__attribute__((nonnull))} as requiring a non-NULL
10754 value.
10756 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10758 @opindex Wanalyzer-null-dereference
10759 @opindex Wno-analyzer-null-dereference
10760 @item -Wno-analyzer-null-dereference
10761 This warning requires @option{-fanalyzer}, which enables it; use
10762 @option{-Wno-analyzer-null-dereference} to disable it.
10764 This diagnostic warns for paths through the code in which a
10765 value known to be NULL is dereferenced.
10767 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10769 @opindex Wanalyzer-putenv-of-auto-var
10770 @opindex Wno-analyzer-putenv-of-auto-var
10771 @item -Wno-analyzer-putenv-of-auto-var
10772 This warning requires @option{-fanalyzer}, which enables it; use
10773 @option{-Wno-analyzer-putenv-of-auto-var} to disable it.
10775 This diagnostic warns for paths through the code in which a
10776 call to @code{putenv} is passed a pointer to an automatic variable
10777 or an on-stack buffer.
10779 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}.
10781 @opindex Wanalyzer-shift-count-negative
10782 @opindex Wno-analyzer-shift-count-negative
10783 @item -Wno-analyzer-shift-count-negative
10784 This warning requires @option{-fanalyzer}, which enables it; use
10785 @option{-Wno-analyzer-shift-count-negative} to disable it.
10787 This diagnostic warns for paths through the code in which a
10788 shift is attempted with a negative count.  It is analogous to
10789 the @option{-Wshift-count-negative} diagnostic implemented in
10790 the C/C++ front ends, but is implemented based on analyzing
10791 interprocedural paths, rather than merely parsing the syntax tree.
10792 However, the analyzer does not prioritize detection of such paths, so
10793 false negatives are more likely relative to other warnings.
10795 @opindex Wanalyzer-shift-count-overflow
10796 @opindex Wno-analyzer-shift-count-overflow
10797 @item -Wno-analyzer-shift-count-overflow
10798 This warning requires @option{-fanalyzer}, which enables it; use
10799 @option{-Wno-analyzer-shift-count-overflow} to disable it.
10801 This diagnostic warns for paths through the code in which a
10802 shift is attempted with a count greater than or equal to the
10803 precision of the operand's type.  It is analogous to
10804 the @option{-Wshift-count-overflow} diagnostic implemented in
10805 the C/C++ front ends, but is implemented based on analyzing
10806 interprocedural paths, rather than merely parsing the syntax tree.
10807 However, the analyzer does not prioritize detection of such paths, so
10808 false negatives are more likely relative to other warnings.
10810 @opindex Wanalyzer-stale-setjmp-buffer
10811 @opindex Wno-analyzer-stale-setjmp-buffer
10812 @item -Wno-analyzer-stale-setjmp-buffer
10813 This warning requires @option{-fanalyzer}, which enables it; use
10814 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
10816 This diagnostic warns for paths through the code in which
10817 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
10818 to a @code{setjmp} call in a function that has returned.
10820 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
10821 location, it records the stack frame.  The stack frame becomes invalid
10822 when the function containing the @code{setjmp} call returns.  Attempting
10823 to rewind to it via @code{longjmp} would reference a stack frame that
10824 no longer exists, and likely lead to a crash (or worse).
10826 @opindex Wanalyzer-tainted-allocation-size
10827 @opindex Wno-analyzer-tainted-allocation-size
10828 @item -Wno-analyzer-tainted-allocation-size
10829 This warning requires both @option{-fanalyzer} and
10830 @option{-fanalyzer-checker=taint} to enable it;
10831 use @option{-Wno-analyzer-tainted-allocation-size} to disable it.
10833 This diagnostic warns for paths through the code in which a value
10834 that could be under an attacker's control is used as the size
10835 of an allocation without being sanitized, so that an attacker could
10836 inject an excessively large allocation and potentially cause a denial
10837 of service attack.
10839 See @uref{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}.
10841 @opindex Wanalyzer-tainted-assertion
10842 @opindex Wno-analyzer-tainted-assertion
10843 @item -Wno-analyzer-tainted-assertion
10845 This warning requires both @option{-fanalyzer} and
10846 @option{-fanalyzer-checker=taint} to enable it;
10847 use @option{-Wno-analyzer-tainted-assertion} to disable it.
10849 This diagnostic warns for paths through the code in which a value
10850 that could be under an attacker's control is used as part of a
10851 condition without being first sanitized, and that condition guards a
10852 call to a function marked with attribute @code{noreturn}
10853 (such as the function @code{__builtin_unreachable}).  Such functions
10854 typically indicate abnormal termination of the program, such as for
10855 assertion failure handlers.  For example:
10857 @smallexample
10858 assert (some_tainted_value < SOME_LIMIT);
10859 @end smallexample
10861 In such cases:
10863 @itemize
10864 @item
10865 when assertion-checking is enabled: an attacker could trigger
10866 a denial of service by injecting an assertion failure
10868 @item
10869 when assertion-checking is disabled, such as by defining @code{NDEBUG},
10870 an attacker could inject data that subverts the process, since it
10871 presumably violates a precondition that is being assumed by the code.
10873 @end itemize
10875 Note that when assertion-checking is disabled, the assertions are
10876 typically removed by the preprocessor before the analyzer has a chance
10877 to "see" them, so this diagnostic can only generate warnings on builds
10878 in which assertion-checking is enabled.
10880 For the purpose of this warning, any function marked with attribute
10881 @code{noreturn} is considered as a possible assertion failure
10882 handler, including @code{__builtin_unreachable}.  Note that these functions
10883 are sometimes removed by the optimizer before the analyzer "sees" them.
10884 Hence optimization should be disabled when attempting to trigger this
10885 diagnostic.
10887 See @uref{https://cwe.mitre.org/data/definitions/617.html, CWE-617: Reachable Assertion}.
10889 The warning can also report problematic constructions such as
10891 @smallexample
10892 switch (some_tainted_value) @{
10893 case 0:
10894   /* [...etc; various valid cases omitted...] */
10895   break;
10897 default:
10898   __builtin_unreachable (); /* BUG: attacker can trigger this  */
10900 @end smallexample
10902 despite the above not being an assertion failure, strictly speaking.
10904 @opindex Wanalyzer-tainted-array-index
10905 @opindex Wno-analyzer-tainted-array-index
10906 @item -Wno-analyzer-tainted-array-index
10907 This warning requires both @option{-fanalyzer} and
10908 @option{-fanalyzer-checker=taint} to enable it;
10909 use @option{-Wno-analyzer-tainted-array-index} to disable it.
10911 This diagnostic warns for paths through the code in which a value
10912 that could be under an attacker's control is used as the index
10913 of an array access without being sanitized, so that an attacker
10914 could inject an out-of-bounds access.
10916 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
10918 @opindex Wanalyzer-tainted-divisor
10919 @opindex Wno-analyzer-tainted-divisor
10920 @item -Wno-analyzer-tainted-divisor
10921 This warning requires both @option{-fanalyzer} and
10922 @option{-fanalyzer-checker=taint} to enable it;
10923 use @option{-Wno-analyzer-tainted-divisor} to disable it.
10925 This diagnostic warns for paths through the code in which a value
10926 that could be under an attacker's control is used as the divisor
10927 in a division or modulus operation without being sanitized, so that
10928 an attacker could inject a division-by-zero.
10930 See @uref{https://cwe.mitre.org/data/definitions/369.html, CWE-369: Divide By Zero}.
10932 @opindex Wanalyzer-tainted-offset
10933 @opindex Wno-analyzer-tainted-offset
10934 @item -Wno-analyzer-tainted-offset
10935 This warning requires both @option{-fanalyzer} and
10936 @option{-fanalyzer-checker=taint} to enable it;
10937 use @option{-Wno-analyzer-tainted-offset} to disable it.
10939 This diagnostic warns for paths through the code in which a value
10940 that could be under an attacker's control is used as a pointer offset
10941 without being sanitized, so that an attacker could inject an out-of-bounds
10942 access.
10944 See @uref{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}.
10946 @opindex Wanalyzer-tainted-size
10947 @opindex Wno-analyzer-tainted-size
10948 @item -Wno-analyzer-tainted-size
10949 This warning requires both @option{-fanalyzer} and
10950 @option{-fanalyzer-checker=taint} to enable it;
10951 use @option{-Wno-analyzer-tainted-size} to disable it.
10953 This diagnostic warns for paths through the code in which a value
10954 that could be under an attacker's control is used as the size of
10955 an operation such as @code{memset} without being sanitized, so that an
10956 attacker could inject an out-of-bounds access.
10958 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
10960 @opindex Wanalyzer-unsafe-call-within-signal-handler
10961 @opindex Wno-analyzer-unsafe-call-within-signal-handler
10962 @item -Wno-analyzer-unsafe-call-within-signal-handler
10963 This warning requires @option{-fanalyzer}, which enables it; use
10964 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
10966 This diagnostic warns for paths through the code in which a
10967 function known to be async-signal-unsafe (such as @code{fprintf}) is
10968 called from a signal handler.
10970 See @uref{https://cwe.mitre.org/data/definitions/479.html, CWE-479: Signal Handler Use of a Non-reentrant Function}.
10972 @opindex Wanalyzer-use-after-free
10973 @opindex Wno-analyzer-use-after-free
10974 @item -Wno-analyzer-use-after-free
10975 This warning requires @option{-fanalyzer}, which enables it; use
10976 @option{-Wno-analyzer-use-after-free} to disable it.
10978 This diagnostic warns for paths through the code in which a
10979 pointer is used after a deallocator is called on it: either @code{free},
10980 or a deallocator referenced by attribute @code{malloc}.
10982 See @uref{https://cwe.mitre.org/data/definitions/416.html, CWE-416: Use After Free}.
10984 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
10985 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
10986 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
10987 This warning requires @option{-fanalyzer}, which enables it; use
10988 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
10989 to disable it.
10991 This diagnostic warns for paths through the code in which a pointer
10992 is dereferenced that points to a variable in a stale stack frame.
10994 @opindex Wanalyzer-va-arg-type-mismatch
10995 @opindex Wno-analyzer-va-arg-type-mismatch
10996 @item -Wno-analyzer-va-arg-type-mismatch
10997 This warning requires @option{-fanalyzer}, which enables it; use
10998 @option{-Wno-analyzer-va-arg-type-mismatch}
10999 to disable it.
11001 This diagnostic warns for interprocedural paths through the code for which
11002 the analyzer detects an attempt to use @code{va_arg} to extract a value
11003 passed to a variadic call, but uses a type that does not match that of
11004 the expression passed to the call.
11006 See @uref{https://cwe.mitre.org/data/definitions/686.html, CWE-686: Function Call With Incorrect Argument Type}.
11008 @opindex Wanalyzer-va-list-exhausted
11009 @opindex Wno-analyzer-va-list-exhausted
11010 @item -Wno-analyzer-va-list-exhausted
11011 This warning requires @option{-fanalyzer}, which enables it; use
11012 @option{-Wno-analyzer-va-list-exhausted}
11013 to disable it.
11015 This diagnostic warns for interprocedural paths through the code for which
11016 the analyzer detects an attempt to use @code{va_arg} to access the next
11017 value passed to a variadic call, but all of the values in the
11018 @code{va_list} have already been consumed.
11020 See @uref{https://cwe.mitre.org/data/definitions/685.html, CWE-685: Function Call With Incorrect Number of Arguments}.
11022 @opindex Wanalyzer-va-list-leak
11023 @opindex Wno-analyzer-va-list-leak
11024 @item -Wno-analyzer-va-list-leak
11025 This warning requires @option{-fanalyzer}, which enables it; use
11026 @option{-Wno-analyzer-va-list-leak}
11027 to disable it.
11029 This diagnostic warns for interprocedural paths through the code for which
11030 the analyzer detects that @code{va_start} or @code{va_copy} has been called
11031 on a @code{va_list} without a corresponding call to @code{va_end}.
11033 @opindex Wanalyzer-va-list-use-after-va-end
11034 @opindex Wno-analyzer-va-list-use-after-va-end
11035 @item -Wno-analyzer-va-list-use-after-va-end
11036 This warning requires @option{-fanalyzer}, which enables it; use
11037 @option{-Wno-analyzer-va-list-use-after-va-end}
11038 to disable it.
11040 This diagnostic warns for interprocedural paths through the code for which
11041 the analyzer detects an attempt to use a @code{va_list}  after
11042 @code{va_end} has been called on it.
11043 @code{va_list}.
11045 @opindex Wanalyzer-write-to-const
11046 @opindex Wno-analyzer-write-to-const
11047 @item -Wno-analyzer-write-to-const
11048 This warning requires @option{-fanalyzer}, which enables it; use
11049 @option{-Wno-analyzer-write-to-const}
11050 to disable it.
11052 This diagnostic warns for paths through the code in which the analyzer
11053 detects an attempt to write through a pointer to a @code{const} object.
11054 However, the analyzer does not prioritize detection of such paths, so
11055 false negatives are more likely relative to other warnings.
11057 @opindex Wanalyzer-write-to-string-literal
11058 @opindex Wno-analyzer-write-to-string-literal
11059 @item -Wno-analyzer-write-to-string-literal
11060 This warning requires @option{-fanalyzer}, which enables it; use
11061 @option{-Wno-analyzer-write-to-string-literal}
11062 to disable it.
11064 This diagnostic warns for paths through the code in which the analyzer
11065 detects an attempt to write through a pointer to a string literal.
11066 However, the analyzer does not prioritize detection of such paths, so
11067 false negatives are more likely relative to other warnings.
11069 @opindex Wanalyzer-use-of-uninitialized-value
11070 @opindex Wno-analyzer-use-of-uninitialized-value
11071 @item -Wno-analyzer-use-of-uninitialized-value
11072 This warning requires @option{-fanalyzer}, which enables it; use
11073 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
11075 This diagnostic warns for paths through the code in which an uninitialized
11076 value is used.
11078 See @uref{https://cwe.mitre.org/data/definitions/457.html, CWE-457: Use of Uninitialized Variable}.
11080 @end table
11082 The analyzer has hardcoded knowledge about the behavior of the following
11083 memory-management functions:
11085 @itemize @bullet
11086 @item @code{alloca}
11087 @item The built-in functions @code{__builtin_alloc},
11088 @code{__builtin_alloc_with_align}, @item @code{__builtin_calloc},
11089 @code{__builtin_free}, @code{__builtin_malloc}, @code{__builtin_memcpy},
11090 @code{__builtin_memcpy_chk}, @code{__builtin_memset},
11091 @code{__builtin_memset_chk}, @code{__builtin_realloc},
11092 @code{__builtin_stack_restore}, and @code{__builtin_stack_save}
11093 @item @code{calloc}
11094 @item @code{free}
11095 @item @code{malloc}
11096 @item @code{memset}
11097 @item @code{operator delete}
11098 @item @code{operator delete []}
11099 @item @code{operator new}
11100 @item @code{operator new []}
11101 @item @code{realloc}
11102 @item @code{strdup}
11103 @item @code{strndup}
11104 @end itemize
11106 @noindent
11107 of the following functions for working with file descriptors:
11109 @itemize @bullet
11110 @item @code{open}
11111 @item @code{close}
11112 @item @code{creat}
11113 @item @code{dup}, @code{dup2} and @code{dup3}
11114 @item @code{isatty}
11115 @item @code{pipe}, and @code{pipe2}
11116 @item @code{read}
11117 @item @code{write}
11118 @item @code{socket}, @code{bind}, @code{listen}, @code{accept}, and @code{connect}
11119 @end itemize
11121 @noindent
11122 of the following functions for working with @code{<stdio.h>} streams:
11123 @itemize @bullet
11124 @item The built-in functions @code{__builtin_fprintf},
11125 @code{__builtin_fprintf_unlocked}, @code{__builtin_fputc},
11126 @code{__builtin_fputc_unlocked}, @code{__builtin_fputs},
11127 @code{__builtin_fputs_unlocked}, @code{__builtin_fwrite},
11128 @code{__builtin_fwrite_unlocked}, @code{__builtin_printf},
11129 @code{__builtin_printf_unlocked}, @code{__builtin_putc},
11130 @code{__builtin_putchar}, @code{__builtin_putchar_unlocked},
11131 @code{__builtin_putc_unlocked}, @code{__builtin_puts},
11132 @code{__builtin_puts_unlocked}, @code{__builtin_vfprintf}, and
11133 @code{__builtin_vprintf}
11134 @item @code{fopen}
11135 @item @code{fclose}
11136 @item @code{ferror}
11137 @item @code{fgets}
11138 @item @code{fgets_unlocked}
11139 @item @code{fileno}
11140 @item @code{fread}
11141 @item @code{getc}
11142 @item @code{getchar}
11143 @item @code{fprintf}
11144 @item @code{printf}
11145 @item @code{fwrite}
11146 @end itemize
11148 @noindent
11149 and of the following functions:
11151 @itemize @bullet
11152 @item The built-in functions @code{__builtin_expect},
11153 @code{__builtin_expect_with_probability}, @code{__builtin_strchr},
11154 @code{__builtin_strcpy}, @code{__builtin_strcpy_chk},
11155 @code{__builtin_strlen}, @code{__builtin_va_copy}, and
11156 @code{__builtin_va_start}
11157 @item The GNU extensions @code{error} and @code{error_at_line}
11158 @item @code{getpass}
11159 @item @code{longjmp}
11160 @item @code{putenv}
11161 @item @code{setjmp}
11162 @item @code{siglongjmp}
11163 @item @code{signal}
11164 @item @code{sigsetjmp}
11165 @item @code{strcat}
11166 @item @code{strchr}
11167 @item @code{strlen}
11168 @end itemize
11170 In addition, various functions with an @code{__analyzer_} prefix have
11171 special meaning to the analyzer, described in the GCC Internals manual.
11173 Pertinent parameters for controlling the exploration are:
11174 @itemize @bullet
11175 @item @option{--param analyzer-bb-explosion-factor=@var{value}}
11176 @item @option{--param analyzer-max-enodes-per-program-point=@var{value}}
11177 @item @option{--param analyzer-max-recursion-depth=@var{value}}
11178 @item @option{--param analyzer-min-snodes-for-call-summary=@var{value}}
11179 @end itemize
11181 The following options control the analyzer.
11183 @table @gcctabopt
11185 @opindex fanalyzer-call-summaries
11186 @opindex fno-analyzer-call-summaries
11187 @item -fanalyzer-call-summaries
11188 Simplify interprocedural analysis by computing the effect of certain calls,
11189 rather than exploring all paths through the function from callsite to each
11190 possible return.
11192 If enabled, call summaries are only used for functions with more than one
11193 call site, and that are sufficiently complicated (as per
11194 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
11196 @opindex fanalyzer-checker
11197 @item -fanalyzer-checker=@var{name}
11198 Restrict the analyzer to run just the named checker, and enable it.
11200 Some checkers are disabled by default (even with @option{-fanalyzer}),
11201 such as the @code{taint} checker that implements
11202 @option{-Wanalyzer-tainted-array-index}, and this option is required
11203 to enable them.
11205 @emph{Note:} currently, @option{-fanalyzer-checker=taint} disables the
11206 following warnings from @option{-fanalyzer}:
11208 @gccoptlist{
11209 -Wanalyzer-deref-before-check
11210 -Wanalyzer-double-fclose
11211 -Wanalyzer-double-free
11212 -Wanalyzer-exposure-through-output-file
11213 -Wanalyzer-fd-access-mode-mismatch
11214 -Wanalyzer-fd-double-close
11215 -Wanalyzer-fd-leak
11216 -Wanalyzer-fd-use-after-close
11217 -Wanalyzer-fd-use-without-check
11218 -Wanalyzer-file-leak
11219 -Wanalyzer-free-of-non-heap
11220 -Wanalyzer-malloc-leak
11221 -Wanalyzer-mismatching-deallocation
11222 -Wanalyzer-null-argument
11223 -Wanalyzer-null-dereference
11224 -Wanalyzer-possible-null-argument
11225 -Wanalyzer-possible-null-dereference
11226 -Wanalyzer-unsafe-call-within-signal-handler
11227 -Wanalyzer-use-after-free
11228 -Wanalyzer-va-list-leak
11229 -Wanalyzer-va-list-use-after-va-end
11232 @opindex fanalyzer-debug-text-art
11233 @opindex fno-analyzer-debug-text-art
11234 @item -fanalyzer-debug-text-art-headings
11235 This option is intended for analyzer developers.  If enabled,
11236 the analyzer will add extra annotations to any diagrams it generates.
11238 @opindex fanalyzer-feasibility
11239 @opindex fno-analyzer-feasibility
11240 @item -fno-analyzer-feasibility
11241 This option is intended for analyzer developers.
11243 By default the analyzer verifies that there is a feasible control flow path
11244 for each diagnostic it emits: that the conditions that hold are not mutually
11245 exclusive.  Diagnostics for which no feasible path can be found are rejected.
11246 This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
11247 debugging issues in this code.
11249 @opindex fanalyzer-fine-grained
11250 @opindex fno-analyzer-fine-grained
11251 @item -fanalyzer-fine-grained
11252 This option is intended for analyzer developers.
11254 Internally the analyzer builds an ``exploded graph'' that combines
11255 control flow graphs with data flow information.
11257 By default, an edge in this graph can contain the effects of a run
11258 of multiple statements within a basic block.  With
11259 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
11261 @opindex fanalyzer-show-duplicate-count
11262 @opindex fno-analyzer-show-duplicate-count
11263 @item -fanalyzer-show-duplicate-count
11264 This option is intended for analyzer developers: if multiple diagnostics
11265 have been detected as being duplicates of each other, it emits a note when
11266 reporting the best diagnostic, giving the number of additional diagnostics
11267 that were suppressed by the deduplication logic.
11269 @opindex fanalyzer-show-events-in-system-headers
11270 @opindex fno-analyzer-show-events-in-system-headers
11271 @item -fanalyzer-show-events-in-system-headers
11272 By default the analyzer emits simplified diagnostics paths by hiding
11273 events fully located within a system header.
11274 With @option{-fanalyzer-show-events-in-system-headers} such
11275 events are no longer suppressed.
11277 @opindex fanalyzer-state-merge
11278 @opindex fno-analyzer-state-merge
11279 @item -fno-analyzer-state-merge
11280 This option is intended for analyzer developers.
11282 By default the analyzer attempts to simplify analysis by merging
11283 sufficiently similar states at each program point as it builds its
11284 ``exploded graph''.  With @option{-fno-analyzer-state-merge} this
11285 merging can be suppressed, for debugging state-handling issues.
11287 @opindex fanalyzer-state-purge
11288 @opindex fno-analyzer-state-purge
11289 @item -fno-analyzer-state-purge
11290 This option is intended for analyzer developers.
11292 By default the analyzer attempts to simplify analysis by purging
11293 aspects of state at a program point that appear to no longer be relevant
11294 e.g. the values of locals that aren't accessed later in the function
11295 and which aren't relevant to leak analysis.
11297 With @option{-fno-analyzer-state-purge} this purging of state can
11298 be suppressed, for debugging state-handling issues.
11300 @opindex fanalyzer-suppress-followups
11301 @opindex fno-analyzer-suppress-followups
11302 @item -fno-analyzer-suppress-followups
11303 This option is intended for analyzer developers.
11305 By default the analyzer will stop exploring an execution path after
11306 encountering certain diagnostics, in order to avoid potentially issuing a
11307 cascade of follow-up diagnostics.
11309 The diagnostics that terminate analysis along a path are:
11311 @itemize
11312 @item @option{-Wanalyzer-null-argument}
11313 @item @option{-Wanalyzer-null-dereference}
11314 @item @option{-Wanalyzer-use-after-free}
11315 @item @option{-Wanalyzer-use-of-pointer-in-stale-stack-frame}
11316 @item @option{-Wanalyzer-use-of-uninitialized-value}
11317 @end itemize
11319 With @option{-fno-analyzer-suppress-followups} the analyzer will
11320 continue to explore such paths even after such diagnostics, which may
11321 be helpful for debugging issues in the analyzer, or for microbenchmarks
11322 for detecting undefined behavior.
11324 @opindex fanalyzer-transitivity
11325 @opindex fno-analyzer-transitivity
11326 @item -fanalyzer-transitivity
11327 This option enables transitivity of constraints within the analyzer.
11329 @opindex fanalyzer-undo-inlining
11330 @opindex fno-analyzer-undo-inlining
11331 @item -fno-analyzer-undo-inlining
11332 This option is intended for analyzer developers.
11334 @option{-fanalyzer} runs relatively late compared to other code analysis
11335 tools, and some optimizations have already been applied to the code.  In
11336 particular function inlining may have occurred, leading to the
11337 interprocedural execution paths emitted by the analyzer containing
11338 function frames that don't correspond to those in the original source
11339 code.
11341 By default the analyzer attempts to reconstruct the original function
11342 frames, and to emit events showing the inlined calls.
11344 With @option{-fno-analyzer-undo-inlining} this attempt to reconstruct
11345 the original frame information can be be disabled, which may be of help
11346 when debugging issues in the analyzer.
11348 @item -fanalyzer-verbose-edges
11349 This option is intended for analyzer developers.  It enables more
11350 verbose, lower-level detail in the descriptions of control flow
11351 within diagnostic paths.
11353 @item -fanalyzer-verbose-state-changes
11354 This option is intended for analyzer developers.  It enables more
11355 verbose, lower-level detail in the descriptions of events relating
11356 to state machines within diagnostic paths.
11358 @item -fanalyzer-verbosity=@var{level}
11359 This option controls the complexity of the control flow paths that are
11360 emitted for analyzer diagnostics.
11362 The @var{level} can be one of:
11364 @table @samp
11365 @item 0
11366 At this level, interprocedural call and return events are displayed,
11367 along with the most pertinent state-change events relating to
11368 a diagnostic.  For example, for a double-@code{free} diagnostic,
11369 both calls to @code{free} will be shown.
11371 @item 1
11372 As per the previous level, but also show events for the entry
11373 to each function.
11375 @item 2
11376 As per the previous level, but also show events relating to
11377 control flow that are significant to triggering the issue
11378 (e.g. ``true path taken'' at a conditional).
11380 This level is the default.
11382 @item 3
11383 As per the previous level, but show all control flow events, not
11384 just significant ones.
11386 @item 4
11387 This level is intended for analyzer developers; it adds various
11388 other events intended for debugging the analyzer.
11390 @end table
11392 @opindex fdump-analyzer
11393 @item -fdump-analyzer
11394 Dump internal details about what the analyzer is doing to
11395 @file{@var{file}.analyzer.txt}.
11396 @option{-fdump-analyzer-stderr} overrides this option.
11398 @opindex fdump-analyzer-stderr
11399 @item -fdump-analyzer-stderr
11400 Dump internal details about what the analyzer is doing to stderr.
11401 This option overrides @option{-fdump-analyzer}.
11403 @opindex fdump-analyzer-callgraph
11404 @item -fdump-analyzer-callgraph
11405 Dump a representation of the call graph suitable for viewing with
11406 GraphViz to @file{@var{file}.callgraph.dot}.
11408 @opindex fdump-analyzer-exploded-graph
11409 @item -fdump-analyzer-exploded-graph
11410 Dump a representation of the ``exploded graph'' suitable for viewing with
11411 GraphViz to @file{@var{file}.eg.dot}.
11412 Nodes are color-coded based on state-machine states to emphasize
11413 state changes.
11415 @opindex dump-analyzer-exploded-nodes
11416 @item -fdump-analyzer-exploded-nodes
11417 Emit diagnostics showing where nodes in the ``exploded graph'' are
11418 in relation to the program source.
11420 @opindex dump-analyzer-exploded-nodes-2
11421 @item -fdump-analyzer-exploded-nodes-2
11422 Dump a textual representation of the ``exploded graph'' to
11423 @file{@var{file}.eg.txt}.
11425 @opindex dump-analyzer-exploded-nodes-3
11426 @item -fdump-analyzer-exploded-nodes-3
11427 Dump a textual representation of the ``exploded graph'' to
11428 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
11429 This is typically a large number of dump files.
11431 @opindex fdump-analyzer-exploded-paths
11432 @item -fdump-analyzer-exploded-paths
11433 Dump a textual representation of the ``exploded path'' for each
11434 diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}.
11436 @opindex dump-analyzer-feasibility
11437 @item -fdump-analyzer-feasibility
11438 Dump internal details about the analyzer's search for feasible paths.
11439 The details are written in a form suitable for viewing with GraphViz
11440 to filenames of the form @file{@var{file}.*.fg.dot},
11441 @file{@var{file}.*.tg.dot}, and @file{@var{file}.*.fpath.txt}.
11443 @opindex fdump-analyzer-json
11444 @item -fdump-analyzer-json
11445 Dump a compressed JSON representation of analyzer internals to
11446 @file{@var{file}.analyzer.json.gz}.  The precise format is subject
11447 to change.
11449 @opindex fdump-analyzer-state-purge
11450 @item -fdump-analyzer-state-purge
11451 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
11452 ``supergraph'' suitable for viewing with GraphViz, but annotate the
11453 graph with information on what state will be purged at each node.
11454 The graph is written to @file{@var{file}.state-purge.dot}.
11456 @opindex fdump-analyzer-supergraph
11457 @item -fdump-analyzer-supergraph
11458 Dump representations of the ``supergraph'' suitable for viewing with
11459 GraphViz to @file{@var{file}.supergraph.dot} and to
11460 @file{@var{file}.supergraph-eg.dot}.  These show all of the
11461 control flow graphs in the program, with interprocedural edges for
11462 calls and returns.  The second dump contains annotations showing nodes
11463 in the ``exploded graph'' and diagnostics associated with them.
11465 @opindex fdump-analyzer-untracked
11466 @item -fdump-analyzer-untracked
11467 Emit custom warnings with internal details intended for analyzer developers.
11469 @end table
11471 @node Debugging Options
11472 @section Options for Debugging Your Program
11473 @cindex options, debugging
11474 @cindex debugging information options
11476 To tell GCC to emit extra information for use by a debugger, in almost 
11477 all cases you need only to add @option{-g} to your other options.  Some debug
11478 formats can co-exist (like DWARF with CTF) when each of them is enabled
11479 explicitly by adding the respective command line option to your other options.
11481 GCC allows you to use @option{-g} with
11482 @option{-O}.  The shortcuts taken by optimized code may occasionally
11483 be surprising: some variables you declared may not exist
11484 at all; flow of control may briefly move where you did not expect it;
11485 some statements may not be executed because they compute constant
11486 results or their values are already at hand; some statements may
11487 execute in different places because they have been moved out of loops.
11488 Nevertheless it is possible to debug optimized output.  This makes
11489 it reasonable to use the optimizer for programs that might have bugs.
11491 If you are not using some other optimization option, consider
11492 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.  
11493 With no @option{-O} option at all, some compiler passes that collect
11494 information useful for debugging do not run at all, so that
11495 @option{-Og} may result in a better debugging experience.
11497 @table @gcctabopt
11498 @opindex g
11499 @item -g
11500 Produce debugging information in the operating system's native format
11501 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
11502 information.
11504 On most systems that use stabs format, @option{-g} enables use of extra
11505 debugging information that only GDB can use; this extra information
11506 makes debugging work better in GDB but probably makes other debuggers
11507 crash or refuse to read the program.  If you want to control for certain whether
11508 to generate the extra information, use @option{-gvms} (see below).
11510 @opindex ggdb
11511 @item -ggdb
11512 Produce debugging information for use by GDB@.  This means to use the
11513 most expressive format available (DWARF, stabs, or the native format
11514 if neither of those are supported), including GDB extensions if at all
11515 possible.
11517 @opindex gdwarf
11518 @item -gdwarf
11519 @itemx -gdwarf-@var{version}
11520 Produce debugging information in DWARF format (if that is supported).
11521 The value of @var{version} may be either 2, 3, 4 or 5; the default
11522 version for most targets is 5 (with the exception of VxWorks, TPF and
11523 Darwin / macOS, which default to version 2, and AIX, which defaults
11524 to version 4).
11526 Note that with DWARF Version 2, some ports require and always
11527 use some non-conflicting DWARF 3 extensions in the unwind tables.
11529 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
11530 for maximum benefit. Version 5 requires GDB 8.0 or higher.
11532 GCC no longer supports DWARF Version 1, which is substantially
11533 different than Version 2 and later.  For historical reasons, some
11534 other DWARF-related options such as
11535 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
11536 in their names, but apply to all currently-supported versions of DWARF.
11538 @opindex gbtf
11539 @item -gbtf
11540 Request BTF debug information.  BTF is the default debugging format for the
11541 eBPF target.  On other targets, like x86, BTF debug information can be
11542 generated along with DWARF debug information when both of the debug formats are
11543 enabled explicitly via their respective command line options.
11545 @opindex gctf
11546 @item -gctf
11547 @itemx -gctf@var{level}
11548 Request CTF debug information and use level to specify how much CTF debug
11549 information should be produced.  If @option{-gctf} is specified
11550 without a value for level, the default level of CTF debug information is 2.
11552 CTF debug information can be generated along with DWARF debug information when
11553 both of the debug formats are enabled explicitly via their respective command
11554 line options.
11556 Level 0 produces no CTF debug information at all.  Thus, @option{-gctf0}
11557 negates @option{-gctf}.
11559 Level 1 produces CTF information for tracebacks only.  This includes callsite
11560 information, but does not include type information.
11562 Level 2 produces type information for entities (functions, data objects etc.)
11563 at file-scope or global-scope only.
11565 @opindex gvms
11566 @item -gvms
11567 Produce debugging information in Alpha/VMS debug format (if that is
11568 supported).  This is the format used by DEBUG on Alpha/VMS systems.
11570 @item -gcodeview
11571 @opindex gcodeview
11572 Produce debugging information in CodeView debug format (if that is
11573 supported).  This is the format used by Microsoft Visual C++ on
11574 Windows.
11576 @item -g@var{level}
11577 @itemx -ggdb@var{level}
11578 @itemx -gvms@var{level}
11579 Request debugging information and also use @var{level} to specify how
11580 much information.  The default level is 2.
11582 Level 0 produces no debug information at all.  Thus, @option{-g0} negates
11583 @option{-g}.
11585 Level 1 produces minimal information, enough for making backtraces in
11586 parts of the program that you don't plan to debug.  This includes
11587 descriptions of functions and external variables, and line number
11588 tables, but no information about local variables.
11590 Level 3 includes extra information, such as all the macro definitions
11591 present in the program.  Some debuggers support macro expansion when
11592 you use @option{-g3}.
11594 If you use multiple @option{-g} options, with or without level numbers,
11595 the last such option is the one that is effective.
11597 @option{-gdwarf} does not accept a concatenated debug level, to avoid
11598 confusion with @option{-gdwarf-@var{level}}.
11599 Instead use an additional @option{-g@var{level}} option to change the
11600 debug level for DWARF.
11602 @opindex feliminate-unused-debug-symbols
11603 @opindex fno-eliminate-unused-debug-symbols
11604 @item -fno-eliminate-unused-debug-symbols
11605 By default, no debug information is produced for symbols that are not actually
11606 used. Use this option if you want debug information for all symbols.
11608 @opindex femit-class-debug-always
11609 @item -femit-class-debug-always
11610 Instead of emitting debugging information for a C++ class in only one
11611 object file, emit it in all object files using the class.  This option
11612 should be used only with debuggers that are unable to handle the way GCC
11613 normally emits debugging information for classes because using this
11614 option increases the size of debugging information by as much as a
11615 factor of two.
11617 @opindex fmerge-debug-strings
11618 @opindex fno-merge-debug-strings
11619 @item -fno-merge-debug-strings
11620 Direct the linker to not merge together strings in the debugging
11621 information that are identical in different object files.  Merging is
11622 not supported by all assemblers or linkers.  Merging decreases the size
11623 of the debug information in the output file at the cost of increasing
11624 link processing time.  Merging is enabled by default.
11626 @opindex fdebug-prefix-map
11627 @item -fdebug-prefix-map=@var{old}=@var{new}
11628 When compiling files residing in directory @file{@var{old}}, record
11629 debugging information describing them as if the files resided in
11630 directory @file{@var{new}} instead.  This can be used to replace a
11631 build-time path with an install-time path in the debug info.  It can
11632 also be used to change an absolute path to a relative path by using
11633 @file{.} for @var{new}.  This can give more reproducible builds, which
11634 are location independent, but may require an extra command to tell GDB
11635 where to find the source files. See also @option{-ffile-prefix-map}
11636 and @option{-fcanon-prefix-map}.
11638 @opindex fvar-tracking
11639 @item -fvar-tracking
11640 Run variable tracking pass.  It computes where variables are stored at each
11641 position in code.  Better debugging information is then generated
11642 (if the debugging information format supports this information).
11644 It is enabled by default when compiling with optimization (@option{-Os},
11645 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
11646 the debug info format supports it.
11648 @opindex fvar-tracking-assignments
11649 @opindex fno-var-tracking-assignments
11650 @item -fvar-tracking-assignments
11651 Annotate assignments to user variables early in the compilation and
11652 attempt to carry the annotations over throughout the compilation all the
11653 way to the end, in an attempt to improve debug information while
11654 optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
11656 It can be enabled even if var-tracking is disabled, in which case
11657 annotations are created and maintained, but discarded at the end.
11658 By default, this flag is enabled together with @option{-fvar-tracking},
11659 except when selective scheduling is enabled.
11661 @opindex gsplit-dwarf
11662 @item -gsplit-dwarf
11663 If DWARF debugging information is enabled, separate as much debugging
11664 information as possible into a separate output file with the extension
11665 @file{.dwo}.  This option allows the build system to avoid linking files with
11666 debug information.  To be useful, this option requires a debugger capable of
11667 reading @file{.dwo} files.
11669 @opindex gdwarf32
11670 @opindex gdwarf64
11671 @item -gdwarf32
11672 @itemx -gdwarf64
11673 If DWARF debugging information is enabled, the @option{-gdwarf32} selects
11674 the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
11675 DWARF format.  The default is target specific, on most targets it is
11676 @option{-gdwarf32} though.  The 32-bit DWARF format is smaller, but
11677 can't support more than 2GiB of debug information in any of the DWARF
11678 debug information sections.  The 64-bit DWARF format allows larger debug
11679 information and might not be well supported by all consumers yet.
11681 @opindex gdescribe-dies
11682 @item -gdescribe-dies
11683 Add description attributes to some DWARF DIEs that have no name attribute,
11684 such as artificial variables, external references and call site
11685 parameter DIEs.
11687 @opindex gpubnames
11688 @item -gpubnames
11689 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
11691 @opindex ggnu-pubnames
11692 @item -ggnu-pubnames
11693 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
11694 suitable for conversion into a GDB@ index.  This option is only useful
11695 with a linker that can produce GDB@ index version 7.
11697 @opindex fdebug-types-section
11698 @opindex fno-debug-types-section
11699 @item -fdebug-types-section
11700 When using DWARF Version 4 or higher, type DIEs can be put into
11701 their own @code{.debug_types} section instead of making them part of the
11702 @code{.debug_info} section.  It is more efficient to put them in a separate
11703 comdat section since the linker can then remove duplicates.
11704 But not all DWARF consumers support @code{.debug_types} sections yet
11705 and on some objects @code{.debug_types} produces larger instead of smaller
11706 debugging information.
11708 @opindex grecord-gcc-switches
11709 @opindex gno-record-gcc-switches
11710 @item -grecord-gcc-switches
11711 @itemx -gno-record-gcc-switches
11712 This switch causes the command-line options used to invoke the
11713 compiler that may affect code generation to be appended to the
11714 DW_AT_producer attribute in DWARF debugging information.  The options
11715 are concatenated with spaces separating them from each other and from
11716 the compiler version.  
11717 It is enabled by default.
11718 See also @option{-frecord-gcc-switches} for another
11719 way of storing compiler options into the object file.  
11721 @opindex gstrict-dwarf
11722 @item -gstrict-dwarf
11723 Disallow using extensions of later DWARF standard version than selected
11724 with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
11725 DWARF extensions from later standard versions is allowed.
11727 @opindex gno-strict-dwarf
11728 @item -gno-strict-dwarf
11729 Allow using extensions of later DWARF standard version than selected with
11730 @option{-gdwarf-@var{version}}.
11732 @opindex gas-loc-support
11733 @item -gas-loc-support
11734 Inform the compiler that the assembler supports @code{.loc} directives.
11735 It may then use them for the assembler to generate DWARF2+ line number
11736 tables.
11738 This is generally desirable, because assembler-generated line-number
11739 tables are a lot more compact than those the compiler can generate
11740 itself.
11742 This option will be enabled by default if, at GCC configure time, the
11743 assembler was found to support such directives.
11745 @opindex gno-as-loc-support
11746 @item -gno-as-loc-support
11747 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
11748 line number tables are to be generated.
11750 @opindex gas-locview-support
11751 @item -gas-locview-support
11752 Inform the compiler that the assembler supports @code{view} assignment
11753 and reset assertion checking in @code{.loc} directives.
11755 This option will be enabled by default if, at GCC configure time, the
11756 assembler was found to support them.
11758 @item -gno-as-locview-support
11759 Force GCC to assign view numbers internally, if
11760 @option{-gvariable-location-views} are explicitly requested.
11762 @opindex gcolumn-info
11763 @opindex gno-column-info
11764 @item -gcolumn-info
11765 @itemx -gno-column-info
11766 Emit location column information into DWARF debugging information, rather
11767 than just file and line.
11768 This option is enabled by default.
11770 @opindex gstatement-frontiers
11771 @opindex gno-statement-frontiers
11772 @item -gstatement-frontiers
11773 @itemx -gno-statement-frontiers
11774 This option causes GCC to create markers in the internal representation
11775 at the beginning of statements, and to keep them roughly in place
11776 throughout compilation, using them to guide the output of @code{is_stmt}
11777 markers in the line number table.  This is enabled by default when
11778 compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2},
11779 @dots{}), and outputting DWARF 2 debug information at the normal level.
11781 @opindex gvariable-location-views
11782 @opindex gvariable-location-views=incompat5
11783 @opindex gno-variable-location-views
11784 @item -gvariable-location-views
11785 @itemx -gvariable-location-views=incompat5
11786 @itemx -gno-variable-location-views
11787 Augment variable location lists with progressive view numbers implied
11788 from the line number table.  This enables debug information consumers to
11789 inspect state at certain points of the program, even if no instructions
11790 associated with the corresponding source locations are present at that
11791 point.  If the assembler lacks support for view numbers in line number
11792 tables, this will cause the compiler to emit the line number table,
11793 which generally makes them somewhat less compact.  The augmented line
11794 number tables and location lists are fully backward-compatible, so they
11795 can be consumed by debug information consumers that are not aware of
11796 these augmentations, but they won't derive any benefit from them either.
11798 This is enabled by default when outputting DWARF 2 debug information at
11799 the normal level, as long as there is assembler support,
11800 @option{-fvar-tracking-assignments} is enabled and
11801 @option{-gstrict-dwarf} is not.  When assembler support is not
11802 available, this may still be enabled, but it will force GCC to output
11803 internal line number tables, and if
11804 @option{-ginternal-reset-location-views} is not enabled, that will most
11805 certainly lead to silently mismatching location views.
11807 There is a proposed representation for view numbers that is not backward
11808 compatible with the location list format introduced in DWARF 5, that can
11809 be enabled with @option{-gvariable-location-views=incompat5}.  This
11810 option may be removed in the future, is only provided as a reference
11811 implementation of the proposed representation.  Debug information
11812 consumers are not expected to support this extended format, and they
11813 would be rendered unable to decode location lists using it.
11815 @opindex ginternal-reset-location-views
11816 @opindex gno-internal-reset-location-views
11817 @item -ginternal-reset-location-views
11818 @itemx -gno-internal-reset-location-views
11819 Attempt to determine location views that can be omitted from location
11820 view lists.  This requires the compiler to have very accurate insn
11821 length estimates, which isn't always the case, and it may cause
11822 incorrect view lists to be generated silently when using an assembler
11823 that does not support location view lists.  The GNU assembler will flag
11824 any such error as a @code{view number mismatch}.  This is only enabled
11825 on ports that define a reliable estimation function.
11827 @opindex ginline-points
11828 @opindex gno-inline-points
11829 @item -ginline-points
11830 @itemx -gno-inline-points
11831 Generate extended debug information for inlined functions.  Location
11832 view tracking markers are inserted at inlined entry points, so that
11833 address and view numbers can be computed and output in debug
11834 information.  This can be enabled independently of location views, in
11835 which case the view numbers won't be output, but it can only be enabled
11836 along with statement frontiers, and it is only enabled by default if
11837 location views are enabled.
11839 @opindex gz
11840 @item -gz@r{[}=@var{type}@r{]}
11841 Produce compressed debug sections in DWARF format, if that is supported.
11842 If @var{type} is not given, the default type depends on the capabilities
11843 of the assembler and linker used.  @var{type} may be one of
11844 @samp{none} (don't compress debug sections), or @samp{zlib} (use zlib
11845 compression in ELF gABI format).  If the linker doesn't support writing
11846 compressed debug sections, the option is rejected.  Otherwise, if the
11847 assembler does not support them, @option{-gz} is silently ignored when
11848 producing object files.
11850 @opindex femit-struct-debug-baseonly
11851 @item -femit-struct-debug-baseonly
11852 Emit debug information for struct-like types
11853 only when the base name of the compilation source file
11854 matches the base name of file in which the struct is defined.
11856 This option substantially reduces the size of debugging information,
11857 but at significant potential loss in type information to the debugger.
11858 See @option{-femit-struct-debug-reduced} for a less aggressive option.
11859 See @option{-femit-struct-debug-detailed} for more detailed control.
11861 This option works only with DWARF debug output.
11863 @opindex femit-struct-debug-reduced
11864 @item -femit-struct-debug-reduced
11865 Emit debug information for struct-like types
11866 only when the base name of the compilation source file
11867 matches the base name of file in which the type is defined,
11868 unless the struct is a template or defined in a system header.
11870 This option significantly reduces the size of debugging information,
11871 with some potential loss in type information to the debugger.
11872 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
11873 See @option{-femit-struct-debug-detailed} for more detailed control.
11875 This option works only with DWARF debug output.
11877 @opindex femit-struct-debug-detailed
11878 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
11879 Specify the struct-like types
11880 for which the compiler generates debug information.
11881 The intent is to reduce duplicate struct debug information
11882 between different object files within the same program.
11884 This option is a detailed version of
11885 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
11886 which serves for most needs.
11888 A specification has the syntax@*
11889 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
11891 The optional first word limits the specification to
11892 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
11893 A struct type is used directly when it is the type of a variable, member.
11894 Indirect uses arise through pointers to structs.
11895 That is, when use of an incomplete struct is valid, the use is indirect.
11896 An example is
11897 @samp{struct one direct; struct two * indirect;}.
11899 The optional second word limits the specification to
11900 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
11901 Generic structs are a bit complicated to explain.
11902 For C++, these are non-explicit specializations of template classes,
11903 or non-template classes within the above.
11904 Other programming languages have generics,
11905 but @option{-femit-struct-debug-detailed} does not yet implement them.
11907 The third word specifies the source files for those
11908 structs for which the compiler should emit debug information.
11909 The values @samp{none} and @samp{any} have the normal meaning.
11910 The value @samp{base} means that
11911 the base of name of the file in which the type declaration appears
11912 must match the base of the name of the main compilation file.
11913 In practice, this means that when compiling @file{foo.c}, debug information
11914 is generated for types declared in that file and @file{foo.h},
11915 but not other header files.
11916 The value @samp{sys} means those types satisfying @samp{base}
11917 or declared in system or compiler headers.
11919 You may need to experiment to determine the best settings for your application.
11921 The default is @option{-femit-struct-debug-detailed=all}.
11923 This option works only with DWARF debug output.
11925 @opindex fdwarf2-cfi-asm
11926 @opindex fno-dwarf2-cfi-asm
11927 @item -fno-dwarf2-cfi-asm
11928 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
11929 instead of using GAS @code{.cfi_*} directives.
11931 @opindex feliminate-unused-debug-types
11932 @opindex fno-eliminate-unused-debug-types
11933 @item -fno-eliminate-unused-debug-types
11934 Normally, when producing DWARF output, GCC avoids producing debug symbol 
11935 output for types that are nowhere used in the source file being compiled.
11936 Sometimes it is useful to have GCC emit debugging
11937 information for all types declared in a compilation
11938 unit, regardless of whether or not they are actually used
11939 in that compilation unit, for example 
11940 if, in the debugger, you want to cast a value to a type that is
11941 not actually used in your program (but is declared).  More often,
11942 however, this results in a significant amount of wasted space.
11943 @end table
11945 @node Optimize Options
11946 @section Options That Control Optimization
11947 @cindex optimize options
11948 @cindex options, optimization
11950 These options control various sorts of optimizations.
11952 Without any optimization option, the compiler's goal is to reduce the
11953 cost of compilation and to make debugging produce the expected
11954 results.  Statements are independent: if you stop the program with a
11955 breakpoint between statements, you can then assign a new value to any
11956 variable or change the program counter to any other statement in the
11957 function and get exactly the results you expect from the source
11958 code.
11960 Turning on optimization flags makes the compiler attempt to improve
11961 the performance and/or code size at the expense of compilation time
11962 and possibly the ability to debug the program.
11964 The compiler performs optimization based on the knowledge it has of the
11965 program.  Compiling multiple files at once to a single output file mode allows
11966 the compiler to use information gained from all of the files when compiling
11967 each of them.
11969 Not all optimizations are controlled directly by a flag.  Only
11970 optimizations that have a flag are listed in this section.
11972 Most optimizations are completely disabled at @option{-O0} or if an
11973 @option{-O} level is not set on the command line, even if individual
11974 optimization flags are specified.  Similarly, @option{-Og} suppresses
11975 many optimization passes.
11977 Depending on the target and how GCC was configured, a slightly different
11978 set of optimizations may be enabled at each @option{-O} level than
11979 those listed here.  You can invoke GCC with @option{-Q --help=optimizers}
11980 to find out the exact set of optimizations that are enabled at each level.
11981 @xref{Overall Options}, for examples.
11983 @table @gcctabopt
11984 @opindex O
11985 @opindex O1
11986 @item -O
11987 @itemx -O1
11988 Optimize.  Optimizing compilation takes somewhat more time, and a lot
11989 more memory for a large function.
11991 With @option{-O}, the compiler tries to reduce code size and execution
11992 time, without performing any optimizations that take a great deal of
11993 compilation time.
11995 @c Note that in addition to the default_options_table list in opts.cc,
11996 @c several optimization flags default to true but control optimization
11997 @c passes that are explicitly disabled at -O0.
11999 @option{-O} turns on the following optimization flags:
12001 @c Please keep the following list alphabetized.
12002 @gccoptlist{-fauto-inc-dec
12003 -fbranch-count-reg
12004 -fcombine-stack-adjustments
12005 -fcompare-elim
12006 -fcprop-registers
12007 -fdce
12008 -fdefer-pop
12009 -fdelayed-branch
12010 -fdse
12011 -fforward-propagate
12012 -fguess-branch-probability
12013 -fif-conversion
12014 -fif-conversion2
12015 -finline-functions-called-once
12016 -fipa-modref
12017 -fipa-profile
12018 -fipa-pure-const
12019 -fipa-reference
12020 -fipa-reference-addressable
12021 -fmerge-constants
12022 -fmove-loop-invariants
12023 -fmove-loop-stores
12024 -fomit-frame-pointer
12025 -freorder-blocks
12026 -fshrink-wrap
12027 -fshrink-wrap-separate
12028 -fsplit-wide-types
12029 -fssa-backprop
12030 -fssa-phiopt
12031 -ftree-bit-ccp
12032 -ftree-ccp
12033 -ftree-ch
12034 -ftree-coalesce-vars
12035 -ftree-copy-prop
12036 -ftree-dce
12037 -ftree-dominator-opts
12038 -ftree-dse
12039 -ftree-forwprop
12040 -ftree-fre
12041 -ftree-phiprop
12042 -ftree-pta
12043 -ftree-scev-cprop
12044 -ftree-sink
12045 -ftree-slsr
12046 -ftree-sra
12047 -ftree-ter
12048 -funit-at-a-time}
12050 @opindex O2
12051 @item -O2
12052 Optimize even more.  GCC performs nearly all supported optimizations
12053 that do not involve a space-speed tradeoff.
12054 As compared to @option{-O}, this option increases both compilation time
12055 and the performance of the generated code.
12057 @option{-O2} turns on all optimization flags specified by @option{-O1}.  It
12058 also turns on the following optimization flags:
12060 @c Please keep the following list alphabetized!
12061 @gccoptlist{-falign-functions  -falign-jumps
12062 -falign-labels  -falign-loops
12063 -fcaller-saves
12064 -fcode-hoisting
12065 -fcrossjumping
12066 -fcse-follow-jumps  -fcse-skip-blocks
12067 -fdelete-null-pointer-checks
12068 -fdevirtualize  -fdevirtualize-speculatively
12069 -fexpensive-optimizations
12070 -ffinite-loops
12071 -fgcse  -fgcse-lm
12072 -fhoist-adjacent-loads
12073 -finline-functions
12074 -finline-small-functions
12075 -findirect-inlining
12076 -fipa-bit-cp  -fipa-cp  -fipa-icf
12077 -fipa-ra  -fipa-sra  -fipa-vrp
12078 -fisolate-erroneous-paths-dereference
12079 -flra-remat
12080 -foptimize-sibling-calls
12081 -foptimize-strlen
12082 -fpartial-inlining
12083 -fpeephole2
12084 -freorder-blocks-algorithm=stc
12085 -freorder-blocks-and-partition  -freorder-functions
12086 -frerun-cse-after-loop
12087 -fschedule-insns  -fschedule-insns2
12088 -fsched-interblock  -fsched-spec
12089 -fstore-merging
12090 -fstrict-aliasing
12091 -fthread-jumps
12092 -ftree-builtin-call-dce
12093 -ftree-loop-vectorize
12094 -ftree-pre
12095 -ftree-slp-vectorize
12096 -ftree-switch-conversion  -ftree-tail-merge
12097 -ftree-vrp
12098 -fvect-cost-model=very-cheap}
12100 Please note the warning under @option{-fgcse} about
12101 invoking @option{-O2} on programs that use computed gotos.
12103 @opindex O3
12104 @item -O3
12105 Optimize yet more.  @option{-O3} turns on all optimizations specified
12106 by @option{-O2} and also turns on the following optimization flags:
12108 @c Please keep the following list alphabetized!
12109 @gccoptlist{-fgcse-after-reload
12110 -fipa-cp-clone
12111 -floop-interchange
12112 -floop-unroll-and-jam
12113 -fpeel-loops
12114 -fpredictive-commoning
12115 -fsplit-loops
12116 -fsplit-paths
12117 -ftree-loop-distribution
12118 -ftree-partial-pre
12119 -funswitch-loops
12120 -fvect-cost-model=dynamic
12121 -fversion-loops-for-strides}
12123 @opindex O0
12124 @item -O0
12125 Reduce compilation time and make debugging produce the expected
12126 results.  This is the default.
12128 @opindex Os
12129 @item -Os
12130 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations 
12131 except those that often increase code size:
12133 @gccoptlist{-falign-functions  -falign-jumps
12134 -falign-labels  -falign-loops
12135 -fprefetch-loop-arrays  -freorder-blocks-algorithm=stc}
12137 It also enables @option{-finline-functions}, causes the compiler to tune for
12138 code size rather than execution speed, and performs further optimizations
12139 designed to reduce code size.
12141 @opindex Ofast
12142 @item -Ofast
12143 Disregard strict standards compliance.  @option{-Ofast} enables all
12144 @option{-O3} optimizations.  It also enables optimizations that are not
12145 valid for all standard-compliant programs.
12146 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
12147 and the Fortran-specific @option{-fstack-arrays}, unless
12148 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
12149 It turns off @option{-fsemantic-interposition}.
12151 @opindex Og
12152 @item -Og
12153 Optimize debugging experience.  @option{-Og} should be the optimization
12154 level of choice for the standard edit-compile-debug cycle, offering
12155 a reasonable level of optimization while maintaining fast compilation
12156 and a good debugging experience.  It is a better choice than @option{-O0}
12157 for producing debuggable code because some compiler passes
12158 that collect debug information are disabled at @option{-O0}.
12160 Like @option{-O0}, @option{-Og} completely disables a number of 
12161 optimization passes so that individual options controlling them have
12162 no effect.  Otherwise @option{-Og} enables all @option{-O1} 
12163 optimization flags except for those that may interfere with debugging:
12165 @gccoptlist{-fbranch-count-reg  -fdelayed-branch
12166 -fdse  -fif-conversion  -fif-conversion2
12167 -finline-functions-called-once
12168 -fmove-loop-invariants  -fmove-loop-stores  -fssa-phiopt
12169 -ftree-bit-ccp  -ftree-dse  -ftree-pta  -ftree-sra}
12171 @opindex Oz
12172 @item -Oz
12173 Optimize aggressively for size rather than speed.  This may increase
12174 the number of instructions executed if those instructions require
12175 fewer bytes to encode.  @option{-Oz} behaves similarly to @option{-Os}
12176 including enabling most @option{-O2} optimizations.
12178 @end table
12180 If you use multiple @option{-O} options, with or without level numbers,
12181 the last such option is the one that is effective.
12183 Options of the form @option{-f@var{flag}} specify machine-independent
12184 flags.  Most flags have both positive and negative forms; the negative
12185 form of @option{-ffoo} is @option{-fno-foo}.  In the table
12186 below, only one of the forms is listed---the one you typically 
12187 use.  You can figure out the other form by either removing @samp{no-}
12188 or adding it.
12190 The following options control specific optimizations.  They are either
12191 activated by @option{-O} options or are related to ones that are.  You
12192 can use the following flags in the rare cases when ``fine-tuning'' of
12193 optimizations to be performed is desired.
12195 @table @gcctabopt
12196 @opindex fno-defer-pop
12197 @opindex fdefer-pop
12198 @item -fno-defer-pop
12199 For machines that must pop arguments after a function call, always pop 
12200 the arguments as soon as each function returns.  
12201 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
12202 this allows the compiler to let arguments accumulate on the stack for several
12203 function calls and pop them all at once.
12205 @opindex fforward-propagate
12206 @item -fforward-propagate
12207 Perform a forward propagation pass on RTL@.  The pass tries to combine two
12208 instructions and checks if the result can be simplified.  If loop unrolling
12209 is active, two passes are performed and the second is scheduled after
12210 loop unrolling.
12212 This option is enabled by default at optimization levels @option{-O1},
12213 @option{-O2}, @option{-O3}, @option{-Os}.
12215 @opindex ffp-contract
12216 @item -ffp-contract=@var{style}
12217 @option{-ffp-contract=off} disables floating-point expression contraction.
12218 @option{-ffp-contract=fast} enables floating-point expression contraction
12219 such as forming of fused multiply-add operations if the target has
12220 native support for them.
12221 @option{-ffp-contract=on} enables floating-point expression contraction
12222 if allowed by the language standard.  This is implemented for C and C++,
12223 where it enables contraction within one expression, but not across
12224 different statements.
12226 The default is @option{-ffp-contract=off} for C in a standards compliant mode
12227 (@option{-std=c11} or similar), @option{-ffp-contract=fast} otherwise.
12229 @opindex fomit-frame-pointer
12230 @item -fomit-frame-pointer
12231 Omit the frame pointer in functions that don't need one.  This avoids the
12232 instructions to save, set up and restore the frame pointer; on many targets
12233 it also makes an extra register available.
12235 On some targets this flag has no effect because the standard calling sequence
12236 always uses a frame pointer, so it cannot be omitted.
12238 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
12239 is used in all functions.  Several targets always omit the frame pointer in
12240 leaf functions.
12242 Enabled by default at @option{-O1} and higher.
12244 @opindex foptimize-sibling-calls
12245 @item -foptimize-sibling-calls
12246 Optimize sibling and tail recursive calls.
12248 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12250 @opindex foptimize-strlen
12251 @item -foptimize-strlen
12252 Optimize various standard C string functions (e.g.@: @code{strlen},
12253 @code{strchr} or @code{strcpy}) and
12254 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
12256 Enabled at levels @option{-O2}, @option{-O3}.
12258 @opindex fno-inline
12259 @opindex finline
12260 @item -fno-inline
12261 Do not expand any functions inline apart from those marked with
12262 the @code{always_inline} attribute.  This is the default when not
12263 optimizing.
12265 Single functions can be exempted from inlining by marking them
12266 with the @code{noinline} attribute.
12268 @opindex finline-small-functions
12269 @item -finline-small-functions
12270 Integrate functions into their callers when their body is smaller than expected
12271 function call code (so overall size of program gets smaller).  The compiler
12272 heuristically decides which functions are simple enough to be worth integrating
12273 in this way.  This inlining applies to all functions, even those not declared
12274 inline.
12276 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12278 @opindex findirect-inlining
12279 @item -findirect-inlining
12280 Inline also indirect calls that are discovered to be known at compile
12281 time thanks to previous inlining.  This option has any effect only
12282 when inlining itself is turned on by the @option{-finline-functions}
12283 or @option{-finline-small-functions} options.
12285 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12287 @opindex finline-functions
12288 @item -finline-functions
12289 Consider all functions for inlining, even if they are not declared inline.
12290 The compiler heuristically decides which functions are worth integrating
12291 in this way.
12293 If all calls to a given function are integrated, and the function is
12294 declared @code{static}, then the function is normally not output as
12295 assembler code in its own right.
12297 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.  Also enabled
12298 by @option{-fprofile-use} and @option{-fauto-profile}.
12300 @opindex finline-functions-called-once
12301 @item -finline-functions-called-once
12302 Consider all @code{static} functions called once for inlining into their
12303 caller even if they are not marked @code{inline}.  If a call to a given
12304 function is integrated, then the function is not output as assembler code
12305 in its own right.
12307 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
12308 but not @option{-Og}.
12310 @opindex fearly-inlining
12311 @item -fearly-inlining
12312 Inline functions marked by @code{always_inline} and functions whose body seems
12313 smaller than the function call overhead early before doing
12314 @option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
12315 makes profiling significantly cheaper and usually inlining faster on programs
12316 having large chains of nested wrapper functions.
12318 Enabled by default.
12320 @opindex fipa-sra
12321 @item -fipa-sra
12322 Perform interprocedural scalar replacement of aggregates, removal of
12323 unused parameters and replacement of parameters passed by reference
12324 by parameters passed by value.
12326 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
12328 @opindex finline-limit
12329 @item -finline-limit=@var{n}
12330 By default, GCC limits the size of functions that can be inlined.  This flag
12331 allows coarse control of this limit.  @var{n} is the size of functions that
12332 can be inlined in number of pseudo instructions.
12334 Inlining is actually controlled by a number of parameters, which may be
12335 specified individually by using @option{--param @var{name}=@var{value}}.
12336 The @option{-finline-limit=@var{n}} option sets some of these parameters
12337 as follows:
12339 @table @gcctabopt
12340 @item max-inline-insns-single
12341 is set to @var{n}/2.
12342 @item max-inline-insns-auto
12343 is set to @var{n}/2.
12344 @end table
12346 See below for a documentation of the individual
12347 parameters controlling inlining and for the defaults of these parameters.
12349 @emph{Note:} there may be no value to @option{-finline-limit} that results
12350 in default behavior.
12352 @emph{Note:} pseudo instruction represents, in this particular context, an
12353 abstract measurement of function's size.  In no way does it represent a count
12354 of assembly instructions and as such its exact meaning might change from one
12355 release to an another.
12357 @opindex fno-keep-inline-dllexport
12358 @opindex fkeep-inline-dllexport
12359 @item -fno-keep-inline-dllexport
12360 This is a more fine-grained version of @option{-fkeep-inline-functions},
12361 which applies only to functions that are declared using the @code{dllexport}
12362 attribute or declspec.  @xref{Function Attributes,,Declaring Attributes of
12363 Functions}.
12365 @opindex fkeep-inline-functions
12366 @item -fkeep-inline-functions
12367 In C, emit @code{static} functions that are declared @code{inline}
12368 into the object file, even if the function has been inlined into all
12369 of its callers.  This switch does not affect functions using the
12370 @code{extern inline} extension in GNU C90@.  In C++, emit any and all
12371 inline functions into the object file.
12373 @opindex fkeep-static-functions
12374 @item -fkeep-static-functions
12375 Emit @code{static} functions into the object file, even if the function
12376 is never used.
12378 @opindex fkeep-static-consts
12379 @item -fkeep-static-consts
12380 Emit variables declared @code{static const} when optimization isn't turned
12381 on, even if the variables aren't referenced.
12383 GCC enables this option by default.  If you want to force the compiler to
12384 check if a variable is referenced, regardless of whether or not
12385 optimization is turned on, use the @option{-fno-keep-static-consts} option.
12387 @opindex fmerge-constants
12388 @item -fmerge-constants
12389 Attempt to merge identical constants (string constants and floating-point
12390 constants) across compilation units.
12392 This option is the default for optimized compilation if the assembler and
12393 linker support it.  Use @option{-fno-merge-constants} to inhibit this
12394 behavior.
12396 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12398 @opindex fmerge-all-constants
12399 @item -fmerge-all-constants
12400 Attempt to merge identical constants and identical variables.
12402 This option implies @option{-fmerge-constants}.  In addition to
12403 @option{-fmerge-constants} this considers e.g.@: even constant initialized
12404 arrays or initialized constant variables with integral or floating-point
12405 types.  Languages like C or C++ require each variable, including multiple
12406 instances of the same variable in recursive calls, to have distinct locations,
12407 so using this option results in non-conforming
12408 behavior.
12410 @opindex fmodulo-sched
12411 @item -fmodulo-sched
12412 Perform swing modulo scheduling immediately before the first scheduling
12413 pass.  This pass looks at innermost loops and reorders their
12414 instructions by overlapping different iterations.
12416 @opindex fmodulo-sched-allow-regmoves
12417 @item -fmodulo-sched-allow-regmoves
12418 Perform more aggressive SMS-based modulo scheduling with register moves
12419 allowed.  By setting this flag certain anti-dependences edges are
12420 deleted, which triggers the generation of reg-moves based on the
12421 life-range analysis.  This option is effective only with
12422 @option{-fmodulo-sched} enabled.
12424 @opindex fno-branch-count-reg
12425 @opindex fbranch-count-reg
12426 @item -fno-branch-count-reg
12427 Disable the optimization pass that scans for opportunities to use 
12428 ``decrement and branch'' instructions on a count register instead of
12429 instruction sequences that decrement a register, compare it against zero, and
12430 then branch based upon the result.  This option is only meaningful on
12431 architectures that support such instructions, which include x86, PowerPC,
12432 IA-64 and S/390.  Note that the @option{-fno-branch-count-reg} option
12433 doesn't remove the decrement and branch instructions from the generated
12434 instruction stream introduced by other optimization passes.
12436 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
12437 except for @option{-Og}.
12439 @opindex fno-function-cse
12440 @opindex ffunction-cse
12441 @item -fno-function-cse
12442 Do not put function addresses in registers; make each instruction that
12443 calls a constant function contain the function's address explicitly.
12445 This option results in less efficient code, but some strange hacks
12446 that alter the assembler output may be confused by the optimizations
12447 performed when this option is not used.
12449 The default is @option{-ffunction-cse}
12451 @opindex fno-zero-initialized-in-bss
12452 @opindex fzero-initialized-in-bss
12453 @item -fno-zero-initialized-in-bss
12454 If the target supports a BSS section, GCC by default puts variables that
12455 are initialized to zero into BSS@.  This can save space in the resulting
12456 code.
12458 This option turns off this behavior because some programs explicitly
12459 rely on variables going to the data section---e.g., so that the
12460 resulting executable can find the beginning of that section and/or make
12461 assumptions based on that.
12463 The default is @option{-fzero-initialized-in-bss}.
12465 @opindex fthread-jumps
12466 @item -fthread-jumps
12467 Perform optimizations that check to see if a jump branches to a
12468 location where another comparison subsumed by the first is found.  If
12469 so, the first branch is redirected to either the destination of the
12470 second branch or a point immediately following it, depending on whether
12471 the condition is known to be true or false.
12473 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12475 @opindex fsplit-wide-types
12476 @item -fsplit-wide-types
12477 When using a type that occupies multiple registers, such as @code{long
12478 long} on a 32-bit system, split the registers apart and allocate them
12479 independently.  This normally generates better code for those types,
12480 but may make debugging more difficult.
12482 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3},
12483 @option{-Os}.
12485 @opindex fsplit-wide-types-early
12486 @item -fsplit-wide-types-early
12487 Fully split wide types early, instead of very late.
12488 This option has no effect unless @option{-fsplit-wide-types} is turned on.
12490 This is the default on some targets.
12492 @opindex fcse-follow-jumps
12493 @item -fcse-follow-jumps
12494 In common subexpression elimination (CSE), scan through jump instructions
12495 when the target of the jump is not reached by any other path.  For
12496 example, when CSE encounters an @code{if} statement with an
12497 @code{else} clause, CSE follows the jump when the condition
12498 tested is false.
12500 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12502 @opindex fcse-skip-blocks
12503 @item -fcse-skip-blocks
12504 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
12505 follow jumps that conditionally skip over blocks.  When CSE
12506 encounters a simple @code{if} statement with no else clause,
12507 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
12508 body of the @code{if}.
12510 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12512 @opindex frerun-cse-after-loop
12513 @item -frerun-cse-after-loop
12514 Re-run common subexpression elimination after loop optimizations are
12515 performed.
12517 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12519 @opindex fgcse
12520 @item -fgcse
12521 Perform a global common subexpression elimination pass.
12522 This pass also performs global constant and copy propagation.
12524 @emph{Note:} When compiling a program using computed gotos, a GCC
12525 extension, you may get better run-time performance if you disable
12526 the global common subexpression elimination pass by adding
12527 @option{-fno-gcse} to the command line.
12529 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12531 @opindex fgcse-lm
12532 @item -fgcse-lm
12533 When @option{-fgcse-lm} is enabled, global common subexpression elimination
12534 attempts to move loads that are only killed by stores into themselves.  This
12535 allows a loop containing a load/store sequence to be changed to a load outside
12536 the loop, and a copy/store within the loop.
12538 Enabled by default when @option{-fgcse} is enabled.
12540 @opindex fgcse-sm
12541 @item -fgcse-sm
12542 When @option{-fgcse-sm} is enabled, a store motion pass is run after
12543 global common subexpression elimination.  This pass attempts to move
12544 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
12545 loops containing a load/store sequence can be changed to a load before
12546 the loop and a store after the loop.
12548 Not enabled at any optimization level.
12550 @opindex fgcse-las
12551 @item -fgcse-las
12552 When @option{-fgcse-las} is enabled, the global common subexpression
12553 elimination pass eliminates redundant loads that come after stores to the
12554 same memory location (both partial and full redundancies).
12556 Not enabled at any optimization level.
12558 @opindex fgcse-after-reload
12559 @item -fgcse-after-reload
12560 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
12561 pass is performed after reload.  The purpose of this pass is to clean up
12562 redundant spilling.
12564 Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}.
12566 @opindex faggressive-loop-optimizations
12567 @item -faggressive-loop-optimizations
12568 This option tells the loop optimizer to use language constraints to
12569 derive bounds for the number of iterations of a loop.  This assumes that
12570 loop code does not invoke undefined behavior by for example causing signed
12571 integer overflows or out-of-bound array accesses.  The bounds for the
12572 number of iterations of a loop are used to guide loop unrolling and peeling
12573 and loop exit test optimizations.
12574 This option is enabled by default.
12576 @opindex funconstrained-commons
12577 @item -funconstrained-commons
12578 This option tells the compiler that variables declared in common blocks
12579 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
12580 prevents certain optimizations that depend on knowing the array bounds.
12582 @opindex fcrossjumping
12583 @item -fcrossjumping
12584 Perform cross-jumping transformation.
12585 This transformation unifies equivalent code and saves code size.  The
12586 resulting code may or may not perform better than without cross-jumping.
12588 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12590 @opindex fauto-inc-dec
12591 @item -fauto-inc-dec
12592 Combine increments or decrements of addresses with memory accesses.
12593 This pass is always skipped on architectures that do not have
12594 instructions to support this.  Enabled by default at @option{-O1} and
12595 higher on architectures that support this.
12597 @opindex fdce
12598 @item -fdce
12599 Perform dead code elimination (DCE) on RTL@.
12600 Enabled by default at @option{-O1} and higher.
12602 @opindex fdse
12603 @item -fdse
12604 Perform dead store elimination (DSE) on RTL@.
12605 Enabled by default at @option{-O1} and higher.
12607 @opindex fif-conversion
12608 @item -fif-conversion
12609 Attempt to transform conditional jumps into branch-less equivalents.  This
12610 includes use of conditional moves, min, max, set flags and abs instructions, and
12611 some tricks doable by standard arithmetics.  The use of conditional execution
12612 on chips where it is available is controlled by @option{-fif-conversion2}.
12614 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12615 not with @option{-Og}.
12617 @opindex fif-conversion2
12618 @item -fif-conversion2
12619 Use conditional execution (where available) to transform conditional jumps into
12620 branch-less equivalents.
12622 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12623 not with @option{-Og}.
12625 @opindex fdeclone-ctor-dtor
12626 @item -fdeclone-ctor-dtor
12627 The C++ ABI requires multiple entry points for constructors and
12628 destructors: one for a base subobject, one for a complete object, and
12629 one for a virtual destructor that calls operator delete afterwards.
12630 For a hierarchy with virtual bases, the base and complete variants are
12631 clones, which means two copies of the function.  With this option, the
12632 base and complete variants are changed to be thunks that call a common
12633 implementation.
12635 Enabled by @option{-Os}.
12637 @opindex fdelete-null-pointer-checks
12638 @item -fdelete-null-pointer-checks
12639 Assume that programs cannot safely dereference null pointers, and that
12640 no code or data element resides at address zero.
12641 This option enables simple constant
12642 folding optimizations at all optimization levels.  In addition, other
12643 optimization passes in GCC use this flag to control global dataflow
12644 analyses that eliminate useless checks for null pointers; these assume
12645 that a memory access to address zero always results in a trap, so
12646 that if a pointer is checked after it has already been dereferenced,
12647 it cannot be null.
12649 Note however that in some environments this assumption is not true.
12650 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
12651 for programs that depend on that behavior.
12653 This option is enabled by default on most targets.  On Nios II ELF, it
12654 defaults to off.  On AVR and MSP430, this option is completely disabled.
12656 Passes that use the dataflow information
12657 are enabled independently at different optimization levels.
12659 @opindex fdevirtualize
12660 @item -fdevirtualize
12661 Attempt to convert calls to virtual functions to direct calls.  This
12662 is done both within a procedure and interprocedurally as part of
12663 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
12664 propagation (@option{-fipa-cp}).
12665 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12667 @opindex fdevirtualize-speculatively
12668 @item -fdevirtualize-speculatively
12669 Attempt to convert calls to virtual functions to speculative direct calls.
12670 Based on the analysis of the type inheritance graph, determine for a given call
12671 the set of likely targets. If the set is small, preferably of size 1, change
12672 the call into a conditional deciding between direct and indirect calls.  The
12673 speculative calls enable more optimizations, such as inlining.  When they seem
12674 useless after further optimization, they are converted back into original form.
12676 @opindex fdevirtualize-at-ltrans
12677 @item -fdevirtualize-at-ltrans
12678 Stream extra information needed for aggressive devirtualization when running
12679 the link-time optimizer in local transformation mode.  
12680 This option enables more devirtualization but
12681 significantly increases the size of streamed data. For this reason it is
12682 disabled by default.
12684 @opindex fexpensive-optimizations
12685 @item -fexpensive-optimizations
12686 Perform a number of minor optimizations that are relatively expensive.
12688 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12690 @opindex free
12691 @item -free
12692 Attempt to remove redundant extension instructions.  This is especially
12693 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
12694 registers after writing to their lower 32-bit half.
12696 Enabled for Alpha, AArch64, LoongArch, PowerPC, RISC-V, SPARC, h83000 and x86 at
12697 levels @option{-O2}, @option{-O3}, @option{-Os}.
12699 @opindex fno-lifetime-dse
12700 @opindex flifetime-dse
12701 @item -fno-lifetime-dse
12702 In C++ the value of an object is only affected by changes within its
12703 lifetime: when the constructor begins, the object has an indeterminate
12704 value, and any changes during the lifetime of the object are dead when
12705 the object is destroyed.  Normally dead store elimination will take
12706 advantage of this; if your code relies on the value of the object
12707 storage persisting beyond the lifetime of the object, you can use this
12708 flag to disable this optimization.  To preserve stores before the
12709 constructor starts (e.g.@: because your operator new clears the object
12710 storage) but still treat the object as dead after the destructor, you
12711 can use @option{-flifetime-dse=1}.  The default behavior can be
12712 explicitly selected with @option{-flifetime-dse=2}.
12713 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
12715 @opindex flive-range-shrinkage
12716 @item -flive-range-shrinkage
12717 Attempt to decrease register pressure through register live range
12718 shrinkage.  This is helpful for fast processors with small or moderate
12719 size register sets.
12721 @opindex fira-algorithm
12722 @item -fira-algorithm=@var{algorithm}
12723 Use the specified coloring algorithm for the integrated register
12724 allocator.  The @var{algorithm} argument can be @samp{priority}, which
12725 specifies Chow's priority coloring, or @samp{CB}, which specifies
12726 Chaitin-Briggs coloring.  Chaitin-Briggs coloring is not implemented
12727 for all architectures, but for those targets that do support it, it is
12728 the default because it generates better code.
12730 @opindex fira-region
12731 @item -fira-region=@var{region}
12732 Use specified regions for the integrated register allocator.  The
12733 @var{region} argument should be one of the following:
12735 @table @samp
12737 @item all
12738 Use all loops as register allocation regions.
12739 This can give the best results for machines with a small and/or
12740 irregular register set.
12742 @item mixed
12743 Use all loops except for loops with small register pressure 
12744 as the regions.  This value usually gives
12745 the best results in most cases and for most architectures,
12746 and is enabled by default when compiling with optimization for speed
12747 (@option{-O}, @option{-O2}, @dots{}).
12749 @item one
12750 Use all functions as a single region.  
12751 This typically results in the smallest code size, and is enabled by default for
12752 @option{-Os} or @option{-O0}.
12754 @end table
12756 @opindex fira-hoist-pressure
12757 @item -fira-hoist-pressure
12758 Use IRA to evaluate register pressure in the code hoisting pass for
12759 decisions to hoist expressions.  This option usually results in smaller
12760 code, but it can slow the compiler down.
12762 This option is enabled at level @option{-Os} for all targets.
12764 @opindex fira-loop-pressure
12765 @item -fira-loop-pressure
12766 Use IRA to evaluate register pressure in loops for decisions to move
12767 loop invariants.  This option usually results in generation
12768 of faster and smaller code on machines with large register files (>= 32
12769 registers), but it can slow the compiler down.
12771 This option is enabled at level @option{-O3} for some targets.
12773 @opindex fno-ira-share-save-slots
12774 @opindex fira-share-save-slots
12775 @item -fno-ira-share-save-slots
12776 Disable sharing of stack slots used for saving call-used hard
12777 registers living through a call.  Each hard register gets a
12778 separate stack slot, and as a result function stack frames are
12779 larger.
12781 @opindex fno-ira-share-spill-slots
12782 @opindex fira-share-spill-slots
12783 @item -fno-ira-share-spill-slots
12784 Disable sharing of stack slots allocated for pseudo-registers.  Each
12785 pseudo-register that does not get a hard register gets a separate
12786 stack slot, and as a result function stack frames are larger.
12788 @opindex flra-remat
12789 @item -flra-remat
12790 Enable CFG-sensitive rematerialization in LRA.  Instead of loading
12791 values of spilled pseudos, LRA tries to rematerialize (recalculate)
12792 values if it is profitable.
12794 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12796 @opindex fdelayed-branch
12797 @item -fdelayed-branch
12798 If supported for the target machine, attempt to reorder instructions
12799 to exploit instruction slots available after delayed branch
12800 instructions.
12802 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os},
12803 but not at @option{-Og}.
12805 @opindex fschedule-insns
12806 @item -fschedule-insns
12807 If supported for the target machine, attempt to reorder instructions to
12808 eliminate execution stalls due to required data being unavailable.  This
12809 helps machines that have slow floating point or memory load instructions
12810 by allowing other instructions to be issued until the result of the load
12811 or floating-point instruction is required.
12813 Enabled at levels @option{-O2}, @option{-O3}.
12815 @opindex fschedule-insns2
12816 @item -fschedule-insns2
12817 Similar to @option{-fschedule-insns}, but requests an additional pass of
12818 instruction scheduling after register allocation has been done.  This is
12819 especially useful on machines with a relatively small number of
12820 registers and where memory load instructions take more than one cycle.
12822 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12824 @opindex fno-sched-interblock
12825 @opindex fsched-interblock
12826 @item -fno-sched-interblock
12827 Disable instruction scheduling across basic blocks, which
12828 is normally enabled when scheduling before register allocation, i.e.@:
12829 with @option{-fschedule-insns} or at @option{-O2} or higher.
12831 @opindex fno-sched-spec
12832 @opindex fsched-spec
12833 @item -fno-sched-spec
12834 Disable speculative motion of non-load instructions, which
12835 is normally enabled when scheduling before register allocation, i.e.@:
12836 with @option{-fschedule-insns} or at @option{-O2} or higher.
12838 @opindex fsched-pressure
12839 @item -fsched-pressure
12840 Enable register pressure sensitive insn scheduling before register
12841 allocation.  This only makes sense when scheduling before register
12842 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
12843 @option{-O2} or higher.  Usage of this option can improve the
12844 generated code and decrease its size by preventing register pressure
12845 increase above the number of available hard registers and subsequent
12846 spills in register allocation.
12848 @opindex fsched-spec-load
12849 @item -fsched-spec-load
12850 Allow speculative motion of some load instructions.  This only makes
12851 sense when scheduling before register allocation, i.e.@: with
12852 @option{-fschedule-insns} or at @option{-O2} or higher.
12854 @opindex fsched-spec-load-dangerous
12855 @item -fsched-spec-load-dangerous
12856 Allow speculative motion of more load instructions.  This only makes
12857 sense when scheduling before register allocation, i.e.@: with
12858 @option{-fschedule-insns} or at @option{-O2} or higher.
12860 @opindex fsched-stalled-insns
12861 @item -fsched-stalled-insns
12862 @itemx -fsched-stalled-insns=@var{n}
12863 Define how many insns (if any) can be moved prematurely from the queue
12864 of stalled insns into the ready list during the second scheduling pass.
12865 @option{-fno-sched-stalled-insns} means that no insns are moved
12866 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
12867 on how many queued insns can be moved prematurely.
12868 @option{-fsched-stalled-insns} without a value is equivalent to
12869 @option{-fsched-stalled-insns=1}.
12871 @opindex fsched-stalled-insns-dep
12872 @item -fsched-stalled-insns-dep
12873 @itemx -fsched-stalled-insns-dep=@var{n}
12874 Define how many insn groups (cycles) are examined for a dependency
12875 on a stalled insn that is a candidate for premature removal from the queue
12876 of stalled insns.  This has an effect only during the second scheduling pass,
12877 and only if @option{-fsched-stalled-insns} is used.
12878 @option{-fno-sched-stalled-insns-dep} is equivalent to
12879 @option{-fsched-stalled-insns-dep=0}.
12880 @option{-fsched-stalled-insns-dep} without a value is equivalent to
12881 @option{-fsched-stalled-insns-dep=1}.
12883 @opindex fsched2-use-superblocks
12884 @item -fsched2-use-superblocks
12885 When scheduling after register allocation, use superblock scheduling.
12886 This allows motion across basic block boundaries,
12887 resulting in faster schedules.  This option is experimental, as not all machine
12888 descriptions used by GCC model the CPU closely enough to avoid unreliable
12889 results from the algorithm.
12891 This only makes sense when scheduling after register allocation, i.e.@: with
12892 @option{-fschedule-insns2} or at @option{-O2} or higher.
12894 @opindex fsched-group-heuristic
12895 @item -fsched-group-heuristic
12896 Enable the group heuristic in the scheduler.  This heuristic favors
12897 the instruction that belongs to a schedule group.  This is enabled
12898 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12899 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12901 @opindex fsched-critical-path-heuristic
12902 @item -fsched-critical-path-heuristic
12903 Enable the critical-path heuristic in the scheduler.  This heuristic favors
12904 instructions on the critical path.  This is enabled by default when
12905 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12906 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12908 @opindex fsched-spec-insn-heuristic
12909 @item -fsched-spec-insn-heuristic
12910 Enable the speculative instruction heuristic in the scheduler.  This
12911 heuristic favors speculative instructions with greater dependency weakness.
12912 This is enabled by default when scheduling is enabled, i.e.@:
12913 with @option{-fschedule-insns} or @option{-fschedule-insns2}
12914 or at @option{-O2} or higher.
12916 @opindex fsched-rank-heuristic
12917 @item -fsched-rank-heuristic
12918 Enable the rank heuristic in the scheduler.  This heuristic favors
12919 the instruction belonging to a basic block with greater size or frequency.
12920 This is enabled by default when scheduling is enabled, i.e.@:
12921 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12922 at @option{-O2} or higher.
12924 @opindex fsched-last-insn-heuristic
12925 @item -fsched-last-insn-heuristic
12926 Enable the last-instruction heuristic in the scheduler.  This heuristic
12927 favors the instruction that is less dependent on the last instruction
12928 scheduled.  This is enabled by default when scheduling is enabled,
12929 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12930 at @option{-O2} or higher.
12932 @opindex fsched-dep-count-heuristic
12933 @item -fsched-dep-count-heuristic
12934 Enable the dependent-count heuristic in the scheduler.  This heuristic
12935 favors the instruction that has more instructions depending on it.
12936 This is enabled by default when scheduling is enabled, i.e.@:
12937 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12938 at @option{-O2} or higher.
12940 @opindex freschedule-modulo-scheduled-loops
12941 @item -freschedule-modulo-scheduled-loops
12942 Modulo scheduling is performed before traditional scheduling.  If a loop
12943 is modulo scheduled, later scheduling passes may change its schedule.  
12944 Use this option to control that behavior.
12946 @opindex fselective-scheduling
12947 @item -fselective-scheduling
12948 Schedule instructions using selective scheduling algorithm.  Selective
12949 scheduling runs instead of the first scheduler pass.
12951 @opindex fselective-scheduling2
12952 @item -fselective-scheduling2
12953 Schedule instructions using selective scheduling algorithm.  Selective
12954 scheduling runs instead of the second scheduler pass.
12956 @opindex fsel-sched-pipelining
12957 @item -fsel-sched-pipelining
12958 Enable software pipelining of innermost loops during selective scheduling.
12959 This option has no effect unless one of @option{-fselective-scheduling} or
12960 @option{-fselective-scheduling2} is turned on.
12962 @opindex fsel-sched-pipelining-outer-loops
12963 @item -fsel-sched-pipelining-outer-loops
12964 When pipelining loops during selective scheduling, also pipeline outer loops.
12965 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
12967 @opindex fsemantic-interposition
12968 @item -fsemantic-interposition
12969 Some object formats, like ELF, allow interposing of symbols by the 
12970 dynamic linker.
12971 This means that for symbols exported from the DSO, the compiler cannot perform
12972 interprocedural propagation, inlining and other optimizations in anticipation
12973 that the function or variable in question may change. While this feature is
12974 useful, for example, to rewrite memory allocation functions by a debugging
12975 implementation, it is expensive in the terms of code quality.
12976 With @option{-fno-semantic-interposition} the compiler assumes that 
12977 if interposition happens for functions the overwriting function will have 
12978 precisely the same semantics (and side effects). 
12979 Similarly if interposition happens
12980 for variables, the constructor of the variable will be the same. The flag
12981 has no effect for functions explicitly declared inline 
12982 (where it is never allowed for interposition to change semantics) 
12983 and for symbols explicitly declared weak.
12985 @opindex fshrink-wrap
12986 @item -fshrink-wrap
12987 Emit function prologues only before parts of the function that need it,
12988 rather than at the top of the function.  This flag is enabled by default at
12989 @option{-O} and higher.
12991 @opindex fshrink-wrap-separate
12992 @item -fshrink-wrap-separate
12993 Shrink-wrap separate parts of the prologue and epilogue separately, so that
12994 those parts are only executed when needed.
12995 This option is on by default, but has no effect unless @option{-fshrink-wrap}
12996 is also turned on and the target supports this.
12998 @opindex fcaller-saves
12999 @item -fcaller-saves
13000 Enable allocation of values to registers that are clobbered by
13001 function calls, by emitting extra instructions to save and restore the
13002 registers around such calls.  Such allocation is done only when it
13003 seems to result in better code.
13005 This option is always enabled by default on certain machines, usually
13006 those which have no call-preserved registers to use instead.
13008 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13010 @opindex fcombine-stack-adjustments
13011 @item -fcombine-stack-adjustments
13012 Tracks stack adjustments (pushes and pops) and stack memory references
13013 and then tries to find ways to combine them.
13015 Enabled by default at @option{-O1} and higher.
13017 @opindex fipa-ra
13018 @item -fipa-ra
13019 Use caller save registers for allocation if those registers are not used by
13020 any called function.  In that case it is not necessary to save and restore
13021 them around calls.  This is only possible if called functions are part of
13022 same compilation unit as current function and they are compiled before it.
13024 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
13025 is disabled if generated code will be instrumented for profiling
13026 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
13027 exactly (this happens on targets that do not expose prologues
13028 and epilogues in RTL).
13030 @opindex fconserve-stack
13031 @item -fconserve-stack
13032 Attempt to minimize stack usage.  The compiler attempts to use less
13033 stack space, even if that makes the program slower.  This option
13034 implies setting the @option{large-stack-frame} parameter to 100
13035 and the @option{large-stack-frame-growth} parameter to 400.
13037 @opindex ftree-reassoc
13038 @item -ftree-reassoc
13039 Perform reassociation on trees.  This flag is enabled by default
13040 at @option{-O1} and higher.
13042 @opindex fcode-hoisting
13043 @item -fcode-hoisting
13044 Perform code hoisting.  Code hoisting tries to move the
13045 evaluation of expressions executed on all paths to the function exit
13046 as early as possible.  This is especially useful as a code size
13047 optimization, but it often helps for code speed as well.
13048 This flag is enabled by default at @option{-O2} and higher.
13050 @opindex ftree-pre
13051 @item -ftree-pre
13052 Perform partial redundancy elimination (PRE) on trees.  This flag is
13053 enabled by default at @option{-O2} and @option{-O3}.
13055 @opindex ftree-partial-pre
13056 @item -ftree-partial-pre
13057 Make partial redundancy elimination (PRE) more aggressive.  This flag is
13058 enabled by default at @option{-O3}.
13060 @opindex ftree-forwprop
13061 @item -ftree-forwprop
13062 Perform forward propagation on trees.  This flag is enabled by default
13063 at @option{-O1} and higher.
13065 @opindex ftree-fre
13066 @item -ftree-fre
13067 Perform full redundancy elimination (FRE) on trees.  The difference
13068 between FRE and PRE is that FRE only considers expressions
13069 that are computed on all paths leading to the redundant computation.
13070 This analysis is faster than PRE, though it exposes fewer redundancies.
13071 This flag is enabled by default at @option{-O1} and higher.
13073 @opindex ftree-phiprop
13074 @item -ftree-phiprop
13075 Perform hoisting of loads from conditional pointers on trees.  This
13076 pass is enabled by default at @option{-O1} and higher.
13078 @opindex fhoist-adjacent-loads
13079 @item -fhoist-adjacent-loads
13080 Speculatively hoist loads from both branches of an if-then-else if the
13081 loads are from adjacent locations in the same structure and the target
13082 architecture has a conditional move instruction.  This flag is enabled
13083 by default at @option{-O2} and higher.
13085 @opindex ftree-copy-prop
13086 @item -ftree-copy-prop
13087 Perform copy propagation on trees.  This pass eliminates unnecessary
13088 copy operations.  This flag is enabled by default at @option{-O1} and
13089 higher.
13091 @opindex fipa-pure-const
13092 @item -fipa-pure-const
13093 Discover which functions are pure or constant.
13094 Enabled by default at @option{-O1} and higher.
13096 @opindex fipa-reference
13097 @item -fipa-reference
13098 Discover which static variables do not escape the
13099 compilation unit.
13100 Enabled by default at @option{-O1} and higher.
13102 @opindex fipa-reference-addressable
13103 @item -fipa-reference-addressable
13104 Discover read-only, write-only and non-addressable static variables.
13105 Enabled by default at @option{-O1} and higher.
13107 @opindex fipa-stack-alignment
13108 @item -fipa-stack-alignment
13109 Reduce stack alignment on call sites if possible.
13110 Enabled by default.
13112 @opindex fipa-pta
13113 @item -fipa-pta
13114 Perform interprocedural pointer analysis and interprocedural modification
13115 and reference analysis.  This option can cause excessive memory and
13116 compile-time usage on large compilation units.  It is not enabled by
13117 default at any optimization level.
13119 @opindex fipa-profile
13120 @item -fipa-profile
13121 Perform interprocedural profile propagation.  The functions called only from
13122 cold functions are marked as cold. Also functions executed once (such as
13123 @code{cold}, @code{noreturn}, static constructors or destructors) are
13124 identified. Cold functions and loop less parts of functions executed once are
13125 then optimized for size.
13126 Enabled by default at @option{-O1} and higher.
13128 @opindex fipa-modref
13129 @item -fipa-modref
13130 Perform interprocedural mod/ref analysis.  This optimization analyzes the side
13131 effects of functions (memory locations that are modified or referenced) and
13132 enables better optimization across the function call boundary.  This flag is
13133 enabled by default at @option{-O1} and higher.
13135 @opindex fipa-cp
13136 @item -fipa-cp
13137 Perform interprocedural constant propagation.
13138 This optimization analyzes the program to determine when values passed
13139 to functions are constants and then optimizes accordingly.
13140 This optimization can substantially increase performance
13141 if the application has constants passed to functions.
13142 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
13143 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13145 @opindex fipa-cp-clone
13146 @item -fipa-cp-clone
13147 Perform function cloning to make interprocedural constant propagation stronger.
13148 When enabled, interprocedural constant propagation performs function cloning
13149 when externally visible function can be called with constant arguments.
13150 Because this optimization can create multiple copies of functions,
13151 it may significantly increase code size
13152 (see @option{--param ipa-cp-unit-growth=@var{value}}).
13153 This flag is enabled by default at @option{-O3}.
13154 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13156 @opindex fipa-bit-cp
13157 @item -fipa-bit-cp
13158 When enabled, perform interprocedural bitwise constant
13159 propagation. This flag is enabled by default at @option{-O2} and
13160 by @option{-fprofile-use} and @option{-fauto-profile}.
13161 It requires that @option{-fipa-cp} is enabled.  
13163 @opindex fipa-vrp
13164 @item -fipa-vrp
13165 When enabled, perform interprocedural propagation of value
13166 ranges. This flag is enabled by default at @option{-O2}. It requires
13167 that @option{-fipa-cp} is enabled.
13169 @opindex fipa-icf
13170 @item -fipa-icf
13171 Perform Identical Code Folding for functions and read-only variables.
13172 The optimization reduces code size and may disturb unwind stacks by replacing
13173 a function by equivalent one with a different name. The optimization works
13174 more effectively with link-time optimization enabled.
13176 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
13177 works on different levels and thus the optimizations are not same - there are
13178 equivalences that are found only by GCC and equivalences found only by Gold.
13180 This flag is enabled by default at @option{-O2} and @option{-Os}.
13182 @opindex flive-patching
13183 @item -flive-patching=@var{level}
13184 Control GCC's optimizations to produce output suitable for live-patching.
13186 If the compiler's optimization uses a function's body or information extracted
13187 from its body to optimize/change another function, the latter is called an
13188 impacted function of the former.  If a function is patched, its impacted
13189 functions should be patched too.
13191 The impacted functions are determined by the compiler's interprocedural
13192 optimizations.  For example, a caller is impacted when inlining a function
13193 into its caller,
13194 cloning a function and changing its caller to call this new clone,
13195 or extracting a function's pureness/constness information to optimize
13196 its direct or indirect callers, etc.
13198 Usually, the more IPA optimizations enabled, the larger the number of
13199 impacted functions for each function.  In order to control the number of
13200 impacted functions and more easily compute the list of impacted function,
13201 IPA optimizations can be partially enabled at two different levels.
13203 The @var{level} argument should be one of the following:
13205 @table @samp
13207 @item inline-clone
13209 Only enable inlining and cloning optimizations, which includes inlining,
13210 cloning, interprocedural scalar replacement of aggregates and partial inlining.
13211 As a result, when patching a function, all its callers and its clones'
13212 callers are impacted, therefore need to be patched as well.
13214 @option{-flive-patching=inline-clone} disables the following optimization flags:
13215 @gccoptlist{-fwhole-program  -fipa-pta  -fipa-reference  -fipa-ra
13216 -fipa-icf  -fipa-icf-functions  -fipa-icf-variables
13217 -fipa-bit-cp  -fipa-vrp  -fipa-pure-const
13218 -fipa-reference-addressable
13219 -fipa-stack-alignment -fipa-modref}
13221 @item inline-only-static
13223 Only enable inlining of static functions.
13224 As a result, when patching a static function, all its callers are impacted
13225 and so need to be patched as well.
13227 In addition to all the flags that @option{-flive-patching=inline-clone}
13228 disables,
13229 @option{-flive-patching=inline-only-static} disables the following additional
13230 optimization flags:
13231 @gccoptlist{-fipa-cp-clone  -fipa-sra  -fpartial-inlining  -fipa-cp}
13233 @end table
13235 When @option{-flive-patching} is specified without any value, the default value
13236 is @var{inline-clone}.
13238 This flag is disabled by default.
13240 Note that @option{-flive-patching} is not supported with link-time optimization
13241 (@option{-flto}).
13243 @opindex fisolate-erroneous-paths-dereference
13244 @item -fisolate-erroneous-paths-dereference
13245 Detect paths that trigger erroneous or undefined behavior due to
13246 dereferencing a null pointer.  Isolate those paths from the main control
13247 flow and turn the statement with erroneous or undefined behavior into a trap.
13248 This flag is enabled by default at @option{-O2} and higher and depends on
13249 @option{-fdelete-null-pointer-checks} also being enabled.
13251 @opindex fisolate-erroneous-paths-attribute
13252 @item -fisolate-erroneous-paths-attribute
13253 Detect paths that trigger erroneous or undefined behavior due to a null value
13254 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
13255 attribute.  Isolate those paths from the main control flow and turn the
13256 statement with erroneous or undefined behavior into a trap.  This is not
13257 currently enabled, but may be enabled by @option{-O2} in the future.
13259 @opindex ftree-sink
13260 @item -ftree-sink
13261 Perform forward store motion on trees.  This flag is
13262 enabled by default at @option{-O1} and higher.
13264 @opindex ftree-bit-ccp
13265 @item -ftree-bit-ccp
13266 Perform sparse conditional bit constant propagation on trees and propagate
13267 pointer alignment information.
13268 This pass only operates on local scalar variables and is enabled by default
13269 at @option{-O1} and higher, except for @option{-Og}.
13270 It requires that @option{-ftree-ccp} is enabled.
13272 @opindex ftree-ccp
13273 @item -ftree-ccp
13274 Perform sparse conditional constant propagation (CCP) on trees.  This
13275 pass only operates on local scalar variables and is enabled by default
13276 at @option{-O1} and higher.
13278 @opindex fssa-backprop
13279 @item -fssa-backprop
13280 Propagate information about uses of a value up the definition chain
13281 in order to simplify the definitions.  For example, this pass strips
13282 sign operations if the sign of a value never matters.  The flag is
13283 enabled by default at @option{-O1} and higher.
13285 @opindex fssa-phiopt
13286 @item -fssa-phiopt
13287 Perform pattern matching on SSA PHI nodes to optimize conditional
13288 code.  This pass is enabled by default at @option{-O1} and higher,
13289 except for @option{-Og}.
13291 @opindex ftree-switch-conversion
13292 @item -ftree-switch-conversion
13293 Perform conversion of simple initializations in a switch to
13294 initializations from a scalar array.  This flag is enabled by default
13295 at @option{-O2} and higher.
13297 @opindex ftree-tail-merge
13298 @item -ftree-tail-merge
13299 Look for identical code sequences.  When found, replace one with a jump to the
13300 other.  This optimization is known as tail merging or cross jumping.  This flag
13301 is enabled by default at @option{-O2} and higher.  The compilation time
13302 in this pass can
13303 be limited using @option{max-tail-merge-comparisons} parameter and
13304 @option{max-tail-merge-iterations} parameter.
13306 @opindex ftree-dce
13307 @item -ftree-dce
13308 Perform dead code elimination (DCE) on trees.  This flag is enabled by
13309 default at @option{-O1} and higher.
13311 @opindex ftree-builtin-call-dce
13312 @item -ftree-builtin-call-dce
13313 Perform conditional dead code elimination (DCE) for calls to built-in functions
13314 that may set @code{errno} but are otherwise free of side effects.  This flag is
13315 enabled by default at @option{-O2} and higher if @option{-Os} is not also
13316 specified.
13318 @opindex ffinite-loops
13319 @opindex fno-finite-loops
13320 @item -ffinite-loops
13321 Assume that a loop with an exit will eventually take the exit and not loop
13322 indefinitely.  This allows the compiler to remove loops that otherwise have
13323 no side-effects, not considering eventual endless looping as such.
13325 This option is enabled by default at @option{-O2} for C++ with -std=c++11
13326 or higher.
13328 @opindex ftree-dominator-opts
13329 @item -ftree-dominator-opts
13330 Perform a variety of simple scalar cleanups (constant/copy
13331 propagation, redundancy elimination, range propagation and expression
13332 simplification) based on a dominator tree traversal.  This also
13333 performs jump threading (to reduce jumps to jumps). This flag is
13334 enabled by default at @option{-O1} and higher.
13336 @opindex ftree-dse
13337 @item -ftree-dse
13338 Perform dead store elimination (DSE) on trees.  A dead store is a store into
13339 a memory location that is later overwritten by another store without
13340 any intervening loads.  In this case the earlier store can be deleted.  This
13341 flag is enabled by default at @option{-O1} and higher.
13343 @opindex ftree-ch
13344 @item -ftree-ch
13345 Perform loop header copying on trees.  This is beneficial since it increases
13346 effectiveness of code motion optimizations.  It also saves one jump.  This flag
13347 is enabled by default at @option{-O1} and higher.  It is not enabled
13348 for @option{-Os}, since it usually increases code size.
13350 @opindex ftree-loop-optimize
13351 @item -ftree-loop-optimize
13352 Perform loop optimizations on trees.  This flag is enabled by default
13353 at @option{-O1} and higher.
13355 @opindex ftree-loop-linear
13356 @opindex floop-strip-mine
13357 @opindex floop-block
13358 @item -ftree-loop-linear
13359 @itemx -floop-strip-mine
13360 @itemx -floop-block
13361 Perform loop nest optimizations.  Same as
13362 @option{-floop-nest-optimize}.  To use this code transformation, GCC has
13363 to be configured with @option{--with-isl} to enable the Graphite loop
13364 transformation infrastructure.
13366 @opindex fgraphite-identity
13367 @item -fgraphite-identity
13368 Enable the identity transformation for graphite.  For every SCoP we generate
13369 the polyhedral representation and transform it back to gimple.  Using
13370 @option{-fgraphite-identity} we can check the costs or benefits of the
13371 GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
13372 are also performed by the code generator isl, like index splitting and
13373 dead code elimination in loops.
13375 @opindex floop-nest-optimize
13376 @item -floop-nest-optimize
13377 Enable the isl based loop nest optimizer.  This is a generic loop nest
13378 optimizer based on the Pluto optimization algorithms.  It calculates a loop
13379 structure optimized for data-locality and parallelism.  This option
13380 is experimental.
13382 @opindex floop-parallelize-all
13383 @item -floop-parallelize-all
13384 Use the Graphite data dependence analysis to identify loops that can
13385 be parallelized.  Parallelize all the loops that can be analyzed to
13386 not contain loop carried dependences without checking that it is
13387 profitable to parallelize the loops.
13389 @opindex ftree-coalesce-vars
13390 @item -ftree-coalesce-vars
13391 While transforming the program out of the SSA representation, attempt to
13392 reduce copying by coalescing versions of different user-defined
13393 variables, instead of just compiler temporaries.  This may severely
13394 limit the ability to debug an optimized program compiled with
13395 @option{-fno-var-tracking-assignments}.  In the negated form, this flag
13396 prevents SSA coalescing of user variables.  This option is enabled by
13397 default if optimization is enabled, and it does very little otherwise.
13399 @opindex ftree-loop-if-convert
13400 @item -ftree-loop-if-convert
13401 Attempt to transform conditional jumps in the innermost loops to
13402 branch-less equivalents.  The intent is to remove control-flow from
13403 the innermost loops in order to improve the ability of the
13404 vectorization pass to handle these loops.  This is enabled by default
13405 if vectorization is enabled.
13407 @opindex ftree-loop-distribution
13408 @item -ftree-loop-distribution
13409 Perform loop distribution.  This flag can improve cache performance on
13410 big loop bodies and allow further loop optimizations, like
13411 parallelization or vectorization, to take place.  For example, the loop
13412 @smallexample
13413 DO I = 1, N
13414   A(I) = B(I) + C
13415   D(I) = E(I) * F
13416 ENDDO
13417 @end smallexample
13418 is transformed to
13419 @smallexample
13420 DO I = 1, N
13421    A(I) = B(I) + C
13422 ENDDO
13423 DO I = 1, N
13424    D(I) = E(I) * F
13425 ENDDO
13426 @end smallexample
13427 This flag is enabled by default at @option{-O3}.
13428 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13430 @opindex ftree-loop-distribute-patterns
13431 @item -ftree-loop-distribute-patterns
13432 Perform loop distribution of patterns that can be code generated with
13433 calls to a library.  This flag is enabled by default at @option{-O2} and
13434 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
13436 This pass distributes the initialization loops and generates a call to
13437 memset zero.  For example, the loop
13438 @smallexample
13439 DO I = 1, N
13440   A(I) = 0
13441   B(I) = A(I) + I
13442 ENDDO
13443 @end smallexample
13444 is transformed to
13445 @smallexample
13446 DO I = 1, N
13447    A(I) = 0
13448 ENDDO
13449 DO I = 1, N
13450    B(I) = A(I) + I
13451 ENDDO
13452 @end smallexample
13453 and the initialization loop is transformed into a call to memset zero.
13454 This flag is enabled by default at @option{-O3}.
13455 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13457 @opindex floop-interchange
13458 @item -floop-interchange
13459 Perform loop interchange outside of graphite.  This flag can improve cache
13460 performance on loop nest and allow further loop optimizations, like
13461 vectorization, to take place.  For example, the loop
13462 @smallexample
13463 for (int i = 0; i < N; i++)
13464   for (int j = 0; j < N; j++)
13465     for (int k = 0; k < N; k++)
13466       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13467 @end smallexample
13468 is transformed to
13469 @smallexample
13470 for (int i = 0; i < N; i++)
13471   for (int k = 0; k < N; k++)
13472     for (int j = 0; j < N; j++)
13473       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13474 @end smallexample
13475 This flag is enabled by default at @option{-O3}.
13476 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13478 @opindex floop-unroll-and-jam
13479 @item -floop-unroll-and-jam
13480 Apply unroll and jam transformations on feasible loops.  In a loop
13481 nest this unrolls the outer loop by some factor and fuses the resulting
13482 multiple inner loops.  This flag is enabled by default at @option{-O3}.
13483 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13485 @opindex ftree-loop-im
13486 @item -ftree-loop-im
13487 Perform loop invariant motion on trees.  This pass moves only invariants that
13488 are hard to handle at RTL level (function calls, operations that expand to
13489 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
13490 operands of conditions that are invariant out of the loop, so that we can use
13491 just trivial invariantness analysis in loop unswitching.  The pass also includes
13492 store motion.
13494 @opindex ftree-loop-ivcanon
13495 @item -ftree-loop-ivcanon
13496 Create a canonical counter for number of iterations in loops for which
13497 determining number of iterations requires complicated analysis.  Later
13498 optimizations then may determine the number easily.  Useful especially
13499 in connection with unrolling.
13501 @opindex ftree-scev-cprop
13502 @item -ftree-scev-cprop
13503 Perform final value replacement.  If a variable is modified in a loop
13504 in such a way that its value when exiting the loop can be determined using
13505 only its initial value and the number of loop iterations, replace uses of
13506 the final value by such a computation, provided it is sufficiently cheap.
13507 This reduces data dependencies and may allow further simplifications.
13508 Enabled by default at @option{-O1} and higher.
13510 @opindex fivopts
13511 @item -fivopts
13512 Perform induction variable optimizations (strength reduction, induction
13513 variable merging and induction variable elimination) on trees.
13515 @opindex ftree-parallelize-loops
13516 @item -ftree-parallelize-loops=n
13517 Parallelize loops, i.e., split their iteration space to run in n threads.
13518 This is only possible for loops whose iterations are independent
13519 and can be arbitrarily reordered.  The optimization is only
13520 profitable on multiprocessor machines, for loops that are CPU-intensive,
13521 rather than constrained e.g.@: by memory bandwidth.  This option
13522 implies @option{-pthread}, and thus is only supported on targets
13523 that have support for @option{-pthread}.
13525 @opindex ftree-pta
13526 @item -ftree-pta
13527 Perform function-local points-to analysis on trees.  This flag is
13528 enabled by default at @option{-O1} and higher, except for @option{-Og}.
13530 @opindex ftree-sra
13531 @item -ftree-sra
13532 Perform scalar replacement of aggregates.  This pass replaces structure
13533 references with scalars to prevent committing structures to memory too
13534 early.  This flag is enabled by default at @option{-O1} and higher,
13535 except for @option{-Og}.
13537 @opindex fstore-merging
13538 @item -fstore-merging
13539 Perform merging of narrow stores to consecutive memory addresses.  This pass
13540 merges contiguous stores of immediate values narrower than a word into fewer
13541 wider stores to reduce the number of instructions.  This is enabled by default
13542 at @option{-O2} and higher as well as @option{-Os}.
13544 @opindex ftree-ter
13545 @item -ftree-ter
13546 Perform temporary expression replacement during the SSA->normal phase.  Single
13547 use/single def temporaries are replaced at their use location with their
13548 defining expression.  This results in non-GIMPLE code, but gives the expanders
13549 much more complex trees to work on resulting in better RTL generation.  This is
13550 enabled by default at @option{-O1} and higher.
13552 @opindex ftree-slsr
13553 @item -ftree-slsr
13554 Perform straight-line strength reduction on trees.  This recognizes related
13555 expressions involving multiplications and replaces them by less expensive
13556 calculations when possible.  This is enabled by default at @option{-O1} and
13557 higher.
13559 @opindex ftree-vectorize
13560 @item -ftree-vectorize
13561 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
13562 and @option{-ftree-slp-vectorize} if not explicitly specified.
13564 @opindex ftree-loop-vectorize
13565 @item -ftree-loop-vectorize
13566 Perform loop vectorization on trees. This flag is enabled by default at
13567 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13568 and @option{-fauto-profile}.
13570 @opindex ftree-slp-vectorize
13571 @item -ftree-slp-vectorize
13572 Perform basic block vectorization on trees. This flag is enabled by default at
13573 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13574 and @option{-fauto-profile}.
13576 @opindex ftrivial-auto-var-init
13577 @item -ftrivial-auto-var-init=@var{choice}
13578 Initialize automatic variables with either a pattern or with zeroes to increase
13579 the security and predictability of a program by preventing uninitialized memory
13580 disclosure and use.
13581 GCC still considers an automatic variable that doesn't have an explicit
13582 initializer as uninitialized, @option{-Wuninitialized} and
13583 @option{-Wanalyzer-use-of-uninitialized-value} will still report
13584 warning messages on such automatic variables and the compiler will
13585 perform optimization as if the variable were uninitialized.
13586 With this option, GCC will also initialize any padding of automatic variables
13587 that have structure or union types to zeroes.
13588 However, the current implementation cannot initialize automatic variables that
13589 are declared between the controlling expression and the first case of a
13590 @code{switch} statement.  Using @option{-Wtrivial-auto-var-init} to report all
13591 such cases.
13593 The three values of @var{choice} are:
13595 @itemize @bullet
13596 @item
13597 @samp{uninitialized} doesn't initialize any automatic variables.
13598 This is C and C++'s default.
13600 @item
13601 @samp{pattern} Initialize automatic variables with values which will likely
13602 transform logic bugs into crashes down the line, are easily recognized in a
13603 crash dump and without being values that programmers can rely on for useful
13604 program semantics.
13605 The current value is byte-repeatable pattern with byte "0xFE".
13606 The values used for pattern initialization might be changed in the future.
13608 @item
13609 @samp{zero} Initialize automatic variables with zeroes.
13610 @end itemize
13612 The default is @samp{uninitialized}.
13614 You can control this behavior for a specific variable by using the variable
13615 attribute @code{uninitialized} (@pxref{Variable Attributes}).
13617 @opindex fvect-cost-model
13618 @item -fvect-cost-model=@var{model}
13619 Alter the cost model used for vectorization.  The @var{model} argument
13620 should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
13621 @samp{very-cheap}.
13622 With the @samp{unlimited} model the vectorized code-path is assumed
13623 to be profitable while with the @samp{dynamic} model a runtime check
13624 guards the vectorized code-path to enable it only for iteration
13625 counts that will likely execute faster than when executing the original
13626 scalar loop.  The @samp{cheap} model disables vectorization of
13627 loops where doing so would be cost prohibitive for example due to
13628 required runtime checks for data dependence or alignment but otherwise
13629 is equal to the @samp{dynamic} model.  The @samp{very-cheap} model only
13630 allows vectorization if the vector code would entirely replace the
13631 scalar code that is being vectorized.  For example, if each iteration
13632 of a vectorized loop would only be able to handle exactly four iterations
13633 of the scalar loop, the @samp{very-cheap} model would only allow
13634 vectorization if the scalar iteration count is known to be a multiple
13635 of four.
13637 The default cost model depends on other optimization flags and is
13638 either @samp{dynamic} or @samp{cheap}.
13640 @opindex fsimd-cost-model
13641 @item -fsimd-cost-model=@var{model}
13642 Alter the cost model used for vectorization of loops marked with the OpenMP
13643 simd directive.  The @var{model} argument should be one of
13644 @samp{unlimited}, @samp{dynamic}, @samp{cheap}.  All values of @var{model}
13645 have the same meaning as described in @option{-fvect-cost-model} and by
13646 default a cost model defined with @option{-fvect-cost-model} is used.
13648 @opindex ftree-vrp
13649 @item -ftree-vrp
13650 Perform Value Range Propagation on trees.  This is similar to the
13651 constant propagation pass, but instead of values, ranges of values are
13652 propagated.  This allows the optimizers to remove unnecessary range
13653 checks like array bound checks and null pointer checks.  This is
13654 enabled by default at @option{-O2} and higher.  Null pointer check
13655 elimination is only done if @option{-fdelete-null-pointer-checks} is
13656 enabled.
13658 @opindex fsplit-paths
13659 @item -fsplit-paths
13660 Split paths leading to loop backedges.  This can improve dead code
13661 elimination and common subexpression elimination.  This is enabled by
13662 default at @option{-O3} and above.
13664 @opindex fsplit-ivs-in-unroller
13665 @item -fsplit-ivs-in-unroller
13666 Enables expression of values of induction variables in later iterations
13667 of the unrolled loop using the value in the first iteration.  This breaks
13668 long dependency chains, thus improving efficiency of the scheduling passes.
13670 A combination of @option{-fweb} and CSE is often sufficient to obtain the
13671 same effect.  However, that is not reliable in cases where the loop body
13672 is more complicated than a single basic block.  It also does not work at all
13673 on some architectures due to restrictions in the CSE pass.
13675 This optimization is enabled by default.
13677 @opindex fvariable-expansion-in-unroller
13678 @item -fvariable-expansion-in-unroller
13679 With this option, the compiler creates multiple copies of some
13680 local variables when unrolling a loop, which can result in superior code.
13682 This optimization is enabled by default for PowerPC targets, but disabled
13683 by default otherwise.
13685 @opindex fpartial-inlining
13686 @item -fpartial-inlining
13687 Inline parts of functions.  This option has any effect only
13688 when inlining itself is turned on by the @option{-finline-functions}
13689 or @option{-finline-small-functions} options.
13691 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13693 @opindex fpredictive-commoning
13694 @item -fpredictive-commoning
13695 Perform predictive commoning optimization, i.e., reusing computations
13696 (especially memory loads and stores) performed in previous
13697 iterations of loops.
13699 This option is enabled at level @option{-O3}.
13700 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13702 @opindex fprefetch-loop-arrays
13703 @item -fprefetch-loop-arrays
13704 If supported by the target machine, generate instructions to prefetch
13705 memory to improve the performance of loops that access large arrays.
13707 This option may generate better or worse code; results are highly
13708 dependent on the structure of loops within the source code.
13710 Disabled at level @option{-Os}.
13712 @opindex fno-printf-return-value
13713 @opindex fprintf-return-value
13714 @item -fno-printf-return-value
13715 Do not substitute constants for known return value of formatted output
13716 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
13717 @code{vsnprintf} (but not @code{printf} of @code{fprintf}).  This
13718 transformation allows GCC to optimize or even eliminate branches based
13719 on the known return value of these functions called with arguments that
13720 are either constant, or whose values are known to be in a range that
13721 makes determining the exact return value possible.  For example, when
13722 @option{-fprintf-return-value} is in effect, both the branch and the
13723 body of the @code{if} statement (but not the call to @code{snprint})
13724 can be optimized away when @code{i} is a 32-bit or smaller integer
13725 because the return value is guaranteed to be at most 8.
13727 @smallexample
13728 char buf[9];
13729 if (snprintf (buf, "%08x", i) >= sizeof buf)
13730   @dots{}
13731 @end smallexample
13733 The @option{-fprintf-return-value} option relies on other optimizations
13734 and yields best results with @option{-O2} and above.  It works in tandem
13735 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
13736 options.  The @option{-fprintf-return-value} option is enabled by default.
13738 @opindex fno-peephole
13739 @opindex fpeephole
13740 @opindex fno-peephole2
13741 @opindex fpeephole2
13742 @item -fno-peephole
13743 @itemx -fno-peephole2
13744 Disable any machine-specific peephole optimizations.  The difference
13745 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
13746 are implemented in the compiler; some targets use one, some use the
13747 other, a few use both.
13749 @option{-fpeephole} is enabled by default.
13750 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13752 @opindex fno-guess-branch-probability
13753 @opindex fguess-branch-probability
13754 @item -fno-guess-branch-probability
13755 Do not guess branch probabilities using heuristics.
13757 GCC uses heuristics to guess branch probabilities if they are
13758 not provided by profiling feedback (@option{-fprofile-arcs}).  These
13759 heuristics are based on the control flow graph.  If some branch probabilities
13760 are specified by @code{__builtin_expect}, then the heuristics are
13761 used to guess branch probabilities for the rest of the control flow graph,
13762 taking the @code{__builtin_expect} info into account.  The interactions
13763 between the heuristics and @code{__builtin_expect} can be complex, and in
13764 some cases, it may be useful to disable the heuristics so that the effects
13765 of @code{__builtin_expect} are easier to understand.
13767 It is also possible to specify expected probability of the expression
13768 with @code{__builtin_expect_with_probability} built-in function.
13770 The default is @option{-fguess-branch-probability} at levels
13771 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
13773 @opindex freorder-blocks
13774 @item -freorder-blocks
13775 Reorder basic blocks in the compiled function in order to reduce number of
13776 taken branches and improve code locality.
13778 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
13780 @opindex freorder-blocks-algorithm
13781 @item -freorder-blocks-algorithm=@var{algorithm}
13782 Use the specified algorithm for basic block reordering.  The
13783 @var{algorithm} argument can be @samp{simple}, which does not increase
13784 code size (except sometimes due to secondary effects like alignment),
13785 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
13786 put all often executed code together, minimizing the number of branches
13787 executed by making extra copies of code.
13789 The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and
13790 @samp{stc} at levels @option{-O2}, @option{-O3}.
13792 @opindex freorder-blocks-and-partition
13793 @item -freorder-blocks-and-partition
13794 In addition to reordering basic blocks in the compiled function, in order
13795 to reduce number of taken branches, partitions hot and cold basic blocks
13796 into separate sections of the assembly and @file{.o} files, to improve
13797 paging and cache locality performance.
13799 This optimization is automatically turned off in the presence of
13800 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
13801 section attribute and on any architecture that does not support named
13802 sections.  When @option{-fsplit-stack} is used this option is not
13803 enabled by default (to avoid linker errors), but may be enabled
13804 explicitly (if using a working linker).
13806 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
13808 @opindex freorder-functions
13809 @item -freorder-functions
13810 Reorder functions in the object file in order to
13811 improve code locality.  This is implemented by using special
13812 subsections @code{.text.hot} for most frequently executed functions and
13813 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
13814 the linker so object file format must support named sections and linker must
13815 place them in a reasonable way.
13817 This option isn't effective unless you either provide profile feedback
13818 (see @option{-fprofile-arcs} for details) or manually annotate functions with 
13819 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
13821 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13823 @opindex fstrict-aliasing
13824 @item -fstrict-aliasing
13825 Allow the compiler to assume the strictest aliasing rules applicable to
13826 the language being compiled.  For C (and C++), this activates
13827 optimizations based on the type of expressions.  In particular, an
13828 object of one type is assumed never to reside at the same address as an
13829 object of a different type, unless the types are almost the same.  For
13830 example, an @code{unsigned int} can alias an @code{int}, but not a
13831 @code{void*} or a @code{double}.  A character type may alias any other
13832 type.
13834 @anchor{Type-punning}Pay special attention to code like this:
13835 @smallexample
13836 union a_union @{
13837   int i;
13838   double d;
13841 int f() @{
13842   union a_union t;
13843   t.d = 3.0;
13844   return t.i;
13846 @end smallexample
13847 The practice of reading from a different union member than the one most
13848 recently written to (called ``type-punning'') is common.  Even with
13849 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
13850 is accessed through the union type.  So, the code above works as
13851 expected.  @xref{Structures unions enumerations and bit-fields
13852 implementation}.  However, this code might not:
13853 @smallexample
13854 int f() @{
13855   union a_union t;
13856   int* ip;
13857   t.d = 3.0;
13858   ip = &t.i;
13859   return *ip;
13861 @end smallexample
13863 Similarly, access by taking the address, casting the resulting pointer
13864 and dereferencing the result has undefined behavior, even if the cast
13865 uses a union type, e.g.:
13866 @smallexample
13867 int f() @{
13868   double d = 3.0;
13869   return ((union a_union *) &d)->i;
13871 @end smallexample
13873 The @option{-fstrict-aliasing} option is enabled at levels
13874 @option{-O2}, @option{-O3}, @option{-Os}.
13876 @opindex fipa-strict-aliasing
13877 @item -fipa-strict-aliasing
13878 Controls whether rules of @option{-fstrict-aliasing} are applied across
13879 function boundaries.  Note that if multiple functions gets inlined into a
13880 single function the memory accesses are no longer considered to be crossing a
13881 function boundary.
13883 The @option{-fipa-strict-aliasing} option is enabled by default and is
13884 effective only in combination with @option{-fstrict-aliasing}.
13886 @opindex falign-functions
13887 @item -falign-functions
13888 @itemx -falign-functions=@var{n}
13889 @itemx -falign-functions=@var{n}:@var{m}
13890 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
13891 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
13892 Align the start of functions to the next power-of-two greater than or
13893 equal to @var{n}, skipping up to @var{m}-1 bytes.  This ensures that at
13894 least the first @var{m} bytes of the function can be fetched by the CPU
13895 without crossing an @var{n}-byte alignment boundary.
13897 If @var{m} is not specified, it defaults to @var{n}.
13899 Examples: @option{-falign-functions=32} aligns functions to the next
13900 32-byte boundary, @option{-falign-functions=24} aligns to the next
13901 32-byte boundary only if this can be done by skipping 23 bytes or less,
13902 @option{-falign-functions=32:7} aligns to the next
13903 32-byte boundary only if this can be done by skipping 6 bytes or less.
13905 The second pair of @var{n2}:@var{m2} values allows you to specify
13906 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
13907 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
13908 otherwise aligns to the next 32-byte boundary if this can be done
13909 by skipping 2 bytes or less.
13910 If @var{m2} is not specified, it defaults to @var{n2}.
13912 Some assemblers only support this flag when @var{n} is a power of two;
13913 in that case, it is rounded up.
13915 @option{-fno-align-functions} and @option{-falign-functions=1} are
13916 equivalent and mean that functions are not aligned.
13918 If @var{n} is not specified or is zero, use a machine-dependent default.
13919 The maximum allowed @var{n} option value is 65536.
13921 Enabled at levels @option{-O2}, @option{-O3}.
13923 @item -flimit-function-alignment
13924 If this option is enabled, the compiler tries to avoid unnecessarily
13925 overaligning functions. It attempts to instruct the assembler to align
13926 by the amount specified by @option{-falign-functions}, but not to
13927 skip more bytes than the size of the function.
13929 @opindex falign-labels
13930 @item -falign-labels
13931 @itemx -falign-labels=@var{n}
13932 @itemx -falign-labels=@var{n}:@var{m}
13933 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
13934 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
13935 Align all branch targets to a power-of-two boundary.
13937 Parameters of this option are analogous to the @option{-falign-functions} option.
13938 @option{-fno-align-labels} and @option{-falign-labels=1} are
13939 equivalent and mean that labels are not aligned.
13941 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
13942 are greater than this value, then their values are used instead.
13944 If @var{n} is not specified or is zero, use a machine-dependent default
13945 which is very likely to be @samp{1}, meaning no alignment.
13946 The maximum allowed @var{n} option value is 65536.
13948 Enabled at levels @option{-O2}, @option{-O3}.
13950 @opindex falign-loops
13951 @item -falign-loops
13952 @itemx -falign-loops=@var{n}
13953 @itemx -falign-loops=@var{n}:@var{m}
13954 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
13955 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
13956 Align loops to a power-of-two boundary.  If the loops are executed
13957 many times, this makes up for any execution of the dummy padding
13958 instructions.
13960 If @option{-falign-labels} is greater than this value, then its value
13961 is used instead.
13963 Parameters of this option are analogous to the @option{-falign-functions} option.
13964 @option{-fno-align-loops} and @option{-falign-loops=1} are
13965 equivalent and mean that loops are not aligned.
13966 The maximum allowed @var{n} option value is 65536.
13968 If @var{n} is not specified or is zero, use a machine-dependent default.
13970 Enabled at levels @option{-O2}, @option{-O3}.
13972 @opindex falign-jumps
13973 @item -falign-jumps
13974 @itemx -falign-jumps=@var{n}
13975 @itemx -falign-jumps=@var{n}:@var{m}
13976 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
13977 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
13978 Align branch targets to a power-of-two boundary, for branch targets
13979 where the targets can only be reached by jumping.  In this case,
13980 no dummy operations need be executed.
13982 If @option{-falign-labels} is greater than this value, then its value
13983 is used instead.
13985 Parameters of this option are analogous to the @option{-falign-functions} option.
13986 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
13987 equivalent and mean that loops are not aligned.
13989 If @var{n} is not specified or is zero, use a machine-dependent default.
13990 The maximum allowed @var{n} option value is 65536.
13992 Enabled at levels @option{-O2}, @option{-O3}.
13994 @opindex fno-allocation-dce
13995 @item -fno-allocation-dce
13996 Do not remove unused C++ allocations in dead code elimination.
13998 @opindex fallow-store-data-races
13999 @item -fallow-store-data-races
14000 Allow the compiler to perform optimizations that may introduce new data races
14001 on stores, without proving that the variable cannot be concurrently accessed
14002 by other threads.  Does not affect optimization of local data.  It is safe to
14003 use this option if it is known that global data will not be accessed by
14004 multiple threads.
14006 Examples of optimizations enabled by @option{-fallow-store-data-races} include
14007 hoisting or if-conversions that may cause a value that was already in memory
14008 to be re-written with that same value.  Such re-writing is safe in a single
14009 threaded context but may be unsafe in a multi-threaded context.  Note that on
14010 some processors, if-conversions may be required in order to enable
14011 vectorization.
14013 Enabled at level @option{-Ofast}.
14015 @opindex funit-at-a-time
14016 @item -funit-at-a-time
14017 This option is left for compatibility reasons. @option{-funit-at-a-time}
14018 has no effect, while @option{-fno-unit-at-a-time} implies
14019 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
14021 Enabled by default.
14023 @opindex fno-toplevel-reorder
14024 @opindex ftoplevel-reorder
14025 @item -fno-toplevel-reorder
14026 Do not reorder top-level functions, variables, and @code{asm}
14027 statements.  Output them in the same order that they appear in the
14028 input file.  When this option is used, unreferenced static variables
14029 are not removed.  This option is intended to support existing code
14030 that relies on a particular ordering.  For new code, it is better to
14031 use attributes when possible.
14033 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
14034 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
14035 Additionally @option{-fno-toplevel-reorder} implies
14036 @option{-fno-section-anchors}.
14038 @opindex funreachable-traps
14039 @item -funreachable-traps
14040 With this option, the compiler turns calls to
14041 @code{__builtin_unreachable} into traps, instead of using them for
14042 optimization.  This also affects any such calls implicitly generated
14043 by the compiler.
14045 This option has the same effect as @option{-fsanitize=unreachable
14046 -fsanitize-trap=unreachable}, but does not affect the values of those
14047 options.  If @option{-fsanitize=unreachable} is enabled, that option
14048 takes priority over this one.
14050 This option is enabled by default at @option{-O0} and @option{-Og}.
14052 @opindex fweb
14053 @item -fweb
14054 Constructs webs as commonly used for register allocation purposes and assign
14055 each web individual pseudo register.  This allows the register allocation pass
14056 to operate on pseudos directly, but also strengthens several other optimization
14057 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
14058 however, make debugging impossible, since variables no longer stay in a
14059 ``home register''.
14061 Enabled by default with @option{-funroll-loops}.
14063 @opindex fwhole-program
14064 @item -fwhole-program
14065 Assume that the current compilation unit represents the whole program being
14066 compiled.  All public functions and variables with the exception of @code{main}
14067 and those merged by attribute @code{externally_visible} become static functions
14068 and in effect are optimized more aggressively by interprocedural optimizers.
14070 With @option{-flto} this option has a limited use.  In most cases the
14071 precise list of symbols used or exported from the binary is known the
14072 resolution info passed to the link-time optimizer by the linker plugin.  It is
14073 still useful if no linker plugin is used or during incremental link step when
14074 final code is produced (with @option{-flto}
14075 @option{-flinker-output=nolto-rel}).
14077 @opindex flto
14078 @item -flto[=@var{n}]
14079 This option runs the standard link-time optimizer.  When invoked
14080 with source code, it generates GIMPLE (one of GCC's internal
14081 representations) and writes it to special ELF sections in the object
14082 file.  When the object files are linked together, all the function
14083 bodies are read from these ELF sections and instantiated as if they
14084 had been part of the same translation unit.
14086 To use the link-time optimizer, @option{-flto} and optimization
14087 options should be specified at compile time and during the final link.
14088 It is recommended that you compile all the files participating in the
14089 same link with the same options and also specify those options at
14090 link time.  
14091 For example:
14093 @smallexample
14094 gcc -c -O2 -flto foo.c
14095 gcc -c -O2 -flto bar.c
14096 gcc -o myprog -flto -O2 foo.o bar.o
14097 @end smallexample
14099 The first two invocations to GCC save a bytecode representation
14100 of GIMPLE into special ELF sections inside @file{foo.o} and
14101 @file{bar.o}.  The final invocation reads the GIMPLE bytecode from
14102 @file{foo.o} and @file{bar.o}, merges the two files into a single
14103 internal image, and compiles the result as usual.  Since both
14104 @file{foo.o} and @file{bar.o} are merged into a single image, this
14105 causes all the interprocedural analyses and optimizations in GCC to
14106 work across the two files as if they were a single one.  This means,
14107 for example, that the inliner is able to inline functions in
14108 @file{bar.o} into functions in @file{foo.o} and vice-versa.
14110 Another (simpler) way to enable link-time optimization is:
14112 @smallexample
14113 gcc -o myprog -flto -O2 foo.c bar.c
14114 @end smallexample
14116 The above generates bytecode for @file{foo.c} and @file{bar.c},
14117 merges them together into a single GIMPLE representation and optimizes
14118 them as usual to produce @file{myprog}.
14120 The important thing to keep in mind is that to enable link-time
14121 optimizations you need to use the GCC driver to perform the link step.
14122 GCC automatically performs link-time optimization if any of the
14123 objects involved were compiled with the @option{-flto} command-line option.  
14124 You can always override
14125 the automatic decision to do link-time optimization
14126 by passing @option{-fno-lto} to the link command.
14128 To make whole program optimization effective, it is necessary to make
14129 certain whole program assumptions.  The compiler needs to know
14130 what functions and variables can be accessed by libraries and runtime
14131 outside of the link-time optimized unit.  When supported by the linker,
14132 the linker plugin (see @option{-fuse-linker-plugin}) passes information
14133 to the compiler about used and externally visible symbols.  When
14134 the linker plugin is not available, @option{-fwhole-program} should be
14135 used to allow the compiler to make these assumptions, which leads
14136 to more aggressive optimization decisions.
14138 When a file is compiled with @option{-flto} without
14139 @option{-fuse-linker-plugin}, the generated object file is larger than
14140 a regular object file because it contains GIMPLE bytecodes and the usual
14141 final code (see @option{-ffat-lto-objects}).  This means that
14142 object files with LTO information can be linked as normal object
14143 files; if @option{-fno-lto} is passed to the linker, no
14144 interprocedural optimizations are applied.  Note that when
14145 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
14146 but you cannot perform a regular, non-LTO link on them.
14148 When producing the final binary, GCC only
14149 applies link-time optimizations to those files that contain bytecode.
14150 Therefore, you can mix and match object files and libraries with
14151 GIMPLE bytecodes and final object code.  GCC automatically selects
14152 which files to optimize in LTO mode and which files to link without
14153 further processing.
14155 Generally, options specified at link time override those
14156 specified at compile time, although in some cases GCC attempts to infer
14157 link-time options from the settings used to compile the input files.
14159 If you do not specify an optimization level option @option{-O} at
14160 link time, then GCC uses the highest optimization level 
14161 used when compiling the object files.  Note that it is generally 
14162 ineffective to specify an optimization level option only at link time and 
14163 not at compile time, for two reasons.  First, compiling without 
14164 optimization suppresses compiler passes that gather information 
14165 needed for effective optimization at link time.  Second, some early
14166 optimization passes can be performed only at compile time and 
14167 not at link time.
14169 There are some code generation flags preserved by GCC when
14170 generating bytecodes, as they need to be used during the final link.
14171 Currently, the following options and their settings are taken from
14172 the first object file that explicitly specifies them: 
14173 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
14174 @option{-fgnu-tm} and all the @option{-m} target flags.
14176 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
14177 @option{-fPIE} are combined based on the following scheme:
14179 @smallexample
14180 @option{-fPIC} + @option{-fpic} = @option{-fpic}
14181 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
14182 @option{-fpic/-fPIC} + (no option) = (no option)
14183 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
14184 @option{-fpic} + @option{-fPIE} = @option{-fpie}
14185 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
14186 @end smallexample
14188 Certain ABI-changing flags are required to match in all compilation units,
14189 and trying to override this at link time with a conflicting value
14190 is ignored.  This includes options such as @option{-freg-struct-return}
14191 and @option{-fpcc-struct-return}. 
14193 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
14194 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
14195 are passed through to the link stage and merged conservatively for
14196 conflicting translation units.  Specifically
14197 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
14198 precedence; and for example @option{-ffp-contract=off} takes precedence
14199 over @option{-ffp-contract=fast}.  You can override them at link time.
14201 Diagnostic options such as @option{-Wstringop-overflow} are passed
14202 through to the link stage and their setting matches that of the
14203 compile-step at function granularity.  Note that this matters only
14204 for diagnostics emitted during optimization.  Note that code
14205 transforms such as inlining can lead to warnings being enabled
14206 or disabled for regions if code not consistent with the setting
14207 at compile time.
14209 When you need to pass options to the assembler via @option{-Wa} or
14210 @option{-Xassembler} make sure to either compile such translation
14211 units with @option{-fno-lto} or consistently use the same assembler
14212 options on all translation units.  You can alternatively also
14213 specify assembler options at LTO link time.
14215 To enable debug info generation you need to supply @option{-g} at
14216 compile time.  If any of the input files at link time were built
14217 with debug info generation enabled the link will enable debug info
14218 generation as well.  Any elaborate debug info settings
14219 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
14220 at the linker command line and mixing different settings in different
14221 translation units is discouraged.
14223 If LTO encounters objects with C linkage declared with incompatible
14224 types in separate translation units to be linked together (undefined
14225 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
14226 issued.  The behavior is still undefined at run time.  Similar
14227 diagnostics may be raised for other languages.
14229 Another feature of LTO is that it is possible to apply interprocedural
14230 optimizations on files written in different languages:
14232 @smallexample
14233 gcc -c -flto foo.c
14234 g++ -c -flto bar.cc
14235 gfortran -c -flto baz.f90
14236 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
14237 @end smallexample
14239 Notice that the final link is done with @command{g++} to get the C++
14240 runtime libraries and @option{-lgfortran} is added to get the Fortran
14241 runtime libraries.  In general, when mixing languages in LTO mode, you
14242 should use the same link command options as when mixing languages in a
14243 regular (non-LTO) compilation.
14245 If object files containing GIMPLE bytecode are stored in a library archive, say
14246 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
14247 are using a linker with plugin support.  To create static libraries suitable
14248 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
14249 and @command{ranlib}; 
14250 to show the symbols of object files with GIMPLE bytecode, use
14251 @command{gcc-nm}.  Those commands require that @command{ar}, @command{ranlib}
14252 and @command{nm} have been compiled with plugin support.  At link time, use the
14253 flag @option{-fuse-linker-plugin} to ensure that the library participates in
14254 the LTO optimization process:
14256 @smallexample
14257 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
14258 @end smallexample
14260 With the linker plugin enabled, the linker extracts the needed
14261 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
14262 to make them part of the aggregated GIMPLE image to be optimized.
14264 If you are not using a linker with plugin support and/or do not
14265 enable the linker plugin, then the objects inside @file{libfoo.a}
14266 are extracted and linked as usual, but they do not participate
14267 in the LTO optimization process.  In order to make a static library suitable
14268 for both LTO optimization and usual linkage, compile its object files with
14269 @option{-flto} @option{-ffat-lto-objects}.
14271 Link-time optimizations do not require the presence of the whole program to
14272 operate.  If the program does not require any symbols to be exported, it is
14273 possible to combine @option{-flto} and @option{-fwhole-program} to allow
14274 the interprocedural optimizers to use more aggressive assumptions which may
14275 lead to improved optimization opportunities.
14276 Use of @option{-fwhole-program} is not needed when linker plugin is
14277 active (see @option{-fuse-linker-plugin}).
14279 The current implementation of LTO makes no
14280 attempt to generate bytecode that is portable between different
14281 types of hosts.  The bytecode files are versioned and there is a
14282 strict version check, so bytecode files generated in one version of
14283 GCC do not work with an older or newer version of GCC.
14285 Link-time optimization does not work well with generation of debugging
14286 information on systems other than those using a combination of ELF and
14287 DWARF.
14289 If you specify the optional @var{n}, the optimization and code
14290 generation done at link time is executed in parallel using @var{n}
14291 parallel jobs by utilizing an installed @command{make} program.  The
14292 environment variable @env{MAKE} may be used to override the program
14293 used.
14295 You can also specify @option{-flto=jobserver} to use GNU make's
14296 job server mode to determine the number of parallel jobs. This
14297 is useful when the Makefile calling GCC is already executing in parallel.
14298 You must prepend a @samp{+} to the command recipe in the parent Makefile
14299 for this to work.  This option likely only works if @env{MAKE} is
14300 GNU make.  Even without the option value, GCC tries to automatically
14301 detect a running GNU make's job server.
14303 Use @option{-flto=auto} to use GNU make's job server, if available,
14304 or otherwise fall back to autodetection of the number of CPU threads
14305 present in your system.
14307 @opindex flto-partition
14308 @item -flto-partition=@var{alg}
14309 Specify the partitioning algorithm used by the link-time optimizer.
14310 The value is either @samp{1to1} to specify a partitioning mirroring
14311 the original source files or @samp{balanced} to specify partitioning
14312 into equally sized chunks (whenever possible) or @samp{max} to create
14313 new partition for every symbol where possible.  Specifying @samp{none}
14314 as an algorithm disables partitioning and streaming completely. 
14315 The default value is @samp{balanced}. While @samp{1to1} can be used
14316 as an workaround for various code ordering issues, the @samp{max}
14317 partitioning is intended for internal testing only.
14318 The value @samp{one} specifies that exactly one partition should be
14319 used while the value @samp{none} bypasses partitioning and executes
14320 the link-time optimization step directly from the WPA phase.
14322 @opindex flto-compression-level
14323 @item -flto-compression-level=@var{n}
14324 This option specifies the level of compression used for intermediate
14325 language written to LTO object files, and is only meaningful in
14326 conjunction with LTO mode (@option{-flto}).  GCC currently supports two
14327 LTO compression algorithms. For zstd, valid values are 0 (no compression)
14328 to 19 (maximum compression), while zlib supports values from 0 to 9.
14329 Values outside this range are clamped to either minimum or maximum
14330 of the supported values.  If the option is not given,
14331 a default balanced compression setting is used.
14333 @opindex fuse-linker-plugin
14334 @item -fuse-linker-plugin
14335 Enables the use of a linker plugin during link-time optimization.  This
14336 option relies on plugin support in the linker, which is available in gold
14337 or in GNU ld 2.21 or newer.
14339 This option enables the extraction of object files with GIMPLE bytecode out
14340 of library archives. This improves the quality of optimization by exposing
14341 more code to the link-time optimizer.  This information specifies what
14342 symbols can be accessed externally (by non-LTO object or during dynamic
14343 linking).  Resulting code quality improvements on binaries (and shared
14344 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
14345 See @option{-flto} for a description of the effect of this flag and how to
14346 use it.
14348 This option is enabled by default when LTO support in GCC is enabled
14349 and GCC was configured for use with
14350 a linker supporting plugins (GNU ld 2.21 or newer or gold).
14352 @opindex ffat-lto-objects
14353 @item -ffat-lto-objects
14354 Fat LTO objects are object files that contain both the intermediate language
14355 and the object code. This makes them usable for both LTO linking and normal
14356 linking. This option is effective only when compiling with @option{-flto}
14357 and is ignored at link time.
14359 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
14360 requires the complete toolchain to be aware of LTO. It requires a linker with
14361 linker plugin support for basic functionality.  Additionally,
14362 @command{nm}, @command{ar} and @command{ranlib}
14363 need to support linker plugins to allow a full-featured build environment
14364 (capable of building static libraries etc).  GCC provides the @command{gcc-ar},
14365 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
14366 to these tools. With non fat LTO makefiles need to be modified to use them.
14368 Note that modern binutils provide plugin auto-load mechanism.
14369 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
14370 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
14371 @command{gcc-ranlib}).
14373 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
14374 support.
14376 @opindex fcompare-elim
14377 @item -fcompare-elim
14378 After register allocation and post-register allocation instruction splitting,
14379 identify arithmetic instructions that compute processor flags similar to a
14380 comparison operation based on that arithmetic.  If possible, eliminate the
14381 explicit comparison operation.
14383 This pass only applies to certain targets that cannot explicitly represent
14384 the comparison operation before register allocation is complete.
14386 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14388 @opindex fcprop-registers
14389 @item -fcprop-registers
14390 After register allocation and post-register allocation instruction splitting,
14391 perform a copy-propagation pass to try to reduce scheduling dependencies
14392 and occasionally eliminate the copy.
14394 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14396 @opindex fprofile-correction
14397 @item -fprofile-correction
14398 Profiles collected using an instrumented binary for multi-threaded programs may
14399 be inconsistent due to missed counter updates. When this option is specified,
14400 GCC uses heuristics to correct or smooth out such inconsistencies. By
14401 default, GCC emits an error message when an inconsistent profile is detected.
14403 This option is enabled by @option{-fauto-profile}.
14405 @opindex fprofile-partial-training
14406 @item -fprofile-partial-training
14407 With @code{-fprofile-use} all portions of programs not executed during train
14408 run are optimized agressively for size rather than speed.  In some cases it is
14409 not practical to train all possible hot paths in the program. (For
14410 example, program may contain functions specific for a given hardware and
14411 trianing may not cover all hardware configurations program is run on.)  With
14412 @code{-fprofile-partial-training} profile feedback will be ignored for all
14413 functions not executed during the train run leading them to be optimized as if
14414 they were compiled without profile feedback. This leads to better performance
14415 when train run is not representative but also leads to significantly bigger
14416 code.
14418 @opindex fprofile-use
14419 @item -fprofile-use
14420 @itemx -fprofile-use=@var{path}
14421 Enable profile feedback-directed optimizations, 
14422 and the following optimizations, many of which
14423 are generally profitable only with profile feedback available:
14425 @gccoptlist{-fbranch-probabilities  -fprofile-values
14426 -funroll-loops  -fpeel-loops  -ftracer  -fvpt
14427 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp
14428 -fpredictive-commoning  -fsplit-loops  -funswitch-loops
14429 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize
14430 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns
14431 -fprofile-reorder-functions}
14433 Before you can use this option, you must first generate profiling information.
14434 @xref{Instrumentation Options}, for information about the
14435 @option{-fprofile-generate} option.
14437 By default, GCC emits an error message if the feedback profiles do not
14438 match the source code.  This error can be turned into a warning by using
14439 @option{-Wno-error=coverage-mismatch}.  Note this may result in poorly
14440 optimized code.  Additionally, by default, GCC also emits a warning message if
14441 the feedback profiles do not exist (see @option{-Wmissing-profile}).
14443 If @var{path} is specified, GCC looks at the @var{path} to find
14444 the profile feedback data files. See @option{-fprofile-dir}.
14446 @opindex fauto-profile
14447 @item -fauto-profile
14448 @itemx -fauto-profile=@var{path}
14449 Enable sampling-based feedback-directed optimizations, 
14450 and the following optimizations,
14451 many of which are generally profitable only with profile feedback available:
14453 @gccoptlist{-fbranch-probabilities  -fprofile-values
14454 -funroll-loops  -fpeel-loops  -ftracer  -fvpt
14455 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp
14456 -fpredictive-commoning  -fsplit-loops  -funswitch-loops
14457 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize
14458 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns
14459 -fprofile-correction}
14461 @var{path} is the name of a file containing AutoFDO profile information.
14462 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
14464 Producing an AutoFDO profile data file requires running your program
14465 with the @command{perf} utility on a supported GNU/Linux target system.
14466 For more information, see @uref{https://perf.wiki.kernel.org/}.
14468 E.g.
14469 @smallexample
14470 perf record -e br_inst_retired:near_taken -b -o perf.data \
14471     -- your_program
14472 @end smallexample
14474 Then use the @command{create_gcov} tool to convert the raw profile data
14475 to a format that can be used by GCC.@  You must also supply the 
14476 unstripped binary for your program to this tool.  
14477 See @uref{https://github.com/google/autofdo}.
14479 E.g.
14480 @smallexample
14481 create_gcov --binary=your_program.unstripped --profile=perf.data \
14482     --gcov=profile.afdo
14483 @end smallexample
14484 @end table
14486 The following options control compiler behavior regarding floating-point 
14487 arithmetic.  These options trade off between speed and
14488 correctness.  All must be specifically enabled.
14490 @table @gcctabopt
14491 @opindex ffloat-store
14492 @item -ffloat-store
14493 Do not store floating-point variables in registers, and inhibit other
14494 options that might change whether a floating-point value is taken from a
14495 register or memory.
14497 @cindex floating-point precision
14498 This option prevents undesirable excess precision on machines such as
14499 the 68000 where the floating registers (of the 68881) keep more
14500 precision than a @code{double} is supposed to have.  Similarly for the
14501 x86 architecture.  For most programs, the excess precision does only
14502 good, but a few programs rely on the precise definition of IEEE floating
14503 point.  Use @option{-ffloat-store} for such programs, after modifying
14504 them to store all pertinent intermediate computations into variables.
14506 @opindex fexcess-precision
14507 @item -fexcess-precision=@var{style}
14508 This option allows further control over excess precision on machines
14509 where floating-point operations occur in a format with more precision or
14510 range than the IEEE standard and interchange floating-point types.  By
14511 default, @option{-fexcess-precision=fast} is in effect; this means that
14512 operations may be carried out in a wider precision than the types specified
14513 in the source if that would result in faster code, and it is unpredictable
14514 when rounding to the types specified in the source code takes place.
14515 When compiling C or C++, if @option{-fexcess-precision=standard} is specified
14516 then excess precision follows the rules specified in ISO C99 or C++; in particular,
14517 both casts and assignments cause values to be rounded to their
14518 semantic types (whereas @option{-ffloat-store} only affects
14519 assignments).  This option is enabled by default for C or C++ if a strict
14520 conformance option such as @option{-std=c99} or @option{-std=c++17} is used.
14521 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
14522 regardless of whether a strict conformance option is used.
14524 @opindex mfpmath
14525 @option{-fexcess-precision=standard} is not implemented for languages
14526 other than C or C++.  On the x86, it has no effect if @option{-mfpmath=sse}
14527 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
14528 semantics apply without excess precision, and in the latter, rounding
14529 is unpredictable.
14531 @opindex ffast-math
14532 @item -ffast-math
14533 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
14534 @option{-ffinite-math-only}, @option{-fno-rounding-math},
14535 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
14536 @option{-fexcess-precision=fast}.
14538 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
14540 This option is not turned on by any @option{-O} option besides
14541 @option{-Ofast} since it can result in incorrect output for programs
14542 that depend on an exact implementation of IEEE or ISO rules/specifications
14543 for math functions. It may, however, yield faster code for programs
14544 that do not require the guarantees of these specifications.
14546 @opindex fno-math-errno
14547 @opindex fmath-errno
14548 @item -fno-math-errno
14549 Do not set @code{errno} after calling math functions that are executed
14550 with a single instruction, e.g., @code{sqrt}.  A program that relies on
14551 IEEE exceptions for math error handling may want to use this flag
14552 for speed while maintaining IEEE arithmetic compatibility.
14554 This option is not turned on by any @option{-O} option since
14555 it can result in incorrect output for programs that depend on
14556 an exact implementation of IEEE or ISO rules/specifications for
14557 math functions. It may, however, yield faster code for programs
14558 that do not require the guarantees of these specifications.
14560 The default is @option{-fmath-errno}.
14562 On Darwin systems, the math library never sets @code{errno}.  There is
14563 therefore no reason for the compiler to consider the possibility that
14564 it might, and @option{-fno-math-errno} is the default.
14566 @opindex funsafe-math-optimizations
14567 @item -funsafe-math-optimizations
14569 Allow optimizations for floating-point arithmetic that (a) assume
14570 that arguments and results are valid and (b) may violate IEEE or
14571 ANSI standards.  When used at link time, it may include libraries
14572 or startup files that change the default FPU control word or other
14573 similar optimizations.
14575 This option is not turned on by any @option{-O} option since
14576 it can result in incorrect output for programs that depend on
14577 an exact implementation of IEEE or ISO rules/specifications for
14578 math functions. It may, however, yield faster code for programs
14579 that do not require the guarantees of these specifications.
14580 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
14581 @option{-fassociative-math} and @option{-freciprocal-math}.
14583 The default is @option{-fno-unsafe-math-optimizations}.
14585 @opindex fassociative-math
14586 @item -fassociative-math
14588 Allow re-association of operands in series of floating-point operations.
14589 This violates the ISO C and C++ language standard by possibly changing
14590 computation result.  NOTE: re-ordering may change the sign of zero as
14591 well as ignore NaNs and inhibit or create underflow or overflow (and
14592 thus cannot be used on code that relies on rounding behavior like
14593 @code{(x + 2**52) - 2**52}.  May also reorder floating-point comparisons
14594 and thus may not be used when ordered comparisons are required.
14595 This option requires that both @option{-fno-signed-zeros} and
14596 @option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
14597 much sense with @option{-frounding-math}. For Fortran the option
14598 is automatically enabled when both @option{-fno-signed-zeros} and
14599 @option{-fno-trapping-math} are in effect.
14601 The default is @option{-fno-associative-math}.
14603 @opindex freciprocal-math
14604 @item -freciprocal-math
14606 Allow the reciprocal of a value to be used instead of dividing by
14607 the value if this enables optimizations.  For example @code{x / y}
14608 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
14609 is subject to common subexpression elimination.  Note that this loses
14610 precision and increases the number of flops operating on the value.
14612 The default is @option{-fno-reciprocal-math}.
14614 @opindex ffinite-math-only
14615 @item -ffinite-math-only
14616 Allow optimizations for floating-point arithmetic that assume
14617 that arguments and results are not NaNs or +-Infs.
14619 This option is not turned on by any @option{-O} option since
14620 it can result in incorrect output for programs that depend on
14621 an exact implementation of IEEE or ISO rules/specifications for
14622 math functions. It may, however, yield faster code for programs
14623 that do not require the guarantees of these specifications.
14625 The default is @option{-fno-finite-math-only}.
14627 @opindex fno-signed-zeros
14628 @opindex fsigned-zeros
14629 @item -fno-signed-zeros
14630 Allow optimizations for floating-point arithmetic that ignore the
14631 signedness of zero.  IEEE arithmetic specifies the behavior of
14632 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
14633 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
14634 This option implies that the sign of a zero result isn't significant.
14636 The default is @option{-fsigned-zeros}.
14638 @opindex fno-trapping-math
14639 @opindex ftrapping-math
14640 @item -fno-trapping-math
14641 Compile code assuming that floating-point operations cannot generate
14642 user-visible traps.  These traps include division by zero, overflow,
14643 underflow, inexact result and invalid operation.  This option requires
14644 that @option{-fno-signaling-nans} be in effect.  Setting this option may
14645 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
14647 This option should never be turned on by any @option{-O} option since
14648 it can result in incorrect output for programs that depend on
14649 an exact implementation of IEEE or ISO rules/specifications for
14650 math functions.
14652 The default is @option{-ftrapping-math}.
14654 Future versions of GCC may provide finer control of this setting
14655 using C99's @code{FENV_ACCESS} pragma.  This command-line option
14656 will be used along with @option{-frounding-math} to specify the
14657 default state for @code{FENV_ACCESS}.
14659 @opindex frounding-math
14660 @item -frounding-math
14661 Disable transformations and optimizations that assume default floating-point
14662 rounding behavior.  This is round-to-zero for all floating point
14663 to integer conversions, and round-to-nearest for all other arithmetic
14664 truncations.  This option should be specified for programs that change
14665 the FP rounding mode dynamically, or that may be executed with a
14666 non-default rounding mode.  This option disables constant folding of
14667 floating-point expressions at compile time (which may be affected by
14668 rounding mode) and arithmetic transformations that are unsafe in the
14669 presence of sign-dependent rounding modes.
14671 The default is @option{-fno-rounding-math}.
14673 This option is experimental and does not currently guarantee to
14674 disable all GCC optimizations that are affected by rounding mode.
14675 Future versions of GCC may provide finer control of this setting
14676 using C99's @code{FENV_ACCESS} pragma.  This command-line option
14677 will be used along with @option{-ftrapping-math} to specify the
14678 default state for @code{FENV_ACCESS}.
14680 @opindex fsignaling-nans
14681 @item -fsignaling-nans
14682 Compile code assuming that IEEE signaling NaNs may generate user-visible
14683 traps during floating-point operations.  Setting this option disables
14684 optimizations that may change the number of exceptions visible with
14685 signaling NaNs.  This option implies @option{-ftrapping-math}.
14687 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
14688 be defined.
14690 The default is @option{-fno-signaling-nans}.
14692 This option is experimental and does not currently guarantee to
14693 disable all GCC optimizations that affect signaling NaN behavior.
14695 @opindex fno-fp-int-builtin-inexact
14696 @opindex ffp-int-builtin-inexact
14697 @item -fno-fp-int-builtin-inexact
14698 Do not allow the built-in functions @code{ceil}, @code{floor},
14699 @code{round} and @code{trunc}, and their @code{float} and @code{long
14700 double} variants, to generate code that raises the ``inexact''
14701 floating-point exception for noninteger arguments.  ISO C99 and C11
14702 allow these functions to raise the ``inexact'' exception, but ISO/IEC
14703 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
14704 ISO C2X, does not allow these functions to do so.
14706 The default is @option{-ffp-int-builtin-inexact}, allowing the
14707 exception to be raised, unless C2X or a later C standard is selected.
14708 This option does nothing unless @option{-ftrapping-math} is in effect.
14710 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
14711 generate a call to a library function then the ``inexact'' exception
14712 may be raised if the library implementation does not follow TS 18661.
14714 @opindex fsingle-precision-constant
14715 @item -fsingle-precision-constant
14716 Treat floating-point constants as single precision instead of
14717 implicitly converting them to double-precision constants.
14719 @opindex fcx-limited-range
14720 @item -fcx-limited-range
14721 When enabled, this option states that a range reduction step is not
14722 needed when performing complex division.  Also, there is no checking
14723 whether the result of a complex multiplication or division is @code{NaN
14724 + I*NaN}, with an attempt to rescue the situation in that case.  The
14725 default is @option{-fno-cx-limited-range}, but is enabled by
14726 @option{-ffast-math}.
14728 This option controls the default setting of the ISO C99
14729 @code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
14730 all languages.
14732 @opindex fcx-fortran-rules
14733 @item -fcx-fortran-rules
14734 Complex multiplication and division follow Fortran rules.  Range
14735 reduction is done as part of complex division, but there is no checking
14736 whether the result of a complex multiplication or division is @code{NaN
14737 + I*NaN}, with an attempt to rescue the situation in that case.
14739 The default is @option{-fno-cx-fortran-rules}.
14741 @end table
14743 The following options control optimizations that may improve
14744 performance, but are not enabled by any @option{-O} options.  This
14745 section includes experimental options that may produce broken code.
14747 @table @gcctabopt
14748 @opindex fbranch-probabilities
14749 @item -fbranch-probabilities
14750 After running a program compiled with @option{-fprofile-arcs}
14751 (@pxref{Instrumentation Options}),
14752 you can compile it a second time using
14753 @option{-fbranch-probabilities}, to improve optimizations based on
14754 the number of times each branch was taken.  When a program
14755 compiled with @option{-fprofile-arcs} exits, it saves arc execution
14756 counts to a file called @file{@var{sourcename}.gcda} for each source
14757 file.  The information in this data file is very dependent on the
14758 structure of the generated code, so you must use the same source code
14759 and the same optimization options for both compilations.
14760 See details about the file naming in @option{-fprofile-arcs}.
14762 With @option{-fbranch-probabilities}, GCC puts a
14763 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
14764 These can be used to improve optimization.  Currently, they are only
14765 used in one place: in @file{reorg.cc}, instead of guessing which path a
14766 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
14767 exactly determine which path is taken more often.
14769 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14771 @opindex fprofile-values
14772 @item -fprofile-values
14773 If combined with @option{-fprofile-arcs}, it adds code so that some
14774 data about values of expressions in the program is gathered.
14776 With @option{-fbranch-probabilities}, it reads back the data gathered
14777 from profiling values of expressions for usage in optimizations.
14779 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
14780 @option{-fauto-profile}.
14782 @opindex fprofile-reorder-functions
14783 @item -fprofile-reorder-functions
14784 Function reordering based on profile instrumentation collects
14785 first time of execution of a function and orders these functions
14786 in ascending order.
14788 Enabled with @option{-fprofile-use}.
14790 @opindex fvpt
14791 @item -fvpt
14792 If combined with @option{-fprofile-arcs}, this option instructs the compiler
14793 to add code to gather information about values of expressions.
14795 With @option{-fbranch-probabilities}, it reads back the data gathered
14796 and actually performs the optimizations based on them.
14797 Currently the optimizations include specialization of division operations
14798 using the knowledge about the value of the denominator.
14800 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
14802 @opindex frename-registers
14803 @item -frename-registers
14804 Attempt to avoid false dependencies in scheduled code by making use
14805 of registers left over after register allocation.  This optimization
14806 most benefits processors with lots of registers.  Depending on the
14807 debug information format adopted by the target, however, it can
14808 make debugging impossible, since variables no longer stay in
14809 a ``home register''.
14811 Enabled by default with @option{-funroll-loops}.
14813 @opindex fschedule-fusion
14814 @item -fschedule-fusion
14815 Performs a target dependent pass over the instruction stream to schedule
14816 instructions of same type together because target machine can execute them
14817 more efficiently if they are adjacent to each other in the instruction flow.
14819 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14821 @opindex ftracer
14822 @item -ftracer
14823 Perform tail duplication to enlarge superblock size.  This transformation
14824 simplifies the control flow of the function allowing other optimizations to do
14825 a better job.
14827 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14829 @opindex funroll-loops
14830 @item -funroll-loops
14831 Unroll loops whose number of iterations can be determined at compile time or
14832 upon entry to the loop.  @option{-funroll-loops} implies
14833 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
14834 It also turns on complete loop peeling (i.e.@: complete removal of loops with
14835 a small constant number of iterations).  This option makes code larger, and may
14836 or may not make it run faster.
14838 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14840 @opindex funroll-all-loops
14841 @item -funroll-all-loops
14842 Unroll all loops, even if their number of iterations is uncertain when
14843 the loop is entered.  This usually makes programs run more slowly.
14844 @option{-funroll-all-loops} implies the same options as
14845 @option{-funroll-loops}.
14847 @opindex fpeel-loops
14848 @item -fpeel-loops
14849 Peels loops for which there is enough information that they do not
14850 roll much (from profile feedback or static analysis).  It also turns on
14851 complete loop peeling (i.e.@: complete removal of loops with small constant
14852 number of iterations).
14854 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
14856 @opindex fmove-loop-invariants
14857 @item -fmove-loop-invariants
14858 Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
14859 at level @option{-O1} and higher, except for @option{-Og}.
14861 @opindex fmove-loop-stores
14862 @item -fmove-loop-stores
14863 Enables the loop store motion pass in the GIMPLE loop optimizer.  This
14864 moves invariant stores to after the end of the loop in exchange for
14865 carrying the stored value in a register across the iteration.
14866 Note for this option to have an effect @option{-ftree-loop-im} has to
14867 be enabled as well.  Enabled at level @option{-O1} and higher, except
14868 for @option{-Og}.
14870 @opindex fsplit-loops
14871 @item -fsplit-loops
14872 Split a loop into two if it contains a condition that's always true
14873 for one side of the iteration space and false for the other.
14875 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14877 @opindex funswitch-loops
14878 @item -funswitch-loops
14879 Move branches with loop invariant conditions out of the loop, with duplicates
14880 of the loop on both branches (modified according to result of the condition).
14882 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14884 @opindex fversion-loops-for-strides
14885 @item -fversion-loops-for-strides
14886 If a loop iterates over an array with a variable stride, create another
14887 version of the loop that assumes the stride is always one.  For example:
14889 @smallexample
14890 for (int i = 0; i < n; ++i)
14891   x[i * stride] = @dots{};
14892 @end smallexample
14894 becomes:
14896 @smallexample
14897 if (stride == 1)
14898   for (int i = 0; i < n; ++i)
14899     x[i] = @dots{};
14900 else
14901   for (int i = 0; i < n; ++i)
14902     x[i * stride] = @dots{};
14903 @end smallexample
14905 This is particularly useful for assumed-shape arrays in Fortran where
14906 (for example) it allows better vectorization assuming contiguous accesses.
14907 This flag is enabled by default at @option{-O3}.
14908 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14910 @opindex ffunction-sections
14911 @opindex fdata-sections
14912 @item -ffunction-sections
14913 @itemx -fdata-sections
14914 Place each function or data item into its own section in the output
14915 file if the target supports arbitrary sections.  The name of the
14916 function or the name of the data item determines the section's name
14917 in the output file.
14919 Use these options on systems where the linker can perform optimizations to
14920 improve locality of reference in the instruction space.  Most systems using the
14921 ELF object format have linkers with such optimizations.  On AIX, the linker
14922 rearranges sections (CSECTs) based on the call graph.  The performance impact
14923 varies.
14925 Together with a linker garbage collection (linker @option{--gc-sections}
14926 option) these options may lead to smaller statically-linked executables (after
14927 stripping).
14929 On ELF/DWARF systems these options do not degenerate the quality of the debug
14930 information.  There could be issues with other object files/debug info formats.
14932 Only use these options when there are significant benefits from doing so.  When
14933 you specify these options, the assembler and linker create larger object and
14934 executable files and are also slower.  These options affect code generation.
14935 They prevent optimizations by the compiler and assembler using relative
14936 locations inside a translation unit since the locations are unknown until
14937 link time.  An example of such an optimization is relaxing calls to short call
14938 instructions.
14940 @opindex fstdarg-opt
14941 @item -fstdarg-opt
14942 Optimize the prologue of variadic argument functions with respect to usage of
14943 those arguments.
14945 @opindex fsection-anchors
14946 @item -fsection-anchors
14947 Try to reduce the number of symbolic address calculations by using
14948 shared ``anchor'' symbols to address nearby objects.  This transformation
14949 can help to reduce the number of GOT entries and GOT accesses on some
14950 targets.
14952 For example, the implementation of the following function @code{foo}:
14954 @smallexample
14955 static int a, b, c;
14956 int foo (void) @{ return a + b + c; @}
14957 @end smallexample
14959 @noindent
14960 usually calculates the addresses of all three variables, but if you
14961 compile it with @option{-fsection-anchors}, it accesses the variables
14962 from a common anchor point instead.  The effect is similar to the
14963 following pseudocode (which isn't valid C):
14965 @smallexample
14966 int foo (void)
14968   register int *xr = &x;
14969   return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
14971 @end smallexample
14973 Not all targets support this option.
14975 @opindex fzero-call-used-regs
14976 @item -fzero-call-used-regs=@var{choice}
14977 Zero call-used registers at function return to increase program
14978 security by either mitigating Return-Oriented Programming (ROP)
14979 attacks or preventing information leakage through registers.
14981 The possible values of @var{choice} are the same as for the
14982 @code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
14983 The default is @samp{skip}.
14985 You can control this behavior for a specific function by using the function
14986 attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
14988 @opindex param
14989 @item --param @var{name}=@var{value}
14990 In some places, GCC uses various constants to control the amount of
14991 optimization that is done.  For example, GCC does not inline functions
14992 that contain more than a certain number of instructions.  You can
14993 control some of these constants on the command line using the
14994 @option{--param} option.
14996 The names of specific parameters, and the meaning of the values, are
14997 tied to the internals of the compiler, and are subject to change
14998 without notice in future releases.
15000 In order to get the minimal, maximal and default values of a parameter,
15001 use the @option{--help=param -Q} options.
15003 In each case, the @var{value} is an integer.  The following choices
15004 of @var{name} are recognized for all targets:
15006 @table @gcctabopt
15007 @item predictable-branch-outcome
15008 When branch is predicted to be taken with probability lower than this threshold
15009 (in percent), then it is considered well predictable.
15011 @item max-rtl-if-conversion-insns
15012 RTL if-conversion tries to remove conditional branches around a block and
15013 replace them with conditionally executed instructions.  This parameter
15014 gives the maximum number of instructions in a block which should be
15015 considered for if-conversion.  The compiler will
15016 also use other heuristics to decide whether if-conversion is likely to be
15017 profitable.
15019 @item max-rtl-if-conversion-predictable-cost
15020 RTL if-conversion will try to remove conditional branches around a block
15021 and replace them with conditionally executed instructions.  These parameters
15022 give the maximum permissible cost for the sequence that would be generated
15023 by if-conversion depending on whether the branch is statically determined
15024 to be predictable or not.  The units for this parameter are the same as
15025 those for the GCC internal seq_cost metric.  The compiler will try to
15026 provide a reasonable default for this parameter using the BRANCH_COST
15027 target macro.
15029 @item max-crossjump-edges
15030 The maximum number of incoming edges to consider for cross-jumping.
15031 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
15032 the number of edges incoming to each block.  Increasing values mean
15033 more aggressive optimization, making the compilation time increase with
15034 probably small improvement in executable size.
15036 @item min-crossjump-insns
15037 The minimum number of instructions that must be matched at the end
15038 of two blocks before cross-jumping is performed on them.  This
15039 value is ignored in the case where all instructions in the block being
15040 cross-jumped from are matched.
15042 @item max-grow-copy-bb-insns
15043 The maximum code size expansion factor when copying basic blocks
15044 instead of jumping.  The expansion is relative to a jump instruction.
15046 @item max-goto-duplication-insns
15047 The maximum number of instructions to duplicate to a block that jumps
15048 to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
15049 passes, GCC factors computed gotos early in the compilation process,
15050 and unfactors them as late as possible.  Only computed jumps at the
15051 end of a basic blocks with no more than max-goto-duplication-insns are
15052 unfactored.
15054 @item max-delay-slot-insn-search
15055 The maximum number of instructions to consider when looking for an
15056 instruction to fill a delay slot.  If more than this arbitrary number of
15057 instructions are searched, the time savings from filling the delay slot
15058 are minimal, so stop searching.  Increasing values mean more
15059 aggressive optimization, making the compilation time increase with probably
15060 small improvement in execution time.
15062 @item max-delay-slot-live-search
15063 When trying to fill delay slots, the maximum number of instructions to
15064 consider when searching for a block with valid live register
15065 information.  Increasing this arbitrarily chosen value means more
15066 aggressive optimization, increasing the compilation time.  This parameter
15067 should be removed when the delay slot code is rewritten to maintain the
15068 control-flow graph.
15070 @item max-gcse-memory
15071 The approximate maximum amount of memory in @code{kB} that can be allocated in
15072 order to perform the global common subexpression elimination
15073 optimization.  If more memory than specified is required, the
15074 optimization is not done.
15076 @item max-gcse-insertion-ratio
15077 If the ratio of expression insertions to deletions is larger than this value
15078 for any expression, then RTL PRE inserts or removes the expression and thus
15079 leaves partially redundant computations in the instruction stream.
15081 @item max-pending-list-length
15082 The maximum number of pending dependencies scheduling allows
15083 before flushing the current state and starting over.  Large functions
15084 with few branches or calls can create excessively large lists which
15085 needlessly consume memory and resources.
15087 @item max-modulo-backtrack-attempts
15088 The maximum number of backtrack attempts the scheduler should make
15089 when modulo scheduling a loop.  Larger values can exponentially increase
15090 compilation time.
15092 @item max-inline-functions-called-once-loop-depth
15093 Maximal loop depth of a call considered by inline heuristics that tries to
15094 inline all functions called once.
15096 @item max-inline-functions-called-once-insns
15097 Maximal estimated size of functions produced while inlining functions called
15098 once.
15100 @item max-inline-insns-single
15101 Several parameters control the tree inliner used in GCC@.  This number sets the
15102 maximum number of instructions (counted in GCC's internal representation) in a
15103 single function that the tree inliner considers for inlining.  This only
15104 affects functions declared inline and methods implemented in a class
15105 declaration (C++). 
15108 @item max-inline-insns-auto
15109 When you use @option{-finline-functions} (included in @option{-O3}),
15110 a lot of functions that would otherwise not be considered for inlining
15111 by the compiler are investigated.  To those functions, a different
15112 (more restrictive) limit compared to functions declared inline can
15113 be applied (@option{--param max-inline-insns-auto}).
15115 @item max-inline-insns-small
15116 This is bound applied to calls which are considered relevant with
15117 @option{-finline-small-functions}.
15119 @item max-inline-insns-size
15120 This is bound applied to calls which are optimized for size. Small growth
15121 may be desirable to anticipate optimization oppurtunities exposed by inlining.
15123 @item uninlined-function-insns
15124 Number of instructions accounted by inliner for function overhead such as
15125 function prologue and epilogue.
15127 @item uninlined-function-time
15128 Extra time accounted by inliner for function overhead such as time needed to
15129 execute function prologue and epilogue.
15131 @item inline-heuristics-hint-percent
15132 The scale (in percents) applied to @option{inline-insns-single},
15133 @option{inline-insns-single-O2}, @option{inline-insns-auto}
15134 when inline heuristics hints that inlining is
15135 very profitable (will enable later optimizations).
15137 @item uninlined-thunk-insns
15138 @item uninlined-thunk-time
15139 Same as @option{--param uninlined-function-insns} and
15140 @option{--param uninlined-function-time} but applied to function thunks.
15142 @item inline-min-speedup
15143 When estimated performance improvement of caller + callee runtime exceeds this
15144 threshold (in percent), the function can be inlined regardless of the limit on
15145 @option{--param max-inline-insns-single} and @option{--param
15146 max-inline-insns-auto}.
15148 @item large-function-insns
15149 The limit specifying really large functions.  For functions larger than this
15150 limit after inlining, inlining is constrained by
15151 @option{--param large-function-growth}.  This parameter is useful primarily
15152 to avoid extreme compilation time caused by non-linear algorithms used by the
15153 back end.
15155 @item large-function-growth
15156 Specifies maximal growth of large function caused by inlining in percents.
15157 For example, parameter value 100 limits large function growth to 2.0 times
15158 the original size.
15160 @item large-unit-insns
15161 The limit specifying large translation unit.  Growth caused by inlining of
15162 units larger than this limit is limited by @option{--param inline-unit-growth}.
15163 For small units this might be too tight.
15164 For example, consider a unit consisting of function A
15165 that is inline and B that just calls A three times.  If B is small relative to
15166 A, the growth of unit is 300\% and yet such inlining is very sane.  For very
15167 large units consisting of small inlineable functions, however, the overall unit
15168 growth limit is needed to avoid exponential explosion of code size.  Thus for
15169 smaller units, the size is increased to @option{--param large-unit-insns}
15170 before applying @option{--param inline-unit-growth}.
15172 @item lazy-modules
15173 Maximum number of concurrently open C++ module files when lazy loading.
15175 @item inline-unit-growth
15176 Specifies maximal overall growth of the compilation unit caused by inlining.
15177 For example, parameter value 20 limits unit growth to 1.2 times the original
15178 size. Cold functions (either marked cold via an attribute or by profile
15179 feedback) are not accounted into the unit size.
15181 @item ipa-cp-unit-growth
15182 Specifies maximal overall growth of the compilation unit caused by
15183 interprocedural constant propagation.  For example, parameter value 10 limits
15184 unit growth to 1.1 times the original size.
15186 @item ipa-cp-large-unit-insns
15187 The size of translation unit that IPA-CP pass considers large.
15189 @item large-stack-frame
15190 The limit specifying large stack frames.  While inlining the algorithm is trying
15191 to not grow past this limit too much.
15193 @item large-stack-frame-growth
15194 Specifies maximal growth of large stack frames caused by inlining in percents.
15195 For example, parameter value 1000 limits large stack frame growth to 11 times
15196 the original size.
15198 @item max-inline-insns-recursive
15199 @itemx max-inline-insns-recursive-auto
15200 Specifies the maximum number of instructions an out-of-line copy of a
15201 self-recursive inline
15202 function can grow into by performing recursive inlining.
15204 @option{--param max-inline-insns-recursive} applies to functions
15205 declared inline.
15206 For functions not declared inline, recursive inlining
15207 happens only when @option{-finline-functions} (included in @option{-O3}) is
15208 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
15210 @item max-inline-recursive-depth
15211 @itemx max-inline-recursive-depth-auto
15212 Specifies the maximum recursion depth used for recursive inlining.
15214 @option{--param max-inline-recursive-depth} applies to functions
15215 declared inline.  For functions not declared inline, recursive inlining
15216 happens only when @option{-finline-functions} (included in @option{-O3}) is
15217 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
15219 @item min-inline-recursive-probability
15220 Recursive inlining is profitable only for function having deep recursion
15221 in average and can hurt for function having little recursion depth by
15222 increasing the prologue size or complexity of function body to other
15223 optimizers.
15225 When profile feedback is available (see @option{-fprofile-generate}) the actual
15226 recursion depth can be guessed from the probability that function recurses
15227 via a given call expression.  This parameter limits inlining only to call
15228 expressions whose probability exceeds the given threshold (in percents).
15230 @item early-inlining-insns
15231 Specify growth that the early inliner can make.  In effect it increases
15232 the amount of inlining for code having a large abstraction penalty.
15234 @item max-early-inliner-iterations
15235 Limit of iterations of the early inliner.  This basically bounds
15236 the number of nested indirect calls the early inliner can resolve.
15237 Deeper chains are still handled by late inlining.
15239 @item comdat-sharing-probability
15240 Probability (in percent) that C++ inline function with comdat visibility
15241 are shared across multiple compilation units.
15243 @item modref-max-bases
15244 @item modref-max-refs
15245 @item modref-max-accesses
15246 Specifies the maximal number of base pointers, references and accesses stored
15247 for a single function by mod/ref analysis.
15249 @item modref-max-tests
15250 Specifies the maxmal number of tests alias oracle can perform to disambiguate
15251 memory locations using the mod/ref information.  This parameter ought to be
15252 bigger than @option{--param modref-max-bases} and @option{--param
15253 modref-max-refs}.
15255 @item modref-max-depth
15256 Specifies the maximum depth of DFS walk used by modref escape analysis.
15257 Setting to 0 disables the analysis completely.
15259 @item modref-max-escape-points
15260 Specifies the maximum number of escape points tracked by modref per SSA-name.
15262 @item modref-max-adjustments
15263 Specifies the maximum number the access range is enlarged during modref dataflow
15264 analysis.
15266 @item profile-func-internal-id
15267 A parameter to control whether to use function internal id in profile
15268 database lookup. If the value is 0, the compiler uses an id that
15269 is based on function assembler name and filename, which makes old profile
15270 data more tolerant to source changes such as function reordering etc.
15272 @item min-vect-loop-bound
15273 The minimum number of iterations under which loops are not vectorized
15274 when @option{-ftree-vectorize} is used.  The number of iterations after
15275 vectorization needs to be greater than the value specified by this option
15276 to allow vectorization.
15278 @item gcse-cost-distance-ratio
15279 Scaling factor in calculation of maximum distance an expression
15280 can be moved by GCSE optimizations.  This is currently supported only in the
15281 code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
15282 is with simple expressions, i.e., the expressions that have cost
15283 less than @option{gcse-unrestricted-cost}.  Specifying 0 disables
15284 hoisting of simple expressions.
15286 @item gcse-unrestricted-cost
15287 Cost, roughly measured as the cost of a single typical machine
15288 instruction, at which GCSE optimizations do not constrain
15289 the distance an expression can travel.  This is currently
15290 supported only in the code hoisting pass.  The lesser the cost,
15291 the more aggressive code hoisting is.  Specifying 0 
15292 allows all expressions to travel unrestricted distances.
15294 @item max-hoist-depth
15295 The depth of search in the dominator tree for expressions to hoist.
15296 This is used to avoid quadratic behavior in hoisting algorithm.
15297 The value of 0 does not limit on the search, but may slow down compilation
15298 of huge functions.
15300 @item max-tail-merge-comparisons
15301 The maximum amount of similar bbs to compare a bb with.  This is used to
15302 avoid quadratic behavior in tree tail merging.
15304 @item max-tail-merge-iterations
15305 The maximum amount of iterations of the pass over the function.  This is used to
15306 limit compilation time in tree tail merging.
15308 @item store-merging-allow-unaligned
15309 Allow the store merging pass to introduce unaligned stores if it is legal to
15310 do so.
15312 @item max-stores-to-merge
15313 The maximum number of stores to attempt to merge into wider stores in the store
15314 merging pass.
15316 @item max-store-chains-to-track
15317 The maximum number of store chains to track at the same time in the attempt
15318 to merge them into wider stores in the store merging pass.
15320 @item max-stores-to-track
15321 The maximum number of stores to track at the same time in the attemt to
15322 to merge them into wider stores in the store merging pass.
15324 @item max-unrolled-insns
15325 The maximum number of instructions that a loop may have to be unrolled.
15326 If a loop is unrolled, this parameter also determines how many times
15327 the loop code is unrolled.
15329 @item max-average-unrolled-insns
15330 The maximum number of instructions biased by probabilities of their execution
15331 that a loop may have to be unrolled.  If a loop is unrolled,
15332 this parameter also determines how many times the loop code is unrolled.
15334 @item max-unroll-times
15335 The maximum number of unrollings of a single loop.
15337 @item max-peeled-insns
15338 The maximum number of instructions that a loop may have to be peeled.
15339 If a loop is peeled, this parameter also determines how many times
15340 the loop code is peeled.
15342 @item max-peel-times
15343 The maximum number of peelings of a single loop.
15345 @item max-peel-branches
15346 The maximum number of branches on the hot path through the peeled sequence.
15348 @item max-completely-peeled-insns
15349 The maximum number of insns of a completely peeled loop.
15351 @item max-completely-peel-times
15352 The maximum number of iterations of a loop to be suitable for complete peeling.
15354 @item max-completely-peel-loop-nest-depth
15355 The maximum depth of a loop nest suitable for complete peeling.
15357 @item max-unswitch-insns
15358 The maximum number of insns of an unswitched loop.
15360 @item max-unswitch-depth
15361 The maximum depth of a loop nest to be unswitched.
15363 @item lim-expensive
15364 The minimum cost of an expensive expression in the loop invariant motion.
15366 @item min-loop-cond-split-prob
15367 When FDO profile information is available, @option{min-loop-cond-split-prob}
15368 specifies minimum threshold for probability of semi-invariant condition
15369 statement to trigger loop split.
15371 @item iv-consider-all-candidates-bound
15372 Bound on number of candidates for induction variables, below which
15373 all candidates are considered for each use in induction variable
15374 optimizations.  If there are more candidates than this,
15375 only the most relevant ones are considered to avoid quadratic time complexity.
15377 @item iv-max-considered-uses
15378 The induction variable optimizations give up on loops that contain more
15379 induction variable uses.
15381 @item iv-always-prune-cand-set-bound
15382 If the number of candidates in the set is smaller than this value,
15383 always try to remove unnecessary ivs from the set
15384 when adding a new one.
15386 @item avg-loop-niter
15387 Average number of iterations of a loop.
15389 @item dse-max-object-size
15390 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
15391 Larger values may result in larger compilation times.
15393 @item dse-max-alias-queries-per-store
15394 Maximum number of queries into the alias oracle per store.
15395 Larger values result in larger compilation times and may result in more
15396 removed dead stores.
15398 @item scev-max-expr-size
15399 Bound on size of expressions used in the scalar evolutions analyzer.
15400 Large expressions slow the analyzer.
15402 @item scev-max-expr-complexity
15403 Bound on the complexity of the expressions in the scalar evolutions analyzer.
15404 Complex expressions slow the analyzer.
15406 @item max-tree-if-conversion-phi-args
15407 Maximum number of arguments in a PHI supported by TREE if conversion
15408 unless the loop is marked with simd pragma.
15410 @item vect-max-layout-candidates
15411 The maximum number of possible vector layouts (such as permutations)
15412 to consider when optimizing to-be-vectorized code.
15414 @item vect-max-version-for-alignment-checks
15415 The maximum number of run-time checks that can be performed when
15416 doing loop versioning for alignment in the vectorizer.
15418 @item vect-max-version-for-alias-checks
15419 The maximum number of run-time checks that can be performed when
15420 doing loop versioning for alias in the vectorizer.
15422 @item vect-max-peeling-for-alignment
15423 The maximum number of loop peels to enhance access alignment
15424 for vectorizer. Value -1 means no limit.
15426 @item max-iterations-to-track
15427 The maximum number of iterations of a loop the brute-force algorithm
15428 for analysis of the number of iterations of the loop tries to evaluate.
15430 @item hot-bb-count-fraction
15431 The denominator n of fraction 1/n of the maximal execution count of a
15432 basic block in the entire program that a basic block needs to at least
15433 have in order to be considered hot.  The default is 10000, which means
15434 that a basic block is considered hot if its execution count is greater
15435 than 1/10000 of the maximal execution count.  0 means that it is never
15436 considered hot.  Used in non-LTO mode.
15438 @item hot-bb-count-ws-permille
15439 The number of most executed permilles, ranging from 0 to 1000, of the
15440 profiled execution of the entire program to which the execution count
15441 of a basic block must be part of in order to be considered hot.  The
15442 default is 990, which means that a basic block is considered hot if
15443 its execution count contributes to the upper 990 permilles, or 99.0%,
15444 of the profiled execution of the entire program.  0 means that it is
15445 never considered hot.  Used in LTO mode.
15447 @item hot-bb-frequency-fraction
15448 The denominator n of fraction 1/n of the execution frequency of the
15449 entry block of a function that a basic block of this function needs
15450 to at least have in order to be considered hot.  The default is 1000,
15451 which means that a basic block is considered hot in a function if it
15452 is executed more frequently than 1/1000 of the frequency of the entry
15453 block of the function.  0 means that it is never considered hot.
15455 @item unlikely-bb-count-fraction
15456 The denominator n of fraction 1/n of the number of profiled runs of
15457 the entire program below which the execution count of a basic block
15458 must be in order for the basic block to be considered unlikely executed.
15459 The default is 20, which means that a basic block is considered unlikely
15460 executed if it is executed in fewer than 1/20, or 5%, of the runs of
15461 the program.  0 means that it is always considered unlikely executed.
15463 @item max-predicted-iterations
15464 The maximum number of loop iterations we predict statically.  This is useful
15465 in cases where a function contains a single loop with known bound and
15466 another loop with unknown bound.
15467 The known number of iterations is predicted correctly, while
15468 the unknown number of iterations average to roughly 10.  This means that the
15469 loop without bounds appears artificially cold relative to the other one.
15471 @item builtin-expect-probability
15472 Control the probability of the expression having the specified value. This
15473 parameter takes a percentage (i.e.@: 0 ... 100) as input.
15475 @item builtin-string-cmp-inline-length
15476 The maximum length of a constant string for a builtin string cmp call 
15477 eligible for inlining.
15479 @item align-threshold
15481 Select fraction of the maximal frequency of executions of a basic block in
15482 a function to align the basic block.
15484 @item align-loop-iterations
15486 A loop expected to iterate at least the selected number of iterations is
15487 aligned.
15489 @item tracer-dynamic-coverage
15490 @itemx tracer-dynamic-coverage-feedback
15492 This value is used to limit superblock formation once the given percentage of
15493 executed instructions is covered.  This limits unnecessary code size
15494 expansion.
15496 The @option{tracer-dynamic-coverage-feedback} parameter
15497 is used only when profile
15498 feedback is available.  The real profiles (as opposed to statically estimated
15499 ones) are much less balanced allowing the threshold to be larger value.
15501 @item tracer-max-code-growth
15502 Stop tail duplication once code growth has reached given percentage.  This is
15503 a rather artificial limit, as most of the duplicates are eliminated later in
15504 cross jumping, so it may be set to much higher values than is the desired code
15505 growth.
15507 @item tracer-min-branch-ratio
15509 Stop reverse growth when the reverse probability of best edge is less than this
15510 threshold (in percent).
15512 @item tracer-min-branch-probability
15513 @itemx tracer-min-branch-probability-feedback
15515 Stop forward growth if the best edge has probability lower than this
15516 threshold.
15518 Similarly to @option{tracer-dynamic-coverage} two parameters are
15519 provided.  @option{tracer-min-branch-probability-feedback} is used for
15520 compilation with profile feedback and @option{tracer-min-branch-probability}
15521 compilation without.  The value for compilation with profile feedback
15522 needs to be more conservative (higher) in order to make tracer
15523 effective.
15525 @item stack-clash-protection-guard-size
15526 Specify the size of the operating system provided stack guard as
15527 2 raised to @var{num} bytes.  Higher values may reduce the
15528 number of explicit probes, but a value larger than the operating system
15529 provided guard will leave code vulnerable to stack clash style attacks.
15531 @item stack-clash-protection-probe-interval
15532 Stack clash protection involves probing stack space as it is allocated.  This
15533 param controls the maximum distance between probes into the stack as 2 raised
15534 to @var{num} bytes.  Higher values may reduce the number of explicit probes, but a value
15535 larger than the operating system provided guard will leave code vulnerable to
15536 stack clash style attacks.
15538 @item max-cse-path-length
15540 The maximum number of basic blocks on path that CSE considers.
15542 @item max-cse-insns
15543 The maximum number of instructions CSE processes before flushing.
15545 @item ggc-min-expand
15547 GCC uses a garbage collector to manage its own memory allocation.  This
15548 parameter specifies the minimum percentage by which the garbage
15549 collector's heap should be allowed to expand between collections.
15550 Tuning this may improve compilation speed; it has no effect on code
15551 generation.
15553 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
15554 RAM >= 1GB@.  If @code{getrlimit} is available, the notion of ``RAM'' is
15555 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
15556 GCC is not able to calculate RAM on a particular platform, the lower
15557 bound of 30% is used.  Setting this parameter and
15558 @option{ggc-min-heapsize} to zero causes a full collection to occur at
15559 every opportunity.  This is extremely slow, but can be useful for
15560 debugging.
15562 @item ggc-min-heapsize
15564 Minimum size of the garbage collector's heap before it begins bothering
15565 to collect garbage.  The first collection occurs after the heap expands
15566 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
15567 tuning this may improve compilation speed, and has no effect on code
15568 generation.
15570 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
15571 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
15572 with a lower bound of 4096 (four megabytes) and an upper bound of
15573 131072 (128 megabytes).  If GCC is not able to calculate RAM on a
15574 particular platform, the lower bound is used.  Setting this parameter
15575 very large effectively disables garbage collection.  Setting this
15576 parameter and @option{ggc-min-expand} to zero causes a full collection
15577 to occur at every opportunity.
15579 @item max-reload-search-insns
15580 The maximum number of instruction reload should look backward for equivalent
15581 register.  Increasing values mean more aggressive optimization, making the
15582 compilation time increase with probably slightly better performance.
15584 @item max-cselib-memory-locations
15585 The maximum number of memory locations cselib should take into account.
15586 Increasing values mean more aggressive optimization, making the compilation time
15587 increase with probably slightly better performance.
15589 @item max-sched-ready-insns
15590 The maximum number of instructions ready to be issued the scheduler should
15591 consider at any given time during the first scheduling pass.  Increasing
15592 values mean more thorough searches, making the compilation time increase
15593 with probably little benefit.
15595 @item max-sched-region-blocks
15596 The maximum number of blocks in a region to be considered for
15597 interblock scheduling.
15599 @item max-pipeline-region-blocks
15600 The maximum number of blocks in a region to be considered for
15601 pipelining in the selective scheduler.
15603 @item max-sched-region-insns
15604 The maximum number of insns in a region to be considered for
15605 interblock scheduling.
15607 @item max-pipeline-region-insns
15608 The maximum number of insns in a region to be considered for
15609 pipelining in the selective scheduler.
15611 @item min-spec-prob
15612 The minimum probability (in percents) of reaching a source block
15613 for interblock speculative scheduling.
15615 @item max-sched-extend-regions-iters
15616 The maximum number of iterations through CFG to extend regions.
15617 A value of 0 disables region extensions.
15619 @item max-sched-insn-conflict-delay
15620 The maximum conflict delay for an insn to be considered for speculative motion.
15622 @item sched-spec-prob-cutoff
15623 The minimal probability of speculation success (in percents), so that
15624 speculative insns are scheduled.
15626 @item sched-state-edge-prob-cutoff
15627 The minimum probability an edge must have for the scheduler to save its
15628 state across it.
15630 @item sched-mem-true-dep-cost
15631 Minimal distance (in CPU cycles) between store and load targeting same
15632 memory locations.
15634 @item selsched-max-lookahead
15635 The maximum size of the lookahead window of selective scheduling.  It is a
15636 depth of search for available instructions.
15638 @item selsched-max-sched-times
15639 The maximum number of times that an instruction is scheduled during
15640 selective scheduling.  This is the limit on the number of iterations
15641 through which the instruction may be pipelined.
15643 @item selsched-insns-to-rename
15644 The maximum number of best instructions in the ready list that are considered
15645 for renaming in the selective scheduler.
15647 @item sms-min-sc
15648 The minimum value of stage count that swing modulo scheduler
15649 generates.
15651 @item max-last-value-rtl
15652 The maximum size measured as number of RTLs that can be recorded in an expression
15653 in combiner for a pseudo register as last known value of that register.
15655 @item max-combine-insns
15656 The maximum number of instructions the RTL combiner tries to combine.
15658 @item integer-share-limit
15659 Small integer constants can use a shared data structure, reducing the
15660 compiler's memory usage and increasing its speed.  This sets the maximum
15661 value of a shared integer constant.
15663 @item ssp-buffer-size
15664 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
15665 protection when @option{-fstack-protector} is used.
15667 @item min-size-for-stack-sharing
15668 The minimum size of variables taking part in stack slot sharing when not
15669 optimizing.
15671 @item max-jump-thread-duplication-stmts
15672 Maximum number of statements allowed in a block that needs to be
15673 duplicated when threading jumps.
15675 @item max-jump-thread-paths
15676 The maximum number of paths to consider when searching for jump threading
15677 opportunities.  When arriving at a block, incoming edges are only considered
15678 if the number of paths to be searched so far multiplied by the number of
15679 incoming edges does not exhaust the specified maximum number of paths to
15680 consider.
15682 @item max-fields-for-field-sensitive
15683 Maximum number of fields in a structure treated in
15684 a field sensitive manner during pointer analysis.
15686 @item prefetch-latency
15687 Estimate on average number of instructions that are executed before
15688 prefetch finishes.  The distance prefetched ahead is proportional
15689 to this constant.  Increasing this number may also lead to less
15690 streams being prefetched (see @option{simultaneous-prefetches}).
15692 @item simultaneous-prefetches
15693 Maximum number of prefetches that can run at the same time.
15695 @item l1-cache-line-size
15696 The size of cache line in L1 data cache, in bytes.
15698 @item l1-cache-size
15699 The size of L1 data cache, in kilobytes.
15701 @item l2-cache-size
15702 The size of L2 data cache, in kilobytes.
15704 @item prefetch-dynamic-strides
15705 Whether the loop array prefetch pass should issue software prefetch hints
15706 for strides that are non-constant.  In some cases this may be
15707 beneficial, though the fact the stride is non-constant may make it
15708 hard to predict when there is clear benefit to issuing these hints.
15710 Set to 1 if the prefetch hints should be issued for non-constant
15711 strides.  Set to 0 if prefetch hints should be issued only for strides that
15712 are known to be constant and below @option{prefetch-minimum-stride}.
15714 @item prefetch-minimum-stride
15715 Minimum constant stride, in bytes, to start using prefetch hints for.  If
15716 the stride is less than this threshold, prefetch hints will not be issued.
15718 This setting is useful for processors that have hardware prefetchers, in
15719 which case there may be conflicts between the hardware prefetchers and
15720 the software prefetchers.  If the hardware prefetchers have a maximum
15721 stride they can handle, it should be used here to improve the use of
15722 software prefetchers.
15724 A value of -1 means we don't have a threshold and therefore
15725 prefetch hints can be issued for any constant stride.
15727 This setting is only useful for strides that are known and constant.
15729 @item destructive-interference-size
15730 @item constructive-interference-size
15731 The values for the C++17 variables
15732 @code{std::hardware_destructive_interference_size} and
15733 @code{std::hardware_constructive_interference_size}.  The destructive
15734 interference size is the minimum recommended offset between two
15735 independent concurrently-accessed objects; the constructive
15736 interference size is the maximum recommended size of contiguous memory
15737 accessed together.  Typically both will be the size of an L1 cache
15738 line for the target, in bytes.  For a generic target covering a range of L1
15739 cache line sizes, typically the constructive interference size will be
15740 the small end of the range and the destructive size will be the large
15741 end.
15743 The destructive interference size is intended to be used for layout,
15744 and thus has ABI impact.  The default value is not expected to be
15745 stable, and on some targets varies with @option{-mtune}, so use of
15746 this variable in a context where ABI stability is important, such as
15747 the public interface of a library, is strongly discouraged; if it is
15748 used in that context, users can stabilize the value using this
15749 option.
15751 The constructive interference size is less sensitive, as it is
15752 typically only used in a @samp{static_assert} to make sure that a type
15753 fits within a cache line.
15755 See also @option{-Winterference-size}.
15757 @item loop-interchange-max-num-stmts
15758 The maximum number of stmts in a loop to be interchanged.
15760 @item loop-interchange-stride-ratio
15761 The minimum ratio between stride of two loops for interchange to be profitable.
15763 @item min-insn-to-prefetch-ratio
15764 The minimum ratio between the number of instructions and the
15765 number of prefetches to enable prefetching in a loop.
15767 @item prefetch-min-insn-to-mem-ratio
15768 The minimum ratio between the number of instructions and the
15769 number of memory references to enable prefetching in a loop.
15771 @item use-canonical-types
15772 Whether the compiler should use the ``canonical'' type system.
15773 Should always be 1, which uses a more efficient internal
15774 mechanism for comparing types in C++ and Objective-C++.  However, if
15775 bugs in the canonical type system are causing compilation failures,
15776 set this value to 0 to disable canonical types.
15778 @item switch-conversion-max-branch-ratio
15779 Switch initialization conversion refuses to create arrays that are
15780 bigger than @option{switch-conversion-max-branch-ratio} times the number of
15781 branches in the switch.
15783 @item max-partial-antic-length
15784 Maximum length of the partial antic set computed during the tree
15785 partial redundancy elimination optimization (@option{-ftree-pre}) when
15786 optimizing at @option{-O3} and above.  For some sorts of source code
15787 the enhanced partial redundancy elimination optimization can run away,
15788 consuming all of the memory available on the host machine.  This
15789 parameter sets a limit on the length of the sets that are computed,
15790 which prevents the runaway behavior.  Setting a value of 0 for
15791 this parameter allows an unlimited set length.
15793 @item rpo-vn-max-loop-depth
15794 Maximum loop depth that is value-numbered optimistically.
15795 When the limit hits the innermost
15796 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
15797 loop nest are value-numbered optimistically and the remaining ones not.
15799 @item sccvn-max-alias-queries-per-access
15800 Maximum number of alias-oracle queries we perform when looking for
15801 redundancies for loads and stores.  If this limit is hit the search
15802 is aborted and the load or store is not considered redundant.  The
15803 number of queries is algorithmically limited to the number of
15804 stores on all paths from the load to the function entry.
15806 @item ira-max-loops-num
15807 IRA uses regional register allocation by default.  If a function
15808 contains more loops than the number given by this parameter, only at most
15809 the given number of the most frequently-executed loops form regions
15810 for regional register allocation.
15812 @item ira-max-conflict-table-size 
15813 Although IRA uses a sophisticated algorithm to compress the conflict
15814 table, the table can still require excessive amounts of memory for
15815 huge functions.  If the conflict table for a function could be more
15816 than the size in MB given by this parameter, the register allocator
15817 instead uses a faster, simpler, and lower-quality
15818 algorithm that does not require building a pseudo-register conflict table.  
15820 @item ira-loop-reserved-regs
15821 IRA can be used to evaluate more accurate register pressure in loops
15822 for decisions to move loop invariants (see @option{-O3}).  The number
15823 of available registers reserved for some other purposes is given
15824 by this parameter.  Default of the parameter
15825 is the best found from numerous experiments.
15827 @item ira-consider-dup-in-all-alts
15828 Make IRA to consider matching constraint (duplicated operand number)
15829 heavily in all available alternatives for preferred register class.
15830 If it is set as zero, it means IRA only respects the matching
15831 constraint when it's in the only available alternative with an
15832 appropriate register class.  Otherwise, it means IRA will check all
15833 available alternatives for preferred register class even if it has
15834 found some choice with an appropriate register class and respect the
15835 found qualified matching constraint.
15837 @item ira-simple-lra-insn-threshold
15838 Approximate function insn number in 1K units triggering simple local RA.
15840 @item lra-inheritance-ebb-probability-cutoff
15841 LRA tries to reuse values reloaded in registers in subsequent insns.
15842 This optimization is called inheritance.  EBB is used as a region to
15843 do this optimization.  The parameter defines a minimal fall-through
15844 edge probability in percentage used to add BB to inheritance EBB in
15845 LRA.  The default value was chosen
15846 from numerous runs of SPEC2000 on x86-64.
15848 @item loop-invariant-max-bbs-in-loop
15849 Loop invariant motion can be very expensive, both in compilation time and
15850 in amount of needed compile-time memory, with very large loops.  Loops
15851 with more basic blocks than this parameter won't have loop invariant
15852 motion optimization performed on them.
15854 @item loop-max-datarefs-for-datadeps
15855 Building data dependencies is expensive for very large loops.  This
15856 parameter limits the number of data references in loops that are
15857 considered for data dependence analysis.  These large loops are no
15858 handled by the optimizations using loop data dependencies.
15860 @item max-vartrack-size
15861 Sets a maximum number of hash table slots to use during variable
15862 tracking dataflow analysis of any function.  If this limit is exceeded
15863 with variable tracking at assignments enabled, analysis for that
15864 function is retried without it, after removing all debug insns from
15865 the function.  If the limit is exceeded even without debug insns, var
15866 tracking analysis is completely disabled for the function.  Setting
15867 the parameter to zero makes it unlimited.
15869 @item max-vartrack-expr-depth
15870 Sets a maximum number of recursion levels when attempting to map
15871 variable names or debug temporaries to value expressions.  This trades
15872 compilation time for more complete debug information.  If this is set too
15873 low, value expressions that are available and could be represented in
15874 debug information may end up not being used; setting this higher may
15875 enable the compiler to find more complex debug expressions, but compile
15876 time and memory use may grow.
15878 @item max-debug-marker-count
15879 Sets a threshold on the number of debug markers (e.g.@: begin stmt
15880 markers) to avoid complexity explosion at inlining or expanding to RTL.
15881 If a function has more such gimple stmts than the set limit, such stmts
15882 will be dropped from the inlined copy of a function, and from its RTL
15883 expansion.
15885 @item min-nondebug-insn-uid
15886 Use uids starting at this parameter for nondebug insns.  The range below
15887 the parameter is reserved exclusively for debug insns created by
15888 @option{-fvar-tracking-assignments}, but debug insns may get
15889 (non-overlapping) uids above it if the reserved range is exhausted.
15891 @item ipa-sra-deref-prob-threshold
15892 IPA-SRA replaces a pointer which is known not be NULL with one or more
15893 new parameters only when the probability (in percent, relative to
15894 function entry) of it being dereferenced is higher than this parameter.
15896 @item ipa-sra-ptr-growth-factor
15897 IPA-SRA replaces a pointer to an aggregate with one or more new
15898 parameters only when their cumulative size is less or equal to
15899 @option{ipa-sra-ptr-growth-factor} times the size of the original
15900 pointer parameter.
15902 @item ipa-sra-ptrwrap-growth-factor
15903 Additional maximum allowed growth of total size of new parameters
15904 that ipa-sra replaces a pointer to an aggregate with,
15905 if it points to a local variable that the caller only writes to and
15906 passes it as an argument to other functions.
15908 @item ipa-sra-max-replacements
15909 Maximum pieces of an aggregate that IPA-SRA tracks.  As a
15910 consequence, it is also the maximum number of replacements of a formal
15911 parameter.
15913 @item sra-max-scalarization-size-Ospeed
15914 @itemx sra-max-scalarization-size-Osize
15915 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
15916 replace scalar parts of aggregates with uses of independent scalar
15917 variables.  These parameters control the maximum size, in storage units,
15918 of aggregate which is considered for replacement when compiling for
15919 speed
15920 (@option{sra-max-scalarization-size-Ospeed}) or size
15921 (@option{sra-max-scalarization-size-Osize}) respectively.
15923 @item sra-max-propagations
15924 The maximum number of artificial accesses that Scalar Replacement of
15925 Aggregates (SRA) will track, per one local variable, in order to
15926 facilitate copy propagation.
15928 @item tm-max-aggregate-size
15929 When making copies of thread-local variables in a transaction, this
15930 parameter specifies the size in bytes after which variables are
15931 saved with the logging functions as opposed to save/restore code
15932 sequence pairs.  This option only applies when using
15933 @option{-fgnu-tm}.
15935 @item graphite-max-nb-scop-params
15936 To avoid exponential effects in the Graphite loop transforms, the
15937 number of parameters in a Static Control Part (SCoP) is bounded.
15938 A value of zero can be used to lift
15939 the bound.  A variable whose value is unknown at compilation time and
15940 defined outside a SCoP is a parameter of the SCoP.
15942 @item loop-block-tile-size
15943 Loop blocking or strip mining transforms, enabled with
15944 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
15945 loop in the loop nest by a given number of iterations.  The strip
15946 length can be changed using the @option{loop-block-tile-size}
15947 parameter.
15949 @item ipa-jump-function-lookups
15950 Specifies number of statements visited during jump function offset discovery.
15952 @item ipa-cp-value-list-size
15953 IPA-CP attempts to track all possible values and types passed to a function's
15954 parameter in order to propagate them and perform devirtualization.
15955 @option{ipa-cp-value-list-size} is the maximum number of values and types it
15956 stores per one formal parameter of a function.
15958 @item ipa-cp-eval-threshold
15959 IPA-CP calculates its own score of cloning profitability heuristics
15960 and performs those cloning opportunities with scores that exceed
15961 @option{ipa-cp-eval-threshold}.
15963 @item ipa-cp-max-recursive-depth
15964 Maximum depth of recursive cloning for self-recursive function.
15966 @item ipa-cp-min-recursive-probability
15967 Recursive cloning only when the probability of call being executed exceeds
15968 the parameter.
15970 @item ipa-cp-profile-count-base
15971 When using @option{-fprofile-use} option, IPA-CP will consider the measured
15972 execution count of a call graph edge at this percentage position in their
15973 histogram as the basis for its heuristics calculation.
15975 @item ipa-cp-recursive-freq-factor
15976 The number of times interprocedural copy propagation expects recursive
15977 functions to call themselves.
15979 @item ipa-cp-recursion-penalty
15980 Percentage penalty the recursive functions will receive when they
15981 are evaluated for cloning.
15983 @item ipa-cp-single-call-penalty
15984 Percentage penalty functions containing a single call to another
15985 function will receive when they are evaluated for cloning.
15987 @item ipa-max-agg-items
15988 IPA-CP is also capable to propagate a number of scalar values passed
15989 in an aggregate. @option{ipa-max-agg-items} controls the maximum
15990 number of such values per one parameter.
15992 @item ipa-cp-loop-hint-bonus
15993 When IPA-CP determines that a cloning candidate would make the number
15994 of iterations of a loop known, it adds a bonus of
15995 @option{ipa-cp-loop-hint-bonus} to the profitability score of
15996 the candidate.
15998 @item ipa-max-loop-predicates
15999 The maximum number of different predicates IPA will use to describe when
16000 loops in a function have known properties.
16002 @item ipa-max-aa-steps
16003 During its analysis of function bodies, IPA-CP employs alias analysis
16004 in order to track values pointed to by function parameters.  In order
16005 not spend too much time analyzing huge functions, it gives up and
16006 consider all memory clobbered after examining
16007 @option{ipa-max-aa-steps} statements modifying memory.
16009 @item ipa-max-switch-predicate-bounds
16010 Maximal number of boundary endpoints of case ranges of switch statement.
16011 For switch exceeding this limit, IPA-CP will not construct cloning cost
16012 predicate, which is used to estimate cloning benefit, for default case
16013 of the switch statement.
16015 @item ipa-max-param-expr-ops
16016 IPA-CP will analyze conditional statement that references some function
16017 parameter to estimate benefit for cloning upon certain constant value.
16018 But if number of operations in a parameter expression exceeds
16019 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
16020 one, and is not handled by IPA analysis.
16022 @item lto-partitions
16023 Specify desired number of partitions produced during WHOPR compilation.
16024 The number of partitions should exceed the number of CPUs used for compilation.
16026 @item lto-min-partition
16027 Size of minimal partition for WHOPR (in estimated instructions).
16028 This prevents expenses of splitting very small programs into too many
16029 partitions.
16031 @item lto-max-partition
16032 Size of max partition for WHOPR (in estimated instructions).
16033 to provide an upper bound for individual size of partition.
16034 Meant to be used only with balanced partitioning.
16036 @item lto-max-streaming-parallelism
16037 Maximal number of parallel processes used for LTO streaming.
16039 @item cxx-max-namespaces-for-diagnostic-help
16040 The maximum number of namespaces to consult for suggestions when C++
16041 name lookup fails for an identifier.
16043 @item sink-frequency-threshold
16044 The maximum relative execution frequency (in percents) of the target block
16045 relative to a statement's original block to allow statement sinking of a
16046 statement.  Larger numbers result in more aggressive statement sinking.
16047 A small positive adjustment is applied for
16048 statements with memory operands as those are even more profitable so sink.
16050 @item max-stores-to-sink
16051 The maximum number of conditional store pairs that can be sunk.  Set to 0
16052 if either vectorization (@option{-ftree-vectorize}) or if-conversion
16053 (@option{-ftree-loop-if-convert}) is disabled.
16055 @item case-values-threshold
16056 The smallest number of different values for which it is best to use a
16057 jump-table instead of a tree of conditional branches.  If the value is
16058 0, use the default for the machine.
16060 @item jump-table-max-growth-ratio-for-size
16061 The maximum code size growth ratio when expanding
16062 into a jump table (in percent).  The parameter is used when
16063 optimizing for size.
16065 @item jump-table-max-growth-ratio-for-speed
16066 The maximum code size growth ratio when expanding
16067 into a jump table (in percent).  The parameter is used when
16068 optimizing for speed.
16070 @item tree-reassoc-width
16071 Set the maximum number of instructions executed in parallel in
16072 reassociated tree. This parameter overrides target dependent
16073 heuristics used by default if has non zero value.
16075 @item sched-pressure-algorithm
16076 Choose between the two available implementations of
16077 @option{-fsched-pressure}.  Algorithm 1 is the original implementation
16078 and is the more likely to prevent instructions from being reordered.
16079 Algorithm 2 was designed to be a compromise between the relatively
16080 conservative approach taken by algorithm 1 and the rather aggressive
16081 approach taken by the default scheduler.  It relies more heavily on
16082 having a regular register file and accurate register pressure classes.
16083 See @file{haifa-sched.cc} in the GCC sources for more details.
16085 The default choice depends on the target.
16087 @item max-slsr-cand-scan
16088 Set the maximum number of existing candidates that are considered when
16089 seeking a basis for a new straight-line strength reduction candidate.
16091 @item asan-globals
16092 Enable buffer overflow detection for global objects.  This kind
16093 of protection is enabled by default if you are using
16094 @option{-fsanitize=address} option.
16095 To disable global objects protection use @option{--param asan-globals=0}.
16097 @item asan-stack
16098 Enable buffer overflow detection for stack objects.  This kind of
16099 protection is enabled by default when using @option{-fsanitize=address}.
16100 To disable stack protection use @option{--param asan-stack=0} option.
16102 @item asan-instrument-reads
16103 Enable buffer overflow detection for memory reads.  This kind of
16104 protection is enabled by default when using @option{-fsanitize=address}.
16105 To disable memory reads protection use
16106 @option{--param asan-instrument-reads=0}.
16108 @item asan-instrument-writes
16109 Enable buffer overflow detection for memory writes.  This kind of
16110 protection is enabled by default when using @option{-fsanitize=address}.
16111 To disable memory writes protection use
16112 @option{--param asan-instrument-writes=0} option.
16114 @item asan-memintrin
16115 Enable detection for built-in functions.  This kind of protection
16116 is enabled by default when using @option{-fsanitize=address}.
16117 To disable built-in functions protection use
16118 @option{--param asan-memintrin=0}.
16120 @item asan-use-after-return
16121 Enable detection of use-after-return.  This kind of protection
16122 is enabled by default when using the @option{-fsanitize=address} option.
16123 To disable it use @option{--param asan-use-after-return=0}.
16125 Note: By default the check is disabled at run time.  To enable it,
16126 add @code{detect_stack_use_after_return=1} to the environment variable
16127 @env{ASAN_OPTIONS}.
16129 @item asan-instrumentation-with-call-threshold
16130 If number of memory accesses in function being instrumented
16131 is greater or equal to this number, use callbacks instead of inline checks.
16132 E.g. to disable inline code use
16133 @option{--param asan-instrumentation-with-call-threshold=0}.
16135 @item asan-kernel-mem-intrinsic-prefix
16136 If nonzero, prefix calls to @code{memcpy}, @code{memset} and @code{memmove}
16137 with @samp{__asan_} or @samp{__hwasan_}
16138 for @option{-fsanitize=kernel-address} or @samp{-fsanitize=kernel-hwaddress},
16139 respectively.
16141 @item hwasan-instrument-stack
16142 Enable hwasan instrumentation of statically sized stack-allocated variables.
16143 This kind of instrumentation is enabled by default when using
16144 @option{-fsanitize=hwaddress} and disabled by default when using
16145 @option{-fsanitize=kernel-hwaddress}.
16146 To disable stack instrumentation use
16147 @option{--param hwasan-instrument-stack=0}, and to enable it use
16148 @option{--param hwasan-instrument-stack=1}.
16150 @item hwasan-random-frame-tag
16151 When using stack instrumentation, decide tags for stack variables using a
16152 deterministic sequence beginning at a random tag for each frame.  With this
16153 parameter unset tags are chosen using the same sequence but beginning from 1.
16154 This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
16155 for @option{-fsanitize=kernel-hwaddress}.
16156 To disable it use @option{--param hwasan-random-frame-tag=0}.
16158 @item hwasan-instrument-allocas
16159 Enable hwasan instrumentation of dynamically sized stack-allocated variables.
16160 This kind of instrumentation is enabled by default when using
16161 @option{-fsanitize=hwaddress} and disabled by default when using
16162 @option{-fsanitize=kernel-hwaddress}.
16163 To disable instrumentation of such variables use
16164 @option{--param hwasan-instrument-allocas=0}, and to enable it use
16165 @option{--param hwasan-instrument-allocas=1}.
16167 @item hwasan-instrument-reads
16168 Enable hwasan checks on memory reads.  Instrumentation of reads is enabled by
16169 default for both @option{-fsanitize=hwaddress} and
16170 @option{-fsanitize=kernel-hwaddress}.
16171 To disable checking memory reads use
16172 @option{--param hwasan-instrument-reads=0}.
16174 @item hwasan-instrument-writes
16175 Enable hwasan checks on memory writes.  Instrumentation of writes is enabled by
16176 default for both @option{-fsanitize=hwaddress} and
16177 @option{-fsanitize=kernel-hwaddress}.
16178 To disable checking memory writes use
16179 @option{--param hwasan-instrument-writes=0}.
16181 @item hwasan-instrument-mem-intrinsics
16182 Enable hwasan instrumentation of builtin functions.  Instrumentation of these
16183 builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
16184 and @option{-fsanitize=kernel-hwaddress}.
16185 To disable instrumentation of builtin functions use
16186 @option{--param hwasan-instrument-mem-intrinsics=0}.
16188 @item use-after-scope-direct-emission-threshold
16189 If the size of a local variable in bytes is smaller or equal to this
16190 number, directly poison (or unpoison) shadow memory instead of using
16191 run-time callbacks.
16193 @item tsan-distinguish-volatile
16194 Emit special instrumentation for accesses to volatiles.
16196 @item tsan-instrument-func-entry-exit
16197 Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
16199 @item max-fsm-thread-path-insns
16200 Maximum number of instructions to copy when duplicating blocks on a
16201 finite state automaton jump thread path.
16203 @item threader-debug
16204 threader-debug=[none|all] Enables verbose dumping of the threader solver.
16206 @item parloops-chunk-size
16207 Chunk size of omp schedule for loops parallelized by parloops.
16209 @item parloops-schedule
16210 Schedule type of omp schedule for loops parallelized by parloops (static,
16211 dynamic, guided, auto, runtime).
16213 @item parloops-min-per-thread
16214 The minimum number of iterations per thread of an innermost parallelized
16215 loop for which the parallelized variant is preferred over the single threaded
16216 one.  Note that for a parallelized loop nest the
16217 minimum number of iterations of the outermost loop per thread is two.
16219 @item max-ssa-name-query-depth
16220 Maximum depth of recursion when querying properties of SSA names in things
16221 like fold routines.  One level of recursion corresponds to following a
16222 use-def chain.
16224 @item max-speculative-devirt-maydefs
16225 The maximum number of may-defs we analyze when looking for a must-def
16226 specifying the dynamic type of an object that invokes a virtual call
16227 we may be able to devirtualize speculatively.
16229 @item ranger-debug
16230 Specifies the type of debug output to be issued for ranges.
16232 @item unroll-jam-min-percent
16233 The minimum percentage of memory references that must be optimized
16234 away for the unroll-and-jam transformation to be considered profitable.
16236 @item unroll-jam-max-unroll
16237 The maximum number of times the outer loop should be unrolled by
16238 the unroll-and-jam transformation.
16240 @item max-rtl-if-conversion-unpredictable-cost
16241 Maximum permissible cost for the sequence that would be generated
16242 by the RTL if-conversion pass for a branch that is considered unpredictable.
16244 @item max-variable-expansions-in-unroller
16245 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
16246 of times that an individual variable will be expanded during loop unrolling.
16248 @item partial-inlining-entry-probability
16249 Maximum probability of the entry BB of split region
16250 (in percent relative to entry BB of the function)
16251 to make partial inlining happen.
16253 @item max-tracked-strlens
16254 Maximum number of strings for which strlen optimization pass will
16255 track string lengths.
16257 @item gcse-after-reload-partial-fraction
16258 The threshold ratio for performing partial redundancy
16259 elimination after reload.
16261 @item gcse-after-reload-critical-fraction
16262 The threshold ratio of critical edges execution count that
16263 permit performing redundancy elimination after reload.
16265 @item max-loop-header-insns
16266 The maximum number of insns in loop header duplicated
16267 by the copy loop headers pass.
16269 @item vect-epilogues-nomask
16270 Enable loop epilogue vectorization using smaller vector size.
16272 @item vect-partial-vector-usage
16273 Controls when the loop vectorizer considers using partial vector loads
16274 and stores as an alternative to falling back to scalar code.  0 stops
16275 the vectorizer from ever using partial vector loads and stores.  1 allows
16276 partial vector loads and stores if vectorization removes the need for the
16277 code to iterate.  2 allows partial vector loads and stores in all loops.
16278 The parameter only has an effect on targets that support partial
16279 vector loads and stores.
16281 @item vect-inner-loop-cost-factor
16282 The maximum factor which the loop vectorizer applies to the cost of statements
16283 in an inner loop relative to the loop being vectorized.  The factor applied
16284 is the maximum of the estimated number of iterations of the inner loop and
16285 this parameter.  The default value of this parameter is 50.
16287 @item vect-induction-float
16288 Enable loop vectorization of floating point inductions.
16290 @item vrp-sparse-threshold
16291 Maximum number of basic blocks before VRP uses a sparse bitmap cache.
16293 @item vrp-switch-limit
16294 Maximum number of outgoing edges in a switch before VRP will not process it.
16296 @item vrp-vector-threshold
16297 Maximum number of basic blocks for VRP to use a basic cache vector.
16299 @item avoid-fma-max-bits
16300 Maximum number of bits for which we avoid creating FMAs.
16302 @item sms-loop-average-count-threshold
16303 A threshold on the average loop count considered by the swing modulo scheduler.
16305 @item sms-dfa-history
16306 The number of cycles the swing modulo scheduler considers when checking
16307 conflicts using DFA.
16309 @item graphite-allow-codegen-errors
16310 Whether codegen errors should be ICEs when @option{-fchecking}.
16312 @item sms-max-ii-factor
16313 A factor for tuning the upper bound that swing modulo scheduler
16314 uses for scheduling a loop.
16316 @item lra-max-considered-reload-pseudos
16317 The max number of reload pseudos which are considered during
16318 spilling a non-reload pseudo.
16320 @item max-pow-sqrt-depth
16321 Maximum depth of sqrt chains to use when synthesizing exponentiation
16322 by a real constant.
16324 @item max-dse-active-local-stores
16325 Maximum number of active local stores in RTL dead store elimination.
16327 @item asan-instrument-allocas
16328 Enable asan allocas/VLAs protection.
16330 @item max-iterations-computation-cost
16331 Bound on the cost of an expression to compute the number of iterations.
16333 @item max-isl-operations
16334 Maximum number of isl operations, 0 means unlimited.
16336 @item graphite-max-arrays-per-scop
16337 Maximum number of arrays per scop.
16339 @item max-vartrack-reverse-op-size
16340 Max. size of loc list for which reverse ops should be added.
16342 @item fsm-scale-path-stmts
16343 Scale factor to apply to the number of statements in a threading path
16344 crossing a loop backedge when comparing to
16345 @option{--param=max-jump-thread-duplication-stmts}.
16347 @item uninit-control-dep-attempts
16348 Maximum number of nested calls to search for control dependencies
16349 during uninitialized variable analysis.
16351 @item sched-autopref-queue-depth
16352 Hardware autoprefetcher scheduler model control flag.
16353 Number of lookahead cycles the model looks into; at '
16354 ' only enable instruction sorting heuristic.
16356 @item loop-versioning-max-inner-insns
16357 The maximum number of instructions that an inner loop can have
16358 before the loop versioning pass considers it too big to copy.
16360 @item loop-versioning-max-outer-insns
16361 The maximum number of instructions that an outer loop can have
16362 before the loop versioning pass considers it too big to copy,
16363 discounting any instructions in inner loops that directly benefit
16364 from versioning.
16366 @item ssa-name-def-chain-limit
16367 The maximum number of SSA_NAME assignments to follow in determining
16368 a property of a variable such as its value.  This limits the number
16369 of iterations or recursive calls GCC performs when optimizing certain
16370 statements or when determining their validity prior to issuing
16371 diagnostics.
16373 @item store-merging-max-size
16374 Maximum size of a single store merging region in bytes.
16376 @item hash-table-verification-limit
16377 The number of elements for which hash table verification is done
16378 for each searched element.
16380 @item max-find-base-term-values
16381 Maximum number of VALUEs handled during a single find_base_term call.
16383 @item analyzer-max-enodes-per-program-point
16384 The maximum number of exploded nodes per program point within
16385 the analyzer, before terminating analysis of that point.
16387 @item analyzer-max-constraints
16388 The maximum number of constraints per state.
16390 @item analyzer-min-snodes-for-call-summary
16391 The minimum number of supernodes within a function for the
16392 analyzer to consider summarizing its effects at call sites.
16394 @item analyzer-max-enodes-for-full-dump
16395 The maximum depth of exploded nodes that should appear in a dot dump
16396 before switching to a less verbose format.
16398 @item analyzer-max-recursion-depth
16399 The maximum number of times a callsite can appear in a call stack
16400 within the analyzer, before terminating analysis of a call that would
16401 recurse deeper.
16403 @item analyzer-max-svalue-depth
16404 The maximum depth of a symbolic value, before approximating
16405 the value as unknown.
16407 @item analyzer-max-infeasible-edges
16408 The maximum number of infeasible edges to reject before declaring
16409 a diagnostic as infeasible.
16411 @item gimple-fe-computed-hot-bb-threshold
16412 The number of executions of a basic block which is considered hot.
16413 The parameter is used only in GIMPLE FE.
16415 @item analyzer-bb-explosion-factor
16416 The maximum number of 'after supernode' exploded nodes within the analyzer
16417 per supernode, before terminating analysis.
16419 @item analyzer-text-art-string-ellipsis-threshold
16420 The number of bytes at which to ellipsize string literals in analyzer text art diagrams.
16422 @item analyzer-text-art-ideal-canvas-width
16423 The ideal width in characters of text art diagrams generated by the analyzer.
16425 @item analyzer-text-art-string-ellipsis-head-len
16426 The number of literal bytes to show at the head of a string literal in text art when ellipsizing it.
16428 @item analyzer-text-art-string-ellipsis-tail-len
16429 The number of literal bytes to show at the tail of a string literal in text art when ellipsizing it.
16431 @item ranger-logical-depth
16432 Maximum depth of logical expression evaluation ranger will look through
16433 when evaluating outgoing edge ranges.
16435 @item ranger-recompute-depth
16436 Maximum depth of instruction chains to consider for recomputation
16437 in the outgoing range calculator.
16439 @item relation-block-limit
16440 Maximum number of relations the oracle will register in a basic block.
16442 @item min-pagesize
16443 Minimum page size for warning purposes.
16445 @item openacc-kernels
16446 Specify mode of OpenACC `kernels' constructs handling.
16447 With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
16448 constructs are decomposed into parts, a sequence of compute
16449 constructs, each then handled individually.
16450 This is work in progress.
16451 With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
16452 constructs are handled by the @samp{parloops} pass, en bloc.
16453 This is the current default.
16455 @item openacc-privatization
16456 Control whether the @option{-fopt-info-omp-note} and applicable
16457 @option{-fdump-tree-*-details} options emit OpenACC privatization diagnostics.
16458 With @option{--param=openacc-privatization=quiet}, don't diagnose.
16459 This is the current default.
16460 With @option{--param=openacc-privatization=noisy}, do diagnose.
16462 @end table
16464 The following choices of @var{name} are available on AArch64 targets:
16466 @table @gcctabopt
16467 @item aarch64-sve-compare-costs
16468 When vectorizing for SVE, consider using ``unpacked'' vectors for
16469 smaller elements and use the cost model to pick the cheapest approach.
16470 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
16472 Using unpacked vectors includes storing smaller elements in larger
16473 containers and accessing elements with extending loads and truncating
16474 stores.
16476 @item aarch64-float-recp-precision
16477 The number of Newton iterations for calculating the reciprocal for float type.
16478 The precision of division is proportional to this param when division
16479 approximation is enabled.  The default value is 1.
16481 @item aarch64-double-recp-precision
16482 The number of Newton iterations for calculating the reciprocal for double type.
16483 The precision of division is propotional to this param when division
16484 approximation is enabled.  The default value is 2.
16486 @item aarch64-autovec-preference
16487 Force an ISA selection strategy for auto-vectorization.  Accepts values from
16488 0 to 4, inclusive.
16489 @table @samp
16490 @item 0
16491 Use the default heuristics.
16492 @item 1
16493 Use only Advanced SIMD for auto-vectorization.
16494 @item 2
16495 Use only SVE for auto-vectorization.
16496 @item 3
16497 Use both Advanced SIMD and SVE.  Prefer Advanced SIMD when the costs are
16498 deemed equal.
16499 @item 4
16500 Use both Advanced SIMD and SVE.  Prefer SVE when the costs are deemed equal.
16501 @end table
16502 The default value is 0.
16504 @item aarch64-loop-vect-issue-rate-niters
16505 The tuning for some AArch64 CPUs tries to take both latencies and issue
16506 rates into account when deciding whether a loop should be vectorized
16507 using SVE, vectorized using Advanced SIMD, or not vectorized at all.
16508 If this parameter is set to @var{n}, GCC will not use this heuristic
16509 for loops that are known to execute in fewer than @var{n} Advanced
16510 SIMD iterations.
16512 @item aarch64-vect-unroll-limit
16513 The vectorizer will use available tuning information to determine whether it
16514 would be beneficial to unroll the main vectorized loop and by how much.  This
16515 parameter set's the upper bound of how much the vectorizer will unroll the main
16516 loop.  The default value is four.
16518 @end table
16520 The following choices of @var{name} are available on i386 and x86_64 targets:
16522 @table @gcctabopt
16523 @item x86-stlf-window-ninsns
16524 Instructions number above which STFL stall penalty can be compensated.
16526 @item x86-stv-max-visits
16527 The maximum number of use and def visits when discovering a STV chain before
16528 the discovery is aborted.
16530 @end table
16532 @end table
16534 @node Instrumentation Options
16535 @section Program Instrumentation Options
16536 @cindex instrumentation options
16537 @cindex program instrumentation options
16538 @cindex run-time error checking options
16539 @cindex profiling options
16540 @cindex options, program instrumentation
16541 @cindex options, run-time error checking
16542 @cindex options, profiling
16544 GCC supports a number of command-line options that control adding
16545 run-time instrumentation to the code it normally generates.  
16546 For example, one purpose of instrumentation is collect profiling
16547 statistics for use in finding program hot spots, code coverage
16548 analysis, or profile-guided optimizations.
16549 Another class of program instrumentation is adding run-time checking 
16550 to detect programming errors like invalid pointer
16551 dereferences or out-of-bounds array accesses, as well as deliberately
16552 hostile attacks such as stack smashing or C++ vtable hijacking.
16553 There is also a general hook which can be used to implement other
16554 forms of tracing or function-level instrumentation for debug or
16555 program analysis purposes.
16557 @table @gcctabopt
16558 @cindex @command{prof}
16559 @cindex @command{gprof}
16560 @opindex p
16561 @opindex pg
16562 @item -p
16563 @itemx -pg
16564 Generate extra code to write profile information suitable for the
16565 analysis program @command{prof} (for @option{-p}) or @command{gprof}
16566 (for @option{-pg}).  You must use this option when compiling
16567 the source files you want data about, and you must also use it when
16568 linking.
16570 You can use the function attribute @code{no_instrument_function} to
16571 suppress profiling of individual functions when compiling with these options.
16572 @xref{Common Function Attributes}.
16574 @opindex fprofile-arcs
16575 @item -fprofile-arcs
16576 Add code so that program flow @dfn{arcs} are instrumented.  During
16577 execution the program records how many times each branch and call is
16578 executed and how many times it is taken or returns.  On targets that support
16579 constructors with priority support, profiling properly handles constructors,
16580 destructors and C++ constructors (and destructors) of classes which are used
16581 as a type of a global variable.
16583 When the compiled
16584 program exits it saves this data to a file called
16585 @file{@var{auxname}.gcda} for each source file.  The data may be used for
16586 profile-directed optimizations (@option{-fbranch-probabilities}), or for
16587 test coverage analysis (@option{-ftest-coverage}).  Each object file's
16588 @var{auxname} is generated from the name of the output file, if
16589 explicitly specified and it is not the final executable, otherwise it is
16590 the basename of the source file.  In both cases any suffix is removed
16591 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
16592 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
16594 Note that if a command line directly links source files, the corresponding
16595 @var{.gcda} files will be prefixed with the unsuffixed name of the output file.
16596 E.g. @code{gcc a.c b.c -o binary} would generate @file{binary-a.gcda} and
16597 @file{binary-b.gcda} files.
16599 @xref{Cross-profiling}.
16601 @cindex @command{gcov}
16602 @opindex coverage
16603 @item --coverage
16605 This option is used to compile and link code instrumented for coverage
16606 analysis.  The option is a synonym for @option{-fprofile-arcs}
16607 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
16608 linking).  See the documentation for those options for more details.
16610 @itemize
16612 @item
16613 Compile the source files with @option{-fprofile-arcs} plus optimization
16614 and code generation options.  For test coverage analysis, use the
16615 additional @option{-ftest-coverage} option.  You do not need to profile
16616 every source file in a program.
16618 @item
16619 Compile the source files additionally with @option{-fprofile-abs-path}
16620 to create absolute path names in the @file{.gcno} files.  This allows
16621 @command{gcov} to find the correct sources in projects where compilations
16622 occur with different working directories.
16624 @item
16625 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
16626 (the latter implies the former).
16628 @item
16629 Run the program on a representative workload to generate the arc profile
16630 information.  This may be repeated any number of times.  You can run
16631 concurrent instances of your program, and provided that the file system
16632 supports locking, the data files will be correctly updated.  Unless
16633 a strict ISO C dialect option is in effect, @code{fork} calls are
16634 detected and correctly handled without double counting.
16636 Moreover, an object file can be recompiled multiple times
16637 and the corresponding @file{.gcda} file merges as long as
16638 the source file and the compiler options are unchanged.
16640 @item
16641 For profile-directed optimizations, compile the source files again with
16642 the same optimization and code generation options plus
16643 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
16644 Control Optimization}).
16646 @item
16647 For test coverage analysis, use @command{gcov} to produce human readable
16648 information from the @file{.gcno} and @file{.gcda} files.  Refer to the
16649 @command{gcov} documentation for further information.
16651 @end itemize
16653 With @option{-fprofile-arcs}, for each function of your program GCC
16654 creates a program flow graph, then finds a spanning tree for the graph.
16655 Only arcs that are not on the spanning tree have to be instrumented: the
16656 compiler adds code to count the number of times that these arcs are
16657 executed.  When an arc is the only exit or only entrance to a block, the
16658 instrumentation code can be added to the block; otherwise, a new basic
16659 block must be created to hold the instrumentation code.
16661 @need 2000
16662 @opindex ftest-coverage
16663 @item -ftest-coverage
16664 Produce a notes file that the @command{gcov} code-coverage utility
16665 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
16666 show program coverage.  Each source file's note file is called
16667 @file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
16668 above for a description of @var{auxname} and instructions on how to
16669 generate test coverage data.  Coverage data matches the source files
16670 more closely if you do not optimize.
16672 @opindex fprofile-abs-path
16673 @item -fprofile-abs-path
16674 Automatically convert relative source file names to absolute path names
16675 in the @file{.gcno} files.  This allows @command{gcov} to find the correct
16676 sources in projects where compilations occur with different working
16677 directories.
16679 @opindex fprofile-dir
16680 @item -fprofile-dir=@var{path}
16682 Set the directory to search for the profile data files in to @var{path}.
16683 This option affects only the profile data generated by
16684 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
16685 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
16686 and its related options.  Both absolute and relative paths can be used.
16687 By default, GCC uses the current directory as @var{path}, thus the
16688 profile data file appears in the same directory as the object file.
16689 In order to prevent the file name clashing, if the object file name is
16690 not an absolute path, we mangle the absolute path of the
16691 @file{@var{sourcename}.gcda} file and use it as the file name of a
16692 @file{.gcda} file.  See details about the file naming in @option{-fprofile-arcs}.
16693 See similar option @option{-fprofile-note}.
16695 When an executable is run in a massive parallel environment, it is recommended
16696 to save profile to different folders.  That can be done with variables
16697 in @var{path} that are exported during run-time:
16699 @table @gcctabopt
16701 @item %p
16702 process ID.
16704 @item %q@{VAR@}
16705 value of environment variable @var{VAR}
16707 @end table
16709 @opindex fprofile-generate
16710 @item -fprofile-generate
16711 @itemx -fprofile-generate=@var{path}
16713 Enable options usually used for instrumenting application to produce
16714 profile useful for later recompilation with profile feedback based
16715 optimization.  You must use @option{-fprofile-generate} both when
16716 compiling and when linking your program.
16718 The following options are enabled:
16719 @option{-fprofile-arcs}, @option{-fprofile-values},
16720 @option{-finline-functions}, and @option{-fipa-bit-cp}.
16722 If @var{path} is specified, GCC looks at the @var{path} to find
16723 the profile feedback data files. See @option{-fprofile-dir}.
16725 To optimize the program based on the collected profile information, use
16726 @option{-fprofile-use}.  @xref{Optimize Options}, for more information.
16728 @opindex fprofile-info-section
16729 @item -fprofile-info-section
16730 @itemx -fprofile-info-section=@var{name}
16732 Register the profile information in the specified section instead of using a
16733 constructor/destructor.  The section name is @var{name} if it is specified,
16734 otherwise the section name defaults to @code{.gcov_info}.  A pointer to the
16735 profile information generated by @option{-fprofile-arcs} is placed in the
16736 specified section for each translation unit.  This option disables the profile
16737 information registration through a constructor and it disables the profile
16738 information processing through a destructor.  This option is not intended to be
16739 used in hosted environments such as GNU/Linux.  It targets freestanding
16740 environments (for example embedded systems) with limited resources which do not
16741 support constructors/destructors or the C library file I/O.
16743 The linker could collect the input sections in a continuous memory block and
16744 define start and end symbols.  A GNU linker script example which defines a
16745 linker output section follows:
16747 @smallexample
16748   .gcov_info      :
16749   @{
16750     PROVIDE (__gcov_info_start = .);
16751     KEEP (*(.gcov_info))
16752     PROVIDE (__gcov_info_end = .);
16753   @}
16754 @end smallexample
16756 The program could dump the profiling information registered in this linker set
16757 for example like this:
16759 @smallexample
16760 #include <gcov.h>
16761 #include <stdio.h>
16762 #include <stdlib.h>
16764 extern const struct gcov_info *const __gcov_info_start[];
16765 extern const struct gcov_info *const __gcov_info_end[];
16767 static void
16768 dump (const void *d, unsigned n, void *arg)
16770   const unsigned char *c = d;
16772   for (unsigned i = 0; i < n; ++i)
16773     printf ("%02x", c[i]);
16776 static void
16777 filename (const char *f, void *arg)
16779   __gcov_filename_to_gcfn (f, dump, arg );
16782 static void *
16783 allocate (unsigned length, void *arg)
16785   return malloc (length);
16788 static void
16789 dump_gcov_info (void)
16791   const struct gcov_info *const *info = __gcov_info_start;
16792   const struct gcov_info *const *end = __gcov_info_end;
16794   /* Obfuscate variable to prevent compiler optimizations.  */
16795   __asm__ ("" : "+r" (info));
16797   while (info != end)
16798   @{
16799     void *arg = NULL;
16800     __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
16801     putchar ('\n');
16802     ++info;
16803   @}
16807 main (void)
16809   dump_gcov_info ();
16810   return 0;
16812 @end smallexample
16814 The @command{merge-stream} subcommand of @command{gcov-tool} may be used to
16815 deserialize the data stream generated by the @code{__gcov_filename_to_gcfn} and
16816 @code{__gcov_info_to_gcda} functions and merge the profile information into
16817 @file{.gcda} files on the host filesystem.
16819 @opindex fprofile-note
16820 @item -fprofile-note=@var{path}
16822 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
16823 location.  If you combine the option with multiple source files,
16824 the @file{.gcno} file will be overwritten.
16826 @opindex fprofile-prefix-path
16827 @item -fprofile-prefix-path=@var{path}
16829 This option can be used in combination with
16830 @option{profile-generate=}@var{profile_dir} and
16831 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
16832 directory of built source tree.  By default @var{profile_dir} will contain
16833 files with mangled absolute paths of all object files in the built project.
16834 This is not desirable when directory used to build the instrumented binary
16835 differs from the directory used to build the binary optimized with profile
16836 feedback because the profile data will not be found during the optimized build.
16837 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
16838 pointing to the base directory of the build can be used to strip the irrelevant
16839 part of the path and keep all file names relative to the main build directory.
16841 @opindex fprofile-prefix-map
16842 @item -fprofile-prefix-map=@var{old}=@var{new}
16843 When compiling files residing in directory @file{@var{old}}, record
16844 profiling information (with @option{--coverage})
16845 describing them as if the files resided in
16846 directory @file{@var{new}} instead.
16847 See also @option{-ffile-prefix-map} and @option{-fcanon-prefix-map}.
16849 @opindex fprofile-update
16850 @item -fprofile-update=@var{method}
16852 Alter the update method for an application instrumented for profile
16853 feedback based optimization.  The @var{method} argument should be one of
16854 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
16855 The first one is useful for single-threaded applications,
16856 while the second one prevents profile corruption by emitting thread-safe code.
16858 @strong{Warning:} When an application does not properly join all threads
16859 (or creates an detached thread), a profile file can be still corrupted.
16861 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
16862 when supported by a target, or to @samp{single} otherwise.  The GCC driver
16863 automatically selects @samp{prefer-atomic} when @option{-pthread}
16864 is present in the command line.
16866 @opindex fprofile-filter-files
16867 @item -fprofile-filter-files=@var{regex}
16869 Instrument only functions from files whose name matches
16870 any of the regular expressions (separated by semi-colons).
16872 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
16873 only @file{main.c} and all C files starting with 'module'.
16875 @opindex fprofile-exclude-files
16876 @item -fprofile-exclude-files=@var{regex}
16878 Instrument only functions from files whose name does not match
16879 any of the regular expressions (separated by semi-colons).
16881 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
16882 of all files that are located in the @file{/usr/} folder.
16884 @opindex fprofile-reproducible
16885 @item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
16886 Control level of reproducibility of profile gathered by
16887 @code{-fprofile-generate}.  This makes it possible to rebuild program
16888 with same outcome which is useful, for example, for distribution
16889 packages.
16891 With @option{-fprofile-reproducible=serial} the profile gathered by
16892 @option{-fprofile-generate} is reproducible provided the trained program
16893 behaves the same at each invocation of the train run, it is not
16894 multi-threaded and profile data streaming is always done in the same
16895 order.  Note that profile streaming happens at the end of program run but
16896 also before @code{fork} function is invoked.
16898 Note that it is quite common that execution counts of some part of
16899 programs depends, for example, on length of temporary file names or
16900 memory space randomization (that may affect hash-table collision rate).
16901 Such non-reproducible part of programs may be annotated by
16902 @code{no_instrument_function} function attribute. @command{gcov-dump} with
16903 @option{-l} can be used to dump gathered data and verify that they are
16904 indeed reproducible.
16906 With @option{-fprofile-reproducible=parallel-runs} collected profile
16907 stays reproducible regardless the order of streaming of the data into
16908 gcda files.  This setting makes it possible to run multiple instances of
16909 instrumented program in parallel (such as with @code{make -j}). This
16910 reduces quality of gathered data, in particular of indirect call
16911 profiling.
16913 @opindex fsanitize=address
16914 @item -fsanitize=address
16915 Enable AddressSanitizer, a fast memory error detector.
16916 Memory access instructions are instrumented to detect
16917 out-of-bounds and use-after-free bugs.
16918 The option enables @option{-fsanitize-address-use-after-scope}.
16919 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
16920 more details.  The run-time behavior can be influenced using the
16921 @env{ASAN_OPTIONS} environment variable.  When set to @code{help=1},
16922 the available options are shown at startup of the instrumented program.  See
16923 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
16924 for a list of supported options.
16925 The option cannot be combined with @option{-fsanitize=thread} or
16926 @option{-fsanitize=hwaddress}.  Note that the only target
16927 @option{-fsanitize=hwaddress} is currently supported on is AArch64.
16929 To get more accurate stack traces, it is possible to use options such as
16930 @option{-O0}, @option{-O1}, or @option{-Og} (which, for instance, prevent
16931 most function inlining), @option{-fno-optimize-sibling-calls} (which prevents
16932 optimizing sibling and tail recursive calls; this option is implicit for
16933 @option{-O0}, @option{-O1}, or @option{-Og}), or @option{-fno-ipa-icf} (which
16934 disables Identical Code Folding for functions).  Since multiple runs of the
16935 program may yield backtraces with different addresses due to ASLR (Address
16936 Space Layout Randomization), it may be desirable to turn ASLR off.  On Linux,
16937 this can be achieved with @samp{setarch `uname -m` -R ./prog}.
16939 @opindex fsanitize=kernel-address
16940 @item -fsanitize=kernel-address
16941 Enable AddressSanitizer for Linux kernel.
16942 See @uref{https://github.com/google/kernel-sanitizers} for more details.
16944 @opindex fsanitize=hwaddress
16945 @item -fsanitize=hwaddress
16946 Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
16947 ignore the top byte of a pointer to allow the detection of memory errors with
16948 a low memory overhead.
16949 Memory access instructions are instrumented to detect out-of-bounds and
16950 use-after-free bugs.
16951 The option enables @option{-fsanitize-address-use-after-scope}.
16953 @uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
16954 for more details.  The run-time behavior can be influenced using the
16955 @env{HWASAN_OPTIONS} environment variable.  When set to @code{help=1},
16956 the available options are shown at startup of the instrumented program.
16957 The option cannot be combined with @option{-fsanitize=thread} or
16958 @option{-fsanitize=address}, and is currently only available on AArch64.
16960 @opindex fsanitize=kernel-hwaddress
16961 @item -fsanitize=kernel-hwaddress
16962 Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
16963 Similar to @option{-fsanitize=kernel-address} but using an alternate
16964 instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
16965 instrumentation differences necessary for compiling the Linux kernel.
16966 These differences are to avoid hwasan library initialization calls and to
16967 account for the stack pointer having a different value in its top byte.
16969 @emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
16970 Instrumenting the stack and alloca calls are not on by default but are still
16971 possible by specifying the command-line options
16972 @option{--param hwasan-instrument-stack=1} and
16973 @option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
16974 tag is not implemented for kernel instrumentation.
16976 @opindex fsanitize=pointer-compare
16977 @item -fsanitize=pointer-compare
16978 Instrument comparison operation (<, <=, >, >=) with pointer operands.
16979 The option must be combined with either @option{-fsanitize=kernel-address} or
16980 @option{-fsanitize=address}
16981 The option cannot be combined with @option{-fsanitize=thread}.
16982 Note: By default the check is disabled at run time.  To enable it,
16983 add @code{detect_invalid_pointer_pairs=2} to the environment variable
16984 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
16985 invalid operation only when both pointers are non-null.
16987 @opindex fsanitize=pointer-subtract
16988 @item -fsanitize=pointer-subtract
16989 Instrument subtraction with pointer operands.
16990 The option must be combined with either @option{-fsanitize=kernel-address} or
16991 @option{-fsanitize=address}
16992 The option cannot be combined with @option{-fsanitize=thread}.
16993 Note: By default the check is disabled at run time.  To enable it,
16994 add @code{detect_invalid_pointer_pairs=2} to the environment variable
16995 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
16996 invalid operation only when both pointers are non-null.
16998 @opindex fsanitize=shadow-call-stack
16999 @item -fsanitize=shadow-call-stack
17000 Enable ShadowCallStack, a security enhancement mechanism used to protect
17001 programs against return address overwrites (e.g. stack buffer overflows.)
17002 It works by saving a function's return address to a separately allocated
17003 shadow call stack in the function prologue and restoring the return address
17004 from the shadow call stack in the function epilogue.  Instrumentation only
17005 occurs in functions that need to save the return address to the stack.
17007 Currently it only supports the aarch64 platform.  It is specifically
17008 designed for linux kernels that enable the CONFIG_SHADOW_CALL_STACK option.
17009 For the user space programs, runtime support is not currently provided
17010 in libc and libgcc.  Users who want to use this feature in user space need
17011 to provide their own support for the runtime.  It should be noted that
17012 this may cause the ABI rules to be broken.
17014 On aarch64, the instrumentation makes use of the platform register @code{x18}.
17015 This generally means that any code that may run on the same thread as code
17016 compiled with ShadowCallStack must be compiled with the flag
17017 @option{-ffixed-x18}, otherwise functions compiled without
17018 @option{-ffixed-x18} might clobber @code{x18} and so corrupt the shadow
17019 stack pointer.
17021 Also, because there is no userspace runtime support, code compiled with
17022 ShadowCallStack cannot use exception handling.  Use @option{-fno-exceptions}
17023 to turn off exceptions.
17025 See @uref{https://clang.llvm.org/docs/ShadowCallStack.html} for more
17026 details.
17028 @opindex fsanitize=thread
17029 @item -fsanitize=thread
17030 Enable ThreadSanitizer, a fast data race detector.
17031 Memory access instructions are instrumented to detect
17032 data race bugs.  See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
17033 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
17034 environment variable; see
17035 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
17036 supported options.
17037 The option cannot be combined with @option{-fsanitize=address},
17038 @option{-fsanitize=leak}.
17040 Note that sanitized atomic builtins cannot throw exceptions when
17041 operating on invalid memory addresses with non-call exceptions
17042 (@option{-fnon-call-exceptions}).
17044 @opindex fsanitize=leak
17045 @item -fsanitize=leak
17046 Enable LeakSanitizer, a memory leak detector.
17047 This option only matters for linking of executables.
17048 The executable is linked against a library that overrides @code{malloc}
17049 and other allocator functions.  See
17050 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
17051 details.  The run-time behavior can be influenced using the
17052 @env{LSAN_OPTIONS} environment variable.
17053 The option cannot be combined with @option{-fsanitize=thread}.
17055 @opindex fsanitize=undefined
17056 @item -fsanitize=undefined
17057 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
17058 Various computations are instrumented to detect undefined behavior
17059 at runtime.  See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details.   The run-time behavior can be influenced using the
17060 @env{UBSAN_OPTIONS} environment variable.  Current suboptions are:
17062 @table @gcctabopt
17064 @opindex fsanitize=shift
17065 @item -fsanitize=shift
17066 This option enables checking that the result of a shift operation is
17067 not undefined.  Note that what exactly is considered undefined differs
17068 slightly between C and C++, as well as between ISO C90 and C99, etc.
17069 This option has two suboptions, @option{-fsanitize=shift-base} and
17070 @option{-fsanitize=shift-exponent}.
17072 @opindex fsanitize=shift-exponent
17073 @item -fsanitize=shift-exponent
17074 This option enables checking that the second argument of a shift operation
17075 is not negative and is smaller than the precision of the promoted first
17076 argument.
17078 @opindex fsanitize=shift-base
17079 @item -fsanitize=shift-base
17080 If the second argument of a shift operation is within range, check that the
17081 result of a shift operation is not undefined.  Note that what exactly is
17082 considered undefined differs slightly between C and C++, as well as between
17083 ISO C90 and C99, etc.
17085 @opindex fsanitize=integer-divide-by-zero
17086 @item -fsanitize=integer-divide-by-zero
17087 Detect integer division by zero.
17089 @opindex fsanitize=unreachable
17090 @item -fsanitize=unreachable
17091 With this option, the compiler turns the @code{__builtin_unreachable}
17092 call into a diagnostics message call instead.  When reaching the
17093 @code{__builtin_unreachable} call, the behavior is undefined.
17095 @opindex fsanitize=vla-bound
17096 @item -fsanitize=vla-bound
17097 This option instructs the compiler to check that the size of a variable
17098 length array is positive.
17100 @opindex fsanitize=null
17101 @item -fsanitize=null
17102 This option enables pointer checking.  Particularly, the application
17103 built with this option turned on will issue an error message when it
17104 tries to dereference a NULL pointer, or if a reference (possibly an
17105 rvalue reference) is bound to a NULL pointer, or if a method is invoked
17106 on an object pointed by a NULL pointer.
17108 @opindex fsanitize=return
17109 @item -fsanitize=return
17110 This option enables return statement checking.  Programs
17111 built with this option turned on will issue an error message
17112 when the end of a non-void function is reached without actually
17113 returning a value.  This option works in C++ only.
17115 @opindex fsanitize=signed-integer-overflow
17116 @item -fsanitize=signed-integer-overflow
17117 This option enables signed integer overflow checking.  We check that
17118 the result of @code{+}, @code{*}, and both unary and binary @code{-}
17119 does not overflow in the signed arithmetics.  This also detects
17120 @code{INT_MIN / -1} signed division.  Note, integer promotion
17121 rules must be taken into account.  That is, the following is not an
17122 overflow:
17123 @smallexample
17124 signed char a = SCHAR_MAX;
17125 a++;
17126 @end smallexample
17128 @opindex fsanitize=bounds
17129 @item -fsanitize=bounds
17130 This option enables instrumentation of array bounds.  Various out of bounds
17131 accesses are detected.  Flexible array members, flexible array member-like
17132 arrays, and initializers of variables with static storage are not
17133 instrumented, with the exception of flexible array member-like arrays
17134 for which @code{-fstrict-flex-arrays} or @code{-fstrict-flex-arrays=}
17135 options or @code{strict_flex_array} attributes say they shouldn't be treated
17136 like flexible array member-like arrays.
17138 @opindex fsanitize=bounds-strict
17139 @item -fsanitize=bounds-strict
17140 This option enables strict instrumentation of array bounds.  Most out of bounds
17141 accesses are detected, including flexible array member-like arrays.
17142 Initializers of variables with static storage are not instrumented.
17144 @opindex fsanitize=alignment
17145 @item -fsanitize=alignment
17147 This option enables checking of alignment of pointers when they are
17148 dereferenced, or when a reference is bound to insufficiently aligned target,
17149 or when a method or constructor is invoked on insufficiently aligned object.
17151 @opindex fsanitize=object-size
17152 @item -fsanitize=object-size
17153 This option enables instrumentation of memory references using the
17154 @code{__builtin_dynamic_object_size} function.  Various out of bounds
17155 pointer accesses are detected.
17157 @opindex fsanitize=float-divide-by-zero
17158 @item -fsanitize=float-divide-by-zero
17159 Detect floating-point division by zero.  Unlike other similar options,
17160 @option{-fsanitize=float-divide-by-zero} is not enabled by
17161 @option{-fsanitize=undefined}, since floating-point division by zero can
17162 be a legitimate way of obtaining infinities and NaNs.
17164 @opindex fsanitize=float-cast-overflow
17165 @item -fsanitize=float-cast-overflow
17166 This option enables floating-point type to integer conversion checking.
17167 We check that the result of the conversion does not overflow.
17168 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
17169 not enabled by @option{-fsanitize=undefined}.
17170 This option does not work well with @code{FE_INVALID} exceptions enabled.
17172 @opindex fsanitize=nonnull-attribute
17173 @item -fsanitize=nonnull-attribute
17175 This option enables instrumentation of calls, checking whether null values
17176 are not passed to arguments marked as requiring a non-null value by the
17177 @code{nonnull} function attribute.
17179 @opindex fsanitize=returns-nonnull-attribute
17180 @item -fsanitize=returns-nonnull-attribute
17182 This option enables instrumentation of return statements in functions
17183 marked with @code{returns_nonnull} function attribute, to detect returning
17184 of null values from such functions.
17186 @opindex fsanitize=bool
17187 @item -fsanitize=bool
17189 This option enables instrumentation of loads from bool.  If a value other
17190 than 0/1 is loaded, a run-time error is issued.
17192 @opindex fsanitize=enum
17193 @item -fsanitize=enum
17195 This option enables instrumentation of loads from an enum type.  If
17196 a value outside the range of values for the enum type is loaded,
17197 a run-time error is issued.
17199 @opindex fsanitize=vptr
17200 @item -fsanitize=vptr
17202 This option enables instrumentation of C++ member function calls, member
17203 accesses and some conversions between pointers to base and derived classes,
17204 to verify the referenced object has the correct dynamic type.
17206 @opindex fsanitize=pointer-overflow
17207 @item -fsanitize=pointer-overflow
17209 This option enables instrumentation of pointer arithmetics.  If the pointer
17210 arithmetics overflows, a run-time error is issued.
17212 @opindex fsanitize=builtin
17213 @item -fsanitize=builtin
17215 This option enables instrumentation of arguments to selected builtin
17216 functions.  If an invalid value is passed to such arguments, a run-time
17217 error is issued.  E.g.@ passing 0 as the argument to @code{__builtin_ctz}
17218 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
17219 by this option.
17221 @end table
17223 Note that sanitizers tend to increase the rate of false positive
17224 warnings, most notably those around @option{-Wmaybe-uninitialized}.
17225 We recommend against combining @option{-Werror} and [the use of]
17226 sanitizers.
17228 While @option{-ftrapv} causes traps for signed overflows to be emitted,
17229 @option{-fsanitize=undefined} gives a diagnostic message.
17230 This currently works only for the C family of languages.
17232 @opindex fno-sanitize=all
17233 @item -fno-sanitize=all
17235 This option disables all previously enabled sanitizers.
17236 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
17237 together.
17239 @opindex fasan-shadow-offset
17240 @item -fasan-shadow-offset=@var{number}
17241 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
17242 It is useful for experimenting with different shadow memory layouts in
17243 Kernel AddressSanitizer.
17245 @opindex fsanitize-sections
17246 @item -fsanitize-sections=@var{s1},@var{s2},...
17247 Sanitize global variables in selected user-defined sections.  @var{si} may
17248 contain wildcards.
17250 @opindex fsanitize-recover
17251 @opindex fno-sanitize-recover
17252 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
17253 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
17254 mentioned in comma-separated list of @var{opts}.  Enabling this option
17255 for a sanitizer component causes it to attempt to continue
17256 running the program as if no error happened.  This means multiple
17257 runtime errors can be reported in a single program run, and the exit
17258 code of the program may indicate success even when errors
17259 have been reported.  The @option{-fno-sanitize-recover=} option
17260 can be used to alter
17261 this behavior: only the first detected error is reported
17262 and program then exits with a non-zero exit code.
17264 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
17265 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
17266 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
17267 @option{-fsanitize=bounds-strict},
17268 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
17269 For these sanitizers error recovery is turned on by default,
17270 except @option{-fsanitize=address}, for which this feature is experimental.
17271 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
17272 accepted, the former enables recovery for all sanitizers that support it,
17273 the latter disables recovery for all sanitizers that support it.
17275 Even if a recovery mode is turned on the compiler side, it needs to be also
17276 enabled on the runtime library side, otherwise the failures are still fatal.
17277 The runtime library defaults to @code{halt_on_error=0} for
17278 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
17279 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
17280 setting the @code{halt_on_error} flag in the corresponding environment variable.
17282 Syntax without an explicit @var{opts} parameter is deprecated.  It is
17283 equivalent to specifying an @var{opts} list of:
17285 @smallexample
17286 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
17287 @end smallexample
17289 @opindex fsanitize-address-use-after-scope
17290 @item -fsanitize-address-use-after-scope
17291 Enable sanitization of local variables to detect use-after-scope bugs.
17292 The option sets @option{-fstack-reuse} to @samp{none}.
17294 @opindex fsanitize-trap
17295 @opindex fno-sanitize-trap
17296 @item -fsanitize-trap@r{[}=@var{opts}@r{]}
17297 The @option{-fsanitize-trap=} option instructs the compiler to
17298 report for sanitizers mentioned in comma-separated list of @var{opts}
17299 undefined behavior using @code{__builtin_trap} rather than a @code{libubsan}
17300 library routine.  If this option is enabled for certain sanitizer,
17301 it takes precedence over the @option{-fsanitizer-recover=} for that
17302 sanitizer, @code{__builtin_trap} will be emitted and be fatal regardless
17303 of whether recovery is enabled or disabled using @option{-fsanitize-recover=}.
17305 The advantage of this is that the @code{libubsan} library is not needed
17306 and is not linked in, so this is usable even in freestanding environments.
17308 Currently this feature works with @option{-fsanitize=undefined} (and its suboptions
17309 except for @option{-fsanitize=vptr}), @option{-fsanitize=float-cast-overflow},
17310 @option{-fsanitize=float-divide-by-zero} and
17311 @option{-fsanitize=bounds-strict}.  @code{-fsanitize-trap=all} can be also
17312 specified, which enables it for @code{undefined} suboptions,
17313 @option{-fsanitize=float-cast-overflow},
17314 @option{-fsanitize=float-divide-by-zero} and
17315 @option{-fsanitize=bounds-strict}.
17316 If @code{-fsanitize-trap=undefined} or @code{-fsanitize-trap=all} is used
17317 and @code{-fsanitize=vptr} is enabled on the command line, the
17318 instrumentation is silently ignored as the instrumentation always needs
17319 @code{libubsan} support, @option{-fsanitize-trap=vptr} is not allowed.
17321 @opindex fsanitize-undefined-trap-on-error
17322 @item -fsanitize-undefined-trap-on-error
17323 The @option{-fsanitize-undefined-trap-on-error} option is deprecated
17324 equivalent of @option{-fsanitize-trap=all}.
17326 @opindex fsanitize-coverage=trace-pc
17327 @item -fsanitize-coverage=trace-pc
17328 Enable coverage-guided fuzzing code instrumentation.
17329 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
17331 @opindex fsanitize-coverage=trace-cmp
17332 @item -fsanitize-coverage=trace-cmp
17333 Enable dataflow guided fuzzing code instrumentation.
17334 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
17335 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
17336 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
17337 variable or @code{__sanitizer_cov_trace_const_cmp1},
17338 @code{__sanitizer_cov_trace_const_cmp2},
17339 @code{__sanitizer_cov_trace_const_cmp4} or
17340 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
17341 operand constant, @code{__sanitizer_cov_trace_cmpf} or
17342 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
17343 @code{__sanitizer_cov_trace_switch} for switch statements.
17345 @opindex fcf-protection
17346 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
17347 Enable code instrumentation of control-flow transfers to increase
17348 program security by checking that target addresses of control-flow
17349 transfer instructions (such as indirect function call, function return,
17350 indirect jump) are valid.  This prevents diverting the flow of control
17351 to an unexpected target.  This is intended to protect against such
17352 threats as Return-oriented Programming (ROP), and similarly
17353 call/jmp-oriented programming (COP/JOP).
17355 The value @code{branch} tells the compiler to implement checking of
17356 validity of control-flow transfer at the point of indirect branch
17357 instructions, i.e.@: call/jmp instructions.  The value @code{return}
17358 implements checking of validity at the point of returning from a
17359 function.  The value @code{full} is an alias for specifying both
17360 @code{branch} and @code{return}. The value @code{none} turns off
17361 instrumentation.
17363 The value @code{check} is used for the final link with link-time
17364 optimization (LTO).  An error is issued if LTO object files are
17365 compiled with different @option{-fcf-protection} values.  The
17366 value @code{check} is ignored at the compile time.
17368 The macro @code{__CET__} is defined when @option{-fcf-protection} is
17369 used.  The first bit of @code{__CET__} is set to 1 for the value
17370 @code{branch} and the second bit of @code{__CET__} is set to 1 for
17371 the @code{return}.
17373 You can also use the @code{nocf_check} attribute to identify
17374 which functions and calls should be skipped from instrumentation
17375 (@pxref{Function Attributes}).
17377 Currently the x86 GNU/Linux target provides an implementation based
17378 on Intel Control-flow Enforcement Technology (CET) which works for
17379 i686 processor or newer.
17381 @opindex fharden-compares
17382 @item -fharden-compares
17383 For every logical test that survives gimple optimizations and is
17384 @emph{not} the condition in a conditional branch (for example,
17385 conditions tested for conditional moves, or to store in boolean
17386 variables), emit extra code to compute and verify the reversed
17387 condition, and to call @code{__builtin_trap} if the results do not
17388 match.  Use with @samp{-fharden-conditional-branches} to cover all
17389 conditionals.
17391 @opindex fharden-conditional-branches
17392 @item -fharden-conditional-branches
17393 For every non-vectorized conditional branch that survives gimple
17394 optimizations, emit extra code to compute and verify the reversed
17395 condition, and to call @code{__builtin_trap} if the result is
17396 unexpected.  Use with @samp{-fharden-compares} to cover all
17397 conditionals.
17399 @opindex fstack-protector
17400 @item -fstack-protector
17401 Emit extra code to check for buffer overflows, such as stack smashing
17402 attacks.  This is done by adding a guard variable to functions with
17403 vulnerable objects.  This includes functions that call @code{alloca}, and
17404 functions with buffers larger than or equal to 8 bytes.  The guards are
17405 initialized when a function is entered and then checked when the function
17406 exits.  If a guard check fails, an error message is printed and the program
17407 exits.  Only variables that are actually allocated on the stack are
17408 considered, optimized away variables or variables allocated in registers
17409 don't count.
17411 @opindex fstack-protector-all
17412 @item -fstack-protector-all
17413 Like @option{-fstack-protector} except that all functions are protected.
17415 @opindex fstack-protector-strong
17416 @item -fstack-protector-strong
17417 Like @option{-fstack-protector} but includes additional functions to
17418 be protected --- those that have local array definitions, or have
17419 references to local frame addresses.  Only variables that are actually
17420 allocated on the stack are considered, optimized away variables or variables
17421 allocated in registers don't count.
17423 @opindex fstack-protector-explicit
17424 @item -fstack-protector-explicit
17425 Like @option{-fstack-protector} but only protects those functions which
17426 have the @code{stack_protect} attribute.
17428 @opindex fstack-check
17429 @item -fstack-check
17430 Generate code to verify that you do not go beyond the boundary of the
17431 stack.  You should specify this flag if you are running in an
17432 environment with multiple threads, but you only rarely need to specify it in
17433 a single-threaded environment since stack overflow is automatically
17434 detected on nearly all systems if there is only one stack.
17436 Note that this switch does not actually cause checking to be done; the
17437 operating system or the language runtime must do that.  The switch causes
17438 generation of code to ensure that they see the stack being extended.
17440 You can additionally specify a string parameter: @samp{no} means no
17441 checking, @samp{generic} means force the use of old-style checking,
17442 @samp{specific} means use the best checking method and is equivalent
17443 to bare @option{-fstack-check}.
17445 Old-style checking is a generic mechanism that requires no specific
17446 target support in the compiler but comes with the following drawbacks:
17448 @enumerate
17449 @item
17450 Modified allocation strategy for large objects: they are always
17451 allocated dynamically if their size exceeds a fixed threshold.  Note this
17452 may change the semantics of some code.
17454 @item
17455 Fixed limit on the size of the static frame of functions: when it is
17456 topped by a particular function, stack checking is not reliable and
17457 a warning is issued by the compiler.
17459 @item
17460 Inefficiency: because of both the modified allocation strategy and the
17461 generic implementation, code performance is hampered.
17462 @end enumerate
17464 Note that old-style stack checking is also the fallback method for
17465 @samp{specific} if no target support has been added in the compiler.
17467 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
17468 and stack overflows.  @samp{specific} is an excellent choice when compiling
17469 Ada code.  It is not generally sufficient to protect against stack-clash
17470 attacks.  To protect against those you want @samp{-fstack-clash-protection}.
17472 @opindex fstack-clash-protection
17473 @item -fstack-clash-protection
17474 Generate code to prevent stack clash style attacks.  When this option is
17475 enabled, the compiler will only allocate one page of stack space at a time
17476 and each page is accessed immediately after allocation.  Thus, it prevents
17477 allocations from jumping over any stack guard page provided by the
17478 operating system.
17480 Most targets do not fully support stack clash protection.  However, on
17481 those targets @option{-fstack-clash-protection} will protect dynamic stack
17482 allocations.  @option{-fstack-clash-protection} may also provide limited
17483 protection for static stack allocations if the target supports
17484 @option{-fstack-check=specific}.
17486 @opindex fstack-limit-register
17487 @opindex fstack-limit-symbol
17488 @opindex fno-stack-limit
17489 @item -fstack-limit-register=@var{reg}
17490 @itemx -fstack-limit-symbol=@var{sym}
17491 @itemx -fno-stack-limit
17492 Generate code to ensure that the stack does not grow beyond a certain value,
17493 either the value of a register or the address of a symbol.  If a larger
17494 stack is required, a signal is raised at run time.  For most targets,
17495 the signal is raised before the stack overruns the boundary, so
17496 it is possible to catch the signal without taking special precautions.
17498 For instance, if the stack starts at absolute address @samp{0x80000000}
17499 and grows downwards, you can use the flags
17500 @option{-fstack-limit-symbol=__stack_limit} and
17501 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
17502 of 128KB@.  Note that this may only work with the GNU linker.
17504 You can locally override stack limit checking by using the
17505 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
17507 @opindex fsplit-stack
17508 @item -fsplit-stack
17509 Generate code to automatically split the stack before it overflows.
17510 The resulting program has a discontiguous stack which can only
17511 overflow if the program is unable to allocate any more memory.  This
17512 is most useful when running threaded programs, as it is no longer
17513 necessary to calculate a good stack size to use for each thread.  This
17514 is currently only implemented for the x86 targets running
17515 GNU/Linux.
17517 When code compiled with @option{-fsplit-stack} calls code compiled
17518 without @option{-fsplit-stack}, there may not be much stack space
17519 available for the latter code to run.  If compiling all code,
17520 including library code, with @option{-fsplit-stack} is not an option,
17521 then the linker can fix up these calls so that the code compiled
17522 without @option{-fsplit-stack} always has a large stack.  Support for
17523 this is implemented in the gold linker in GNU binutils release 2.21
17524 and later.
17526 @opindex fvtable-verify
17527 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
17528 This option is only available when compiling C++ code.
17529 It turns on (or off, if using @option{-fvtable-verify=none}) the security
17530 feature that verifies at run time, for every virtual call, that
17531 the vtable pointer through which the call is made is valid for the type of
17532 the object, and has not been corrupted or overwritten.  If an invalid vtable
17533 pointer is detected at run time, an error is reported and execution of the
17534 program is immediately halted.
17536 This option causes run-time data structures to be built at program startup,
17537 which are used for verifying the vtable pointers.  
17538 The options @samp{std} and @samp{preinit}
17539 control the timing of when these data structures are built.  In both cases the
17540 data structures are built before execution reaches @code{main}.  Using
17541 @option{-fvtable-verify=std} causes the data structures to be built after
17542 shared libraries have been loaded and initialized.
17543 @option{-fvtable-verify=preinit} causes them to be built before shared
17544 libraries have been loaded and initialized.
17546 If this option appears multiple times in the command line with different
17547 values specified, @samp{none} takes highest priority over both @samp{std} and
17548 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
17550 @opindex fvtv-debug
17551 @item -fvtv-debug
17552 When used in conjunction with @option{-fvtable-verify=std} or 
17553 @option{-fvtable-verify=preinit}, causes debug versions of the 
17554 runtime functions for the vtable verification feature to be called.  
17555 This flag also causes the compiler to log information about which 
17556 vtable pointers it finds for each class.
17557 This information is written to a file named @file{vtv_set_ptr_data.log} 
17558 in the directory named by the environment variable @env{VTV_LOGS_DIR} 
17559 if that is defined or the current working directory otherwise.
17561 Note:  This feature @emph{appends} data to the log file. If you want a fresh log
17562 file, be sure to delete any existing one.
17564 @opindex fvtv-counts
17565 @item -fvtv-counts
17566 This is a debugging flag.  When used in conjunction with
17567 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
17568 causes the compiler to keep track of the total number of virtual calls
17569 it encounters and the number of verifications it inserts.  It also
17570 counts the number of calls to certain run-time library functions
17571 that it inserts and logs this information for each compilation unit.
17572 The compiler writes this information to a file named
17573 @file{vtv_count_data.log} in the directory named by the environment
17574 variable @env{VTV_LOGS_DIR} if that is defined or the current working
17575 directory otherwise.  It also counts the size of the vtable pointer sets
17576 for each class, and writes this information to @file{vtv_class_set_sizes.log}
17577 in the same directory.
17579 Note:  This feature @emph{appends} data to the log files.  To get fresh log
17580 files, be sure to delete any existing ones.
17582 @opindex finstrument-functions
17583 @item -finstrument-functions
17584 Generate instrumentation calls for entry and exit to functions.  Just
17585 after function entry and just before function exit, the following
17586 profiling functions are called with the address of the current
17587 function and its call site.  (On some platforms,
17588 @code{__builtin_return_address} does not work beyond the current
17589 function, so the call site information may not be available to the
17590 profiling functions otherwise.)
17592 @smallexample
17593 void __cyg_profile_func_enter (void *this_fn,
17594                                void *call_site);
17595 void __cyg_profile_func_exit  (void *this_fn,
17596                                void *call_site);
17597 @end smallexample
17599 The first argument is the address of the start of the current function,
17600 which may be looked up exactly in the symbol table.
17602 This instrumentation is also done for functions expanded inline in other
17603 functions.  The profiling calls indicate where, conceptually, the
17604 inline function is entered and exited.  This means that addressable
17605 versions of such functions must be available.  If all your uses of a
17606 function are expanded inline, this may mean an additional expansion of
17607 code size.  If you use @code{extern inline} in your C code, an
17608 addressable version of such functions must be provided.  (This is
17609 normally the case anyway, but if you get lucky and the optimizer always
17610 expands the functions inline, you might have gotten away without
17611 providing static copies.)
17613 A function may be given the attribute @code{no_instrument_function}, in
17614 which case this instrumentation is not done.  This can be used, for
17615 example, for the profiling functions listed above, high-priority
17616 interrupt routines, and any functions from which the profiling functions
17617 cannot safely be called (perhaps signal handlers, if the profiling
17618 routines generate output or allocate memory).
17619 @xref{Common Function Attributes}.
17621 @opindex finstrument-functions-once
17622 @item -finstrument-functions-once
17623 This is similar to @option{-finstrument-functions}, but the profiling
17624 functions are called only once per instrumented function, i.e. the first
17625 profiling function is called after the first entry into the instrumented
17626 function and the second profiling function is called before the exit
17627 corresponding to this first entry.
17629 The definition of @code{once} for the purpose of this option is a little
17630 vague because the implementation is not protected against data races.
17631 As a result, the implementation only guarantees that the profiling
17632 functions are called at @emph{least} once per process and at @emph{most}
17633 once per thread, but the calls are always paired, that is to say, if a
17634 thread calls the first function, then it will call the second function,
17635 unless it never reaches the exit of the instrumented function.
17637 @opindex finstrument-functions-exclude-file-list
17638 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
17640 Set the list of functions that are excluded from instrumentation (see
17641 the description of @option{-finstrument-functions}).  If the file that
17642 contains a function definition matches with one of @var{file}, then
17643 that function is not instrumented.  The match is done on substrings:
17644 if the @var{file} parameter is a substring of the file name, it is
17645 considered to be a match.
17647 For example:
17649 @smallexample
17650 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
17651 @end smallexample
17653 @noindent
17654 excludes any inline function defined in files whose pathnames
17655 contain @file{/bits/stl} or @file{include/sys}.
17657 If, for some reason, you want to include letter @samp{,} in one of
17658 @var{sym}, write @samp{\,}. For example,
17659 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
17660 (note the single quote surrounding the option).
17662 @opindex finstrument-functions-exclude-function-list
17663 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
17665 This is similar to @option{-finstrument-functions-exclude-file-list},
17666 but this option sets the list of function names to be excluded from
17667 instrumentation.  The function name to be matched is its user-visible
17668 name, such as @code{vector<int> blah(const vector<int> &)}, not the
17669 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
17670 match is done on substrings: if the @var{sym} parameter is a substring
17671 of the function name, it is considered to be a match.  For C99 and C++
17672 extended identifiers, the function name must be given in UTF-8, not
17673 using universal character names.
17675 @opindex fpatchable-function-entry
17676 @item -fpatchable-function-entry=@var{N}[,@var{M}]
17677 Generate @var{N} NOPs right at the beginning
17678 of each function, with the function entry point before the @var{M}th NOP.
17679 If @var{M} is omitted, it defaults to @code{0} so the
17680 function entry points to the address just at the first NOP.
17681 The NOP instructions reserve extra space which can be used to patch in
17682 any desired instrumentation at run time, provided that the code segment
17683 is writable.  The amount of space is controllable indirectly via
17684 the number of NOPs; the NOP instruction used corresponds to the instruction
17685 emitted by the internal GCC back-end interface @code{gen_nop}.  This behavior
17686 is target-specific and may also depend on the architecture variant and/or
17687 other compilation options.
17689 For run-time identification, the starting addresses of these areas,
17690 which correspond to their respective function entries minus @var{M},
17691 are additionally collected in the @code{__patchable_function_entries}
17692 section of the resulting binary.
17694 Note that the value of @code{__attribute__ ((patchable_function_entry
17695 (N,M)))} takes precedence over command-line option
17696 @option{-fpatchable-function-entry=N,M}.  This can be used to increase
17697 the area size or to remove it completely on a single function.
17698 If @code{N=0}, no pad location is recorded.
17700 The NOP instructions are inserted at---and maybe before, depending on
17701 @var{M}---the function entry address, even before the prologue.  On
17702 PowerPC with the ELFv2 ABI, for a function with dual entry points,
17703 the local entry point is this function entry address.
17705 The maximum value of @var{N} and @var{M} is 65535.  On PowerPC with the
17706 ELFv2 ABI, for a function with dual entry points, the supported values
17707 for @var{M} are 0, 2, 6 and 14.
17708 @end table
17711 @node Preprocessor Options
17712 @section Options Controlling the Preprocessor
17713 @cindex preprocessor options
17714 @cindex options, preprocessor
17716 These options control the C preprocessor, which is run on each C source
17717 file before actual compilation.
17719 If you use the @option{-E} option, nothing is done except preprocessing.
17720 Some of these options make sense only together with @option{-E} because
17721 they cause the preprocessor output to be unsuitable for actual
17722 compilation.
17724 In addition to the options listed here, there are a number of options 
17725 to control search paths for include files documented in 
17726 @ref{Directory Options}.  
17727 Options to control preprocessor diagnostics are listed in 
17728 @ref{Warning Options}.
17730 @table @gcctabopt
17731 @include cppopts.texi
17733 @opindex Wp
17734 @item -Wp,@var{option}
17735 You can use @option{-Wp,@var{option}} to bypass the compiler driver
17736 and pass @var{option} directly through to the preprocessor.  If
17737 @var{option} contains commas, it is split into multiple options at the
17738 commas.  However, many options are modified, translated or interpreted
17739 by the compiler driver before being passed to the preprocessor, and
17740 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
17741 interface is undocumented and subject to change, so whenever possible
17742 you should avoid using @option{-Wp} and let the driver handle the
17743 options instead.
17745 @opindex Xpreprocessor
17746 @item -Xpreprocessor @var{option}
17747 Pass @var{option} as an option to the preprocessor.  You can use this to
17748 supply system-specific preprocessor options that GCC does not 
17749 recognize.
17751 If you want to pass an option that takes an argument, you must use
17752 @option{-Xpreprocessor} twice, once for the option and once for the argument.
17754 @opindex no-integrated-cpp
17755 @item -no-integrated-cpp
17756 Perform preprocessing as a separate pass before compilation.
17757 By default, GCC performs preprocessing as an integrated part of
17758 input tokenization and parsing.
17759 If this option is provided, the appropriate language front end
17760 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
17761 and Objective-C, respectively) is instead invoked twice,
17762 once for preprocessing only and once for actual compilation
17763 of the preprocessed input.
17764 This option may be useful in conjunction with the @option{-B} or
17765 @option{-wrapper} options to specify an alternate preprocessor or
17766 perform additional processing of the program source between
17767 normal preprocessing and compilation.
17769 @opindex flarge-source-files
17770 @item -flarge-source-files
17771 Adjust GCC to expect large source files, at the expense of slower
17772 compilation and higher memory usage.
17774 Specifically, GCC normally tracks both column numbers and line numbers
17775 within source files and it normally prints both of these numbers in
17776 diagnostics.  However, once it has processed a certain number of source
17777 lines, it stops tracking column numbers and only tracks line numbers.
17778 This means that diagnostics for later lines do not include column numbers.
17779 It also means that options like @option{-Wmisleading-indentation} cease to work
17780 at that point, although the compiler prints a note if this happens.
17781 Passing @option{-flarge-source-files} significantly increases the number
17782 of source lines that GCC can process before it stops tracking columns.
17784 @end table
17786 @node Assembler Options
17787 @section Passing Options to the Assembler
17789 @c prevent bad page break with this line
17790 You can pass options to the assembler.
17792 @table @gcctabopt
17793 @opindex Wa
17794 @item -Wa,@var{option}
17795 Pass @var{option} as an option to the assembler.  If @var{option}
17796 contains commas, it is split into multiple options at the commas.
17798 @opindex Xassembler
17799 @item -Xassembler @var{option}
17800 Pass @var{option} as an option to the assembler.  You can use this to
17801 supply system-specific assembler options that GCC does not
17802 recognize.
17804 If you want to pass an option that takes an argument, you must use
17805 @option{-Xassembler} twice, once for the option and once for the argument.
17807 @end table
17809 @node Link Options
17810 @section Options for Linking
17811 @cindex link options
17812 @cindex options, linking
17814 These options come into play when the compiler links object files into
17815 an executable output file.  They are meaningless if the compiler is
17816 not doing a link step.
17818 @table @gcctabopt
17819 @cindex file names
17820 @item @var{object-file-name}
17821 A file name that does not end in a special recognized suffix is
17822 considered to name an object file or library.  (Object files are
17823 distinguished from libraries by the linker according to the file
17824 contents.)  If linking is done, these object files are used as input
17825 to the linker.
17827 @opindex c
17828 @opindex S
17829 @opindex E
17830 @item -c
17831 @itemx -S
17832 @itemx -E
17833 If any of these options is used, then the linker is not run, and
17834 object file names should not be used as arguments.  @xref{Overall
17835 Options}.
17837 @opindex flinker-output
17838 @item -flinker-output=@var{type}
17839 This option controls code generation of the link-time optimizer.  By
17840 default the linker output is automatically determined by the linker
17841 plugin.  For debugging the compiler and if incremental linking with a 
17842 non-LTO object file is desired, it may be useful to control the type
17843 manually.
17845 If @var{type} is @samp{exec}, code generation produces a static
17846 binary. In this case @option{-fpic} and @option{-fpie} are both
17847 disabled.
17849 If @var{type} is @samp{dyn}, code generation produces a shared
17850 library.  In this case @option{-fpic} or @option{-fPIC} is preserved,
17851 but not enabled automatically.  This allows to build shared libraries
17852 without position-independent code on architectures where this is
17853 possible, i.e.@: on x86.
17855 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
17856 executable. This results in similar optimizations as @samp{exec}
17857 except that @option{-fpie} is not disabled if specified at compilation
17858 time.
17860 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
17861 done.  The sections containing intermediate code for link-time optimization are
17862 merged, pre-optimized, and output to the resulting object file. In addition, if
17863 @option{-ffat-lto-objects} is specified, binary code is produced for future
17864 non-LTO linking. The object file produced by incremental linking is smaller
17865 than a static library produced from the same object files.  At link time the
17866 result of incremental linking also loads faster than a static
17867 library assuming that the majority of objects in the library are used.
17869 Finally @samp{nolto-rel} configures the compiler for incremental linking where
17870 code generation is forced, a final binary is produced, and the intermediate
17871 code for later link-time optimization is stripped. When multiple object files
17872 are linked together the resulting code is better optimized than with
17873 link-time optimizations disabled (for example, cross-module inlining 
17874 happens), but most of benefits of whole program optimizations are lost. 
17876 During the incremental link (by @option{-r}) the linker plugin defaults to
17877 @option{rel}. With current interfaces to GNU Binutils it is however not
17878 possible to incrementally link LTO objects and non-LTO objects into a single
17879 mixed object file.  If any of object files in incremental link cannot
17880 be used for link-time optimization, the linker plugin issues a warning and
17881 uses @samp{nolto-rel}. To maintain whole program optimization, it is
17882 recommended to link such objects into static library instead. Alternatively it
17883 is possible to use H.J. Lu's binutils with support for mixed objects.
17885 @opindex fuse-ld=bfd
17886 @item -fuse-ld=bfd
17887 Use the @command{bfd} linker instead of the default linker.
17889 @opindex fuse-ld=gold
17890 @item -fuse-ld=gold
17891 Use the @command{gold} linker instead of the default linker.
17893 @opindex fuse-ld=lld
17894 @item -fuse-ld=lld
17895 Use the LLVM @command{lld} linker instead of the default linker.
17897 @opindex fuse-ld=mold
17898 @item -fuse-ld=mold
17899 Use the Modern Linker (@command{mold}) instead of the default linker.
17901 @cindex Libraries
17902 @opindex l
17903 @item -l@var{library}
17904 @itemx -l @var{library}
17905 Search the library named @var{library} when linking.  (The second
17906 alternative with the library as a separate argument is only for
17907 POSIX compliance and is not recommended.)
17909 The @option{-l} option is passed directly to the linker by GCC.  Refer
17910 to your linker documentation for exact details.  The general
17911 description below applies to the GNU linker.  
17913 The linker searches a standard list of directories for the library.
17914 The directories searched include several standard system directories
17915 plus any that you specify with @option{-L}.
17917 Static libraries are archives of object files, and have file names
17918 like @file{lib@var{library}.a}.  Some targets also support shared
17919 libraries, which typically have names like @file{lib@var{library}.so}.
17920 If both static and shared libraries are found, the linker gives
17921 preference to linking with the shared library unless the
17922 @option{-static} option is used.
17924 It makes a difference where in the command you write this option; the
17925 linker searches and processes libraries and object files in the order they
17926 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
17927 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
17928 to functions in @samp{z}, those functions may not be loaded.
17930 @opindex lobjc
17931 @item -lobjc
17932 You need this special case of the @option{-l} option in order to
17933 link an Objective-C or Objective-C++ program.
17935 @opindex nostartfiles
17936 @item -nostartfiles
17937 Do not use the standard system startup files when linking.
17938 The standard system libraries are used normally, unless @option{-nostdlib},
17939 @option{-nolibc}, or @option{-nodefaultlibs} is used.
17941 @opindex nodefaultlibs
17942 @item -nodefaultlibs
17943 Do not use the standard system libraries when linking.
17944 Only the libraries you specify are passed to the linker, and options
17945 specifying linkage of the system libraries, such as @option{-static-libgcc}
17946 or @option{-shared-libgcc}, are ignored.  
17947 The standard startup files are used normally, unless @option{-nostartfiles}
17948 is used.  
17950 The compiler may generate calls to @code{memcmp},
17951 @code{memset}, @code{memcpy} and @code{memmove}.
17952 These entries are usually resolved by entries in
17953 libc.  These entry points should be supplied through some other
17954 mechanism when this option is specified.
17956 @opindex nolibc
17957 @item -nolibc
17958 Do not use the C library or system libraries tightly coupled with it when
17959 linking.  Still link with the startup files, @file{libgcc} or toolchain
17960 provided language support libraries such as @file{libgnat}, @file{libgfortran}
17961 or @file{libstdc++} unless options preventing their inclusion are used as
17962 well.  This typically removes @option{-lc} from the link command line, as well
17963 as system libraries that normally go with it and become meaningless when
17964 absence of a C library is assumed, for example @option{-lpthread} or
17965 @option{-lm} in some configurations.  This is intended for bare-board
17966 targets when there is indeed no C library available.
17968 @opindex nostdlib
17969 @item -nostdlib
17970 Do not use the standard system startup files or libraries when linking.
17971 No startup files and only the libraries you specify are passed to
17972 the linker, and options specifying linkage of the system libraries, such as
17973 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
17975 The compiler may generate calls to @code{memcmp}, @code{memset},
17976 @code{memcpy} and @code{memmove}.
17977 These entries are usually resolved by entries in
17978 libc.  These entry points should be supplied through some other
17979 mechanism when this option is specified.
17981 @cindex @option{-lgcc}, use with @option{-nostdlib}
17982 @cindex @option{-nostdlib} and unresolved references
17983 @cindex unresolved references and @option{-nostdlib}
17984 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
17985 @cindex @option{-nodefaultlibs} and unresolved references
17986 @cindex unresolved references and @option{-nodefaultlibs}
17987 One of the standard libraries bypassed by @option{-nostdlib} and
17988 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
17989 which GCC uses to overcome shortcomings of particular machines, or special
17990 needs for some languages.
17991 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
17992 Collection (GCC) Internals},
17993 for more discussion of @file{libgcc.a}.)
17994 In most cases, you need @file{libgcc.a} even when you want to avoid
17995 other standard libraries.  In other words, when you specify @option{-nostdlib}
17996 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
17997 This ensures that you have no unresolved references to internal GCC
17998 library subroutines.
17999 (An example of such an internal subroutine is @code{__main}, used to ensure C++
18000 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
18001 GNU Compiler Collection (GCC) Internals}.)
18003 @opindex nostdlib++
18004 @item -nostdlib++
18005 Do not implicitly link with standard C++ libraries.
18007 @opindex e
18008 @opindex entry
18009 @item -e @var{entry}
18010 @itemx --entry=@var{entry}
18012 Specify that the program entry point is @var{entry}.  The argument is
18013 interpreted by the linker; the GNU linker accepts either a symbol name
18014 or an address.
18016 @opindex pie
18017 @item -pie
18018 Produce a dynamically linked position independent executable on targets
18019 that support it.  For predictable results, you must also specify the same
18020 set of options used for compilation (@option{-fpie}, @option{-fPIE},
18021 or model suboptions) when you specify this linker option.
18023 @opindex no-pie
18024 @item -no-pie
18025 Don't produce a dynamically linked position independent executable.
18027 @opindex static-pie
18028 @item -static-pie
18029 Produce a static position independent executable on targets that support
18030 it.  A static position independent executable is similar to a static
18031 executable, but can be loaded at any address without a dynamic linker.
18032 For predictable results, you must also specify the same set of options
18033 used for compilation (@option{-fpie}, @option{-fPIE}, or model
18034 suboptions) when you specify this linker option.
18036 @opindex pthread
18037 @item -pthread
18038 Link with the POSIX threads library.  This option is supported on 
18039 GNU/Linux targets, most other Unix derivatives, and also on 
18040 x86 Cygwin and MinGW targets.  On some targets this option also sets 
18041 flags for the preprocessor, so it should be used consistently for both
18042 compilation and linking.
18044 @opindex r
18045 @item -r
18046 Produce a relocatable object as output.  This is also known as partial
18047 linking.
18049 @opindex rdynamic
18050 @item -rdynamic
18051 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
18052 that support it. This instructs the linker to add all symbols, not
18053 only used ones, to the dynamic symbol table. This option is needed
18054 for some uses of @code{dlopen} or to allow obtaining backtraces
18055 from within a program.
18057 @opindex s
18058 @item -s
18059 Remove all symbol table and relocation information from the executable.
18061 @opindex static
18062 @item -static
18063 On systems that support dynamic linking, this overrides @option{-pie}
18064 and prevents linking with the shared libraries.  On other systems, this
18065 option has no effect.
18067 @opindex shared
18068 @item -shared
18069 Produce a shared object which can then be linked with other objects to
18070 form an executable.  Not all systems support this option.  For predictable
18071 results, you must also specify the same set of options used for compilation
18072 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
18073 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
18074 needs to build supplementary stub code for constructors to work.  On
18075 multi-libbed systems, @samp{gcc -shared} must select the correct support
18076 libraries to link against.  Failing to supply the correct flags may lead
18077 to subtle defects.  Supplying them in cases where they are not necessary
18078 is innocuous.  @option{-shared} suppresses the addition of startup code
18079 to alter the floating-point environment as done with @option{-ffast-math},
18080 @option{-Ofast} or @option{-funsafe-math-optimizations} on some targets.}
18082 @opindex shared-libgcc
18083 @opindex static-libgcc
18084 @item -shared-libgcc
18085 @itemx -static-libgcc
18086 On systems that provide @file{libgcc} as a shared library, these options
18087 force the use of either the shared or static version, respectively.
18088 If no shared version of @file{libgcc} was built when the compiler was
18089 configured, these options have no effect.
18091 There are several situations in which an application should use the
18092 shared @file{libgcc} instead of the static version.  The most common
18093 of these is when the application wishes to throw and catch exceptions
18094 across different shared libraries.  In that case, each of the libraries
18095 as well as the application itself should use the shared @file{libgcc}.
18097 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
18098 whenever you build a shared library or a main executable, because C++
18099 programs typically use exceptions, so this is the right thing to do.
18101 If, instead, you use the GCC driver to create shared libraries, you may
18102 find that they are not always linked with the shared @file{libgcc}.
18103 If GCC finds, at its configuration time, that you have a non-GNU linker
18104 or a GNU linker that does not support option @option{--eh-frame-hdr},
18105 it links the shared version of @file{libgcc} into shared libraries
18106 by default.  Otherwise, it takes advantage of the linker and optimizes
18107 away the linking with the shared version of @file{libgcc}, linking with
18108 the static version of libgcc by default.  This allows exceptions to
18109 propagate through such shared libraries, without incurring relocation
18110 costs at library load time.
18112 However, if a library or main executable is supposed to throw or catch
18113 exceptions, you must link it using the G++ driver, or using the option
18114 @option{-shared-libgcc}, such that it is linked with the shared
18115 @file{libgcc}.
18117 @opindex static-libasan
18118 @item -static-libasan
18119 When the @option{-fsanitize=address} option is used to link a program,
18120 the GCC driver automatically links against @option{libasan}.  If
18121 @file{libasan} is available as a shared library, and the @option{-static}
18122 option is not used, then this links against the shared version of
18123 @file{libasan}.  The @option{-static-libasan} option directs the GCC
18124 driver to link @file{libasan} statically, without necessarily linking
18125 other libraries statically.
18127 @opindex static-libtsan
18128 @item -static-libtsan
18129 When the @option{-fsanitize=thread} option is used to link a program,
18130 the GCC driver automatically links against @option{libtsan}.  If
18131 @file{libtsan} is available as a shared library, and the @option{-static}
18132 option is not used, then this links against the shared version of
18133 @file{libtsan}.  The @option{-static-libtsan} option directs the GCC
18134 driver to link @file{libtsan} statically, without necessarily linking
18135 other libraries statically.
18137 @opindex static-liblsan
18138 @item -static-liblsan
18139 When the @option{-fsanitize=leak} option is used to link a program,
18140 the GCC driver automatically links against @option{liblsan}.  If
18141 @file{liblsan} is available as a shared library, and the @option{-static}
18142 option is not used, then this links against the shared version of
18143 @file{liblsan}.  The @option{-static-liblsan} option directs the GCC
18144 driver to link @file{liblsan} statically, without necessarily linking
18145 other libraries statically.
18147 @opindex static-libubsan
18148 @item -static-libubsan
18149 When the @option{-fsanitize=undefined} option is used to link a program,
18150 the GCC driver automatically links against @option{libubsan}.  If
18151 @file{libubsan} is available as a shared library, and the @option{-static}
18152 option is not used, then this links against the shared version of
18153 @file{libubsan}.  The @option{-static-libubsan} option directs the GCC
18154 driver to link @file{libubsan} statically, without necessarily linking
18155 other libraries statically.
18157 @opindex static-libstdc++
18158 @item -static-libstdc++
18159 When the @command{g++} program is used to link a C++ program, it
18160 normally automatically links against @option{libstdc++}.  If
18161 @file{libstdc++} is available as a shared library, and the
18162 @option{-static} option is not used, then this links against the
18163 shared version of @file{libstdc++}.  That is normally fine.  However, it
18164 is sometimes useful to freeze the version of @file{libstdc++} used by
18165 the program without going all the way to a fully static link.  The
18166 @option{-static-libstdc++} option directs the @command{g++} driver to
18167 link @file{libstdc++} statically, without necessarily linking other
18168 libraries statically.
18170 @opindex symbolic
18171 @item -symbolic
18172 Bind references to global symbols when building a shared object.  Warn
18173 about any unresolved references (unless overridden by the link editor
18174 option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support
18175 this option.
18177 @opindex T
18178 @cindex linker script
18179 @item -T @var{script}
18180 Use @var{script} as the linker script.  This option is supported by most
18181 systems using the GNU linker.  On some targets, such as bare-board
18182 targets without an operating system, the @option{-T} option may be required
18183 when linking to avoid references to undefined symbols.
18185 @opindex Xlinker
18186 @item -Xlinker @var{option}
18187 Pass @var{option} as an option to the linker.  You can use this to
18188 supply system-specific linker options that GCC does not recognize.
18190 If you want to pass an option that takes a separate argument, you must use
18191 @option{-Xlinker} twice, once for the option and once for the argument.
18192 For example, to pass @option{-assert definitions}, you must write
18193 @option{-Xlinker -assert -Xlinker definitions}.  It does not work to write
18194 @option{-Xlinker "-assert definitions"}, because this passes the entire
18195 string as a single argument, which is not what the linker expects.
18197 When using the GNU linker, it is usually more convenient to pass
18198 arguments to linker options using the @option{@var{option}=@var{value}}
18199 syntax than as separate arguments.  For example, you can specify
18200 @option{-Xlinker -Map=output.map} rather than
18201 @option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
18202 this syntax for command-line options.
18204 @opindex Wl
18205 @item -Wl,@var{option}
18206 Pass @var{option} as an option to the linker.  If @var{option} contains
18207 commas, it is split into multiple options at the commas.  You can use this
18208 syntax to pass an argument to the option.
18209 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
18210 linker.  When using the GNU linker, you can also get the same effect with
18211 @option{-Wl,-Map=output.map}.
18213 @opindex u
18214 @item -u @var{symbol}
18215 Pretend the symbol @var{symbol} is undefined, to force linking of
18216 library modules to define it.  You can use @option{-u} multiple times with
18217 different symbols to force loading of additional library modules.
18219 @opindex z
18220 @item -z @var{keyword}
18221 @option{-z} is passed directly on to the linker along with the keyword
18222 @var{keyword}. See the section in the documentation of your linker for
18223 permitted values and their meanings.
18224 @end table
18226 @node Directory Options
18227 @section Options for Directory Search
18228 @cindex directory options
18229 @cindex options, directory search
18230 @cindex search path
18232 These options specify directories to search for header files, for
18233 libraries and for parts of the compiler:
18235 @table @gcctabopt
18236 @include cppdiropts.texi
18238 @opindex iplugindir=
18239 @item -iplugindir=@var{dir}
18240 Set the directory to search for plugins that are passed
18241 by @option{-fplugin=@var{name}} instead of
18242 @option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
18243 to be used by the user, but only passed by the driver.
18245 @opindex L
18246 @item -L@var{dir}
18247 Add directory @var{dir} to the list of directories to be searched
18248 for @option{-l}.
18250 @opindex B
18251 @item -B@var{prefix}
18252 This option specifies where to find the executables, libraries,
18253 include files, and data files of the compiler itself.
18255 The compiler driver program runs one or more of the subprograms
18256 @command{cpp}, @command{cc1}, @command{as} and @command{ld}.  It tries
18257 @var{prefix} as a prefix for each program it tries to run, both with and
18258 without @samp{@var{machine}/@var{version}/} for the corresponding target
18259 machine and compiler version.
18261 For each subprogram to be run, the compiler driver first tries the
18262 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
18263 is not specified, the driver tries two standard prefixes, 
18264 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
18265 those results in a file name that is found, the unmodified program
18266 name is searched for using the directories specified in your
18267 @env{PATH} environment variable.
18269 The compiler checks to see if the path provided by @option{-B}
18270 refers to a directory, and if necessary it adds a directory
18271 separator character at the end of the path.
18273 @option{-B} prefixes that effectively specify directory names also apply
18274 to libraries in the linker, because the compiler translates these
18275 options into @option{-L} options for the linker.  They also apply to
18276 include files in the preprocessor, because the compiler translates these
18277 options into @option{-isystem} options for the preprocessor.  In this case,
18278 the compiler appends @samp{include} to the prefix.
18280 The runtime support file @file{libgcc.a} can also be searched for using
18281 the @option{-B} prefix, if needed.  If it is not found there, the two
18282 standard prefixes above are tried, and that is all.  The file is left
18283 out of the link if it is not found by those means.
18285 Another way to specify a prefix much like the @option{-B} prefix is to use
18286 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
18287 Variables}.
18289 As a special kludge, if the path provided by @option{-B} is
18290 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
18291 9, then it is replaced by @file{[dir/]include}.  This is to help
18292 with boot-strapping the compiler.
18294 @opindex no-canonical-prefixes
18295 @item -no-canonical-prefixes
18296 Do not expand any symbolic links, resolve references to @samp{/../}
18297 or @samp{/./}, or make the path absolute when generating a relative
18298 prefix.
18300 @opindex sysroot
18301 @item --sysroot=@var{dir}
18302 Use @var{dir} as the logical root directory for headers and libraries.
18303 For example, if the compiler normally searches for headers in
18304 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
18305 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
18307 If you use both this option and the @option{-isysroot} option, then
18308 the @option{--sysroot} option applies to libraries, but the
18309 @option{-isysroot} option applies to header files.
18311 The GNU linker (beginning with version 2.16) has the necessary support
18312 for this option.  If your linker does not support this option, the
18313 header file aspect of @option{--sysroot} still works, but the
18314 library aspect does not.
18316 @opindex no-sysroot-suffix
18317 @item --no-sysroot-suffix
18318 For some targets, a suffix is added to the root directory specified
18319 with @option{--sysroot}, depending on the other options used, so that
18320 headers may for example be found in
18321 @file{@var{dir}/@var{suffix}/usr/include} instead of
18322 @file{@var{dir}/usr/include}.  This option disables the addition of
18323 such a suffix.
18325 @end table
18327 @node Code Gen Options
18328 @section Options for Code Generation Conventions
18329 @cindex code generation conventions
18330 @cindex options, code generation
18331 @cindex run-time options
18333 These machine-independent options control the interface conventions
18334 used in code generation.
18336 Most of them have both positive and negative forms; the negative form
18337 of @option{-ffoo} is @option{-fno-foo}.  In the table below, only
18338 one of the forms is listed---the one that is not the default.  You
18339 can figure out the other form by either removing @samp{no-} or adding
18342 @table @gcctabopt
18343 @opindex fstack_reuse
18344 @item -fstack-reuse=@var{reuse-level}
18345 This option controls stack space reuse for user declared local/auto variables
18346 and compiler generated temporaries.  @var{reuse_level} can be @samp{all},
18347 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
18348 local variables and temporaries, @samp{named_vars} enables the reuse only for
18349 user defined local variables with names, and @samp{none} disables stack reuse
18350 completely. The default value is @samp{all}. The option is needed when the
18351 program extends the lifetime of a scoped local variable or a compiler generated
18352 temporary beyond the end point defined by the language.  When a lifetime of
18353 a variable ends, and if the variable lives in memory, the optimizing compiler
18354 has the freedom to reuse its stack space with other temporaries or scoped
18355 local variables whose live range does not overlap with it. Legacy code extending
18356 local lifetime is likely to break with the stack reuse optimization.
18358 For example,
18360 @smallexample
18361    int *p;
18362    @{
18363      int local1;
18365      p = &local1;
18366      local1 = 10;
18367      ....
18368    @}
18369    @{
18370       int local2;
18371       local2 = 20;
18372       ...
18373    @}
18375    if (*p == 10)  // out of scope use of local1
18376      @{
18378      @}
18379 @end smallexample
18381 Another example:
18382 @smallexample
18384    struct A
18385    @{
18386        A(int k) : i(k), j(k) @{ @}
18387        int i;
18388        int j;
18389    @};
18391    A *ap;
18393    void foo(const A& ar)
18394    @{
18395       ap = &ar;
18396    @}
18398    void bar()
18399    @{
18400       foo(A(10)); // temp object's lifetime ends when foo returns
18402       @{
18403         A a(20);
18404         ....
18405       @}
18406       ap->i+= 10;  // ap references out of scope temp whose space
18407                    // is reused with a. What is the value of ap->i?
18408    @}
18410 @end smallexample
18412 The lifetime of a compiler generated temporary is well defined by the C++
18413 standard. When a lifetime of a temporary ends, and if the temporary lives
18414 in memory, the optimizing compiler has the freedom to reuse its stack
18415 space with other temporaries or scoped local variables whose live range
18416 does not overlap with it. However some of the legacy code relies on
18417 the behavior of older compilers in which temporaries' stack space is
18418 not reused, the aggressive stack reuse can lead to runtime errors. This
18419 option is used to control the temporary stack reuse optimization.
18421 @opindex ftrapv
18422 @item -ftrapv
18423 This option generates traps for signed overflow on addition, subtraction,
18424 multiplication operations.
18425 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18426 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18427 @option{-fwrapv} being effective.  Note that only active options override, so
18428 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18429 results in @option{-ftrapv} being effective.
18431 @opindex fwrapv
18432 @item -fwrapv
18433 This option instructs the compiler to assume that signed arithmetic
18434 overflow of addition, subtraction and multiplication wraps around
18435 using twos-complement representation.  This flag enables some optimizations
18436 and disables others.
18437 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18438 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18439 @option{-fwrapv} being effective.  Note that only active options override, so
18440 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18441 results in @option{-ftrapv} being effective.
18443 @opindex fwrapv-pointer
18444 @item -fwrapv-pointer
18445 This option instructs the compiler to assume that pointer arithmetic
18446 overflow on addition and subtraction wraps around using twos-complement
18447 representation.  This flag disables some optimizations which assume
18448 pointer overflow is invalid.
18450 @opindex fstrict-overflow
18451 @item -fstrict-overflow
18452 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
18453 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
18455 @opindex fexceptions
18456 @item -fexceptions
18457 Enable exception handling.  Generates extra code needed to propagate
18458 exceptions.  For some targets, this implies GCC generates frame
18459 unwind information for all functions, which can produce significant data
18460 size overhead, although it does not affect execution.  If you do not
18461 specify this option, GCC enables it by default for languages like
18462 C++ that normally require exception handling, and disables it for
18463 languages like C that do not normally require it.  However, you may need
18464 to enable this option when compiling C code that needs to interoperate
18465 properly with exception handlers written in C++.  You may also wish to
18466 disable this option if you are compiling older C++ programs that don't
18467 use exception handling.
18469 @opindex fnon-call-exceptions
18470 @item -fnon-call-exceptions
18471 Generate code that allows trapping instructions to throw exceptions.
18472 Note that this requires platform-specific runtime support that does
18473 not exist everywhere.  Moreover, it only allows @emph{trapping}
18474 instructions to throw exceptions, i.e.@: memory references or floating-point
18475 instructions.  It does not allow exceptions to be thrown from
18476 arbitrary signal handlers such as @code{SIGALRM}.  This enables
18477 @option{-fexceptions}.
18479 @opindex fdelete-dead-exceptions
18480 @item -fdelete-dead-exceptions
18481 Consider that instructions that may throw exceptions but don't otherwise
18482 contribute to the execution of the program can be optimized away.
18483 This does not affect calls to functions except those with the
18484 @code{pure} or @code{const} attributes.
18485 This option is enabled by default for the Ada and C++ compilers, as permitted by
18486 the language specifications.
18487 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
18489 @opindex funwind-tables
18490 @item -funwind-tables
18491 Similar to @option{-fexceptions}, except that it just generates any needed
18492 static data, but does not affect the generated code in any other way.
18493 You normally do not need to enable this option; instead, a language processor
18494 that needs this handling enables it on your behalf.
18496 @opindex fasynchronous-unwind-tables
18497 @item -fasynchronous-unwind-tables
18498 Generate unwind table in DWARF format, if supported by target machine.  The
18499 table is exact at each instruction boundary, so it can be used for stack
18500 unwinding from asynchronous events (such as debugger or garbage collector).
18502 @opindex fno-gnu-unique
18503 @opindex fgnu-unique
18504 @item -fno-gnu-unique
18505 On systems with recent GNU assembler and C library, the C++ compiler
18506 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
18507 of template static data members and static local variables in inline
18508 functions are unique even in the presence of @code{RTLD_LOCAL}; this
18509 is necessary to avoid problems with a library used by two different
18510 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
18511 therefore disagreeing with the other one about the binding of the
18512 symbol.  But this causes @code{dlclose} to be ignored for affected
18513 DSOs; if your program relies on reinitialization of a DSO via
18514 @code{dlclose} and @code{dlopen}, you can use
18515 @option{-fno-gnu-unique}.
18517 @opindex fpcc-struct-return
18518 @item -fpcc-struct-return
18519 Return ``short'' @code{struct} and @code{union} values in memory like
18520 longer ones, rather than in registers.  This convention is less
18521 efficient, but it has the advantage of allowing intercallability between
18522 GCC-compiled files and files compiled with other compilers, particularly
18523 the Portable C Compiler (pcc).
18525 The precise convention for returning structures in memory depends
18526 on the target configuration macros.
18528 Short structures and unions are those whose size and alignment match
18529 that of some integer type.
18531 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
18532 switch is not binary compatible with code compiled with the
18533 @option{-freg-struct-return} switch.
18534 Use it to conform to a non-default application binary interface.
18536 @opindex freg-struct-return
18537 @item -freg-struct-return
18538 Return @code{struct} and @code{union} values in registers when possible.
18539 This is more efficient for small structures than
18540 @option{-fpcc-struct-return}.
18542 If you specify neither @option{-fpcc-struct-return} nor
18543 @option{-freg-struct-return}, GCC defaults to whichever convention is
18544 standard for the target.  If there is no standard convention, GCC
18545 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
18546 the principal compiler.  In those cases, we can choose the standard, and
18547 we chose the more efficient register return alternative.
18549 @strong{Warning:} code compiled with the @option{-freg-struct-return}
18550 switch is not binary compatible with code compiled with the
18551 @option{-fpcc-struct-return} switch.
18552 Use it to conform to a non-default application binary interface.
18554 @opindex fshort-enums
18555 @item -fshort-enums
18556 Allocate to an @code{enum} type only as many bytes as it needs for the
18557 declared range of possible values.  Specifically, the @code{enum} type
18558 is equivalent to the smallest integer type that has enough room.
18559 This option has no effect for an enumeration type with a fixed underlying
18560 type.
18562 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
18563 code that is not binary compatible with code generated without that switch.
18564 Use it to conform to a non-default application binary interface.
18566 @opindex fshort-wchar
18567 @item -fshort-wchar
18568 Override the underlying type for @code{wchar_t} to be @code{short
18569 unsigned int} instead of the default for the target.  This option is
18570 useful for building programs to run under WINE@.
18572 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
18573 code that is not binary compatible with code generated without that switch.
18574 Use it to conform to a non-default application binary interface.
18576 @opindex fcommon
18577 @opindex fno-common
18578 @cindex tentative definitions
18579 @item -fcommon
18580 In C code, this option controls the placement of global variables
18581 defined without an initializer, known as @dfn{tentative definitions}
18582 in the C standard.  Tentative definitions are distinct from declarations
18583 of a variable with the @code{extern} keyword, which do not allocate storage.
18585 The default is @option{-fno-common}, which specifies that the compiler places
18586 uninitialized global variables in the BSS section of the object file.
18587 This inhibits the merging of tentative definitions by the linker so you get a
18588 multiple-definition error if the same variable is accidentally defined in more
18589 than one compilation unit.
18591 The @option{-fcommon} places uninitialized global variables in a common block.
18592 This allows the linker to resolve all tentative definitions of the same variable
18593 in different compilation units to the same object, or to a non-tentative
18594 definition.  This behavior is inconsistent with C++, and on many targets implies
18595 a speed and code size penalty on global variable references.  It is mainly
18596 useful to enable legacy code to link without errors.
18598 @opindex fno-ident
18599 @opindex fident
18600 @item -fno-ident
18601 Ignore the @code{#ident} directive.
18603 @opindex finhibit-size-directive
18604 @item -finhibit-size-directive
18605 Don't output a @code{.size} assembler directive, or anything else that
18606 would cause trouble if the function is split in the middle, and the
18607 two halves are placed at locations far apart in memory.  This option is
18608 used when compiling @file{crtstuff.c}; you should not need to use it
18609 for anything else.
18611 @opindex fverbose-asm
18612 @item -fverbose-asm
18613 Put extra commentary information in the generated assembly code to
18614 make it more readable.  This option is generally only of use to those
18615 who actually need to read the generated assembly code (perhaps while
18616 debugging the compiler itself).
18618 @option{-fno-verbose-asm}, the default, causes the
18619 extra information to be omitted and is useful when comparing two assembler
18620 files.
18622 The added comments include:
18624 @itemize @bullet
18626 @item
18627 information on the compiler version and command-line options,
18629 @item
18630 the source code lines associated with the assembly instructions,
18631 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
18633 @item
18634 hints on which high-level expressions correspond to
18635 the various assembly instruction operands.
18637 @end itemize
18639 For example, given this C source file:
18641 @smallexample
18642 int test (int n)
18644   int i;
18645   int total = 0;
18647   for (i = 0; i < n; i++)
18648     total += i * i;
18650   return total;
18652 @end smallexample
18654 compiling to (x86_64) assembly via @option{-S} and emitting the result
18655 direct to stdout via @option{-o} @option{-}
18657 @smallexample
18658 gcc -S test.c -fverbose-asm -Os -o -
18659 @end smallexample
18661 gives output similar to this:
18663 @smallexample
18664         .file   "test.c"
18665 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
18666   [...snip...]
18667 # options passed:
18668   [...snip...]
18670         .text
18671         .globl  test
18672         .type   test, @@function
18673 test:
18674 .LFB0:
18675         .cfi_startproc
18676 # test.c:4:   int total = 0;
18677         xorl    %eax, %eax      # <retval>
18678 # test.c:6:   for (i = 0; i < n; i++)
18679         xorl    %edx, %edx      # i
18680 .L2:
18681 # test.c:6:   for (i = 0; i < n; i++)
18682         cmpl    %edi, %edx      # n, i
18683         jge     .L5     #,
18684 # test.c:7:     total += i * i;
18685         movl    %edx, %ecx      # i, tmp92
18686         imull   %edx, %ecx      # i, tmp92
18687 # test.c:6:   for (i = 0; i < n; i++)
18688         incl    %edx    # i
18689 # test.c:7:     total += i * i;
18690         addl    %ecx, %eax      # tmp92, <retval>
18691         jmp     .L2     #
18692 .L5:
18693 # test.c:10: @}
18694         ret
18695         .cfi_endproc
18696 .LFE0:
18697         .size   test, .-test
18698         .ident  "GCC: (GNU) 7.0.0 20160809 (experimental)"
18699         .section        .note.GNU-stack,"",@@progbits
18700 @end smallexample
18702 The comments are intended for humans rather than machines and hence the
18703 precise format of the comments is subject to change.
18705 @opindex frecord-gcc-switches
18706 @item -frecord-gcc-switches
18707 This switch causes the command line used to invoke the
18708 compiler to be recorded into the object file that is being created.
18709 This switch is only implemented on some targets and the exact format
18710 of the recording is target and binary file format dependent, but it
18711 usually takes the form of a section containing ASCII text.  This
18712 switch is related to the @option{-fverbose-asm} switch, but that
18713 switch only records information in the assembler output file as
18714 comments, so it never reaches the object file.
18715 See also @option{-grecord-gcc-switches} for another
18716 way of storing compiler options into the object file.
18718 @opindex fpic
18719 @cindex global offset table
18720 @cindex PIC
18721 @item -fpic
18722 Generate position-independent code (PIC) suitable for use in a shared
18723 library, if supported for the target machine.  Such code accesses all
18724 constant addresses through a global offset table (GOT)@.  The dynamic
18725 loader resolves the GOT entries when the program starts (the dynamic
18726 loader is not part of GCC; it is part of the operating system).  If
18727 the GOT size for the linked executable exceeds a machine-specific
18728 maximum size, you get an error message from the linker indicating that
18729 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
18730 instead.  (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
18731 on the m68k and RS/6000.  The x86 has no such limit.)
18733 Position-independent code requires special support, and therefore works
18734 only on certain machines.  For the x86, GCC supports PIC for System V
18735 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
18736 position-independent.
18738 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18739 are defined to 1.
18741 @opindex fPIC
18742 @item -fPIC
18743 If supported for the target machine, emit position-independent code,
18744 suitable for dynamic linking and avoiding any limit on the size of the
18745 global offset table.  This option makes a difference on AArch64, m68k,
18746 PowerPC and SPARC@.
18748 Position-independent code requires special support, and therefore works
18749 only on certain machines.
18751 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18752 are defined to 2.
18754 @opindex fpie
18755 @opindex fPIE
18756 @item -fpie
18757 @itemx -fPIE
18758 These options are similar to @option{-fpic} and @option{-fPIC}, but the
18759 generated position-independent code can be only linked into executables.
18760 Usually these options are used to compile code that will be linked using
18761 the @option{-pie} GCC option.
18763 @option{-fpie} and @option{-fPIE} both define the macros
18764 @code{__pie__} and @code{__PIE__}.  The macros have the value 1
18765 for @option{-fpie} and 2 for @option{-fPIE}.
18767 @opindex fno-plt
18768 @opindex fplt
18769 @item -fno-plt
18770 Do not use the PLT for external function calls in position-independent code.
18771 Instead, load the callee address at call sites from the GOT and branch to it.
18772 This leads to more efficient code by eliminating PLT stubs and exposing
18773 GOT loads to optimizations.  On architectures such as 32-bit x86 where
18774 PLT stubs expect the GOT pointer in a specific register, this gives more
18775 register allocation freedom to the compiler.
18776 Lazy binding requires use of the PLT; 
18777 with @option{-fno-plt} all external symbols are resolved at load time.
18779 Alternatively, the function attribute @code{noplt} can be used to avoid calls
18780 through the PLT for specific external functions.
18782 In position-dependent code, a few targets also convert calls to
18783 functions that are marked to not use the PLT to use the GOT instead.
18785 @opindex fno-jump-tables
18786 @opindex fjump-tables
18787 @item -fno-jump-tables
18788 Do not use jump tables for switch statements even where it would be
18789 more efficient than other code generation strategies.  This option is
18790 of use in conjunction with @option{-fpic} or @option{-fPIC} for
18791 building code that forms part of a dynamic linker and cannot
18792 reference the address of a jump table.  On some targets, jump tables
18793 do not require a GOT and this option is not needed.
18795 @opindex fno-bit-tests
18796 @opindex fbit-tests
18797 @item -fno-bit-tests
18798 Do not use bit tests for switch statements even where it would be
18799 more efficient than other code generation strategies.
18801 @opindex ffixed
18802 @item -ffixed-@var{reg}
18803 Treat the register named @var{reg} as a fixed register; generated code
18804 should never refer to it (except perhaps as a stack pointer, frame
18805 pointer or in some other fixed role).
18807 @var{reg} must be the name of a register.  The register names accepted
18808 are machine-specific and are defined in the @code{REGISTER_NAMES}
18809 macro in the machine description macro file.
18811 This flag does not have a negative form, because it specifies a
18812 three-way choice.
18814 @opindex fcall-used
18815 @item -fcall-used-@var{reg}
18816 Treat the register named @var{reg} as an allocable register that is
18817 clobbered by function calls.  It may be allocated for temporaries or
18818 variables that do not live across a call.  Functions compiled this way
18819 do not save and restore the register @var{reg}.
18821 It is an error to use this flag with the frame pointer or stack pointer.
18822 Use of this flag for other registers that have fixed pervasive roles in
18823 the machine's execution model produces disastrous results.
18825 This flag does not have a negative form, because it specifies a
18826 three-way choice.
18828 @opindex fcall-saved
18829 @item -fcall-saved-@var{reg}
18830 Treat the register named @var{reg} as an allocable register saved by
18831 functions.  It may be allocated even for temporaries or variables that
18832 live across a call.  Functions compiled this way save and restore
18833 the register @var{reg} if they use it.
18835 It is an error to use this flag with the frame pointer or stack pointer.
18836 Use of this flag for other registers that have fixed pervasive roles in
18837 the machine's execution model produces disastrous results.
18839 A different sort of disaster results from the use of this flag for
18840 a register in which function values may be returned.
18842 This flag does not have a negative form, because it specifies a
18843 three-way choice.
18845 @opindex fpack-struct
18846 @item -fpack-struct[=@var{n}]
18847 Without a value specified, pack all structure members together without
18848 holes.  When a value is specified (which must be a small power of two), pack
18849 structure members according to this value, representing the maximum
18850 alignment (that is, objects with default alignment requirements larger than
18851 this are output potentially unaligned at the next fitting location.
18853 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
18854 code that is not binary compatible with code generated without that switch.
18855 Additionally, it makes the code suboptimal.
18856 Use it to conform to a non-default application binary interface.
18858 @opindex fleading-underscore
18859 @item -fleading-underscore
18860 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
18861 change the way C symbols are represented in the object file.  One use
18862 is to help link with legacy assembly code.
18864 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
18865 generate code that is not binary compatible with code generated without that
18866 switch.  Use it to conform to a non-default application binary interface.
18867 Not all targets provide complete support for this switch.
18869 @opindex ftls-model
18870 @item -ftls-model=@var{model}
18871 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
18872 The @var{model} argument should be one of @samp{global-dynamic},
18873 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
18874 Note that the choice is subject to optimization: the compiler may use
18875 a more efficient model for symbols not visible outside of the translation
18876 unit, or if @option{-fpic} is not given on the command line.
18878 The default without @option{-fpic} is @samp{initial-exec}; with
18879 @option{-fpic} the default is @samp{global-dynamic}.
18881 @opindex ftrampolines
18882 @item -ftrampolines
18883 For targets that normally need trampolines for nested functions, always
18884 generate them instead of using descriptors.  Otherwise, for targets that
18885 do not need them, like for example HP-PA or IA-64, do nothing.
18887 A trampoline is a small piece of code that is created at run time on the
18888 stack when the address of a nested function is taken, and is used to call
18889 the nested function indirectly.  Therefore, it requires the stack to be
18890 made executable in order for the program to work properly.
18892 @option{-fno-trampolines} is enabled by default on a language by language
18893 basis to let the compiler avoid generating them, if it computes that this
18894 is safe, and replace them with descriptors.  Descriptors are made up of data
18895 only, but the generated code must be prepared to deal with them.  As of this
18896 writing, @option{-fno-trampolines} is enabled by default only for Ada.
18898 Moreover, code compiled with @option{-ftrampolines} and code compiled with
18899 @option{-fno-trampolines} are not binary compatible if nested functions are
18900 present.  This option must therefore be used on a program-wide basis and be
18901 manipulated with extreme care.
18903 For languages other than Ada, the @code{-ftrampolines} and
18904 @code{-fno-trampolines} options currently have no effect, and
18905 trampolines are always generated on platforms that need them
18906 for nested functions.
18908 @opindex fvisibility
18909 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
18910 Set the default ELF image symbol visibility to the specified option---all
18911 symbols are marked with this unless overridden within the code.
18912 Using this feature can very substantially improve linking and
18913 load times of shared object libraries, produce more optimized
18914 code, provide near-perfect API export and prevent symbol clashes.
18915 It is @strong{strongly} recommended that you use this in any shared objects
18916 you distribute.
18918 Despite the nomenclature, @samp{default} always means public; i.e.,
18919 available to be linked against from outside the shared object.
18920 @samp{protected} and @samp{internal} are pretty useless in real-world
18921 usage so the only other commonly used option is @samp{hidden}.
18922 The default if @option{-fvisibility} isn't specified is
18923 @samp{default}, i.e., make every symbol public.
18925 A good explanation of the benefits offered by ensuring ELF
18926 symbols have the correct visibility is given by ``How To Write
18927 Shared Libraries'' by Ulrich Drepper (which can be found at
18928 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
18929 solution made possible by this option to marking things hidden when
18930 the default is public is to make the default hidden and mark things
18931 public.  This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
18932 and @code{__attribute__ ((visibility("default")))} instead of
18933 @code{__declspec(dllexport)} you get almost identical semantics with
18934 identical syntax.  This is a great boon to those working with
18935 cross-platform projects.
18937 For those adding visibility support to existing code, you may find
18938 @code{#pragma GCC visibility} of use.  This works by you enclosing
18939 the declarations you wish to set visibility for with (for example)
18940 @code{#pragma GCC visibility push(hidden)} and
18941 @code{#pragma GCC visibility pop}.
18942 Bear in mind that symbol visibility should be viewed @strong{as
18943 part of the API interface contract} and thus all new code should
18944 always specify visibility when it is not the default; i.e., declarations
18945 only for use within the local DSO should @strong{always} be marked explicitly
18946 as hidden as so to avoid PLT indirection overheads---making this
18947 abundantly clear also aids readability and self-documentation of the code.
18948 Note that due to ISO C++ specification requirements, @code{operator new} and
18949 @code{operator delete} must always be of default visibility.
18951 Be aware that headers from outside your project, in particular system
18952 headers and headers from any other library you use, may not be
18953 expecting to be compiled with visibility other than the default.  You
18954 may need to explicitly say @code{#pragma GCC visibility push(default)}
18955 before including any such headers.
18957 @code{extern} declarations are not affected by @option{-fvisibility}, so
18958 a lot of code can be recompiled with @option{-fvisibility=hidden} with
18959 no modifications.  However, this means that calls to @code{extern}
18960 functions with no explicit visibility use the PLT, so it is more
18961 effective to use @code{__attribute ((visibility))} and/or
18962 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
18963 declarations should be treated as hidden.
18965 Note that @option{-fvisibility} does affect C++ vague linkage
18966 entities. This means that, for instance, an exception class that is
18967 be thrown between DSOs must be explicitly marked with default
18968 visibility so that the @samp{type_info} nodes are unified between
18969 the DSOs.
18971 An overview of these techniques, their benefits and how to use them
18972 is at @uref{https://gcc.gnu.org/@/wiki/@/Visibility}.
18974 @opindex fstrict-volatile-bitfields
18975 @item -fstrict-volatile-bitfields
18976 This option should be used if accesses to volatile bit-fields (or other
18977 structure fields, although the compiler usually honors those types
18978 anyway) should use a single access of the width of the
18979 field's type, aligned to a natural alignment if possible.  For
18980 example, targets with memory-mapped peripheral registers might require
18981 all such accesses to be 16 bits wide; with this flag you can
18982 declare all peripheral bit-fields as @code{unsigned short} (assuming short
18983 is 16 bits on these targets) to force GCC to use 16-bit accesses
18984 instead of, perhaps, a more efficient 32-bit access.
18986 If this option is disabled, the compiler uses the most efficient
18987 instruction.  In the previous example, that might be a 32-bit load
18988 instruction, even though that accesses bytes that do not contain
18989 any portion of the bit-field, or memory-mapped registers unrelated to
18990 the one being updated.
18992 In some cases, such as when the @code{packed} attribute is applied to a 
18993 structure field, it may not be possible to access the field with a single
18994 read or write that is correctly aligned for the target machine.  In this
18995 case GCC falls back to generating multiple accesses rather than code that 
18996 will fault or truncate the result at run time.
18998 Note:  Due to restrictions of the C/C++11 memory model, write accesses are
18999 not allowed to touch non bit-field members.  It is therefore recommended
19000 to define all bits of the field's type as bit-field members.
19002 The default value of this option is determined by the application binary
19003 interface for the target processor.
19005 @opindex fsync-libcalls
19006 @item -fsync-libcalls
19007 This option controls whether any out-of-line instance of the @code{__sync}
19008 family of functions may be used to implement the C++11 @code{__atomic}
19009 family of functions.
19011 The default value of this option is enabled, thus the only useful form
19012 of the option is @option{-fno-sync-libcalls}.  This option is used in
19013 the implementation of the @file{libatomic} runtime library.
19015 @end table
19017 @node Developer Options
19018 @section GCC Developer Options
19019 @cindex developer options
19020 @cindex debugging GCC
19021 @cindex debug dump options
19022 @cindex dump options
19023 @cindex compilation statistics
19025 This section describes command-line options that are primarily of
19026 interest to GCC developers, including options to support compiler
19027 testing and investigation of compiler bugs and compile-time
19028 performance problems.  This includes options that produce debug dumps
19029 at various points in the compilation; that print statistics such as
19030 memory use and execution time; and that print information about GCC's
19031 configuration, such as where it searches for libraries.  You should
19032 rarely need to use any of these options for ordinary compilation and
19033 linking tasks.
19035 Many developer options that cause GCC to dump output to a file take an
19036 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
19037 or @samp{-} to dump to standard output, and @samp{stderr} for standard
19038 error.
19040 If @samp{=@var{filename}} is omitted, a default dump file name is
19041 constructed by concatenating the base dump file name, a pass number,
19042 phase letter, and pass name.  The base dump file name is the name of
19043 output file produced by the compiler if explicitly specified and not
19044 an executable; otherwise it is the source file name.
19045 The pass number is determined by the order passes are registered with
19046 the compiler's pass manager. 
19047 This is generally the same as the order of execution, but passes
19048 registered by plugins, target-specific passes, or passes that are
19049 otherwise registered late are numbered higher than the pass named
19050 @samp{final}, even if they are executed earlier.  The phase letter is
19051 one of @samp{i} (inter-procedural analysis), @samp{l}
19052 (language-specific), @samp{r} (RTL), or @samp{t} (tree). 
19053 The files are created in the directory of the output file. 
19055 @table @gcctabopt
19057 @opindex fcallgraph-info
19058 @item -fcallgraph-info
19059 @itemx -fcallgraph-info=@var{MARKERS}
19060 Makes the compiler output callgraph information for the program, on a
19061 per-object-file basis.  The information is generated in the common VCG
19062 format.  It can be decorated with additional, per-node and/or per-edge
19063 information, if a list of comma-separated markers is additionally
19064 specified.  When the @code{su} marker is specified, the callgraph is
19065 decorated with stack usage information; it is equivalent to
19066 @option{-fstack-usage}.  When the @code{da} marker is specified, the
19067 callgraph is decorated with information about dynamically allocated
19068 objects.
19070 When compiling with @option{-flto}, no callgraph information is output
19071 along with the object file.  At LTO link time, @option{-fcallgraph-info}
19072 may generate multiple callgraph information files next to intermediate
19073 LTO output files.
19075 @opindex d
19076 @opindex fdump-rtl-@var{pass}
19077 @item -d@var{letters}
19078 @itemx -fdump-rtl-@var{pass}
19079 @itemx -fdump-rtl-@var{pass}=@var{filename}
19080 Says to make debugging dumps during compilation at times specified by
19081 @var{letters}.  This is used for debugging the RTL-based passes of the
19082 compiler.
19084 Some @option{-d@var{letters}} switches have different meaning when
19085 @option{-E} is used for preprocessing.  @xref{Preprocessor Options},
19086 for information about preprocessor-specific dump options.
19088 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
19089 @option{-d} option @var{letters}.  Here are the possible
19090 letters for use in @var{pass} and @var{letters}, and their meanings:
19092 @table @gcctabopt
19094 @opindex fdump-rtl-alignments
19095 @item -fdump-rtl-alignments
19096 Dump after branch alignments have been computed.
19098 @opindex fdump-rtl-asmcons
19099 @item -fdump-rtl-asmcons
19100 Dump after fixing rtl statements that have unsatisfied in/out constraints.
19102 @opindex fdump-rtl-auto_inc_dec
19103 @item -fdump-rtl-auto_inc_dec
19104 Dump after auto-inc-dec discovery.  This pass is only run on
19105 architectures that have auto inc or auto dec instructions.
19107 @opindex fdump-rtl-barriers
19108 @item -fdump-rtl-barriers
19109 Dump after cleaning up the barrier instructions.
19111 @opindex fdump-rtl-bbpart
19112 @item -fdump-rtl-bbpart
19113 Dump after partitioning hot and cold basic blocks.
19115 @opindex fdump-rtl-bbro
19116 @item -fdump-rtl-bbro
19117 Dump after block reordering.
19119 @opindex fdump-rtl-btl2
19120 @opindex fdump-rtl-btl2
19121 @item -fdump-rtl-btl1
19122 @itemx -fdump-rtl-btl2
19123 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
19124 after the two branch
19125 target load optimization passes.
19127 @opindex fdump-rtl-bypass
19128 @item -fdump-rtl-bypass
19129 Dump after jump bypassing and control flow optimizations.
19131 @opindex fdump-rtl-combine
19132 @item -fdump-rtl-combine
19133 Dump after the RTL instruction combination pass.
19135 @opindex fdump-rtl-compgotos
19136 @item -fdump-rtl-compgotos
19137 Dump after duplicating the computed gotos.
19139 @opindex fdump-rtl-ce1
19140 @opindex fdump-rtl-ce2
19141 @opindex fdump-rtl-ce3
19142 @item -fdump-rtl-ce1
19143 @itemx -fdump-rtl-ce2
19144 @itemx -fdump-rtl-ce3
19145 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
19146 @option{-fdump-rtl-ce3} enable dumping after the three
19147 if conversion passes.
19149 @opindex fdump-rtl-cprop_hardreg
19150 @item -fdump-rtl-cprop_hardreg
19151 Dump after hard register copy propagation.
19153 @opindex fdump-rtl-csa
19154 @item -fdump-rtl-csa
19155 Dump after combining stack adjustments.
19157 @opindex fdump-rtl-cse1
19158 @opindex fdump-rtl-cse2
19159 @item -fdump-rtl-cse1
19160 @itemx -fdump-rtl-cse2
19161 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
19162 the two common subexpression elimination passes.
19164 @opindex fdump-rtl-dce
19165 @item -fdump-rtl-dce
19166 Dump after the standalone dead code elimination passes.
19168 @opindex fdump-rtl-dbr
19169 @item -fdump-rtl-dbr
19170 Dump after delayed branch scheduling.
19172 @opindex fdump-rtl-dce1
19173 @opindex fdump-rtl-dce2
19174 @item -fdump-rtl-dce1
19175 @itemx -fdump-rtl-dce2
19176 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
19177 the two dead store elimination passes.
19179 @opindex fdump-rtl-eh
19180 @item -fdump-rtl-eh
19181 Dump after finalization of EH handling code.
19183 @opindex fdump-rtl-eh_ranges
19184 @item -fdump-rtl-eh_ranges
19185 Dump after conversion of EH handling range regions.
19187 @opindex fdump-rtl-expand
19188 @item -fdump-rtl-expand
19189 Dump after RTL generation.
19191 @opindex fdump-rtl-fwprop1
19192 @opindex fdump-rtl-fwprop2
19193 @item -fdump-rtl-fwprop1
19194 @itemx -fdump-rtl-fwprop2
19195 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
19196 dumping after the two forward propagation passes.
19198 @opindex fdump-rtl-gcse1
19199 @opindex fdump-rtl-gcse2
19200 @item -fdump-rtl-gcse1
19201 @itemx -fdump-rtl-gcse2
19202 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
19203 after global common subexpression elimination.
19205 @opindex fdump-rtl-init-regs
19206 @item -fdump-rtl-init-regs
19207 Dump after the initialization of the registers.
19209 @opindex fdump-rtl-initvals
19210 @item -fdump-rtl-initvals
19211 Dump after the computation of the initial value sets.
19213 @opindex fdump-rtl-into_cfglayout
19214 @item -fdump-rtl-into_cfglayout
19215 Dump after converting to cfglayout mode.
19217 @opindex fdump-rtl-ira
19218 @item -fdump-rtl-ira
19219 Dump after iterated register allocation.
19221 @opindex fdump-rtl-jump
19222 @item -fdump-rtl-jump
19223 Dump after the second jump optimization.
19225 @opindex fdump-rtl-loop2
19226 @item -fdump-rtl-loop2
19227 @option{-fdump-rtl-loop2} enables dumping after the rtl
19228 loop optimization passes.
19230 @opindex fdump-rtl-mach
19231 @item -fdump-rtl-mach
19232 Dump after performing the machine dependent reorganization pass, if that
19233 pass exists.
19235 @opindex fdump-rtl-mode_sw
19236 @item -fdump-rtl-mode_sw
19237 Dump after removing redundant mode switches.
19239 @opindex fdump-rtl-rnreg
19240 @item -fdump-rtl-rnreg
19241 Dump after register renumbering.
19243 @opindex fdump-rtl-outof_cfglayout
19244 @item -fdump-rtl-outof_cfglayout
19245 Dump after converting from cfglayout mode.
19247 @opindex fdump-rtl-peephole2
19248 @item -fdump-rtl-peephole2
19249 Dump after the peephole pass.
19251 @opindex fdump-rtl-postreload
19252 @item -fdump-rtl-postreload
19253 Dump after post-reload optimizations.
19255 @opindex fdump-rtl-pro_and_epilogue
19256 @item -fdump-rtl-pro_and_epilogue
19257 Dump after generating the function prologues and epilogues.
19259 @opindex fdump-rtl-sched1
19260 @opindex fdump-rtl-sched2
19261 @item -fdump-rtl-sched1
19262 @itemx -fdump-rtl-sched2
19263 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
19264 after the basic block scheduling passes.
19266 @opindex fdump-rtl-ree
19267 @item -fdump-rtl-ree
19268 Dump after sign/zero extension elimination.
19270 @opindex fdump-rtl-seqabstr
19271 @item -fdump-rtl-seqabstr
19272 Dump after common sequence discovery.
19274 @opindex fdump-rtl-shorten
19275 @item -fdump-rtl-shorten
19276 Dump after shortening branches.
19278 @opindex fdump-rtl-sibling
19279 @item -fdump-rtl-sibling
19280 Dump after sibling call optimizations.
19282 @opindex fdump-rtl-split1
19283 @opindex fdump-rtl-split2
19284 @opindex fdump-rtl-split3
19285 @opindex fdump-rtl-split4
19286 @opindex fdump-rtl-split5
19287 @item -fdump-rtl-split1
19288 @itemx -fdump-rtl-split2
19289 @itemx -fdump-rtl-split3
19290 @itemx -fdump-rtl-split4
19291 @itemx -fdump-rtl-split5
19292 These options enable dumping after five rounds of
19293 instruction splitting.
19295 @opindex fdump-rtl-sms
19296 @item -fdump-rtl-sms
19297 Dump after modulo scheduling.  This pass is only run on some
19298 architectures.
19300 @opindex fdump-rtl-stack
19301 @item -fdump-rtl-stack
19302 Dump after conversion from GCC's ``flat register file'' registers to the
19303 x87's stack-like registers.  This pass is only run on x86 variants.
19305 @opindex fdump-rtl-subreg1
19306 @opindex fdump-rtl-subreg2
19307 @item -fdump-rtl-subreg1
19308 @itemx -fdump-rtl-subreg2
19309 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
19310 the two subreg expansion passes.
19312 @opindex fdump-rtl-unshare
19313 @item -fdump-rtl-unshare
19314 Dump after all rtl has been unshared.
19316 @opindex fdump-rtl-vartrack
19317 @item -fdump-rtl-vartrack
19318 Dump after variable tracking.
19320 @opindex fdump-rtl-vregs
19321 @item -fdump-rtl-vregs
19322 Dump after converting virtual registers to hard registers.
19324 @opindex fdump-rtl-web
19325 @item -fdump-rtl-web
19326 Dump after live range splitting.
19328 @opindex fdump-rtl-regclass
19329 @opindex fdump-rtl-subregs_of_mode_init
19330 @opindex fdump-rtl-subregs_of_mode_finish
19331 @opindex fdump-rtl-dfinit
19332 @opindex fdump-rtl-dfinish
19333 @item -fdump-rtl-regclass
19334 @itemx -fdump-rtl-subregs_of_mode_init
19335 @itemx -fdump-rtl-subregs_of_mode_finish
19336 @itemx -fdump-rtl-dfinit
19337 @itemx -fdump-rtl-dfinish
19338 These dumps are defined but always produce empty files.
19340 @opindex da
19341 @opindex fdump-rtl-all
19342 @item -da
19343 @itemx -fdump-rtl-all
19344 Produce all the dumps listed above.
19346 @opindex dA
19347 @item -dA
19348 Annotate the assembler output with miscellaneous debugging information.
19350 @opindex dD
19351 @item -dD
19352 Dump all macro definitions, at the end of preprocessing, in addition to
19353 normal output.
19355 @opindex dH
19356 @item -dH
19357 Produce a core dump whenever an error occurs.
19359 @opindex dp
19360 @item -dp
19361 Annotate the assembler output with a comment indicating which
19362 pattern and alternative is used.  The length and cost of each instruction are
19363 also printed.
19365 @opindex dP
19366 @item -dP
19367 Dump the RTL in the assembler output as a comment before each instruction.
19368 Also turns on @option{-dp} annotation.
19370 @opindex dx
19371 @item -dx
19372 Just generate RTL for a function instead of compiling it.  Usually used
19373 with @option{-fdump-rtl-expand}.
19374 @end table
19376 @opindex fdump-debug
19377 @item -fdump-debug
19378 Dump debugging information generated during the debug
19379 generation phase.
19381 @opindex fdump-earlydebug
19382 @item -fdump-earlydebug
19383 Dump debugging information generated during the early debug
19384 generation phase.
19386 @opindex fdump-noaddr
19387 @item -fdump-noaddr
19388 When doing debugging dumps, suppress address output.  This makes it more
19389 feasible to use diff on debugging dumps for compiler invocations with
19390 different compiler binaries and/or different
19391 text / bss / data / heap / stack / dso start locations.
19393 @opindex freport-bug
19394 @item -freport-bug
19395 Collect and dump debug information into a temporary file if an
19396 internal compiler error (ICE) occurs.
19398 @opindex fdump-unnumbered
19399 @item -fdump-unnumbered
19400 When doing debugging dumps, suppress instruction numbers and address output.
19401 This makes it more feasible to use diff on debugging dumps for compiler
19402 invocations with different options, in particular with and without
19403 @option{-g}.
19405 @opindex fdump-unnumbered-links
19406 @item -fdump-unnumbered-links
19407 When doing debugging dumps (see @option{-d} option above), suppress
19408 instruction numbers for the links to the previous and next instructions
19409 in a sequence.
19411 @opindex fdump-ipa
19412 @item -fdump-ipa-@var{switch}
19413 @itemx -fdump-ipa-@var{switch}-@var{options}
19414 Control the dumping at various stages of inter-procedural analysis
19415 language tree to a file.  The file name is generated by appending a
19416 switch specific suffix to the source file name, and the file is created
19417 in the same directory as the output file.  The following dumps are
19418 possible:
19420 @table @samp
19421 @item all
19422 Enables all inter-procedural analysis dumps.
19424 @item cgraph
19425 Dumps information about call-graph optimization, unused function removal,
19426 and inlining decisions.
19428 @item inline
19429 Dump after function inlining.
19431 @end table
19433 Additionally, the options @option{-optimized}, @option{-missed},
19434 @option{-note}, and @option{-all} can be provided, with the same meaning
19435 as for @option{-fopt-info}, defaulting to @option{-optimized}.
19437 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
19438 information on callsites that were inlined, along with callsites
19439 that were not inlined.
19441 By default, the dump will contain messages about successful
19442 optimizations (equivalent to @option{-optimized}) together with
19443 low-level details about the analysis.
19445 @opindex fdump-lang
19446 @item -fdump-lang
19447 Dump language-specific information.  The file name is made by appending
19448 @file{.lang} to the source file name.
19450 @opindex fdump-lang-all
19451 @opindex fdump-lang
19452 @item -fdump-lang-all
19453 @itemx -fdump-lang-@var{switch}
19454 @itemx -fdump-lang-@var{switch}-@var{options}
19455 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
19456 Control the dumping of language-specific information.  The @var{options}
19457 and @var{filename} portions behave as described in the
19458 @option{-fdump-tree} option.  The following @var{switch} values are
19459 accepted:
19461 @table @samp
19462 @item all
19464 Enable all language-specific dumps.
19466 @item class
19467 Dump class hierarchy information.  Virtual table information is emitted
19468 unless '@option{slim}' is specified.  This option is applicable to C++ only.
19470 @item module
19471 Dump module information.  Options @option{lineno} (locations),
19472 @option{graph} (reachability), @option{blocks} (clusters),
19473 @option{uid} (serialization), @option{alias} (mergeable),
19474 @option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
19475 (macros) may provide additional information.  This option is
19476 applicable to C++ only.
19478 @item raw
19479 Dump the raw internal tree data.  This option is applicable to C++ only.
19481 @end table
19483 @opindex fdump-passes
19484 @item -fdump-passes
19485 Print on @file{stderr} the list of optimization passes that are turned
19486 on and off by the current command-line options.
19488 @opindex fdump-statistics
19489 @item -fdump-statistics-@var{option}
19490 Enable and control dumping of pass statistics in a separate file.  The
19491 file name is generated by appending a suffix ending in
19492 @samp{.statistics} to the source file name, and the file is created in
19493 the same directory as the output file.  If the @samp{-@var{option}}
19494 form is used, @samp{-stats} causes counters to be summed over the
19495 whole compilation unit while @samp{-details} dumps every event as
19496 the passes generate them.  The default with no option is to sum
19497 counters for each function compiled.
19499 @opindex fdump-tree-all
19500 @opindex fdump-tree
19501 @item -fdump-tree-all
19502 @itemx -fdump-tree-@var{switch}
19503 @itemx -fdump-tree-@var{switch}-@var{options}
19504 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
19505 Control the dumping at various stages of processing the intermediate
19506 language tree to a file.  If the @samp{-@var{options}}
19507 form is used, @var{options} is a list of @samp{-} separated options
19508 which control the details of the dump.  Not all options are applicable
19509 to all dumps; those that are not meaningful are ignored.  The
19510 following options are available
19512 @table @samp
19513 @item address
19514 Print the address of each node.  Usually this is not meaningful as it
19515 changes according to the environment and source file.  Its primary use
19516 is for tying up a dump file with a debug environment.
19517 @item asmname
19518 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
19519 in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
19520 use working backward from mangled names in the assembly file.
19521 @item slim
19522 When dumping front-end intermediate representations, inhibit dumping
19523 of members of a scope or body of a function merely because that scope
19524 has been reached.  Only dump such items when they are directly reachable
19525 by some other path.
19527 When dumping pretty-printed trees, this option inhibits dumping the
19528 bodies of control structures.
19530 When dumping RTL, print the RTL in slim (condensed) form instead of
19531 the default LISP-like representation.
19532 @item raw
19533 Print a raw representation of the tree.  By default, trees are
19534 pretty-printed into a C-like representation.
19535 @item details
19536 Enable more detailed dumps (not honored by every dump option). Also
19537 include information from the optimization passes.
19538 @item stats
19539 Enable dumping various statistics about the pass (not honored by every dump
19540 option).
19541 @item blocks
19542 Enable showing basic block boundaries (disabled in raw dumps).
19543 @item graph
19544 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
19545 dump a representation of the control flow graph suitable for viewing with
19546 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}.  Each function in
19547 the file is pretty-printed as a subgraph, so that GraphViz can render them
19548 all in a single plot.
19550 This option currently only works for RTL dumps, and the RTL is always
19551 dumped in slim form.
19552 @item vops
19553 Enable showing virtual operands for every statement.
19554 @item lineno
19555 Enable showing line numbers for statements.
19556 @item uid
19557 Enable showing the unique ID (@code{DECL_UID}) for each variable.
19558 @item verbose
19559 Enable showing the tree dump for each statement.
19560 @item eh
19561 Enable showing the EH region number holding each statement.
19562 @item scev
19563 Enable showing scalar evolution analysis details.
19564 @item optimized
19565 Enable showing optimization information (only available in certain
19566 passes).
19567 @item missed
19568 Enable showing missed optimization information (only available in certain
19569 passes).
19570 @item note
19571 Enable other detailed optimization information (only available in
19572 certain passes).
19573 @item all
19574 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
19575 and @option{lineno}.
19576 @item optall
19577 Turn on all optimization options, i.e., @option{optimized},
19578 @option{missed}, and @option{note}.
19579 @end table
19581 To determine what tree dumps are available or find the dump for a pass
19582 of interest follow the steps below.
19584 @enumerate
19585 @item
19586 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
19587 look for a code that corresponds to the pass you are interested in.
19588 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
19589 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
19590 The number at the end distinguishes distinct invocations of the same pass.
19591 @item
19592 To enable the creation of the dump file, append the pass code to
19593 the @option{-fdump-} option prefix and invoke GCC with it.  For example,
19594 to enable the dump from the Early Value Range Propagation pass, invoke
19595 GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
19596 specify the name of the dump file.  If you don't specify one, GCC
19597 creates as described below.
19598 @item
19599 Find the pass dump in a file whose name is composed of three components
19600 separated by a period: the name of the source file GCC was invoked to
19601 compile, a numeric suffix indicating the pass number followed by the
19602 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
19603 and finally the pass code.  For example, the Early VRP pass dump might
19604 be in a file named @file{myfile.c.038t.evrp} in the current working
19605 directory.  Note that the numeric codes are not stable and may change
19606 from one version of GCC to another.
19607 @end enumerate
19609 @opindex fopt-info
19610 @item -fopt-info
19611 @itemx -fopt-info-@var{options}
19612 @itemx -fopt-info-@var{options}=@var{filename}
19613 Controls optimization dumps from various optimization passes. If the
19614 @samp{-@var{options}} form is used, @var{options} is a list of
19615 @samp{-} separated option keywords to select the dump details and
19616 optimizations.  
19618 The @var{options} can be divided into three groups:
19619 @enumerate
19620 @item
19621 options describing what kinds of messages should be emitted,
19622 @item
19623 options describing the verbosity of the dump, and
19624 @item
19625 options describing which optimizations should be included.
19626 @end enumerate
19627 The options from each group can be freely mixed as they are
19628 non-overlapping. However, in case of any conflicts,
19629 the later options override the earlier options on the command
19630 line. 
19632 The following options control which kinds of messages should be emitted:
19634 @table @samp
19635 @item optimized
19636 Print information when an optimization is successfully applied. It is
19637 up to a pass to decide which information is relevant. For example, the
19638 vectorizer passes print the source location of loops which are
19639 successfully vectorized.
19640 @item missed
19641 Print information about missed optimizations. Individual passes
19642 control which information to include in the output. 
19643 @item note
19644 Print verbose information about optimizations, such as certain
19645 transformations, more detailed messages about decisions etc.
19646 @item all
19647 Print detailed optimization information. This includes
19648 @samp{optimized}, @samp{missed}, and @samp{note}.
19649 @end table
19651 The following option controls the dump verbosity:
19653 @table @samp
19654 @item internals
19655 By default, only ``high-level'' messages are emitted. This option enables
19656 additional, more detailed, messages, which are likely to only be of interest
19657 to GCC developers.
19658 @end table
19660 One or more of the following option keywords can be used to describe a
19661 group of optimizations:
19663 @table @samp
19664 @item ipa
19665 Enable dumps from all interprocedural optimizations.
19666 @item loop
19667 Enable dumps from all loop optimizations.
19668 @item inline
19669 Enable dumps from all inlining optimizations.
19670 @item omp
19671 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
19672 @item vec
19673 Enable dumps from all vectorization optimizations.
19674 @item optall
19675 Enable dumps from all optimizations. This is a superset of
19676 the optimization groups listed above.
19677 @end table
19679 If @var{options} is
19680 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
19681 about successful optimizations from all the passes, omitting messages
19682 that are treated as ``internals''.
19684 If the @var{filename} is provided, then the dumps from all the
19685 applicable optimizations are concatenated into the @var{filename}.
19686 Otherwise the dump is output onto @file{stderr}. Though multiple
19687 @option{-fopt-info} options are accepted, only one of them can include
19688 a @var{filename}. If other filenames are provided then all but the
19689 first such option are ignored.
19691 Note that the output @var{filename} is overwritten
19692 in case of multiple translation units. If a combined output from
19693 multiple translation units is desired, @file{stderr} should be used
19694 instead.
19696 In the following example, the optimization info is output to
19697 @file{stderr}:
19699 @smallexample
19700 gcc -O3 -fopt-info
19701 @end smallexample
19703 This example:
19704 @smallexample
19705 gcc -O3 -fopt-info-missed=missed.all
19706 @end smallexample
19708 @noindent
19709 outputs missed optimization report from all the passes into
19710 @file{missed.all}, and this one:
19712 @smallexample
19713 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
19714 @end smallexample
19716 @noindent
19717 prints information about missed optimization opportunities from
19718 vectorization passes on @file{stderr}.  
19719 Note that @option{-fopt-info-vec-missed} is equivalent to 
19720 @option{-fopt-info-missed-vec}.  The order of the optimization group
19721 names and message types listed after @option{-fopt-info} does not matter.
19723 As another example,
19724 @smallexample
19725 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
19726 @end smallexample
19728 @noindent
19729 outputs information about missed optimizations as well as
19730 optimized locations from all the inlining passes into
19731 @file{inline.txt}.
19733 Finally, consider:
19735 @smallexample
19736 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
19737 @end smallexample
19739 @noindent
19740 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
19741 in conflict since only one output file is allowed. In this case, only
19742 the first option takes effect and the subsequent options are
19743 ignored. Thus only @file{vec.miss} is produced which contains
19744 dumps from the vectorizer about missed opportunities.
19746 @opindex fsave-optimization-record
19747 @item -fsave-optimization-record
19748 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
19749 were performed, for those optimizations that support @option{-fopt-info}.
19751 This option is experimental and the format of the data within the
19752 compressed JSON file is subject to change.
19754 It is roughly equivalent to a machine-readable version of
19755 @option{-fopt-info-all}, as a collection of messages with source file,
19756 line number and column number, with the following additional data for
19757 each message:
19759 @itemize @bullet
19761 @item
19762 the execution count of the code being optimized, along with metadata about
19763 whether this was from actual profile data, or just an estimate, allowing
19764 consumers to prioritize messages by code hotness,
19766 @item
19767 the function name of the code being optimized, where applicable,
19769 @item
19770 the ``inlining chain'' for the code being optimized, so that when
19771 a function is inlined into several different places (which might
19772 themselves be inlined), the reader can distinguish between the copies,
19774 @item
19775 objects identifying those parts of the message that refer to expressions,
19776 statements or symbol-table nodes, which of these categories they are, and,
19777 when available, their source code location,
19779 @item
19780 the GCC pass that emitted the message, and
19782 @item
19783 the location in GCC's own code from which the message was emitted
19785 @end itemize
19787 Additionally, some messages are logically nested within other
19788 messages, reflecting implementation details of the optimization
19789 passes.
19791 @opindex fsched-verbose
19792 @item -fsched-verbose=@var{n}
19793 On targets that use instruction scheduling, this option controls the
19794 amount of debugging output the scheduler prints to the dump files.
19796 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
19797 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
19798 For @var{n} greater than one, it also output basic block probabilities,
19799 detailed ready list information and unit/insn info.  For @var{n} greater
19800 than two, it includes RTL at abort point, control-flow and regions info.
19801 And for @var{n} over four, @option{-fsched-verbose} also includes
19802 dependence info.
19806 @opindex fdisable-
19807 @opindex fenable-
19808 @item -fenable-@var{kind}-@var{pass}
19809 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
19811 This is a set of options that are used to explicitly disable/enable
19812 optimization passes.  These options are intended for use for debugging GCC.
19813 Compiler users should use regular options for enabling/disabling
19814 passes instead.
19816 @table @gcctabopt
19818 @item -fdisable-ipa-@var{pass}
19819 Disable IPA pass @var{pass}. @var{pass} is the pass name.  If the same pass is
19820 statically invoked in the compiler multiple times, the pass name should be
19821 appended with a sequential number starting from 1.
19823 @item -fdisable-rtl-@var{pass}
19824 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
19825 Disable RTL pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
19826 statically invoked in the compiler multiple times, the pass name should be
19827 appended with a sequential number starting from 1.  @var{range-list} is a 
19828 comma-separated list of function ranges or assembler names.  Each range is a number
19829 pair separated by a colon.  The range is inclusive in both ends.  If the range
19830 is trivial, the number pair can be simplified as a single number.  If the
19831 function's call graph node's @var{uid} falls within one of the specified ranges,
19832 the @var{pass} is disabled for that function.  The @var{uid} is shown in the
19833 function header of a dump file, and the pass names can be dumped by using
19834 option @option{-fdump-passes}.
19836 @item -fdisable-tree-@var{pass}
19837 @itemx -fdisable-tree-@var{pass}=@var{range-list}
19838 Disable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description of
19839 option arguments.
19841 @item -fenable-ipa-@var{pass}
19842 Enable IPA pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
19843 statically invoked in the compiler multiple times, the pass name should be
19844 appended with a sequential number starting from 1.
19846 @item -fenable-rtl-@var{pass}
19847 @itemx -fenable-rtl-@var{pass}=@var{range-list}
19848 Enable RTL pass @var{pass}.  See @option{-fdisable-rtl} for option argument
19849 description and examples.
19851 @item -fenable-tree-@var{pass}
19852 @itemx -fenable-tree-@var{pass}=@var{range-list}
19853 Enable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description
19854 of option arguments.
19856 @end table
19858 Here are some examples showing uses of these options.
19860 @smallexample
19862 # disable ccp1 for all functions
19863    -fdisable-tree-ccp1
19864 # disable complete unroll for function whose cgraph node uid is 1
19865    -fenable-tree-cunroll=1
19866 # disable gcse2 for functions at the following ranges [1,1],
19867 # [300,400], and [400,1000]
19868 # disable gcse2 for functions foo and foo2
19869    -fdisable-rtl-gcse2=foo,foo2
19870 # disable early inlining
19871    -fdisable-tree-einline
19872 # disable ipa inlining
19873    -fdisable-ipa-inline
19874 # enable tree full unroll
19875    -fenable-tree-unroll
19877 @end smallexample
19879 @opindex fchecking
19880 @opindex fno-checking
19881 @item -fchecking
19882 @itemx -fchecking=@var{n}
19883 Enable internal consistency checking.  The default depends on
19884 the compiler configuration.  @option{-fchecking=2} enables further
19885 internal consistency checking that might affect code generation.
19887 @opindex frandom-seed
19888 @item -frandom-seed=@var{string}
19889 This option provides a seed that GCC uses in place of
19890 random numbers in generating certain symbol names
19891 that have to be different in every compiled file.  It is also used to
19892 place unique stamps in coverage data files and the object files that
19893 produce them.  You can use the @option{-frandom-seed} option to produce
19894 reproducibly identical object files.
19896 The @var{string} can either be a number (decimal, octal or hex) or an
19897 arbitrary string (in which case it's converted to a number by
19898 computing CRC32).
19900 The @var{string} should be different for every file you compile.
19902 @opindex save-temps
19903 @item -save-temps
19904 Store the usual ``temporary'' intermediate files permanently; name them
19905 as auxiliary output files, as specified described under
19906 @option{-dumpbase} and @option{-dumpdir}.
19908 When used in combination with the @option{-x} command-line option,
19909 @option{-save-temps} is sensible enough to avoid overwriting an
19910 input source file with the same extension as an intermediate file.
19911 The corresponding intermediate file may be obtained by renaming the
19912 source file before using @option{-save-temps}.
19914 @opindex save-temps=cwd
19915 @item -save-temps=cwd
19916 Equivalent to @option{-save-temps -dumpdir ./}.
19918 @opindex save-temps=obj
19919 @item -save-temps=obj
19920 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
19921 @file{outdir/} is the directory of the output file specified after the
19922 @option{-o} option, including any directory separators.  If the
19923 @option{-o} option is not used, the @option{-save-temps=obj} switch
19924 behaves like @option{-save-temps=cwd}.
19926 @opindex time
19927 @item -time@r{[}=@var{file}@r{]}
19928 Report the CPU time taken by each subprocess in the compilation
19929 sequence.  For C source files, this is the compiler proper and assembler
19930 (plus the linker if linking is done).
19932 Without the specification of an output file, the output looks like this:
19934 @smallexample
19935 # cc1 0.12 0.01
19936 # as 0.00 0.01
19937 @end smallexample
19939 The first number on each line is the ``user time'', that is time spent
19940 executing the program itself.  The second number is ``system time'',
19941 time spent executing operating system routines on behalf of the program.
19942 Both numbers are in seconds.
19944 With the specification of an output file, the output is appended to the
19945 named file, and it looks like this:
19947 @smallexample
19948 0.12 0.01 cc1 @var{options}
19949 0.00 0.01 as @var{options}
19950 @end smallexample
19952 The ``user time'' and the ``system time'' are moved before the program
19953 name, and the options passed to the program are displayed, so that one
19954 can later tell what file was being compiled, and with which options.
19956 @opindex fdump-final-insns
19957 @item -fdump-final-insns@r{[}=@var{file}@r{]}
19958 Dump the final internal representation (RTL) to @var{file}.  If the
19959 optional argument is omitted (or if @var{file} is @code{.}), the name
19960 of the dump file is determined by appending @code{.gkd} to the
19961 dump base name, see @option{-dumpbase}.
19963 @opindex fcompare-debug
19964 @opindex fno-compare-debug
19965 @item -fcompare-debug@r{[}=@var{opts}@r{]}
19966 If no error occurs during compilation, run the compiler a second time,
19967 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
19968 passed to the second compilation.  Dump the final internal
19969 representation in both compilations, and print an error if they differ.
19971 If the equal sign is omitted, the default @option{-gtoggle} is used.
19973 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
19974 and nonzero, implicitly enables @option{-fcompare-debug}.  If
19975 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
19976 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
19977 is used.
19979 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
19980 is equivalent to @option{-fno-compare-debug}, which disables the dumping
19981 of the final representation and the second compilation, preventing even
19982 @env{GCC_COMPARE_DEBUG} from taking effect.
19984 To verify full coverage during @option{-fcompare-debug} testing, set
19985 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
19986 which GCC rejects as an invalid option in any actual compilation
19987 (rather than preprocessing, assembly or linking).  To get just a
19988 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
19989 not overridden} will do.
19991 @opindex fcompare-debug-second
19992 @item -fcompare-debug-second
19993 This option is implicitly passed to the compiler for the second
19994 compilation requested by @option{-fcompare-debug}, along with options to
19995 silence warnings, and omitting other options that would cause the compiler
19996 to produce output to files or to standard output as a side effect.  Dump
19997 files and preserved temporary files are renamed so as to contain the
19998 @code{.gk} additional extension during the second compilation, to avoid
19999 overwriting those generated by the first.
20001 When this option is passed to the compiler driver, it causes the
20002 @emph{first} compilation to be skipped, which makes it useful for little
20003 other than debugging the compiler proper.
20005 @opindex gtoggle
20006 @item -gtoggle
20007 Turn off generation of debug info, if leaving out this option
20008 generates it, or turn it on at level 2 otherwise.  The position of this
20009 argument in the command line does not matter; it takes effect after all
20010 other options are processed, and it does so only once, no matter how
20011 many times it is given.  This is mainly intended to be used with
20012 @option{-fcompare-debug}.
20014 @opindex fvar-tracking-assignments-toggle
20015 @opindex fno-var-tracking-assignments-toggle
20016 @item -fvar-tracking-assignments-toggle
20017 Toggle @option{-fvar-tracking-assignments}, in the same way that
20018 @option{-gtoggle} toggles @option{-g}.
20020 @opindex Q
20021 @item -Q
20022 Makes the compiler print out each function name as it is compiled, and
20023 print some statistics about each pass when it finishes.
20025 @opindex ftime-report
20026 @item -ftime-report
20027 Makes the compiler print some statistics to stderr about the time consumed
20028 by each pass when it finishes.
20030 If SARIF output of diagnostics was requested via
20031 @option{-fdiagnostics-format=sarif-file} or
20032 @option{-fdiagnostics-format=sarif-stderr} then the @option{-ftime-report}
20033 information is instead emitted in JSON form as part of SARIF output.  The
20034 precise format of this JSON data is subject to change, and the values may
20035 not exactly match those emitted to stderr due to being written out at a
20036 slightly different place within the compiler.
20038 @opindex ftime-report-details
20039 @item -ftime-report-details
20040 Record the time consumed by infrastructure parts separately for each pass.
20042 @opindex fira-verbose
20043 @item -fira-verbose=@var{n}
20044 Control the verbosity of the dump file for the integrated register allocator.
20045 The default value is 5.  If the value @var{n} is greater or equal to 10,
20046 the dump output is sent to stderr using the same format as @var{n} minus 10.
20048 @opindex flto-report
20049 @item -flto-report
20050 Prints a report with internal details on the workings of the link-time
20051 optimizer.  The contents of this report vary from version to version.
20052 It is meant to be useful to GCC developers when processing object
20053 files in LTO mode (via @option{-flto}).
20055 Disabled by default.
20057 @opindex flto-report-wpa
20058 @item -flto-report-wpa
20059 Like @option{-flto-report}, but only print for the WPA phase of link-time
20060 optimization.
20062 @opindex fmem-report
20063 @item -fmem-report
20064 Makes the compiler print some statistics about permanent memory
20065 allocation when it finishes.
20067 @opindex fmem-report-wpa
20068 @item -fmem-report-wpa
20069 Makes the compiler print some statistics about permanent memory
20070 allocation for the WPA phase only.
20072 @opindex fpre-ipa-mem-report
20073 @opindex fpost-ipa-mem-report
20074 @item -fpre-ipa-mem-report
20075 @item -fpost-ipa-mem-report
20076 Makes the compiler print some statistics about permanent memory
20077 allocation before or after interprocedural optimization.
20079 @opindex fmultiflags
20080 @item -fmultiflags
20081 This option enables multilib-aware @code{TFLAGS} to be used to build
20082 target libraries with options different from those the compiler is
20083 configured to use by default, through the use of specs (@xref{Spec
20084 Files}) set up by compiler internals, by the target, or by builders at
20085 configure time.
20087 Like @code{TFLAGS}, this allows the target libraries to be built for
20088 portable baseline environments, while the compiler defaults to more
20089 demanding ones.  That's useful because users can easily override the
20090 defaults the compiler is configured to use to build their own programs,
20091 if the defaults are not ideal for their target environment, whereas
20092 rebuilding the runtime libraries is usually not as easy or desirable.
20094 Unlike @code{TFLAGS}, the use of specs enables different flags to be
20095 selected for different multilibs.  The way to accomplish that is to
20096 build with @samp{make TFLAGS=-fmultiflags}, after configuring
20097 @samp{--with-specs=%@{fmultiflags:...@}}.
20099 This option is discarded by the driver once it's done processing driver
20100 self spec.
20102 It is also useful to check that @code{TFLAGS} are being used to build
20103 all target libraries, by configuring a non-bootstrap compiler
20104 @samp{--with-specs='%@{!fmultiflags:%emissing TFLAGS@}'} and building
20105 the compiler and target libraries.
20107 @opindex fprofile-report
20108 @item -fprofile-report
20109 Makes the compiler print some statistics about consistency of the
20110 (estimated) profile and effect of individual passes.
20112 @opindex fstack-usage
20113 @item -fstack-usage
20114 Makes the compiler output stack usage information for the program, on a
20115 per-function basis.  The filename for the dump is made by appending
20116 @file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
20117 the output file, if explicitly specified and it is not an executable,
20118 otherwise it is the basename of the source file.  An entry is made up
20119 of three fields:
20121 @itemize
20122 @item
20123 The name of the function.
20124 @item
20125 A number of bytes.
20126 @item
20127 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
20128 @end itemize
20130 The qualifier @code{static} means that the function manipulates the stack
20131 statically: a fixed number of bytes are allocated for the frame on function
20132 entry and released on function exit; no stack adjustments are otherwise made
20133 in the function.  The second field is this fixed number of bytes.
20135 The qualifier @code{dynamic} means that the function manipulates the stack
20136 dynamically: in addition to the static allocation described above, stack
20137 adjustments are made in the body of the function, for example to push/pop
20138 arguments around function calls.  If the qualifier @code{bounded} is also
20139 present, the amount of these adjustments is bounded at compile time and
20140 the second field is an upper bound of the total amount of stack used by
20141 the function.  If it is not present, the amount of these adjustments is
20142 not bounded at compile time and the second field only represents the
20143 bounded part.
20145 @opindex fstats
20146 @item -fstats
20147 Emit statistics about front-end processing at the end of the compilation.
20148 This option is supported only by the C++ front end, and
20149 the information is generally only useful to the G++ development team.
20151 @opindex fdbg-cnt-list
20152 @item -fdbg-cnt-list
20153 Print the name and the counter upper bound for all debug counters.
20156 @opindex fdbg-cnt
20157 @item -fdbg-cnt=@var{counter-value-list}
20158 Set the internal debug counter lower and upper bound.  @var{counter-value-list}
20159 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
20160 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
20161 the name of the counter and list of closed intervals.
20162 The @var{lower_bound} is optional and is zero
20163 initialized if not set.
20164 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
20165 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
20166 eleventh invocation.
20167 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
20169 @opindex print-file-name
20170 @item -print-file-name=@var{library}
20171 Print the full absolute name of the library file @var{library} that
20172 would be used when linking---and don't do anything else.  With this
20173 option, GCC does not compile or link anything; it just prints the
20174 file name.
20176 @opindex print-multi-directory
20177 @item -print-multi-directory
20178 Print the directory name corresponding to the multilib selected by any
20179 other switches present in the command line.  This directory is supposed
20180 to exist in @env{GCC_EXEC_PREFIX}.
20182 @opindex print-multi-lib
20183 @item -print-multi-lib
20184 Print the mapping from multilib directory names to compiler switches
20185 that enable them.  The directory name is separated from the switches by
20186 @samp{;}, and each switch starts with an @samp{@@} instead of the
20187 @samp{-}, without spaces between multiple switches.  This is supposed to
20188 ease shell processing.
20190 @opindex print-multi-os-directory
20191 @item -print-multi-os-directory
20192 Print the path to OS libraries for the selected
20193 multilib, relative to some @file{lib} subdirectory.  If OS libraries are
20194 present in the @file{lib} subdirectory and no multilibs are used, this is
20195 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
20196 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
20197 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
20198 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
20200 @opindex print-multiarch
20201 @item -print-multiarch
20202 Print the path to OS libraries for the selected multiarch,
20203 relative to some @file{lib} subdirectory.
20205 @opindex print-prog-name
20206 @item -print-prog-name=@var{program}
20207 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
20209 @opindex print-libgcc-file-name
20210 @item -print-libgcc-file-name
20211 Same as @option{-print-file-name=libgcc.a}.
20213 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
20214 but you do want to link with @file{libgcc.a}.  You can do:
20216 @smallexample
20217 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
20218 @end smallexample
20220 @opindex print-search-dirs
20221 @item -print-search-dirs
20222 Print the name of the configured installation directory and a list of
20223 program and library directories @command{gcc} searches---and don't do anything else.
20225 This is useful when @command{gcc} prints the error message
20226 @samp{installation problem, cannot exec cpp0: No such file or directory}.
20227 To resolve this you either need to put @file{cpp0} and the other compiler
20228 components where @command{gcc} expects to find them, or you can set the environment
20229 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
20230 Don't forget the trailing @samp{/}.
20231 @xref{Environment Variables}.
20233 @opindex print-sysroot
20234 @item -print-sysroot
20235 Print the target sysroot directory that is used during
20236 compilation.  This is the target sysroot specified either at configure
20237 time or using the @option{--sysroot} option, possibly with an extra
20238 suffix that depends on compilation options.  If no target sysroot is
20239 specified, the option prints nothing.
20241 @opindex print-sysroot-headers-suffix
20242 @item -print-sysroot-headers-suffix
20243 Print the suffix added to the target sysroot when searching for
20244 headers, or give an error if the compiler is not configured with such
20245 a suffix---and don't do anything else.
20247 @opindex dumpmachine
20248 @item -dumpmachine
20249 Print the compiler's target machine (for example,
20250 @samp{i686-pc-linux-gnu})---and don't do anything else.
20252 @opindex dumpversion
20253 @item -dumpversion
20254 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
20255 anything else.  This is the compiler version used in filesystem paths and
20256 specs. Depending on how the compiler has been configured it can be just
20257 a single number (major version), two numbers separated by a dot (major and
20258 minor version) or three numbers separated by dots (major, minor and patchlevel
20259 version).
20261 @opindex dumpfullversion
20262 @item -dumpfullversion
20263 Print the full compiler version---and don't do anything else. The output is
20264 always three numbers separated by dots, major, minor and patchlevel version.
20266 @opindex dumpspecs
20267 @item -dumpspecs
20268 Print the compiler's built-in specs---and don't do anything else.  (This
20269 is used when GCC itself is being built.)  @xref{Spec Files}.
20270 @end table
20272 @node Submodel Options
20273 @section Machine-Dependent Options
20274 @cindex submodel options
20275 @cindex specifying hardware config
20276 @cindex hardware models and configurations, specifying
20277 @cindex target-dependent options
20278 @cindex machine-dependent options
20280 Each target machine supported by GCC can have its own options---for
20281 example, to allow you to compile for a particular processor variant or
20282 ABI, or to control optimizations specific to that machine.  By
20283 convention, the names of machine-specific options start with
20284 @samp{-m}.
20286 Some configurations of the compiler also support additional target-specific
20287 options, usually for compatibility with other compilers on the same
20288 platform.
20290 @c This list is ordered alphanumerically by subsection name.
20291 @c It should be the same order and spelling as these options are listed
20292 @c in Machine Dependent Options
20294 @menu
20295 * AArch64 Options::
20296 * Adapteva Epiphany Options::
20297 * AMD GCN Options::
20298 * ARC Options::
20299 * ARM Options::
20300 * AVR Options::
20301 * Blackfin Options::
20302 * C6X Options::
20303 * CRIS Options::
20304 * C-SKY Options::
20305 * Darwin Options::
20306 * DEC Alpha Options::
20307 * eBPF Options::
20308 * FR30 Options::
20309 * FT32 Options::
20310 * FRV Options::
20311 * GNU/Linux Options::
20312 * H8/300 Options::
20313 * HPPA Options::
20314 * IA-64 Options::
20315 * LM32 Options::
20316 * LoongArch Options::
20317 * M32C Options::
20318 * M32R/D Options::
20319 * M680x0 Options::
20320 * MCore Options::
20321 * MicroBlaze Options::
20322 * MIPS Options::
20323 * MMIX Options::
20324 * MN10300 Options::
20325 * Moxie Options::
20326 * MSP430 Options::
20327 * NDS32 Options::
20328 * Nios II Options::
20329 * Nvidia PTX Options::
20330 * OpenRISC Options::
20331 * PDP-11 Options::
20332 * PowerPC Options::
20333 * PRU Options::
20334 * RISC-V Options::
20335 * RL78 Options::
20336 * RS/6000 and PowerPC Options::
20337 * RX Options::
20338 * S/390 and zSeries Options::
20339 * SH Options::
20340 * Solaris 2 Options::
20341 * SPARC Options::
20342 * System V Options::
20343 * V850 Options::
20344 * VAX Options::
20345 * Visium Options::
20346 * VMS Options::
20347 * VxWorks Options::
20348 * x86 Options::
20349 * x86 Windows Options::
20350 * Xstormy16 Options::
20351 * Xtensa Options::
20352 * zSeries Options::
20353 @end menu
20355 @node AArch64 Options
20356 @subsection AArch64 Options
20357 @cindex AArch64 Options
20359 These options are defined for AArch64 implementations:
20361 @table @gcctabopt
20363 @opindex mabi
20364 @item -mabi=@var{name}
20365 Generate code for the specified data model.  Permissible values
20366 are @samp{ilp32} for SysV-like data model where int, long int and pointers
20367 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
20368 but long int and pointers are 64 bits.
20370 The default depends on the specific target configuration.  Note that
20371 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
20372 entire program with the same ABI, and link with a compatible set of libraries.
20374 @opindex mbig-endian
20375 @item -mbig-endian
20376 Generate big-endian code.  This is the default when GCC is configured for an
20377 @samp{aarch64_be-*-*} target.
20379 @opindex mgeneral-regs-only
20380 @item -mgeneral-regs-only
20381 Generate code which uses only the general-purpose registers.  This will prevent
20382 the compiler from using floating-point and Advanced SIMD registers but will not
20383 impose any restrictions on the assembler.
20385 @opindex mlittle-endian
20386 @item -mlittle-endian
20387 Generate little-endian code.  This is the default when GCC is configured for an
20388 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
20390 @opindex mcmodel=tiny
20391 @item -mcmodel=tiny
20392 Generate code for the tiny code model.  The program and its statically defined
20393 symbols must be within 1MB of each other.  Programs can be statically or
20394 dynamically linked.
20396 @opindex mcmodel=small
20397 @item -mcmodel=small
20398 Generate code for the small code model.  The program and its statically defined
20399 symbols must be within 4GB of each other.  Programs can be statically or
20400 dynamically linked.  This is the default code model.
20402 @opindex mcmodel=large
20403 @item -mcmodel=large
20404 Generate code for the large code model.  This makes no assumptions about
20405 addresses and sizes of sections.  Programs can be statically linked only.  The
20406 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
20407 @option{-fpic} and @option{-fPIC}.
20409 @item -mtp=@var{name}
20410 @opindex mtp
20411 Specify the system register to use as a thread pointer.  The valid values
20412 are @samp{tpidr_el0}, @samp{tpidrro_el0}, @samp{tpidr_el1}, @samp{tpidr_el2},
20413 @samp{tpidr_el3}.  For backwards compatibility the aliases @samp{el0},
20414 @samp{el1}, @samp{el2}, @samp{el3} are also accepted.
20415 The default setting is @samp{tpidr_el0}.  It is recommended to compile all
20416 code intended to interoperate with the same value of this option to avoid
20417 accessing a different thread pointer from the wrong exception level.
20419 @opindex mstrict-align
20420 @opindex mno-strict-align
20421 @item -mstrict-align
20422 @itemx -mno-strict-align
20423 Avoid or allow generating memory accesses that may not be aligned on a natural
20424 object boundary as described in the architecture specification.
20426 @opindex momit-leaf-frame-pointer
20427 @opindex mno-omit-leaf-frame-pointer
20428 @item -momit-leaf-frame-pointer
20429 @itemx -mno-omit-leaf-frame-pointer
20430 Omit or keep the frame pointer in leaf functions.  The former behavior is the
20431 default.
20433 @opindex mstack-protector-guard
20434 @opindex mstack-protector-guard-reg
20435 @opindex mstack-protector-guard-offset
20436 @item -mstack-protector-guard=@var{guard}
20437 @itemx -mstack-protector-guard-reg=@var{reg}
20438 @itemx -mstack-protector-guard-offset=@var{offset}
20439 Generate stack protection code using canary at @var{guard}.  Supported
20440 locations are @samp{global} for a global canary or @samp{sysreg} for a
20441 canary in an appropriate system register.
20443 With the latter choice the options
20444 @option{-mstack-protector-guard-reg=@var{reg}} and
20445 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
20446 which system register to use as base register for reading the canary,
20447 and from what offset from that base register. There is no default
20448 register or offset as this is entirely for use within the Linux
20449 kernel.
20451 @opindex mtls-dialect=desc
20452 @item -mtls-dialect=desc
20453 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
20454 of TLS variables.  This is the default.
20456 @opindex mtls-dialect=traditional
20457 @item -mtls-dialect=traditional
20458 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
20459 of TLS variables.
20461 @opindex mtls-size
20462 @item -mtls-size=@var{size}
20463 Specify bit size of immediate TLS offsets.  Valid values are 12, 24, 32, 48.
20464 This option requires binutils 2.26 or newer.
20466 @opindex mfix-cortex-a53-835769
20467 @opindex mno-fix-cortex-a53-835769
20468 @item -mfix-cortex-a53-835769
20469 @itemx -mno-fix-cortex-a53-835769
20470 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
20471 This involves inserting a NOP instruction between memory instructions and
20472 64-bit integer multiply-accumulate instructions.
20474 @opindex mfix-cortex-a53-843419
20475 @opindex mno-fix-cortex-a53-843419
20476 @item -mfix-cortex-a53-843419
20477 @itemx -mno-fix-cortex-a53-843419
20478 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
20479 This erratum workaround is made at link time and this will only pass the
20480 corresponding flag to the linker.
20482 @opindex mlow-precision-recip-sqrt
20483 @opindex mno-low-precision-recip-sqrt
20484 @item -mlow-precision-recip-sqrt
20485 @itemx -mno-low-precision-recip-sqrt
20486 Enable or disable the reciprocal square root approximation.
20487 This option only has an effect if @option{-ffast-math} or
20488 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20489 precision of reciprocal square root results to about 16 bits for
20490 single precision and to 32 bits for double precision.
20492 @opindex mlow-precision-sqrt
20493 @opindex mno-low-precision-sqrt
20494 @item -mlow-precision-sqrt
20495 @itemx -mno-low-precision-sqrt
20496 Enable or disable the square root approximation.
20497 This option only has an effect if @option{-ffast-math} or
20498 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20499 precision of square root results to about 16 bits for
20500 single precision and to 32 bits for double precision.
20501 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
20503 @opindex mlow-precision-div
20504 @opindex mno-low-precision-div
20505 @item -mlow-precision-div
20506 @itemx -mno-low-precision-div
20507 Enable or disable the division approximation.
20508 This option only has an effect if @option{-ffast-math} or
20509 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20510 precision of division results to about 16 bits for
20511 single precision and to 32 bits for double precision.
20513 @item -mtrack-speculation
20514 @itemx -mno-track-speculation
20515 Enable or disable generation of additional code to track speculative
20516 execution through conditional branches.  The tracking state can then
20517 be used by the compiler when expanding calls to
20518 @code{__builtin_speculation_safe_copy} to permit a more efficient code
20519 sequence to be generated.
20521 @item -moutline-atomics
20522 @itemx -mno-outline-atomics
20523 Enable or disable calls to out-of-line helpers to implement atomic operations.
20524 These helpers will, at runtime, determine if the LSE instructions from
20525 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
20526 instructions that are present in the base ARMv8.0 ISA.
20528 This option is only applicable when compiling for the base ARMv8.0
20529 instruction set.  If using a later revision, e.g. @option{-march=armv8.1-a}
20530 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
20531 used directly.  The same applies when using @option{-mcpu=} when the
20532 selected cpu supports the @samp{lse} feature.
20533 This option is on by default.
20535 @opindex march
20536 @item -march=@var{name}
20537 Specify the name of the target architecture and, optionally, one or
20538 more feature modifiers.  This option has the form
20539 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
20541 The table below summarizes the permissible values for @var{arch}
20542 and the features that they enable by default:
20544 @multitable @columnfractions 0.20 0.20 0.60
20545 @headitem @var{arch} value @tab Architecture @tab Includes by default
20546 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
20547 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
20548 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
20549 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
20550 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
20551 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
20552 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
20553 @item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64}
20554 @item @samp{armv8.8-a} @tab Armv8.8-a @tab @samp{armv8.7-a}, @samp{+mops}
20555 @item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2}
20556 @item @samp{armv9.1-a} @tab Armv9.1-A @tab @samp{armv9-a}, @samp{+bf16}, @samp{+i8mm}
20557 @item @samp{armv9.2-a} @tab Armv9.2-A @tab @samp{armv9.1-a}, @samp{+ls64}
20558 @item @samp{armv9.3-a} @tab Armv9.3-A @tab @samp{armv9.2-a}, @samp{+mops}
20559 @item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
20560 @end multitable
20562 The value @samp{native} is available on native AArch64 GNU/Linux and
20563 causes the compiler to pick the architecture of the host system.  This
20564 option has no effect if the compiler is unable to recognize the
20565 architecture of the host system,
20567 The permissible values for @var{feature} are listed in the sub-section
20568 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20569 Feature Modifiers}.  Where conflicting feature modifiers are
20570 specified, the right-most feature is used.
20572 GCC uses @var{name} to determine what kind of instructions it can emit
20573 when generating assembly code.  If @option{-march} is specified
20574 without either of @option{-mtune} or @option{-mcpu} also being
20575 specified, the code is tuned to perform well across a range of target
20576 processors implementing the target architecture.
20578 @opindex mtune
20579 @item -mtune=@var{name}
20580 Specify the name of the target processor for which GCC should tune the
20581 performance of the code.  Permissible values for this option are:
20582 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
20583 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
20584 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
20585 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
20586 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
20587 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
20588 @samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
20589 @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{neoverse-v2}, @samp{qdf24xx},
20590 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
20591 @samp{octeontx}, @samp{octeontx81},  @samp{octeontx83},
20592 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
20593 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
20594 @samp{octeontx2f95mm},
20595 @samp{a64fx},
20596 @samp{thunderx}, @samp{thunderxt88},
20597 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
20598 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
20599 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20600 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20601 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
20602 @samp{cortex-r82}, @samp{cortex-x1}, @samp{cortex-x1c}, @samp{cortex-x2},
20603 @samp{cortex-x3}, @samp{cortex-a510}, @samp{cortex-a520}, @samp{cortex-a710},
20604 @samp{cortex-a715}, @samp{cortex-a720}, @samp{ampere1}, @samp{ampere1a},
20605 and @samp{native}.
20607 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20608 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20609 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
20610 should tune for a big.LITTLE system.
20612 The value @samp{neoverse-512tvb} specifies that GCC should tune
20613 for Neoverse cores that (a) implement SVE and (b) have a total vector
20614 bandwidth of 512 bits per cycle.  In other words, the option tells GCC to
20615 tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
20616 instructions a cycle and that can execute an equivalent number of SVE
20617 arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
20618 This is more general than tuning for a specific core like Neoverse V1
20619 but is more specific than the default tuning described below.
20621 Additionally on native AArch64 GNU/Linux systems the value
20622 @samp{native} tunes performance to the host system.  This option has no effect
20623 if the compiler is unable to recognize the processor of the host system.
20625 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
20626 are specified, the code is tuned to perform well across a range
20627 of target processors.
20629 This option cannot be suffixed by feature modifiers.
20631 @opindex mcpu
20632 @item -mcpu=@var{name}
20633 Specify the name of the target processor, optionally suffixed by one
20634 or more feature modifiers.  This option has the form
20635 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
20636 the permissible values for @var{cpu} are the same as those available
20637 for @option{-mtune}.  The permissible values for @var{feature} are
20638 documented in the sub-section on
20639 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20640 Feature Modifiers}.  Where conflicting feature modifiers are
20641 specified, the right-most feature is used.
20643 GCC uses @var{name} to determine what kind of instructions it can emit when
20644 generating assembly code (as if by @option{-march}) and to determine
20645 the target processor for which to tune for performance (as if
20646 by @option{-mtune}).  Where this option is used in conjunction
20647 with @option{-march} or @option{-mtune}, those options take precedence
20648 over the appropriate part of this option.
20650 @option{-mcpu=neoverse-512tvb} is special in that it does not refer
20651 to a specific core, but instead refers to all Neoverse cores that
20652 (a) implement SVE and (b) have a total vector bandwidth of 512 bits
20653 a cycle.  Unless overridden by @option{-march},
20654 @option{-mcpu=neoverse-512tvb} generates code that can run on a
20655 Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
20656 these properties.  Unless overridden by @option{-mtune},
20657 @option{-mcpu=neoverse-512tvb} tunes code in the same way as for
20658 @option{-mtune=neoverse-512tvb}.
20660 @opindex moverride
20661 @item -moverride=@var{string}
20662 Override tuning decisions made by the back-end in response to a
20663 @option{-mtune=} switch.  The syntax, semantics, and accepted values
20664 for @var{string} in this option are not guaranteed to be consistent
20665 across releases.
20667 This option is only intended to be useful when developing GCC.
20669 @opindex mverbose-cost-dump
20670 @item -mverbose-cost-dump
20671 Enable verbose cost model dumping in the debug dump files.  This option is
20672 provided for use in debugging the compiler.
20674 @opindex mpc-relative-literal-loads
20675 @opindex mno-pc-relative-literal-loads
20676 @item -mpc-relative-literal-loads
20677 @itemx -mno-pc-relative-literal-loads
20678 Enable or disable PC-relative literal loads.  With this option literal pools are
20679 accessed using a single instruction and emitted after each function.  This
20680 limits the maximum size of functions to 1MB.  This is enabled by default for
20681 @option{-mcmodel=tiny}.
20683 @opindex msign-return-address
20684 @item -msign-return-address=@var{scope}
20685 Select the function scope on which return address signing will be applied.
20686 Permissible values are @samp{none}, which disables return address signing,
20687 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
20688 functions, and @samp{all}, which enables pointer signing for all functions.  The
20689 default value is @samp{none}. This option has been deprecated by
20690 -mbranch-protection.
20692 @opindex mbranch-protection
20693 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
20694 Select the branch protection features to use.
20695 @samp{none} is the default and turns off all types of branch protection.
20696 @samp{standard} turns on all types of branch protection features.  If a feature
20697 has additional tuning options, then @samp{standard} sets it to its standard
20698 level.
20699 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
20700 level: signing functions that save the return address to memory (non-leaf
20701 functions will practically always do this) using the a-key.  The optional
20702 argument @samp{leaf} can be used to extend the signing to include leaf
20703 functions.  The optional argument @samp{b-key} can be used to sign the functions
20704 with the B-key instead of the A-key.
20705 @samp{bti} turns on branch target identification mechanism.
20707 @opindex mharden-sls
20708 @item -mharden-sls=@var{opts}
20709 Enable compiler hardening against straight line speculation (SLS).
20710 @var{opts} is a comma-separated list of the following options:
20711 @table @samp
20712 @item retbr
20713 @item blr
20714 @end table
20715 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
20716 @samp{-mharden-sls=none} disables all SLS hardening.
20718 @opindex msve-vector-bits
20719 @item -msve-vector-bits=@var{bits}
20720 Specify the number of bits in an SVE vector register.  This option only has
20721 an effect when SVE is enabled.
20723 GCC supports two forms of SVE code generation: ``vector-length
20724 agnostic'' output that works with any size of vector register and
20725 ``vector-length specific'' output that allows GCC to make assumptions
20726 about the vector length when it is useful for optimization reasons.
20727 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
20728 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
20729 Specifying @samp{scalable} selects vector-length agnostic
20730 output.  At present @samp{-msve-vector-bits=128} also generates vector-length
20731 agnostic output for big-endian targets.  All other values generate
20732 vector-length specific code.  The behavior of these values may change
20733 in future releases and no value except @samp{scalable} should be
20734 relied on for producing code that is portable across different
20735 hardware SVE vector lengths.
20737 The default is @samp{-msve-vector-bits=scalable}, which produces
20738 vector-length agnostic code.
20739 @end table
20741 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
20742 @anchor{aarch64-feature-modifiers}
20743 @cindex @option{-march} feature modifiers
20744 @cindex @option{-mcpu} feature modifiers
20745 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
20746 the following and their inverses @option{no@var{feature}}:
20748 @table @samp
20749 @item crc
20750 Enable CRC extension.  This is on by default for
20751 @option{-march=armv8.1-a}.
20752 @item crypto
20753 Enable Crypto extension.  This also enables Advanced SIMD and floating-point
20754 instructions.
20755 @item fp
20756 Enable floating-point instructions.  This is on by default for all possible
20757 values for options @option{-march} and @option{-mcpu}.
20758 @item simd
20759 Enable Advanced SIMD instructions.  This also enables floating-point
20760 instructions.  This is on by default for all possible values for options
20761 @option{-march} and @option{-mcpu}.
20762 @item sve
20763 Enable Scalable Vector Extension instructions.  This also enables Advanced
20764 SIMD and floating-point instructions.
20765 @item lse
20766 Enable Large System Extension instructions.  This is on by default for
20767 @option{-march=armv8.1-a}.
20768 @item rdma
20769 Enable Round Double Multiply Accumulate instructions.  This is on by default
20770 for @option{-march=armv8.1-a}.
20771 @item fp16
20772 Enable FP16 extension.  This also enables floating-point instructions.
20773 @item fp16fml
20774 Enable FP16 fmla extension.  This also enables FP16 extensions and
20775 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.
20777 @item rcpc
20778 Enable the RCpc extension.  This enables the use of the LDAPR instructions for
20779 load-acquire atomic semantics, and passes it on to the assembler, enabling
20780 inline asm statements to use instructions from the RCpc extension.
20781 @item dotprod
20782 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
20783 @item aes
20784 Enable the Armv8-a aes and pmull crypto extension.  This also enables Advanced
20785 SIMD instructions.
20786 @item sha2
20787 Enable the Armv8-a sha2 crypto extension.  This also enables Advanced SIMD instructions.
20788 @item sha3
20789 Enable the sha512 and sha3 crypto extension.  This also enables Advanced SIMD
20790 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
20791 @item sm4
20792 Enable the sm3 and sm4 crypto extension.  This also enables Advanced SIMD instructions.
20793 Use of this option with architectures prior to Armv8.2-A is not supported.
20794 @item profile
20795 Enable the Statistical Profiling extension.  This option is only to enable the
20796 extension at the assembler level and does not affect code generation.
20797 @item rng
20798 Enable the Armv8.5-a Random Number instructions.  This option is only to
20799 enable the extension at the assembler level and does not affect code
20800 generation.
20801 @item memtag
20802 Enable the Armv8.5-a Memory Tagging Extensions.
20803 Use of this option with architectures prior to Armv8.5-A is not supported.
20804 @item sb
20805 Enable the Armv8-a Speculation Barrier instruction.  This option is only to
20806 enable the extension at the assembler level and does not affect code
20807 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
20808 @item ssbs
20809 Enable the Armv8-a Speculative Store Bypass Safe instruction.  This option
20810 is only to enable the extension at the assembler level and does not affect code
20811 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
20812 @item predres
20813 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
20814 This option is only to enable the extension at the assembler level and does
20815 not affect code generation.  This option is enabled by default for
20816 @option{-march=armv8.5-a}.
20817 @item sve2
20818 Enable the Armv8-a Scalable Vector Extension 2.  This also enables SVE
20819 instructions.
20820 @item sve2-bitperm
20821 Enable SVE2 bitperm instructions.  This also enables SVE2 instructions.
20822 @item sve2-sm4
20823 Enable SVE2 sm4 instructions.  This also enables SVE2 instructions.
20824 @item sve2-aes
20825 Enable SVE2 aes instructions.  This also enables SVE2 instructions.
20826 @item sve2-sha3
20827 Enable SVE2 sha3 instructions.  This also enables SVE2 instructions.
20828 @item tme
20829 Enable the Transactional Memory Extension.
20830 @item i8mm
20831 Enable 8-bit Integer Matrix Multiply instructions.  This also enables
20832 Advanced SIMD and floating-point instructions.  This option is enabled by
20833 default for @option{-march=armv8.6-a}.  Use of this option with architectures
20834 prior to Armv8.2-A is not supported.
20835 @item f32mm
20836 Enable 32-bit Floating point Matrix Multiply instructions.  This also enables
20837 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
20838 not supported.
20839 @item f64mm
20840 Enable 64-bit Floating point Matrix Multiply instructions.  This also enables
20841 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
20842 not supported.
20843 @item bf16
20844 Enable brain half-precision floating-point instructions.  This also enables
20845 Advanced SIMD and floating-point instructions.  This option is enabled by
20846 default for @option{-march=armv8.6-a}.  Use of this option with architectures
20847 prior to Armv8.2-A is not supported.
20848 @item ls64
20849 Enable the 64-byte atomic load and store instructions for accelerators.
20850 This option is enabled by default for @option{-march=armv8.7-a}.
20851 @item mops
20852 Enable the instructions to accelerate memory operations like @code{memcpy},
20853 @code{memmove}, @code{memset}.  This option is enabled by default for
20854 @option{-march=armv8.8-a}
20855 @item flagm
20856 Enable the Flag Manipulation instructions Extension.
20857 @item pauth
20858 Enable the Pointer Authentication Extension.
20859 @item cssc
20860 Enable the Common Short Sequence Compression instructions.
20862 @end table
20864 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
20865 which implies @option{fp}.
20866 Conversely, @option{nofp} implies @option{nosimd}, which implies
20867 @option{nocrypto}, @option{noaes} and @option{nosha2}.
20869 @node Adapteva Epiphany Options
20870 @subsection Adapteva Epiphany Options
20872 These @samp{-m} options are defined for Adapteva Epiphany:
20874 @table @gcctabopt
20875 @opindex mhalf-reg-file
20876 @item -mhalf-reg-file
20877 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
20878 That allows code to run on hardware variants that lack these registers.
20880 @opindex mprefer-short-insn-regs
20881 @item -mprefer-short-insn-regs
20882 Preferentially allocate registers that allow short instruction generation.
20883 This can result in increased instruction count, so this may either reduce or
20884 increase overall code size.
20886 @opindex mbranch-cost
20887 @item -mbranch-cost=@var{num}
20888 Set the cost of branches to roughly @var{num} ``simple'' instructions.
20889 This cost is only a heuristic and is not guaranteed to produce
20890 consistent results across releases.
20892 @opindex mcmove
20893 @item -mcmove
20894 Enable the generation of conditional moves.
20896 @opindex mnops
20897 @item -mnops=@var{num}
20898 Emit @var{num} NOPs before every other generated instruction.
20900 @opindex mno-soft-cmpsf
20901 @opindex msoft-cmpsf
20902 @item -mno-soft-cmpsf
20903 For single-precision floating-point comparisons, emit an @code{fsub} instruction
20904 and test the flags.  This is faster than a software comparison, but can
20905 get incorrect results in the presence of NaNs, or when two different small
20906 numbers are compared such that their difference is calculated as zero.
20907 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
20908 software comparisons.
20910 @opindex mstack-offset
20911 @item -mstack-offset=@var{num}
20912 Set the offset between the top of the stack and the stack pointer.
20913 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
20914 can be used by leaf functions without stack allocation.
20915 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
20916 Note also that this option changes the ABI; compiling a program with a
20917 different stack offset than the libraries have been compiled with
20918 generally does not work.
20919 This option can be useful if you want to evaluate if a different stack
20920 offset would give you better code, but to actually use a different stack
20921 offset to build working programs, it is recommended to configure the
20922 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
20924 @opindex mno-round-nearest
20925 @opindex mround-nearest
20926 @item -mno-round-nearest
20927 Make the scheduler assume that the rounding mode has been set to
20928 truncating.  The default is @option{-mround-nearest}.
20930 @opindex mlong-calls
20931 @item -mlong-calls
20932 If not otherwise specified by an attribute, assume all calls might be beyond
20933 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
20934 function address into a register before performing a (otherwise direct) call.
20935 This is the default.
20937 @opindex short-calls
20938 @item -mshort-calls
20939 If not otherwise specified by an attribute, assume all direct calls are
20940 in the range of the @code{b} / @code{bl} instructions, so use these instructions
20941 for direct calls.  The default is @option{-mlong-calls}.
20943 @opindex msmall16
20944 @item -msmall16
20945 Assume addresses can be loaded as 16-bit unsigned values.  This does not
20946 apply to function addresses for which @option{-mlong-calls} semantics
20947 are in effect.
20949 @opindex mfp-mode
20950 @item -mfp-mode=@var{mode}
20951 Set the prevailing mode of the floating-point unit.
20952 This determines the floating-point mode that is provided and expected
20953 at function call and return time.  Making this mode match the mode you
20954 predominantly need at function start can make your programs smaller and
20955 faster by avoiding unnecessary mode switches.
20957 @var{mode} can be set to one the following values:
20959 @table @samp
20960 @item caller
20961 Any mode at function entry is valid, and retained or restored when
20962 the function returns, and when it calls other functions.
20963 This mode is useful for compiling libraries or other compilation units
20964 you might want to incorporate into different programs with different
20965 prevailing FPU modes, and the convenience of being able to use a single
20966 object file outweighs the size and speed overhead for any extra
20967 mode switching that might be needed, compared with what would be needed
20968 with a more specific choice of prevailing FPU mode.
20970 @item truncate
20971 This is the mode used for floating-point calculations with
20972 truncating (i.e.@: round towards zero) rounding mode.  That includes
20973 conversion from floating point to integer.
20975 @item round-nearest
20976 This is the mode used for floating-point calculations with
20977 round-to-nearest-or-even rounding mode.
20979 @item int
20980 This is the mode used to perform integer calculations in the FPU, e.g.@:
20981 integer multiply, or integer multiply-and-accumulate.
20982 @end table
20984 The default is @option{-mfp-mode=caller}
20986 @opindex mno-split-lohi
20987 @opindex msplit-lohi
20988 @opindex mno-postinc
20989 @opindex mpostinc
20990 @opindex mno-postmodify
20991 @opindex mpostmodify
20992 @item -mno-split-lohi
20993 @itemx -mno-postinc
20994 @itemx -mno-postmodify
20995 Code generation tweaks that disable, respectively, splitting of 32-bit
20996 loads, generation of post-increment addresses, and generation of
20997 post-modify addresses.  The defaults are @option{msplit-lohi},
20998 @option{-mpost-inc}, and @option{-mpost-modify}.
21000 @opindex mno-vect-double
21001 @opindex mvect-double
21002 @item -mnovect-double
21003 Change the preferred SIMD mode to SImode.  The default is
21004 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
21006 @opindex max-vect-align
21007 @item -max-vect-align=@var{num}
21008 The maximum alignment for SIMD vector mode types.
21009 @var{num} may be 4 or 8.  The default is 8.
21010 Note that this is an ABI change, even though many library function
21011 interfaces are unaffected if they don't use SIMD vector modes
21012 in places that affect size and/or alignment of relevant types.
21014 @opindex msplit-vecmove-early
21015 @item -msplit-vecmove-early
21016 Split vector moves into single word moves before reload.  In theory this
21017 can give better register allocation, but so far the reverse seems to be
21018 generally the case.
21020 @opindex m1reg-
21021 @item -m1reg-@var{reg}
21022 Specify a register to hold the constant @minus{}1, which makes loading small negative
21023 constants and certain bitmasks faster.
21024 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
21025 which specify use of that register as a fixed register,
21026 and @samp{none}, which means that no register is used for this
21027 purpose.  The default is @option{-m1reg-none}.
21029 @end table
21031 @node AMD GCN Options
21032 @subsection AMD GCN Options
21033 @cindex AMD GCN Options
21035 These options are defined specifically for the AMD GCN port.
21037 @table @gcctabopt
21039 @opindex march
21040 @opindex mtune
21041 @item -march=@var{gpu}
21042 @itemx -mtune=@var{gpu}
21043 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
21046 @table @samp
21047 @item fiji
21048 Compile for GCN3 Fiji devices (gfx803).
21050 @item gfx900
21051 Compile for GCN5 Vega 10 devices (gfx900).
21053 @item gfx906
21054 Compile for GCN5 Vega 20 devices (gfx906).
21056 @item gfx908
21057 Compile for CDNA1 Instinct MI100 series devices (gfx908).
21059 @item gfx90a
21060 Compile for CDNA2 Instinct MI200 series devices (gfx90a).
21062 @end table
21064 @opindex msram-ecc
21065 @item -msram-ecc=on
21066 @itemx -msram-ecc=off
21067 @itemx -msram-ecc=any
21068 Compile binaries suitable for devices with the SRAM-ECC feature enabled,
21069 disabled, or either mode.  This feature can be enabled per-process on some
21070 devices.  The compiled code must match the device mode. The default is
21071 @samp{any}, for devices that support it.
21073 @opindex mstack-size
21074 @item -mstack-size=@var{bytes}
21075 Specify how many @var{bytes} of stack space will be requested for each GPU
21076 thread (wave-front).  Beware that there may be many threads and limited memory
21077 available.  The size of the stack allocation may also have an impact on
21078 run-time performance.  The default is 32KB when using OpenACC or OpenMP, and
21079 1MB otherwise.
21081 @opindex mxnack
21082 @item -mxnack=on
21083 @itemx -mxnack=off
21084 @itemx -mxnack=any
21085 Compile binaries suitable for devices with the XNACK feature enabled, disabled,
21086 or either mode.  Some devices always require XNACK and some allow the user to
21087 configure XNACK.  The compiled code must match the device mode.
21088 @c The default is @samp{-mxnack=any}.
21089 At present this option is a placeholder for support that is not yet implemented.
21091 @end table
21093 @node ARC Options
21094 @subsection ARC Options
21095 @cindex ARC options
21097 The following options control the architecture variant for which code
21098 is being compiled:
21100 @c architecture variants
21101 @table @gcctabopt
21103 @opindex mbarrel-shifter
21104 @item -mbarrel-shifter
21105 Generate instructions supported by barrel shifter.  This is the default
21106 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
21108 @opindex mjli-always
21109 @item -mjli-always
21110 Force to call a function using jli_s instruction.  This option is
21111 valid only for ARCv2 architecture.
21113 @opindex mcpu
21114 @item -mcpu=@var{cpu}
21115 Set architecture type, register usage, and instruction scheduling
21116 parameters for @var{cpu}.  There are also shortcut alias options
21117 available for backward compatibility and convenience.  Supported
21118 values for @var{cpu} are
21120 @table @samp
21121 @opindex mA6
21122 @opindex mARC600
21123 @item arc600
21124 Compile for ARC600.  Aliases: @option{-mA6}, @option{-mARC600}.
21126 @opindex mARC601
21127 @item arc601
21128 Compile for ARC601.  Alias: @option{-mARC601}.
21130 @opindex mA7
21131 @opindex mARC700
21132 @item arc700
21133 Compile for ARC700.  Aliases: @option{-mA7}, @option{-mARC700}.
21134 This is the default when configured with @option{--with-cpu=arc700}@.
21136 @item arcem
21137 Compile for ARC EM.
21139 @item archs
21140 Compile for ARC HS.
21142 @item em
21143 Compile for ARC EM CPU with no hardware extensions.
21145 @item em4
21146 Compile for ARC EM4 CPU.
21148 @item em4_dmips
21149 Compile for ARC EM4 DMIPS CPU.
21151 @item em4_fpus
21152 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
21153 extension.
21155 @item em4_fpuda
21156 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
21157 double assist instructions.
21159 @item hs
21160 Compile for ARC HS CPU with no hardware extensions except the atomic
21161 instructions.
21163 @item hs34
21164 Compile for ARC HS34 CPU.
21166 @item hs38
21167 Compile for ARC HS38 CPU.
21169 @item hs38_linux
21170 Compile for ARC HS38 CPU with all hardware extensions on.
21172 @item hs4x
21173 Compile for ARC HS4x CPU.
21175 @item hs4xd
21176 Compile for ARC HS4xD CPU.
21178 @item hs4x_rel31
21179 Compile for ARC HS4x CPU release 3.10a.
21181 @item arc600_norm
21182 Compile for ARC 600 CPU with @code{norm} instructions enabled.
21184 @item arc600_mul32x16
21185 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply 
21186 instructions enabled.
21188 @item arc600_mul64
21189 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family 
21190 instructions enabled.
21192 @item arc601_norm
21193 Compile for ARC 601 CPU with @code{norm} instructions enabled.
21195 @item arc601_mul32x16
21196 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
21197 instructions enabled.
21199 @item arc601_mul64
21200 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
21201 instructions enabled.
21203 @item nps400
21204 Compile for ARC 700 on NPS400 chip.
21206 @item em_mini
21207 Compile for ARC EM minimalist configuration featuring reduced register
21208 set.
21210 @end table
21212 @opindex mdpfp
21213 @opindex mdpfp-compact
21214 @item -mdpfp
21215 @itemx -mdpfp-compact
21216 Generate double-precision FPX instructions, tuned for the compact
21217 implementation.
21219 @opindex mdpfp-fast
21220 @item -mdpfp-fast
21221 Generate double-precision FPX instructions, tuned for the fast
21222 implementation.
21224 @opindex mno-dpfp-lrsr
21225 @item -mno-dpfp-lrsr
21226 Disable @code{lr} and @code{sr} instructions from using FPX extension
21227 aux registers.
21229 @opindex mea
21230 @item -mea
21231 Generate extended arithmetic instructions.  Currently only
21232 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
21233 supported.  Only valid for @option{-mcpu=ARC700}.
21235 @opindex mno-mpy
21236 @opindex mmpy
21237 @item -mno-mpy
21238 Do not generate @code{mpy}-family instructions for ARC700.  This option is
21239 deprecated.
21241 @opindex mmul32x16
21242 @item -mmul32x16
21243 Generate 32x16-bit multiply and multiply-accumulate instructions.
21245 @opindex mmul64
21246 @item -mmul64
21247 Generate @code{mul64} and @code{mulu64} instructions.  
21248 Only valid for @option{-mcpu=ARC600}.
21250 @opindex mnorm
21251 @item -mnorm
21252 Generate @code{norm} instructions.  This is the default if @option{-mcpu=ARC700}
21253 is in effect.
21255 @opindex mspfp
21256 @opindex mspfp-compact
21257 @item -mspfp
21258 @itemx -mspfp-compact
21259 Generate single-precision FPX instructions, tuned for the compact
21260 implementation.
21262 @opindex mspfp-fast
21263 @item -mspfp-fast
21264 Generate single-precision FPX instructions, tuned for the fast
21265 implementation.
21267 @opindex msimd
21268 @item -msimd
21269 Enable generation of ARC SIMD instructions via target-specific
21270 builtins.  Only valid for @option{-mcpu=ARC700}.
21272 @opindex msoft-float
21273 @item -msoft-float
21274 This option ignored; it is provided for compatibility purposes only.
21275 Software floating-point code is emitted by default, and this default
21276 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
21277 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
21278 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
21280 @opindex mswap
21281 @item -mswap
21282 Generate @code{swap} instructions.
21284 @opindex matomic
21285 @item -matomic
21286 This enables use of the locked load/store conditional extension to implement
21287 atomic memory built-in functions.  Not available for ARC 6xx or ARC
21288 EM cores.
21290 @opindex mdiv-rem
21291 @item -mdiv-rem
21292 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
21294 @opindex mcode-density
21295 @item -mcode-density
21296 Enable code density instructions for ARC EM.  
21297 This option is on by default for ARC HS.
21299 @opindex mll64
21300 @item -mll64
21301 Enable double load/store operations for ARC HS cores.
21303 @opindex mtp-regno
21304 @item -mtp-regno=@var{regno}
21305 Specify thread pointer register number.
21307 @opindex mmpy-option
21308 @item -mmpy-option=@var{multo}
21309 Compile ARCv2 code with a multiplier design option.  You can specify 
21310 the option using either a string or numeric value for @var{multo}.  
21311 @samp{wlh1} is the default value.  The recognized values are:
21313 @table @samp
21314 @item 0
21315 @itemx none
21316 No multiplier available.
21318 @item 1
21319 @itemx w
21320 16x16 multiplier, fully pipelined.
21321 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
21323 @item 2
21324 @itemx wlh1
21325 32x32 multiplier, fully
21326 pipelined (1 stage).  The following instructions are additionally
21327 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21329 @item 3
21330 @itemx wlh2
21331 32x32 multiplier, fully pipelined
21332 (2 stages).  The following instructions are additionally enabled: @code{mpy},
21333 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21335 @item 4
21336 @itemx wlh3
21337 Two 16x16 multipliers, blocking,
21338 sequential.  The following instructions are additionally enabled: @code{mpy},
21339 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21341 @item 5
21342 @itemx wlh4
21343 One 16x16 multiplier, blocking,
21344 sequential.  The following instructions are additionally enabled: @code{mpy},
21345 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21347 @item 6
21348 @itemx wlh5
21349 One 32x4 multiplier, blocking,
21350 sequential.  The following instructions are additionally enabled: @code{mpy},
21351 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21353 @item 7
21354 @itemx plus_dmpy
21355 ARC HS SIMD support.
21357 @item 8
21358 @itemx plus_macd
21359 ARC HS SIMD support.
21361 @item 9
21362 @itemx plus_qmacw
21363 ARC HS SIMD support.
21365 @end table
21367 This option is only available for ARCv2 cores@.
21369 @opindex mfpu
21370 @item -mfpu=@var{fpu}
21371 Enables support for specific floating-point hardware extensions for ARCv2
21372 cores.  Supported values for @var{fpu} are:
21374 @table @samp
21376 @item fpus
21377 Enables support for single-precision floating-point hardware
21378 extensions@.
21380 @item fpud
21381 Enables support for double-precision floating-point hardware
21382 extensions.  The single-precision floating-point extension is also
21383 enabled.  Not available for ARC EM@.
21385 @item fpuda
21386 Enables support for double-precision floating-point hardware
21387 extensions using double-precision assist instructions.  The single-precision
21388 floating-point extension is also enabled.  This option is
21389 only available for ARC EM@.
21391 @item fpuda_div
21392 Enables support for double-precision floating-point hardware
21393 extensions using double-precision assist instructions.
21394 The single-precision floating-point, square-root, and divide 
21395 extensions are also enabled.  This option is
21396 only available for ARC EM@.
21398 @item fpuda_fma
21399 Enables support for double-precision floating-point hardware
21400 extensions using double-precision assist instructions.
21401 The single-precision floating-point and fused multiply and add 
21402 hardware extensions are also enabled.  This option is
21403 only available for ARC EM@.
21405 @item fpuda_all
21406 Enables support for double-precision floating-point hardware
21407 extensions using double-precision assist instructions.
21408 All single-precision floating-point hardware extensions are also
21409 enabled.  This option is only available for ARC EM@.
21411 @item fpus_div
21412 Enables support for single-precision floating-point, square-root and divide 
21413 hardware extensions@.
21415 @item fpud_div
21416 Enables support for double-precision floating-point, square-root and divide 
21417 hardware extensions.  This option
21418 includes option @samp{fpus_div}. Not available for ARC EM@.
21420 @item fpus_fma
21421 Enables support for single-precision floating-point and 
21422 fused multiply and add hardware extensions@.
21424 @item fpud_fma
21425 Enables support for double-precision floating-point and 
21426 fused multiply and add hardware extensions.  This option
21427 includes option @samp{fpus_fma}.  Not available for ARC EM@.
21429 @item fpus_all
21430 Enables support for all single-precision floating-point hardware
21431 extensions@.
21433 @item fpud_all
21434 Enables support for all single- and double-precision floating-point
21435 hardware extensions.  Not available for ARC EM@.
21437 @end table
21439 @opindex mirq-ctrl-saved
21440 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
21441 Specifies general-purposes registers that the processor automatically
21442 saves/restores on interrupt entry and exit.  @var{register-range} is
21443 specified as two registers separated by a dash.  The register range
21444 always starts with @code{r0}, the upper limit is @code{fp} register.
21445 @var{blink} and @var{lp_count} are optional.  This option is only
21446 valid for ARC EM and ARC HS cores.
21448 @opindex mrgf-banked-regs
21449 @item -mrgf-banked-regs=@var{number}
21450 Specifies the number of registers replicated in second register bank
21451 on entry to fast interrupt.  Fast interrupts are interrupts with the
21452 highest priority level P0.  These interrupts save only PC and STATUS32
21453 registers to avoid memory transactions during interrupt entry and exit
21454 sequences.  Use this option when you are using fast interrupts in an
21455 ARC V2 family processor.  Permitted values are 4, 8, 16, and 32.
21457 @opindex mlpc-width
21458 @item -mlpc-width=@var{width}
21459 Specify the width of the @code{lp_count} register.  Valid values for
21460 @var{width} are 8, 16, 20, 24, 28 and 32 bits.  The default width is
21461 fixed to 32 bits.  If the width is less than 32, the compiler does not
21462 attempt to transform loops in your program to use the zero-delay loop
21463 mechanism unless it is known that the @code{lp_count} register can
21464 hold the required loop-counter value.  Depending on the width
21465 specified, the compiler and run-time library might continue to use the
21466 loop mechanism for various needs.  This option defines macro
21467 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
21469 @opindex mrf16
21470 @item -mrf16
21471 This option instructs the compiler to generate code for a 16-entry
21472 register file.  This option defines the @code{__ARC_RF16__}
21473 preprocessor macro.
21475 @opindex mbranch-index
21476 @item -mbranch-index
21477 Enable use of @code{bi} or @code{bih} instructions to implement jump
21478 tables.
21480 @end table
21482 The following options are passed through to the assembler, and also
21483 define preprocessor macro symbols.
21485 @c Flags used by the assembler, but for which we define preprocessor
21486 @c macro symbols as well.
21487 @table @gcctabopt
21488 @opindex mdsp-packa
21489 @item -mdsp-packa
21490 Passed down to the assembler to enable the DSP Pack A extensions.
21491 Also sets the preprocessor symbol @code{__Xdsp_packa}.  This option is
21492 deprecated.
21494 @opindex mdvbf
21495 @item -mdvbf
21496 Passed down to the assembler to enable the dual Viterbi butterfly
21497 extension.  Also sets the preprocessor symbol @code{__Xdvbf}.  This
21498 option is deprecated.
21500 @c ARC700 4.10 extension instruction
21501 @opindex mlock
21502 @item -mlock
21503 Passed down to the assembler to enable the locked load/store
21504 conditional extension.  Also sets the preprocessor symbol
21505 @code{__Xlock}.
21507 @opindex mmac-d16
21508 @item -mmac-d16
21509 Passed down to the assembler.  Also sets the preprocessor symbol
21510 @code{__Xxmac_d16}.  This option is deprecated.
21512 @opindex mmac-24
21513 @item -mmac-24
21514 Passed down to the assembler.  Also sets the preprocessor symbol
21515 @code{__Xxmac_24}.  This option is deprecated.
21517 @c ARC700 4.10 extension instruction
21518 @opindex mrtsc
21519 @item -mrtsc
21520 Passed down to the assembler to enable the 64-bit time-stamp counter
21521 extension instruction.  Also sets the preprocessor symbol
21522 @code{__Xrtsc}.  This option is deprecated.
21524 @c ARC700 4.10 extension instruction
21525 @opindex mswape
21526 @item -mswape
21527 Passed down to the assembler to enable the swap byte ordering
21528 extension instruction.  Also sets the preprocessor symbol
21529 @code{__Xswape}.
21531 @opindex mtelephony
21532 @item -mtelephony
21533 Passed down to the assembler to enable dual- and single-operand
21534 instructions for telephony.  Also sets the preprocessor symbol
21535 @code{__Xtelephony}.  This option is deprecated.
21537 @opindex mxy
21538 @item -mxy
21539 Passed down to the assembler to enable the XY memory extension.  Also
21540 sets the preprocessor symbol @code{__Xxy}.
21542 @end table
21544 The following options control how the assembly code is annotated:
21546 @c Assembly annotation options
21547 @table @gcctabopt
21548 @opindex misize
21549 @item -misize
21550 Annotate assembler instructions with estimated addresses.
21552 @opindex mannotate-align
21553 @item -mannotate-align
21554 Explain what alignment considerations lead to the decision to make an
21555 instruction short or long.
21557 @end table
21559 The following options are passed through to the linker:
21561 @c options passed through to the linker
21562 @table @gcctabopt
21563 @opindex marclinux
21564 @item -marclinux
21565 Passed through to the linker, to specify use of the @code{arclinux} emulation.
21566 This option is enabled by default in tool chains built for
21567 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
21568 when profiling is not requested.
21570 @opindex marclinux_prof
21571 @item -marclinux_prof
21572 Passed through to the linker, to specify use of the
21573 @code{arclinux_prof} emulation.  This option is enabled by default in
21574 tool chains built for @w{@code{arc-linux-uclibc}} and
21575 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
21577 @end table
21579 The following options control the semantics of generated code:
21581 @c semantically relevant code generation options
21582 @table @gcctabopt
21583 @opindex mlong-calls
21584 @item -mlong-calls
21585 Generate calls as register indirect calls, thus providing access
21586 to the full 32-bit address range.
21588 @opindex mmedium-calls
21589 @item -mmedium-calls
21590 Don't use less than 25-bit addressing range for calls, which is the
21591 offset available for an unconditional branch-and-link
21592 instruction.  Conditional execution of function calls is suppressed, to
21593 allow use of the 25-bit range, rather than the 21-bit range with
21594 conditional branch-and-link.  This is the default for tool chains built
21595 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
21597 @opindex G
21598 @item -G @var{num}
21599 Put definitions of externally-visible data in a small data section if
21600 that data is no bigger than @var{num} bytes.  The default value of
21601 @var{num} is 4 for any ARC configuration, or 8 when we have double
21602 load/store operations.
21604 @opindex mno-sdata
21605 @opindex msdata
21606 @item -mno-sdata
21607 Do not generate sdata references.  This is the default for tool chains
21608 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
21609 targets.
21611 @opindex mvolatile-cache
21612 @item -mvolatile-cache
21613 Use ordinarily cached memory accesses for volatile references.  This is the
21614 default.
21616 @opindex mno-volatile-cache
21617 @opindex mvolatile-cache
21618 @item -mno-volatile-cache
21619 Enable cache bypass for volatile references.
21621 @end table
21623 The following options fine tune code generation:
21624 @c code generation tuning options
21625 @table @gcctabopt
21626 @opindex malign-call
21627 @item -malign-call
21628 Does nothing.  Preserved for backward compatibility.
21630 @opindex mauto-modify-reg
21631 @item -mauto-modify-reg
21632 Enable the use of pre/post modify with register displacement.
21634 @opindex mbbit-peephole
21635 @item -mbbit-peephole
21636 Does nothing.  Preserved for backward compatibility.
21638 @opindex mno-brcc
21639 @item -mno-brcc
21640 This option disables a target-specific pass in @file{arc_reorg} to
21641 generate compare-and-branch (@code{br@var{cc}}) instructions.  
21642 It has no effect on
21643 generation of these instructions driven by the combiner pass.
21645 @opindex mcase-vector-pcrel
21646 @item -mcase-vector-pcrel
21647 Use PC-relative switch case tables to enable case table shortening.
21648 This is the default for @option{-Os}.
21650 @opindex mcompact-casesi
21651 @item -mcompact-casesi
21652 Enable compact @code{casesi} pattern.  This is the default for @option{-Os},
21653 and only available for ARCv1 cores.  This option is deprecated.
21655 @opindex mno-cond-exec
21656 @item -mno-cond-exec
21657 Disable the ARCompact-specific pass to generate conditional 
21658 execution instructions.
21660 Due to delay slot scheduling and interactions between operand numbers,
21661 literal sizes, instruction lengths, and the support for conditional execution,
21662 the target-independent pass to generate conditional execution is often lacking,
21663 so the ARC port has kept a special pass around that tries to find more
21664 conditional execution generation opportunities after register allocation,
21665 branch shortening, and delay slot scheduling have been done.  This pass
21666 generally, but not always, improves performance and code size, at the cost of
21667 extra compilation time, which is why there is an option to switch it off.
21668 If you have a problem with call instructions exceeding their allowable
21669 offset range because they are conditionalized, you should consider using
21670 @option{-mmedium-calls} instead.
21672 @opindex mearly-cbranchsi
21673 @item -mearly-cbranchsi
21674 Enable pre-reload use of the @code{cbranchsi} pattern.
21676 @opindex mexpand-adddi
21677 @item -mexpand-adddi
21678 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
21679 @code{add.f}, @code{adc} etc.  This option is deprecated.
21681 @opindex mindexed-loads
21682 @item -mindexed-loads
21683 Enable the use of indexed loads.  This can be problematic because some
21684 optimizers then assume that indexed stores exist, which is not
21685 the case.
21687 @opindex mlra
21688 @item -mlra
21689 Enable Local Register Allocation.  This is still experimental for ARC,
21690 so by default the compiler uses standard reload
21691 (i.e.@: @option{-mno-lra}).
21693 @opindex mlra-priority-none
21694 @item -mlra-priority-none
21695 Don't indicate any priority for target registers.
21697 @opindex mlra-priority-compact
21698 @item -mlra-priority-compact
21699 Indicate target register priority for r0..r3 / r12..r15.
21701 @opindex mlra-priority-noncompact
21702 @item -mlra-priority-noncompact
21703 Reduce target register priority for r0..r3 / r12..r15.
21705 @opindex mmillicode
21706 @item -mmillicode
21707 When optimizing for size (using @option{-Os}), prologues and epilogues
21708 that have to save or restore a large number of registers are often
21709 shortened by using call to a special function in libgcc; this is
21710 referred to as a @emph{millicode} call.  As these calls can pose
21711 performance issues, and/or cause linking issues when linking in a
21712 nonstandard way, this option is provided to turn on or off millicode
21713 call generation.
21715 @opindex mcode-density-frame
21716 @item -mcode-density-frame
21717 This option enable the compiler to emit @code{enter} and @code{leave}
21718 instructions.  These instructions are only valid for CPUs with
21719 code-density feature.
21721 @opindex mmixed-code
21722 @item -mmixed-code
21723 Does nothing.  Preserved for backward compatibility.
21725 @opindex mq-class
21726 @item -mq-class
21727 Ths option is deprecated.  Enable @samp{q} instruction alternatives.
21728 This is the default for @option{-Os}.
21730 @opindex mRcq
21731 @item -mRcq
21732 Does nothing.  Preserved for backward compatibility.
21734 @opindex mRcw
21735 @item -mRcw
21736 Does nothing.  Preserved for backward compatibility.
21738 @opindex msize-level
21739 @item -msize-level=@var{level}
21740 Fine-tune size optimization with regards to instruction lengths and alignment.
21741 The recognized values for @var{level} are:
21742 @table @samp
21743 @item 0
21744 No size optimization.  This level is deprecated and treated like @samp{1}.
21746 @item 1
21747 Short instructions are used opportunistically.
21749 @item 2
21750 In addition, alignment of loops and of code after barriers are dropped.
21752 @item 3
21753 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
21755 @end table
21757 This defaults to @samp{3} when @option{-Os} is in effect.  Otherwise,
21758 the behavior when this is not set is equivalent to level @samp{1}.
21760 @opindex mtune
21761 @item -mtune=@var{cpu}
21762 Set instruction scheduling parameters for @var{cpu}, overriding any implied
21763 by @option{-mcpu=}.
21765 Supported values for @var{cpu} are
21767 @table @samp
21768 @item ARC600
21769 Tune for ARC600 CPU.
21771 @item ARC601
21772 Tune for ARC601 CPU.
21774 @item ARC700
21775 Tune for ARC700 CPU with standard multiplier block.
21777 @item ARC700-xmac
21778 Tune for ARC700 CPU with XMAC block.
21780 @item ARC725D
21781 Tune for ARC725D CPU.
21783 @item ARC750D
21784 Tune for ARC750D CPU.
21786 @item core3
21787 Tune for ARCv2 core3 type CPU.  This option enable usage of
21788 @code{dbnz} instruction.
21790 @item release31a
21791 Tune for ARC4x release 3.10a.
21793 @end table
21795 @opindex mmultcost
21796 @item -mmultcost=@var{num}
21797 Cost to assume for a multiply instruction, with @samp{4} being equal to a
21798 normal instruction.
21800 @opindex munalign-prob-threshold
21801 @item -munalign-prob-threshold=@var{probability}
21802 Does nothing.  Preserved for backward compatibility.
21804 @end table
21806 The following options are maintained for backward compatibility, but
21807 are now deprecated and will be removed in a future release:
21809 @c Deprecated options
21810 @table @gcctabopt
21812 @opindex margonaut
21813 @item -margonaut
21814 Obsolete FPX.
21816 @opindex mbig-endian
21817 @opindex EB
21818 @item -mbig-endian
21819 @itemx -EB
21820 Compile code for big-endian targets.  Use of these options is now
21821 deprecated.  Big-endian code is supported by configuring GCC to build
21822 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
21823 for which big endian is the default.
21825 @opindex mlittle-endian
21826 @opindex EL
21827 @item -mlittle-endian
21828 @itemx -EL
21829 Compile code for little-endian targets.  Use of these options is now
21830 deprecated.  Little-endian code is supported by configuring GCC to build 
21831 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
21832 for which little endian is the default.
21834 @opindex mbarrel_shifter
21835 @item -mbarrel_shifter
21836 Replaced by @option{-mbarrel-shifter}.
21838 @opindex mdpfp_compact
21839 @item -mdpfp_compact
21840 Replaced by @option{-mdpfp-compact}.
21842 @opindex mdpfp_fast
21843 @item -mdpfp_fast
21844 Replaced by @option{-mdpfp-fast}.
21846 @opindex mdsp_packa
21847 @item -mdsp_packa
21848 Replaced by @option{-mdsp-packa}.
21850 @opindex mEA
21851 @item -mEA
21852 Replaced by @option{-mea}.
21854 @opindex mmac_24
21855 @item -mmac_24
21856 Replaced by @option{-mmac-24}.
21858 @opindex mmac_d16
21859 @item -mmac_d16
21860 Replaced by @option{-mmac-d16}.
21862 @opindex mspfp_compact
21863 @item -mspfp_compact
21864 Replaced by @option{-mspfp-compact}.
21866 @opindex mspfp_fast
21867 @item -mspfp_fast
21868 Replaced by @option{-mspfp-fast}.
21870 @opindex mtune
21871 @item -mtune=@var{cpu}
21872 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
21873 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
21874 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
21876 @opindex multcost
21877 @item -multcost=@var{num}
21878 Replaced by @option{-mmultcost}.
21880 @end table
21882 @node ARM Options
21883 @subsection ARM Options
21884 @cindex ARM options
21886 These @samp{-m} options are defined for the ARM port:
21888 @table @gcctabopt
21889 @opindex mabi
21890 @item -mabi=@var{name}
21891 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
21892 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
21894 @opindex mapcs-frame
21895 @item -mapcs-frame
21896 Generate a stack frame that is compliant with the ARM Procedure Call
21897 Standard for all functions, even if this is not strictly necessary for
21898 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
21899 with this option causes the stack frames not to be generated for
21900 leaf functions.  The default is @option{-mno-apcs-frame}.
21901 This option is deprecated.
21903 @opindex mapcs
21904 @item -mapcs
21905 This is a synonym for @option{-mapcs-frame} and is deprecated.
21907 @ignore
21908 @c not currently implemented
21909 @opindex mapcs-stack-check
21910 @item -mapcs-stack-check
21911 Generate code to check the amount of stack space available upon entry to
21912 every function (that actually uses some stack space).  If there is
21913 insufficient space available then either the function
21914 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
21915 called, depending upon the amount of stack space required.  The runtime
21916 system is required to provide these functions.  The default is
21917 @option{-mno-apcs-stack-check}, since this produces smaller code.
21919 @c not currently implemented
21920 @opindex mapcs-reentrant
21921 @item -mapcs-reentrant
21922 Generate reentrant, position-independent code.  The default is
21923 @option{-mno-apcs-reentrant}.
21924 @end ignore
21926 @opindex mthumb-interwork
21927 @item -mthumb-interwork
21928 Generate code that supports calling between the ARM and Thumb
21929 instruction sets.  Without this option, on pre-v5 architectures, the
21930 two instruction sets cannot be reliably used inside one program.  The
21931 default is @option{-mno-thumb-interwork}, since slightly larger code
21932 is generated when @option{-mthumb-interwork} is specified.  In AAPCS
21933 configurations this option is meaningless.
21935 @opindex mno-sched-prolog
21936 @opindex msched-prolog
21937 @item -mno-sched-prolog
21938 Prevent the reordering of instructions in the function prologue, or the
21939 merging of those instruction with the instructions in the function's
21940 body.  This means that all functions start with a recognizable set
21941 of instructions (or in fact one of a choice from a small set of
21942 different function prologues), and this information can be used to
21943 locate the start of functions inside an executable piece of code.  The
21944 default is @option{-msched-prolog}.
21946 @opindex mfloat-abi
21947 @item -mfloat-abi=@var{name}
21948 Specifies which floating-point ABI to use.  Permissible values
21949 are: @samp{soft}, @samp{softfp} and @samp{hard}.
21951 Specifying @samp{soft} causes GCC to generate output containing
21952 library calls for floating-point operations.
21953 @samp{softfp} allows the generation of code using hardware floating-point
21954 instructions, but still uses the soft-float calling conventions.
21955 @samp{hard} allows generation of floating-point instructions
21956 and uses FPU-specific calling conventions.
21958 The default depends on the specific target configuration.  Note that
21959 the hard-float and soft-float ABIs are not link-compatible; you must
21960 compile your entire program with the same ABI, and link with a
21961 compatible set of libraries.
21963 @opindex mgeneral-regs-only
21964 @item -mgeneral-regs-only
21965 Generate code which uses only the general-purpose registers.  This will prevent
21966 the compiler from using floating-point and Advanced SIMD registers but will not
21967 impose any restrictions on the assembler.
21969 @opindex mlittle-endian
21970 @item -mlittle-endian
21971 Generate code for a processor running in little-endian mode.  This is
21972 the default for all standard configurations.
21974 @opindex mbig-endian
21975 @item -mbig-endian
21976 Generate code for a processor running in big-endian mode; the default is
21977 to compile code for a little-endian processor.
21979 @opindex mbe8
21980 @item -mbe8
21981 @itemx -mbe32
21982 When linking a big-endian image select between BE8 and BE32 formats.
21983 The option has no effect for little-endian images and is ignored.  The
21984 default is dependent on the selected target architecture.  For ARMv6
21985 and later architectures the default is BE8, for older architectures
21986 the default is BE32.  BE32 format has been deprecated by ARM.
21988 @opindex march
21989 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
21990 This specifies the name of the target ARM architecture.  GCC uses this
21991 name to determine what kind of instructions it can emit when generating
21992 assembly code.  This option can be used in conjunction with or instead
21993 of the @option{-mcpu=} option.
21995 Permissible names are:
21996 @samp{armv4t},
21997 @samp{armv5t}, @samp{armv5te},
21998 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
21999 @samp{armv6z}, @samp{armv6zk},
22000 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve}, 
22001 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
22002 @samp{armv8.4-a},
22003 @samp{armv8.5-a},
22004 @samp{armv8.6-a},
22005 @samp{armv9-a},
22006 @samp{armv7-r},
22007 @samp{armv8-r},
22008 @samp{armv6-m}, @samp{armv6s-m},
22009 @samp{armv7-m}, @samp{armv7e-m},
22010 @samp{armv8-m.base}, @samp{armv8-m.main},
22011 @samp{armv8.1-m.main},
22012 @samp{armv9-a},
22013 @samp{iwmmxt} and @samp{iwmmxt2}.
22015 Additionally, the following architectures, which lack support for the
22016 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
22018 Many of the architectures support extensions.  These can be added by
22019 appending @samp{+@var{extension}} to the architecture name.  Extension
22020 options are processed in order and capabilities accumulate.  An extension
22021 will also enable any necessary base extensions
22022 upon which it depends.  For example, the @samp{+crypto} extension
22023 will always enable the @samp{+simd} extension.  The exception to the
22024 additive construction is for extensions that are prefixed with
22025 @samp{+no@dots{}}: these extensions disable the specified option and
22026 any other extensions that may depend on the presence of that
22027 extension.
22029 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
22030 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
22031 entirely disabled by the @samp{+nofp} option that follows it.
22033 Most extension names are generically named, but have an effect that is
22034 dependent upon the architecture to which it is applied.  For example,
22035 the @samp{+simd} option can be applied to both @samp{armv7-a} and
22036 @samp{armv8-a} architectures, but will enable the original ARMv7-A
22037 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
22038 variant for @samp{armv8-a}.
22040 The table below lists the supported extensions for each architecture.
22041 Architectures not mentioned do not support any extensions.
22043 @table @samp
22044 @item armv5te
22045 @itemx armv6
22046 @itemx armv6j
22047 @itemx armv6k
22048 @itemx armv6kz
22049 @itemx armv6t2
22050 @itemx armv6z
22051 @itemx armv6zk
22052 @table @samp
22053 @item +fp
22054 The VFPv2 floating-point instructions.  The extension @samp{+vfpv2} can be
22055 used as an alias for this extension.
22057 @item +nofp
22058 Disable the floating-point instructions.
22059 @end table
22061 @item armv7
22062 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
22063 @table @samp
22064 @item +fp
22065 The VFPv3 floating-point instructions, with 16 double-precision
22066 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
22067 for this extension.  Note that floating-point is not supported by the
22068 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
22069 ARMv7-R architectures.
22071 @item +nofp
22072 Disable the floating-point instructions.
22073 @end table
22075 @item armv7-a
22076 @table @samp
22077 @item +mp
22078 The multiprocessing extension.
22080 @item +sec
22081 The security extension.
22083 @item +fp
22084 The VFPv3 floating-point instructions, with 16 double-precision
22085 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
22086 for this extension.
22088 @item +simd
22089 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
22090 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
22091 for this extension.
22093 @item +vfpv3
22094 The VFPv3 floating-point instructions, with 32 double-precision
22095 registers.
22097 @item +vfpv3-d16-fp16
22098 The VFPv3 floating-point instructions, with 16 double-precision
22099 registers and the half-precision floating-point conversion operations.
22101 @item +vfpv3-fp16
22102 The VFPv3 floating-point instructions, with 32 double-precision
22103 registers and the half-precision floating-point conversion operations.
22105 @item +vfpv4-d16
22106 The VFPv4 floating-point instructions, with 16 double-precision
22107 registers.
22109 @item +vfpv4
22110 The VFPv4 floating-point instructions, with 32 double-precision
22111 registers.
22113 @item +neon-fp16
22114 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
22115 the half-precision floating-point conversion operations.
22117 @item +neon-vfpv4
22118 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
22120 @item +nosimd
22121 Disable the Advanced SIMD instructions (does not disable floating point).
22123 @item +nofp
22124 Disable the floating-point and Advanced SIMD instructions.
22125 @end table
22127 @item armv7ve
22128 The extended version of the ARMv7-A architecture with support for
22129 virtualization.
22130 @table @samp
22131 @item +fp
22132 The VFPv4 floating-point instructions, with 16 double-precision registers.
22133 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
22135 @item +simd
22136 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.  The
22137 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
22139 @item +vfpv3-d16
22140 The VFPv3 floating-point instructions, with 16 double-precision
22141 registers.
22143 @item +vfpv3
22144 The VFPv3 floating-point instructions, with 32 double-precision
22145 registers.
22147 @item +vfpv3-d16-fp16
22148 The VFPv3 floating-point instructions, with 16 double-precision
22149 registers and the half-precision floating-point conversion operations.
22151 @item +vfpv3-fp16
22152 The VFPv3 floating-point instructions, with 32 double-precision
22153 registers and the half-precision floating-point conversion operations.
22155 @item +vfpv4-d16
22156 The VFPv4 floating-point instructions, with 16 double-precision
22157 registers.
22159 @item +vfpv4
22160 The VFPv4 floating-point instructions, with 32 double-precision
22161 registers.
22163 @item +neon
22164 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
22165 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
22167 @item +neon-fp16
22168 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
22169 the half-precision floating-point conversion operations.
22171 @item +nosimd
22172 Disable the Advanced SIMD instructions (does not disable floating point).
22174 @item +nofp
22175 Disable the floating-point and Advanced SIMD instructions.
22176 @end table
22178 @item armv8-a
22179 @table @samp
22180 @item +crc
22181 The Cyclic Redundancy Check (CRC) instructions.
22182 @item +simd
22183 The ARMv8-A Advanced SIMD and floating-point instructions.
22184 @item +crypto
22185 The cryptographic instructions.
22186 @item +nocrypto
22187 Disable the cryptographic instructions.
22188 @item +nofp
22189 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22190 @item +sb
22191 Speculation Barrier Instruction.
22192 @item +predres
22193 Execution and Data Prediction Restriction Instructions.
22194 @end table
22196 @item armv8.1-a
22197 @table @samp
22198 @item +simd
22199 The ARMv8.1-A Advanced SIMD and floating-point instructions.
22201 @item +crypto
22202 The cryptographic instructions.  This also enables the Advanced SIMD and
22203 floating-point instructions.
22205 @item +nocrypto
22206 Disable the cryptographic instructions.
22208 @item +nofp
22209 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22211 @item +sb
22212 Speculation Barrier Instruction.
22214 @item +predres
22215 Execution and Data Prediction Restriction Instructions.
22216 @end table
22218 @item armv8.2-a
22219 @itemx armv8.3-a
22220 @table @samp
22221 @item +fp16
22222 The half-precision floating-point data processing instructions.
22223 This also enables the Advanced SIMD and floating-point instructions.
22225 @item +fp16fml
22226 The half-precision floating-point fmla extension.  This also enables
22227 the half-precision floating-point extension and Advanced SIMD and
22228 floating-point instructions.
22230 @item +simd
22231 The ARMv8.1-A Advanced SIMD and floating-point instructions.
22233 @item +crypto
22234 The cryptographic instructions.  This also enables the Advanced SIMD and
22235 floating-point instructions.
22237 @item +dotprod
22238 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
22240 @item +nocrypto
22241 Disable the cryptographic extension.
22243 @item +nofp
22244 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22246 @item +sb
22247 Speculation Barrier Instruction.
22249 @item +predres
22250 Execution and Data Prediction Restriction Instructions.
22252 @item +i8mm
22253 8-bit Integer Matrix Multiply instructions.
22254 This also enables Advanced SIMD and floating-point instructions.
22256 @item +bf16
22257 Brain half-precision floating-point instructions.
22258 This also enables Advanced SIMD and floating-point instructions.
22259 @end table
22261 @item armv8.4-a
22262 @table @samp
22263 @item +fp16
22264 The half-precision floating-point data processing instructions.
22265 This also enables the Advanced SIMD and floating-point instructions as well
22266 as the Dot Product extension and the half-precision floating-point fmla
22267 extension.
22269 @item +simd
22270 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22271 Dot Product extension.
22273 @item +crypto
22274 The cryptographic instructions.  This also enables the Advanced SIMD and
22275 floating-point instructions as well as the Dot Product extension.
22277 @item +nocrypto
22278 Disable the cryptographic extension.
22280 @item +nofp
22281 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22283 @item +sb
22284 Speculation Barrier Instruction.
22286 @item +predres
22287 Execution and Data Prediction Restriction 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.5-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 armv8.6-a
22330 @table @samp
22331 @item +fp16
22332 The half-precision floating-point data processing instructions.
22333 This also enables the Advanced SIMD and floating-point instructions as well
22334 as the Dot Product extension and the half-precision floating-point fmla
22335 extension.
22337 @item +simd
22338 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22339 Dot Product extension.
22341 @item +crypto
22342 The cryptographic instructions.  This also enables the Advanced SIMD and
22343 floating-point instructions as well as the Dot Product extension.
22345 @item +nocrypto
22346 Disable the cryptographic extension.
22348 @item +nofp
22349 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22351 @item +i8mm
22352 8-bit Integer Matrix Multiply instructions.
22353 This also enables Advanced SIMD and floating-point instructions.
22355 @item +bf16
22356 Brain half-precision floating-point instructions.
22357 This also enables Advanced SIMD and floating-point instructions.
22358 @end table
22360 @item armv7-r
22361 @table @samp
22362 @item +fp.sp
22363 The single-precision VFPv3 floating-point instructions.  The extension
22364 @samp{+vfpv3xd} can be used as an alias for this extension.
22366 @item +fp
22367 The VFPv3 floating-point instructions with 16 double-precision registers.
22368 The extension +vfpv3-d16 can be used as an alias for this extension.
22370 @item +vfpv3xd-d16-fp16
22371 The single-precision VFPv3 floating-point instructions with 16 double-precision
22372 registers and the half-precision floating-point conversion operations.
22374 @item +vfpv3-d16-fp16
22375 The VFPv3 floating-point instructions with 16 double-precision
22376 registers and the half-precision floating-point conversion operations.
22378 @item +nofp
22379 Disable the floating-point extension.
22381 @item +idiv
22382 The ARM-state integer division instructions.
22384 @item +noidiv
22385 Disable the ARM-state integer division extension.
22386 @end table
22388 @item armv7e-m
22389 @table @samp
22390 @item +fp
22391 The single-precision VFPv4 floating-point instructions.
22393 @item +fpv5
22394 The single-precision FPv5 floating-point instructions.
22396 @item +fp.dp
22397 The single- and double-precision FPv5 floating-point instructions.
22399 @item +nofp
22400 Disable the floating-point extensions.
22401 @end table
22403 @item  armv8.1-m.main
22404 @table @samp
22406 @item +dsp
22407 The DSP instructions.
22409 @item +mve
22410 The M-Profile Vector Extension (MVE) integer instructions.
22412 @item +mve.fp
22413 The M-Profile Vector Extension (MVE) integer and single precision
22414 floating-point instructions.
22416 @item +fp
22417 The single-precision floating-point instructions.
22419 @item +fp.dp
22420 The single- and double-precision floating-point instructions.
22422 @item +nofp
22423 Disable the floating-point extension.
22425 @item +cdecp0, +cdecp1, ... , +cdecp7
22426 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22427 to the numbers given in the options in the range 0 to 7.
22429 @item +pacbti
22430 Enable the Pointer Authentication and Branch Target Identification Extension.
22431 @end table
22433 @item  armv8-m.main
22434 @table @samp
22435 @item +dsp
22436 The DSP instructions.
22438 @item +nodsp
22439 Disable the DSP extension.
22441 @item +fp
22442 The single-precision floating-point instructions.
22444 @item +fp.dp
22445 The single- and double-precision floating-point instructions.
22447 @item +nofp
22448 Disable the floating-point extension.
22450 @item +cdecp0, +cdecp1, ... , +cdecp7
22451 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22452 to the numbers given in the options in the range 0 to 7.
22453 @end table
22455 @item armv8-r
22456 @table @samp
22457 @item +crc
22458 The Cyclic Redundancy Check (CRC) instructions.
22459 @item +fp.sp
22460 The single-precision FPv5 floating-point instructions.
22461 @item +simd
22462 The ARMv8-A Advanced SIMD and floating-point instructions.
22463 @item +crypto
22464 The cryptographic instructions.
22465 @item +nocrypto
22466 Disable the cryptographic instructions.
22467 @item +nofp
22468 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22469 @end table
22471 @end table
22473 @option{-march=native} causes the compiler to auto-detect the architecture
22474 of the build computer.  At present, this feature is only supported on
22475 GNU/Linux, and not all architectures are recognized.  If the auto-detect
22476 is unsuccessful the option has no effect.
22478 @opindex mtune
22479 @item -mtune=@var{name}
22480 This option specifies the name of the target ARM processor for
22481 which GCC should tune the performance of the code.
22482 For some ARM implementations better performance can be obtained by using
22483 this option.
22484 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
22485 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
22486 @samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810},
22487 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
22488 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
22489 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
22490 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
22491 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
22492 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
22493 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
22494 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
22495 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
22496 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
22497 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
22498 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, @samp{cortex-a710},
22499 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
22500 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus},
22501 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
22502 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
22503 @samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-m85}, @samp{cortex-x1},
22504 @samp{cortex-x1c}, @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
22505 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
22506 @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
22507 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
22508 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{star-mc1},
22509 @samp{xgene1}.
22511 Additionally, this option can specify that GCC should tune the performance
22512 of the code for a big.LITTLE system.  Permissible names are:
22513 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
22514 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22515 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
22516 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
22518 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
22519 performance for a blend of processors within architecture @var{arch}.
22520 The aim is to generate code that run well on the current most popular
22521 processors, balancing between optimizations that benefit some CPUs in the
22522 range, and avoiding performance pitfalls of other CPUs.  The effects of
22523 this option may change in future GCC versions as CPU models come and go.
22525 @option{-mtune} permits the same extension options as @option{-mcpu}, but
22526 the extension options do not affect the tuning of the generated code.
22528 @option{-mtune=native} causes the compiler to auto-detect the CPU
22529 of the build computer.  At present, this feature is only supported on
22530 GNU/Linux, and not all architectures are recognized.  If the auto-detect is
22531 unsuccessful the option has no effect.
22533 @opindex mcpu
22534 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
22535 This specifies the name of the target ARM processor.  GCC uses this name
22536 to derive the name of the target ARM architecture (as if specified
22537 by @option{-march}) and the ARM processor type for which to tune for
22538 performance (as if specified by @option{-mtune}).  Where this option
22539 is used in conjunction with @option{-march} or @option{-mtune},
22540 those options take precedence over the appropriate part of this option.
22542 Many of the supported CPUs implement optional architectural
22543 extensions.  Where this is so the architectural extensions are
22544 normally enabled by default.  If implementations that lack the
22545 extension exist, then the extension syntax can be used to disable
22546 those extensions that have been omitted.  For floating-point and
22547 Advanced SIMD (Neon) instructions, the settings of the options
22548 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
22549 floating-point and Advanced SIMD instructions will only be used if
22550 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
22551 @option{-mfpu} other than @samp{auto} will override the available
22552 floating-point and SIMD extension instructions.
22554 For example, @samp{cortex-a9} can be found in three major
22555 configurations: integer only, with just a floating-point unit or with
22556 floating-point and Advanced SIMD.  The default is to enable all the
22557 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
22558 be used to disable just the SIMD or both the SIMD and floating-point
22559 instructions respectively.
22561 Permissible names for this option are the same as those for
22562 @option{-mtune}.
22564 The following extension options are common to the listed CPUs:
22566 @table @samp
22567 @item +nodsp
22568 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p},
22569 @samp{cortex-m55} and @samp{cortex-m85}. Also disable the M-Profile Vector
22570 Extension (MVE) integer and single precision floating-point instructions on
22571 @samp{cortex-m55} and @samp{cortex-m85}.
22573 @item +nopacbti
22574 Disable the Pointer Authentication and Branch Target Identification Extension
22575 on @samp{cortex-m85}.
22577 @item +nomve
22578 Disable the M-Profile Vector Extension (MVE) integer and single precision
22579 floating-point instructions on @samp{cortex-m55} and @samp{cortex-m85}.
22581 @item +nomve.fp
22582 Disable the M-Profile Vector Extension (MVE) single precision floating-point
22583 instructions on @samp{cortex-m55} and @samp{cortex-m85}.
22585 @item +cdecp0, +cdecp1, ... , +cdecp7
22586 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22587 to the numbers given in the options in the range 0 to 7 on @samp{cortex-m55}.
22589 @item  +nofp
22590 Disables the floating-point instructions on @samp{arm9e},
22591 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
22592 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
22593 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
22594 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p}
22595 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p},
22596 @samp{cortex-m55} and @samp{cortex-m85}.
22597 Disables the floating-point and SIMD instructions on
22598 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
22599 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
22600 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
22601 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
22602 @samp{cortex-a53} and @samp{cortex-a55}.
22604 @item +nofp.dp
22605 Disables the double-precision component of the floating-point instructions
22606 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
22607 @samp{cortex-r52plus} and @samp{cortex-m7}.
22609 @item +nosimd
22610 Disables the SIMD (but not floating-point) instructions on
22611 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
22612 and @samp{cortex-a9}.
22614 @item +crypto
22615 Enables the cryptographic instructions on @samp{cortex-a32},
22616 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
22617 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
22618 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22619 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
22620 @samp{cortex-a75.cortex-a55}.
22621 @end table
22623 Additionally the @samp{generic-armv7-a} pseudo target defaults to
22624 VFPv3 with 16 double-precision registers.  It supports the following
22625 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
22626 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
22627 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
22628 @samp{neon-fp16}, @samp{neon-vfpv4}.  The meanings are the same as for
22629 the extensions to @option{-march=armv7-a}.
22631 @option{-mcpu=generic-@var{arch}} is also permissible, and is
22632 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
22633 See @option{-mtune} for more information.
22635 @option{-mcpu=native} causes the compiler to auto-detect the CPU
22636 of the build computer.  At present, this feature is only supported on
22637 GNU/Linux, and not all architectures are recognized.  If the auto-detect
22638 is unsuccessful the option has no effect.
22640 @opindex mfpu
22641 @item -mfpu=@var{name}
22642 This specifies what floating-point hardware (or hardware emulation) is
22643 available on the target.  Permissible names are: @samp{auto}, @samp{vfpv2},
22644 @samp{vfpv3},
22645 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
22646 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
22647 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
22648 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
22649 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
22650 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
22651 is an alias for @samp{vfpv2}.
22653 The setting @samp{auto} is the default and is special.  It causes the
22654 compiler to select the floating-point and Advanced SIMD instructions
22655 based on the settings of @option{-mcpu} and @option{-march}.
22657 If the selected floating-point hardware includes the NEON extension
22658 (e.g.@: @option{-mfpu=neon}), note that floating-point
22659 operations are not generated by GCC's auto-vectorization pass unless
22660 @option{-funsafe-math-optimizations} is also specified.  This is
22661 because NEON hardware does not fully implement the IEEE 754 standard for
22662 floating-point arithmetic (in particular denormal values are treated as
22663 zero), so the use of NEON instructions may lead to a loss of precision.
22665 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}).
22667 @opindex mfp16-format
22668 @item -mfp16-format=@var{name}
22669 Specify the format of the @code{__fp16} half-precision floating-point type.
22670 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
22671 the default is @samp{none}, in which case the @code{__fp16} type is not
22672 defined.  @xref{Half-Precision}, for more information.
22674 @opindex mstructure-size-boundary
22675 @item -mstructure-size-boundary=@var{n}
22676 The sizes of all structures and unions are rounded up to a multiple
22677 of the number of bits set by this option.  Permissible values are 8, 32
22678 and 64.  The default value varies for different toolchains.  For the COFF
22679 targeted toolchain the default value is 8.  A value of 64 is only allowed
22680 if the underlying ABI supports it.
22682 Specifying a larger number can produce faster, more efficient code, but
22683 can also increase the size of the program.  Different values are potentially
22684 incompatible.  Code compiled with one value cannot necessarily expect to
22685 work with code or libraries compiled with another value, if they exchange
22686 information using structures or unions.
22688 This option is deprecated.
22690 @opindex mabort-on-noreturn
22691 @item -mabort-on-noreturn
22692 Generate a call to the function @code{abort} at the end of a
22693 @code{noreturn} function.  It is executed if the function tries to
22694 return.
22696 @opindex mlong-calls
22697 @opindex mno-long-calls
22698 @item -mlong-calls
22699 @itemx -mno-long-calls
22700 Tells the compiler to perform function calls by first loading the
22701 address of the function into a register and then performing a subroutine
22702 call on this register.  This switch is needed if the target function
22703 lies outside of the 64-megabyte addressing range of the offset-based
22704 version of subroutine call instruction.
22706 Even if this switch is enabled, not all function calls are turned
22707 into long calls.  The heuristic is that static functions, functions
22708 that have the @code{short_call} attribute, functions that are inside
22709 the scope of a @code{#pragma no_long_calls} directive, and functions whose
22710 definitions have already been compiled within the current compilation
22711 unit are not turned into long calls.  The exceptions to this rule are
22712 that weak function definitions, functions with the @code{long_call}
22713 attribute or the @code{section} attribute, and functions that are within
22714 the scope of a @code{#pragma long_calls} directive are always
22715 turned into long calls.
22717 This feature is not enabled by default.  Specifying
22718 @option{-mno-long-calls} restores the default behavior, as does
22719 placing the function calls within the scope of a @code{#pragma
22720 long_calls_off} directive.  Note these switches have no effect on how
22721 the compiler generates code to handle function calls via function
22722 pointers.
22724 @opindex msingle-pic-base
22725 @item -msingle-pic-base
22726 Treat the register used for PIC addressing as read-only, rather than
22727 loading it in the prologue for each function.  The runtime system is
22728 responsible for initializing this register with an appropriate value
22729 before execution begins.
22731 @opindex mpic-register
22732 @item -mpic-register=@var{reg}
22733 Specify the register to be used for PIC addressing.
22734 For standard PIC base case, the default is any suitable register
22735 determined by compiler.  For single PIC base case, the default is
22736 @samp{R9} if target is EABI based or stack-checking is enabled,
22737 otherwise the default is @samp{R10}.
22739 @opindex mpic-data-is-text-relative
22740 @item -mpic-data-is-text-relative
22741 Assume that the displacement between the text and data segments is fixed
22742 at static link time.  This permits using PC-relative addressing
22743 operations to access data known to be in the data segment.  For
22744 non-VxWorks RTP targets, this option is enabled by default.  When
22745 disabled on such targets, it will enable @option{-msingle-pic-base} by
22746 default.
22748 @opindex mpoke-function-name
22749 @item -mpoke-function-name
22750 Write the name of each function into the text section, directly
22751 preceding the function prologue.  The generated code is similar to this:
22753 @smallexample
22754      t0
22755          .ascii "arm_poke_function_name", 0
22756          .align
22757      t1
22758          .word 0xff000000 + (t1 - t0)
22759      arm_poke_function_name
22760          mov     ip, sp
22761          stmfd   sp!, @{fp, ip, lr, pc@}
22762          sub     fp, ip, #4
22763 @end smallexample
22765 When performing a stack backtrace, code can inspect the value of
22766 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
22767 location @code{pc - 12} and the top 8 bits are set, then we know that
22768 there is a function name embedded immediately preceding this location
22769 and has length @code{((pc[-3]) & 0xff000000)}.
22771 @opindex marm
22772 @opindex mthumb
22773 @item -mthumb
22774 @itemx -marm
22776 Select between generating code that executes in ARM and Thumb
22777 states.  The default for most configurations is to generate code
22778 that executes in ARM state, but the default can be changed by
22779 configuring GCC with the @option{--with-mode=}@var{state}
22780 configure option.
22782 You can also override the ARM and Thumb mode for each function
22783 by using the @code{target("thumb")} and @code{target("arm")} function attributes
22784 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
22786 @opindex mflip-thumb
22787 @item -mflip-thumb 
22788 Switch ARM/Thumb modes on alternating functions.
22789 This option is provided for regression testing of mixed Thumb/ARM code
22790 generation, and is not intended for ordinary use in compiling code.
22792 @opindex mtpcs-frame
22793 @item -mtpcs-frame
22794 Generate a stack frame that is compliant with the Thumb Procedure Call
22795 Standard for all non-leaf functions.  (A leaf function is one that does
22796 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
22798 @opindex mtpcs-leaf-frame
22799 @item -mtpcs-leaf-frame
22800 Generate a stack frame that is compliant with the Thumb Procedure Call
22801 Standard for all leaf functions.  (A leaf function is one that does
22802 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
22804 @opindex mcallee-super-interworking
22805 @item -mcallee-super-interworking
22806 Gives all externally visible functions in the file being compiled an ARM
22807 instruction set header which switches to Thumb mode before executing the
22808 rest of the function.  This allows these functions to be called from
22809 non-interworking code.  This option is not valid in AAPCS configurations
22810 because interworking is enabled by default.
22812 @opindex mcaller-super-interworking
22813 @item -mcaller-super-interworking
22814 Allows calls via function pointers (including virtual functions) to
22815 execute correctly regardless of whether the target code has been
22816 compiled for interworking or not.  There is a small overhead in the cost
22817 of executing a function pointer if this option is enabled.  This option
22818 is not valid in AAPCS configurations because interworking is enabled
22819 by default.
22821 @opindex mtp
22822 @item -mtp=@var{name}
22823 Specify the access model for the thread local storage pointer.  The model
22824 @samp{soft} generates calls to @code{__aeabi_read_tp}.  Other accepted
22825 models are @samp{tpidrurw}, @samp{tpidruro} and @samp{tpidrprw} which fetch
22826 the thread pointer from the corresponding system register directly
22827 (supported from the arm6k architecture and later).  These system registers
22828 are accessed through the CP15 co-processor interface and the argument
22829 @samp{cp15} is also accepted as a convenience alias of @samp{tpidruro}.
22830 The argument @samp{auto} uses the best available method for the selected
22831 processor.  The default setting is @samp{auto}.
22833 @opindex mtls-dialect
22834 @item -mtls-dialect=@var{dialect}
22835 Specify the dialect to use for accessing thread local storage.  Two
22836 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}.  The
22837 @samp{gnu} dialect selects the original GNU scheme for supporting
22838 local and global dynamic TLS models.  The @samp{gnu2} dialect
22839 selects the GNU descriptor scheme, which provides better performance
22840 for shared libraries.  The GNU descriptor scheme is compatible with
22841 the original scheme, but does require new assembler, linker and
22842 library support.  Initial and local exec TLS models are unaffected by
22843 this option and always use the original scheme.
22845 @opindex mword-relocations
22846 @item -mword-relocations
22847 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
22848 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
22849 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
22850 is specified. This option conflicts with @option{-mslow-flash-data}.
22852 @opindex mfix-cortex-m3-ldrd
22853 @item -mfix-cortex-m3-ldrd
22854 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
22855 with overlapping destination and base registers are used.  This option avoids
22856 generating these instructions.  This option is enabled by default when
22857 @option{-mcpu=cortex-m3} is specified.
22859 @item -mfix-cortex-a57-aes-1742098
22860 @itemx -mno-fix-cortex-a57-aes-1742098
22861 @itemx -mfix-cortex-a72-aes-1655431
22862 @itemx -mno-fix-cortex-a72-aes-1655431
22863 Enable (disable) mitigation for an erratum on Cortex-A57 and
22864 Cortex-A72 that affects the AES cryptographic instructions.  This
22865 option is enabled by default when either @option{-mcpu=cortex-a57} or
22866 @option{-mcpu=cortex-a72} is specified.
22868 @opindex munaligned-access
22869 @opindex mno-unaligned-access
22870 @item -munaligned-access
22871 @itemx -mno-unaligned-access
22872 Enables (or disables) reading and writing of 16- and 32- bit values
22873 from addresses that are not 16- or 32- bit aligned.  By default
22874 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
22875 ARMv8-M Baseline architectures, and enabled for all other
22876 architectures.  If unaligned access is not enabled then words in packed
22877 data structures are accessed a byte at a time.
22879 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
22880 generated object file to either true or false, depending upon the
22881 setting of this option.  If unaligned access is enabled then the
22882 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
22883 defined.
22885 @opindex mneon-for-64bits
22886 @item -mneon-for-64bits
22887 This option is deprecated and has no effect.
22889 @opindex mslow-flash-data
22890 @item -mslow-flash-data
22891 Assume loading data from flash is slower than fetching instruction.
22892 Therefore literal load is minimized for better performance.
22893 This option is only supported when compiling for ARMv7 M-profile and
22894 off by default. It conflicts with @option{-mword-relocations}.
22896 @opindex masm-syntax-unified
22897 @item -masm-syntax-unified
22898 Assume inline assembler is using unified asm syntax.  The default is
22899 currently off which implies divided syntax.  This option has no impact
22900 on Thumb2. However, this may change in future releases of GCC.
22901 Divided syntax should be considered deprecated.
22903 @opindex mrestrict-it
22904 @item -mrestrict-it
22905 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
22906 IT blocks can only contain a single 16-bit instruction from a select
22907 set of instructions. This option is on by default for ARMv8-A Thumb mode.
22909 @opindex mprint-tune-info
22910 @item -mprint-tune-info
22911 Print CPU tuning information as comment in assembler file.  This is
22912 an option used only for regression testing of the compiler and not
22913 intended for ordinary use in compiling code.  This option is disabled
22914 by default.
22916 @opindex mverbose-cost-dump
22917 @item -mverbose-cost-dump
22918 Enable verbose cost model dumping in the debug dump files.  This option is
22919 provided for use in debugging the compiler.
22921 @opindex mpure-code
22922 @item -mpure-code
22923 Do not allow constant data to be placed in code sections.
22924 Additionally, when compiling for ELF object format give all text sections the
22925 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}.  This option
22926 is only available when generating non-pic code for M-profile targets.
22928 @opindex mcmse
22929 @item -mcmse
22930 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
22931 Development Tools Engineering Specification", which can be found on
22932 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
22934 @opindex mfix-cmse-cve-2021-35465
22935 @item -mfix-cmse-cve-2021-35465
22936 Mitigate against a potential security issue with the @code{VLLDM} instruction
22937 in some M-profile devices when using CMSE (CVE-2021-365465).  This option is
22938 enabled by default when the option @option{-mcpu=} is used with
22939 @code{cortex-m33}, @code{cortex-m35p}, @code{cortex-m55}, @code{cortex-m85}
22940 or @code{star-mc1}. The option @option{-mno-fix-cmse-cve-2021-35465} can be used
22941 to disable the mitigation.
22943 @opindex mstack-protector-guard
22944 @opindex mstack-protector-guard-offset
22945 @item -mstack-protector-guard=@var{guard}
22946 @itemx -mstack-protector-guard-offset=@var{offset}
22947 Generate stack protection code using canary at @var{guard}.  Supported
22948 locations are @samp{global} for a global canary or @samp{tls} for a
22949 canary accessible via the TLS register. The option
22950 @option{-mstack-protector-guard-offset=} is for use with
22951 @option{-fstack-protector-guard=tls} and not for use in user-land code.
22953 @opindex mfdpic
22954 @opindex mno-fdpic
22955 @item -mfdpic
22956 @itemx -mno-fdpic
22957 Select the FDPIC ABI, which uses 64-bit function descriptors to
22958 represent pointers to functions.  When the compiler is configured for
22959 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
22960 and implies @option{-fPIE} if none of the PIC/PIE-related options is
22961 provided.  On other targets, it only enables the FDPIC-specific code
22962 generation features, and the user should explicitly provide the
22963 PIC/PIE-related options as needed.
22965 Note that static linking is not supported because it would still
22966 involve the dynamic linker when the program self-relocates.  If such
22967 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
22969 The opposite @option{-mno-fdpic} option is useful (and required) to
22970 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
22971 toolchain as the one used to build the userland programs.
22973 @opindex mbranch-protection
22974 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}][+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]]
22975 Enable branch protection features (armv8.1-m.main only).
22976 @samp{none} generate code without branch protection or return address
22977 signing.
22978 @samp{standard[+@var{leaf}]} generate code with all branch protection
22979 features enabled at their standard level.
22980 @samp{pac-ret[+@var{leaf}]} generate code with return address signing
22981 set to its standard level, which is to sign all functions that save
22982 the return address to memory.
22983 @samp{leaf} When return address signing is enabled, also sign leaf
22984 functions even if they do not write the return address to memory.
22985 +@samp{bti} Add landing-pad instructions at the permitted targets of
22986 indirect branch instructions.
22988 If the @samp{+pacbti} architecture extension is not enabled, then all
22989 branch protection and return address signing operations are
22990 constrained to use only the instructions defined in the
22991 architectural-NOP space. The generated code will remain
22992 backwards-compatible with earlier versions of the architecture, but
22993 the additional security can be enabled at run time on processors that
22994 support the @samp{PACBTI} extension.
22996 Branch target enforcement using BTI can only be enabled at runtime if
22997 all code in the application has been compiled with at least
22998 @samp{-mbranch-protection=bti}.
23000 Any setting other than @samp{none} is supported only on armv8-m.main
23001 or later.
23003 The default is to generate code without branch protection or return
23004 address signing.
23006 @end table
23008 @node AVR Options
23009 @subsection AVR Options
23010 @cindex AVR Options
23012 These options are defined for AVR implementations:
23014 @table @gcctabopt
23015 @opindex mmcu
23016 @item -mmcu=@var{mcu}
23017 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
23019 The default for this option is@tie{}@samp{avr2}.
23021 GCC supports the following AVR devices and ISAs:
23023 @include avr-mmcu.texi
23025 @opindex mabsdata
23026 @item -mabsdata
23028 Assume that all data in static storage can be accessed by LDS / STS
23029 instructions.  This option has only an effect on reduced Tiny devices like
23030 ATtiny40.  See also the @code{absdata}
23031 @ref{AVR Variable Attributes,variable attribute}.
23033 @opindex maccumulate-args
23034 @item -maccumulate-args
23035 Accumulate outgoing function arguments and acquire/release the needed
23036 stack space for outgoing function arguments once in function
23037 prologue/epilogue.  Without this option, outgoing arguments are pushed
23038 before calling a function and popped afterwards.
23040 Popping the arguments after the function call can be expensive on
23041 AVR so that accumulating the stack space might lead to smaller
23042 executables because arguments need not be removed from the
23043 stack after such a function call.
23045 This option can lead to reduced code size for functions that perform
23046 several calls to functions that get their arguments on the stack like
23047 calls to printf-like functions.
23049 @opindex mbranch-cost
23050 @item -mbranch-cost=@var{cost}
23051 Set the branch costs for conditional branch instructions to
23052 @var{cost}.  Reasonable values for @var{cost} are small, non-negative
23053 integers. The default branch cost is 0.
23055 @opindex mcall-prologues
23056 @item -mcall-prologues
23057 Functions prologues/epilogues are expanded as calls to appropriate
23058 subroutines.  Code size is smaller.
23060 @opindex mdouble
23061 @opindex mlong-double
23062 @item -mdouble=@var{bits}
23063 @itemx -mlong-double=@var{bits}
23064 Set the size (in bits) of the @code{double} or @code{long double} type,
23065 respectively.  Possible values for @var{bits} are 32 and 64.
23066 Whether or not a specific value for @var{bits} is allowed depends on
23067 the @code{--with-double=} and @code{--with-long-double=}
23068 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
23069 and the same applies for the default values of the options.
23071 @opindex mgas-isr-prologues
23072 @item -mgas-isr-prologues
23073 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
23074 instruction supported by GNU Binutils.
23075 If this option is on, the feature can still be disabled for individual
23076 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
23077 function attribute.  This feature is activated per default
23078 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
23079 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
23081 @opindex mint8
23082 @item -mint8
23083 Assume @code{int} to be 8-bit integer.  This affects the sizes of all types: a
23084 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
23085 and @code{long long} is 4 bytes.  Please note that this option does not
23086 conform to the C standards, but it results in smaller code
23087 size.
23089 @opindex mmain-is-OS_task
23090 @item -mmain-is-OS_task
23091 Do not save registers in @code{main}.  The effect is the same like
23092 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
23093 to @code{main}. It is activated per default if optimization is on.
23095 @opindex mn-flash
23096 @item -mn-flash=@var{num}
23097 Assume that the flash memory has a size of 
23098 @var{num} times 64@tie{}KiB.
23100 @opindex mno-interrupts
23101 @item -mno-interrupts
23102 Generated code is not compatible with hardware interrupts.
23103 Code size is smaller.
23105 @opindex mrelax
23106 @item -mrelax
23107 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
23108 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
23109 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
23110 the assembler's command line and the @option{--relax} option to the
23111 linker's command line.
23113 Jump relaxing is performed by the linker because jump offsets are not
23114 known before code is located. Therefore, the assembler code generated by the
23115 compiler is the same, but the instructions in the executable may
23116 differ from instructions in the assembler code.
23118 Relaxing must be turned on if linker stubs are needed, see the
23119 section on @code{EIND} and linker stubs below.
23121 @opindex mrmw
23122 @item -mrmw
23123 Assume that the device supports the Read-Modify-Write
23124 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
23126 @opindex mshort-calls
23127 @item -mshort-calls
23129 Assume that @code{RJMP} and @code{RCALL} can target the whole
23130 program memory.
23132 This option is used internally for multilib selection.  It is
23133 not an optimization option, and you don't need to set it by hand.
23135 @opindex msp8
23136 @item -msp8
23137 Treat the stack pointer register as an 8-bit register,
23138 i.e.@: assume the high byte of the stack pointer is zero.
23139 In general, you don't need to set this option by hand.
23141 This option is used internally by the compiler to select and
23142 build multilibs for architectures @code{avr2} and @code{avr25}.
23143 These architectures mix devices with and without @code{SPH}.
23144 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
23145 the compiler driver adds or removes this option from the compiler
23146 proper's command line, because the compiler then knows if the device
23147 or architecture has an 8-bit stack pointer and thus no @code{SPH}
23148 register or not.
23150 @opindex mstrict-X
23151 @item -mstrict-X
23152 Use address register @code{X} in a way proposed by the hardware.  This means
23153 that @code{X} is only used in indirect, post-increment or
23154 pre-decrement addressing.
23156 Without this option, the @code{X} register may be used in the same way
23157 as @code{Y} or @code{Z} which then is emulated by additional
23158 instructions.  
23159 For example, loading a value with @code{X+const} addressing with a
23160 small non-negative @code{const < 64} to a register @var{Rn} is
23161 performed as
23163 @example
23164 adiw r26, const   ; X += const
23165 ld   @var{Rn}, X        ; @var{Rn} = *X
23166 sbiw r26, const   ; X -= const
23167 @end example
23169 @opindex mtiny-stack
23170 @item -mtiny-stack
23171 Only change the lower 8@tie{}bits of the stack pointer.
23173 @opindex mfract-convert-truncate
23174 @item -mfract-convert-truncate
23175 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
23177 @opindex nodevicelib
23178 @item -nodevicelib
23179 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
23181 @opindex nodevicespecs
23182 @item -nodevicespecs
23183 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
23184 command line.  The user takes responsibility for supplying the sub-processes
23185 like compiler proper, assembler and linker with appropriate command line
23186 options.  This means that the user has to supply her private device specs
23187 file by means of @option{-specs=@var{path-to-specs-file}}.  There is no
23188 more need for option @option{-mmcu=@var{mcu}}.
23190 This option can also serve as a replacement for the older way of
23191 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
23192 which contains a folder named @code{device-specs} which contains a specs file named
23193 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
23195 @opindex Waddr-space-convert
23196 @opindex Wno-addr-space-convert
23197 @item -Waddr-space-convert
23198 Warn about conversions between address spaces in the case where the
23199 resulting address space is not contained in the incoming address space.
23201 @opindex Wmisspelled-isr
23202 @opindex Wno-misspelled-isr
23203 @item -Wmisspelled-isr
23204 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
23205 Enabled by default.
23206 @end table
23208 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
23209 @cindex @code{EIND}
23210 Pointers in the implementation are 16@tie{}bits wide.
23211 The address of a function or label is represented as word address so
23212 that indirect jumps and calls can target any code address in the
23213 range of 64@tie{}Ki words.
23215 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
23216 bytes of program memory space, there is a special function register called
23217 @code{EIND} that serves as most significant part of the target address
23218 when @code{EICALL} or @code{EIJMP} instructions are used.
23220 Indirect jumps and calls on these devices are handled as follows by
23221 the compiler and are subject to some limitations:
23223 @itemize @bullet
23225 @item
23226 The compiler never sets @code{EIND}.
23228 @item
23229 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
23230 instructions or might read @code{EIND} directly in order to emulate an
23231 indirect call/jump by means of a @code{RET} instruction.
23233 @item
23234 The compiler assumes that @code{EIND} never changes during the startup
23235 code or during the application. In particular, @code{EIND} is not
23236 saved/restored in function or interrupt service routine
23237 prologue/epilogue.
23239 @item
23240 For indirect calls to functions and computed goto, the linker
23241 generates @emph{stubs}. Stubs are jump pads sometimes also called
23242 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
23243 The stub contains a direct jump to the desired address.
23245 @item
23246 Linker relaxation must be turned on so that the linker generates
23247 the stubs correctly in all situations. See the compiler option
23248 @option{-mrelax} and the linker option @option{--relax}.
23249 There are corner cases where the linker is supposed to generate stubs
23250 but aborts without relaxation and without a helpful error message.
23252 @item
23253 The default linker script is arranged for code with @code{EIND = 0}.
23254 If code is supposed to work for a setup with @code{EIND != 0}, a custom
23255 linker script has to be used in order to place the sections whose
23256 name start with @code{.trampolines} into the segment where @code{EIND}
23257 points to.
23259 @item
23260 The startup code from libgcc never sets @code{EIND}.
23261 Notice that startup code is a blend of code from libgcc and AVR-LibC.
23262 For the impact of AVR-LibC on @code{EIND}, see the
23263 @w{@uref{https://www.nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
23265 @item
23266 It is legitimate for user-specific startup code to set up @code{EIND}
23267 early, for example by means of initialization code located in
23268 section @code{.init3}. Such code runs prior to general startup code
23269 that initializes RAM and calls constructors, but after the bit
23270 of startup code from AVR-LibC that sets @code{EIND} to the segment
23271 where the vector table is located.
23272 @example
23273 #include <avr/io.h>
23275 static void
23276 __attribute__((section(".init3"),naked,used,no_instrument_function))
23277 init3_set_eind (void)
23279   __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
23280                   "out %i0,r24" :: "n" (&EIND) : "r24","memory");
23282 @end example
23284 @noindent
23285 The @code{__trampolines_start} symbol is defined in the linker script.
23287 @item
23288 Stubs are generated automatically by the linker if
23289 the following two conditions are met:
23290 @itemize @minus
23292 @item The address of a label is taken by means of the @code{gs} modifier
23293 (short for @emph{generate stubs}) like so:
23294 @example
23295 LDI r24, lo8(gs(@var{func}))
23296 LDI r25, hi8(gs(@var{func}))
23297 @end example
23298 @item The final location of that label is in a code segment
23299 @emph{outside} the segment where the stubs are located.
23300 @end itemize
23302 @item
23303 The compiler emits such @code{gs} modifiers for code labels in the
23304 following situations:
23305 @itemize @minus
23306 @item Taking address of a function or code label.
23307 @item Computed goto.
23308 @item If prologue-save function is used, see @option{-mcall-prologues}
23309 command-line option.
23310 @item Switch/case dispatch tables. If you do not want such dispatch
23311 tables you can specify the @option{-fno-jump-tables} command-line option.
23312 @item C and C++ constructors/destructors called during startup/shutdown.
23313 @item If the tools hit a @code{gs()} modifier explained above.
23314 @end itemize
23316 @item
23317 Jumping to non-symbolic addresses like so is @emph{not} supported:
23319 @example
23320 int main (void)
23322     /* Call function at word address 0x2 */
23323     return ((int(*)(void)) 0x2)();
23325 @end example
23327 Instead, a stub has to be set up, i.e.@: the function has to be called
23328 through a symbol (@code{func_4} in the example):
23330 @example
23331 int main (void)
23333     extern int func_4 (void);
23335     /* Call function at byte address 0x4 */
23336     return func_4();
23338 @end example
23340 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
23341 Alternatively, @code{func_4} can be defined in the linker script.
23342 @end itemize
23344 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
23345 @cindex @code{RAMPD}
23346 @cindex @code{RAMPX}
23347 @cindex @code{RAMPY}
23348 @cindex @code{RAMPZ}
23349 Some AVR devices support memories larger than the 64@tie{}KiB range
23350 that can be accessed with 16-bit pointers.  To access memory locations
23351 outside this 64@tie{}KiB range, the content of a @code{RAMP}
23352 register is used as high part of the address:
23353 The @code{X}, @code{Y}, @code{Z} address register is concatenated
23354 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
23355 register, respectively, to get a wide address. Similarly,
23356 @code{RAMPD} is used together with direct addressing.
23358 @itemize
23359 @item
23360 The startup code initializes the @code{RAMP} special function
23361 registers with zero.
23363 @item
23364 If a @ref{AVR Named Address Spaces,named address space} other than
23365 generic or @code{__flash} is used, then @code{RAMPZ} is set
23366 as needed before the operation.
23368 @item
23369 If the device supports RAM larger than 64@tie{}KiB and the compiler
23370 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
23371 is reset to zero after the operation.
23373 @item
23374 If the device comes with a specific @code{RAMP} register, the ISR
23375 prologue/epilogue saves/restores that SFR and initializes it with
23376 zero in case the ISR code might (implicitly) use it.
23378 @item
23379 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
23380 If you use inline assembler to read from locations outside the
23381 16-bit address range and change one of the @code{RAMP} registers,
23382 you must reset it to zero after the access.
23384 @end itemize
23386 @subsubsection AVR Built-in Macros
23388 GCC defines several built-in macros so that the user code can test
23389 for the presence or absence of features.  Almost any of the following
23390 built-in macros are deduced from device capabilities and thus
23391 triggered by the @option{-mmcu=} command-line option.
23393 For even more AVR-specific built-in macros see
23394 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
23396 @table @code
23398 @item __AVR_ARCH__
23399 Build-in macro that resolves to a decimal number that identifies the
23400 architecture and depends on the @option{-mmcu=@var{mcu}} option.
23401 Possible values are:
23403 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
23404 @code{4}, @code{5}, @code{51}, @code{6}
23406 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
23407 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
23409 respectively and
23411 @code{100},
23412 @code{102}, @code{103}, @code{104},
23413 @code{105}, @code{106}, @code{107}
23415 for @var{mcu}=@code{avrtiny},
23416 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
23417 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
23418 If @var{mcu} specifies a device, this built-in macro is set
23419 accordingly. For example, with @option{-mmcu=atmega8} the macro is
23420 defined to @code{4}.
23422 @item __AVR_@var{Device}__
23423 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
23424 the device's name. For example, @option{-mmcu=atmega8} defines the
23425 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
23426 @code{__AVR_ATtiny261A__}, etc.
23428 The built-in macros' names follow
23429 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
23430 the device name as from the AVR user manual. The difference between
23431 @var{Device} in the built-in macro and @var{device} in
23432 @option{-mmcu=@var{device}} is that the latter is always lowercase.
23434 If @var{device} is not a device but only a core architecture like
23435 @samp{avr51}, this macro is not defined.
23437 @item __AVR_DEVICE_NAME__
23438 Setting @option{-mmcu=@var{device}} defines this built-in macro to
23439 the device's name. For example, with @option{-mmcu=atmega8} the macro
23440 is defined to @code{atmega8}.
23442 If @var{device} is not a device but only a core architecture like
23443 @samp{avr51}, this macro is not defined.
23445 @item __AVR_XMEGA__
23446 The device / architecture belongs to the XMEGA family of devices.
23448 @item __AVR_HAVE_ELPM__
23449 The device has the @code{ELPM} instruction.
23451 @item __AVR_HAVE_ELPMX__
23452 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
23453 R@var{n},Z+} instructions.
23455 @item __AVR_HAVE_MOVW__
23456 The device has the @code{MOVW} instruction to perform 16-bit
23457 register-register moves.
23459 @item __AVR_HAVE_LPMX__
23460 The device has the @code{LPM R@var{n},Z} and
23461 @code{LPM R@var{n},Z+} instructions.
23463 @item __AVR_HAVE_MUL__
23464 The device has a hardware multiplier. 
23466 @item __AVR_HAVE_JMP_CALL__
23467 The device has the @code{JMP} and @code{CALL} instructions.
23468 This is the case for devices with more than 8@tie{}KiB of program
23469 memory.
23471 @item __AVR_HAVE_EIJMP_EICALL__
23472 @itemx __AVR_3_BYTE_PC__
23473 The device has the @code{EIJMP} and @code{EICALL} instructions.
23474 This is the case for devices with more than 128@tie{}KiB of program memory.
23475 This also means that the program counter
23476 (PC) is 3@tie{}bytes wide.
23478 @item __AVR_2_BYTE_PC__
23479 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
23480 with up to 128@tie{}KiB of program memory.
23482 @item __AVR_HAVE_8BIT_SP__
23483 @itemx __AVR_HAVE_16BIT_SP__
23484 The stack pointer (SP) register is treated as 8-bit respectively
23485 16-bit register by the compiler.
23486 The definition of these macros is affected by @option{-mtiny-stack}.
23488 @item __AVR_HAVE_SPH__
23489 @itemx __AVR_SP8__
23490 The device has the SPH (high part of stack pointer) special function
23491 register or has an 8-bit stack pointer, respectively.
23492 The definition of these macros is affected by @option{-mmcu=} and
23493 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
23494 by @option{-msp8}.
23496 @item __AVR_HAVE_RAMPD__
23497 @itemx __AVR_HAVE_RAMPX__
23498 @itemx __AVR_HAVE_RAMPY__
23499 @itemx __AVR_HAVE_RAMPZ__
23500 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
23501 @code{RAMPZ} special function register, respectively.
23503 @item __NO_INTERRUPTS__
23504 This macro reflects the @option{-mno-interrupts} command-line option.
23506 @item __AVR_ERRATA_SKIP__
23507 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
23508 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
23509 instructions because of a hardware erratum.  Skip instructions are
23510 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
23511 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
23512 set.
23514 @item __AVR_ISA_RMW__
23515 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
23517 @item __AVR_SFR_OFFSET__=@var{offset}
23518 Instructions that can address I/O special function registers directly
23519 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
23520 address as if addressed by an instruction to access RAM like @code{LD}
23521 or @code{STS}. This offset depends on the device architecture and has
23522 to be subtracted from the RAM address in order to get the
23523 respective I/O@tie{}address.
23525 @item __AVR_SHORT_CALLS__
23526 The @option{-mshort-calls} command line option is set.
23528 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
23529 Some devices support reading from flash memory by means of @code{LD*}
23530 instructions.  The flash memory is seen in the data address space
23531 at an offset of @code{__AVR_PM_BASE_ADDRESS__}.  If this macro
23532 is not defined, this feature is not available.  If defined,
23533 the address space is linear and there is no need to put
23534 @code{.rodata} into RAM.  This is handled by the default linker
23535 description file, and is currently available for
23536 @code{avrtiny} and @code{avrxmega3}.  Even more convenient,
23537 there is no need to use address spaces like @code{__flash} or
23538 features like attribute @code{progmem} and @code{pgm_read_*}.
23540 @item __WITH_AVRLIBC__
23541 The compiler is configured to be used together with AVR-Libc.
23542 See the @option{--with-avrlibc} configure option.
23544 @item __HAVE_DOUBLE_MULTILIB__
23545 Defined if @option{-mdouble=} acts as a multilib option.
23547 @item __HAVE_DOUBLE32__
23548 @itemx __HAVE_DOUBLE64__
23549 Defined if the compiler supports 32-bit double resp. 64-bit double.
23550 The actual layout is specified by option @option{-mdouble=}.
23552 @item __DEFAULT_DOUBLE__
23553 The size in bits of @code{double} if @option{-mdouble=} is not set.
23554 To test the layout of @code{double} in a program, use the built-in
23555 macro @code{__SIZEOF_DOUBLE__}.
23557 @item __HAVE_LONG_DOUBLE32__
23558 @itemx __HAVE_LONG_DOUBLE64__
23559 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
23560 @itemx __DEFAULT_LONG_DOUBLE__
23561 Same as above, but for @code{long double} instead of @code{double}.
23563 @item __WITH_DOUBLE_COMPARISON__
23564 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
23565 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
23566 and is defined to @code{2} or @code{3}.
23568 @item __WITH_LIBF7_LIBGCC__
23569 @itemx __WITH_LIBF7_MATH__
23570 @itemx __WITH_LIBF7_MATH_SYMBOLS__
23571 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
23572 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
23574 @end table
23576 @node Blackfin Options
23577 @subsection Blackfin Options
23578 @cindex Blackfin Options
23580 @table @gcctabopt
23581 @opindex mcpu=
23582 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
23583 Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
23584 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
23585 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
23586 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
23587 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
23588 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
23589 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
23590 @samp{bf561}, @samp{bf592}.
23592 The optional @var{sirevision} specifies the silicon revision of the target
23593 Blackfin processor.  Any workarounds available for the targeted silicon revision
23594 are enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
23595 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
23596 are enabled.  The @code{__SILICON_REVISION__} macro is defined to two
23597 hexadecimal digits representing the major and minor numbers in the silicon
23598 revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
23599 is not defined.  If @var{sirevision} is @samp{any}, the
23600 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
23601 If this optional @var{sirevision} is not used, GCC assumes the latest known
23602 silicon revision of the targeted Blackfin processor.
23604 GCC defines a preprocessor macro for the specified @var{cpu}.
23605 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
23606 provided by libgloss to be linked in if @option{-msim} is not given.
23608 Without this option, @samp{bf532} is used as the processor by default.
23610 Note that support for @samp{bf561} is incomplete.  For @samp{bf561},
23611 only the preprocessor macro is defined.
23613 @opindex msim
23614 @item -msim
23615 Specifies that the program will be run on the simulator.  This causes
23616 the simulator BSP provided by libgloss to be linked in.  This option
23617 has effect only for @samp{bfin-elf} toolchain.
23618 Certain other options, such as @option{-mid-shared-library} and
23619 @option{-mfdpic}, imply @option{-msim}.
23621 @opindex momit-leaf-frame-pointer
23622 @item -momit-leaf-frame-pointer
23623 Don't keep the frame pointer in a register for leaf functions.  This
23624 avoids the instructions to save, set up and restore frame pointers and
23625 makes an extra register available in leaf functions.
23627 @opindex mspecld-anomaly
23628 @item -mspecld-anomaly
23629 When enabled, the compiler ensures that the generated code does not
23630 contain speculative loads after jump instructions. If this option is used,
23631 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
23633 @opindex mno-specld-anomaly
23634 @opindex mspecld-anomaly
23635 @item -mno-specld-anomaly
23636 Don't generate extra code to prevent speculative loads from occurring.
23638 @opindex mcsync-anomaly
23639 @item -mcsync-anomaly
23640 When enabled, the compiler ensures that the generated code does not
23641 contain CSYNC or SSYNC instructions too soon after conditional branches.
23642 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
23644 @opindex mno-csync-anomaly
23645 @opindex mcsync-anomaly
23646 @item -mno-csync-anomaly
23647 Don't generate extra code to prevent CSYNC or SSYNC instructions from
23648 occurring too soon after a conditional branch.
23650 @opindex mlow64k
23651 @item -mlow64k
23652 When enabled, the compiler is free to take advantage of the knowledge that
23653 the entire program fits into the low 64k of memory.
23655 @opindex mno-low64k
23656 @item -mno-low64k
23657 Assume that the program is arbitrarily large.  This is the default.
23659 @opindex mstack-check-l1
23660 @item -mstack-check-l1
23661 Do stack checking using information placed into L1 scratchpad memory by the
23662 uClinux kernel.
23664 @opindex mid-shared-library
23665 @item -mid-shared-library
23666 Generate code that supports shared libraries via the library ID method.
23667 This allows for execute in place and shared libraries in an environment
23668 without virtual memory management.  This option implies @option{-fPIC}.
23669 With a @samp{bfin-elf} target, this option implies @option{-msim}.
23671 @opindex mno-id-shared-library
23672 @opindex mid-shared-library
23673 @item -mno-id-shared-library
23674 Generate code that doesn't assume ID-based shared libraries are being used.
23675 This is the default.
23677 @opindex mleaf-id-shared-library
23678 @item -mleaf-id-shared-library
23679 Generate code that supports shared libraries via the library ID method,
23680 but assumes that this library or executable won't link against any other
23681 ID shared libraries.  That allows the compiler to use faster code for jumps
23682 and calls.
23684 @opindex mno-leaf-id-shared-library
23685 @opindex mleaf-id-shared-library
23686 @item -mno-leaf-id-shared-library
23687 Do not assume that the code being compiled won't link against any ID shared
23688 libraries.  Slower code is generated for jump and call insns.
23690 @opindex mshared-library-id
23691 @item -mshared-library-id=n
23692 Specifies the identification number of the ID-based shared library being
23693 compiled.  Specifying a value of 0 generates more compact code; specifying
23694 other values forces the allocation of that number to the current
23695 library but is no more space- or time-efficient than omitting this option.
23697 @opindex msep-data
23698 @item -msep-data
23699 Generate code that allows the data segment to be located in a different
23700 area of memory from the text segment.  This allows for execute in place in
23701 an environment without virtual memory management by eliminating relocations
23702 against the text section.
23704 @opindex mno-sep-data
23705 @opindex msep-data
23706 @item -mno-sep-data
23707 Generate code that assumes that the data segment follows the text segment.
23708 This is the default.
23710 @opindex mlong-calls
23711 @opindex mno-long-calls
23712 @item -mlong-calls
23713 @itemx -mno-long-calls
23714 Tells the compiler to perform function calls by first loading the
23715 address of the function into a register and then performing a subroutine
23716 call on this register.  This switch is needed if the target function
23717 lies outside of the 24-bit addressing range of the offset-based
23718 version of subroutine call instruction.
23720 This feature is not enabled by default.  Specifying
23721 @option{-mno-long-calls} restores the default behavior.  Note these
23722 switches have no effect on how the compiler generates code to handle
23723 function calls via function pointers.
23725 @opindex mfast-fp
23726 @item -mfast-fp
23727 Link with the fast floating-point library. This library relaxes some of
23728 the IEEE floating-point standard's rules for checking inputs against
23729 Not-a-Number (NAN), in the interest of performance.
23731 @opindex minline-plt
23732 @item -minline-plt
23733 Enable inlining of PLT entries in function calls to functions that are
23734 not known to bind locally.  It has no effect without @option{-mfdpic}.
23736 @opindex mmulticore
23737 @item -mmulticore
23738 Build a standalone application for multicore Blackfin processors. 
23739 This option causes proper start files and link scripts supporting 
23740 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 
23741 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 
23743 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
23744 selects the one-application-per-core programming model.  Without
23745 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
23746 programming model is used. In this model, the main function of Core B
23747 should be named as @code{coreb_main}.
23749 If this option is not used, the single-core application programming
23750 model is used.
23752 @opindex mcorea
23753 @item -mcorea
23754 Build a standalone application for Core A of BF561 when using
23755 the one-application-per-core programming model. Proper start files
23756 and link scripts are used to support Core A, and the macro
23757 @code{__BFIN_COREA} is defined.
23758 This option can only be used in conjunction with @option{-mmulticore}.
23760 @opindex mcoreb
23761 @item -mcoreb
23762 Build a standalone application for Core B of BF561 when using
23763 the one-application-per-core programming model. Proper start files
23764 and link scripts are used to support Core B, and the macro
23765 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
23766 should be used instead of @code{main}. 
23767 This option can only be used in conjunction with @option{-mmulticore}.
23769 @opindex msdram
23770 @item -msdram
23771 Build a standalone application for SDRAM. Proper start files and
23772 link scripts are used to put the application into SDRAM, and the macro
23773 @code{__BFIN_SDRAM} is defined.
23774 The loader should initialize SDRAM before loading the application.
23776 @opindex micplb
23777 @item -micplb
23778 Assume that ICPLBs are enabled at run time.  This has an effect on certain
23779 anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
23780 are enabled; for standalone applications the default is off.
23781 @end table
23783 @node C6X Options
23784 @subsection C6X Options
23785 @cindex C6X Options
23787 @table @gcctabopt
23788 @opindex march
23789 @item -march=@var{name}
23790 This specifies the name of the target architecture.  GCC uses this
23791 name to determine what kind of instructions it can emit when generating
23792 assembly code.  Permissible names are: @samp{c62x},
23793 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
23795 @opindex mbig-endian
23796 @item -mbig-endian
23797 Generate code for a big-endian target.
23799 @opindex mlittle-endian
23800 @item -mlittle-endian
23801 Generate code for a little-endian target.  This is the default.
23803 @opindex msim
23804 @item -msim
23805 Choose startup files and linker script suitable for the simulator.
23807 @opindex msdata=default
23808 @item -msdata=default
23809 Put small global and static data in the @code{.neardata} section,
23810 which is pointed to by register @code{B14}.  Put small uninitialized
23811 global and static data in the @code{.bss} section, which is adjacent
23812 to the @code{.neardata} section.  Put small read-only data into the
23813 @code{.rodata} section.  The corresponding sections used for large
23814 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
23816 @opindex msdata=all
23817 @item -msdata=all
23818 Put all data, not just small objects, into the sections reserved for
23819 small data, and use addressing relative to the @code{B14} register to
23820 access them.
23822 @opindex msdata=none
23823 @item -msdata=none
23824 Make no use of the sections reserved for small data, and use absolute
23825 addresses to access all data.  Put all initialized global and static
23826 data in the @code{.fardata} section, and all uninitialized data in the
23827 @code{.far} section.  Put all constant data into the @code{.const}
23828 section.
23829 @end table
23831 @node CRIS Options
23832 @subsection CRIS Options
23833 @cindex CRIS Options
23835 These options are defined specifically for the CRIS ports.
23837 @table @gcctabopt
23838 @opindex march
23839 @opindex mcpu
23840 @item -march=@var{architecture-type}
23841 @itemx -mcpu=@var{architecture-type}
23842 Generate code for the specified architecture.  The choices for
23843 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
23844 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
23845 Default is @samp{v0}.
23847 @opindex mtune
23848 @item -mtune=@var{architecture-type}
23849 Tune to @var{architecture-type} everything applicable about the generated
23850 code, except for the ABI and the set of available instructions.  The
23851 choices for @var{architecture-type} are the same as for
23852 @option{-march=@var{architecture-type}}.
23854 @opindex mmax-stack-frame
23855 @item -mmax-stack-frame=@var{n}
23856 Warn when the stack frame of a function exceeds @var{n} bytes.
23858 @opindex metrax4
23859 @opindex metrax100
23860 @item -metrax4
23861 @itemx -metrax100
23862 The options @option{-metrax4} and @option{-metrax100} are synonyms for
23863 @option{-march=v3} and @option{-march=v8} respectively.
23865 @opindex mmul-bug-workaround
23866 @opindex mno-mul-bug-workaround
23867 @item -mmul-bug-workaround
23868 @itemx -mno-mul-bug-workaround
23869 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
23870 models where it applies.  This option is disabled by default.
23872 @opindex mpdebug
23873 @item -mpdebug
23874 Enable CRIS-specific verbose debug-related information in the assembly
23875 code.  This option also has the effect of turning off the @samp{#NO_APP}
23876 formatted-code indicator to the assembler at the beginning of the
23877 assembly file.
23879 @opindex mcc-init
23880 @item -mcc-init
23881 Do not use condition-code results from previous instruction; always emit
23882 compare and test instructions before use of condition codes.
23884 @opindex mno-side-effects
23885 @opindex mside-effects
23886 @item -mno-side-effects
23887 Do not emit instructions with side effects in addressing modes other than
23888 post-increment.
23890 @opindex mstack-align
23891 @opindex mno-stack-align
23892 @opindex mdata-align
23893 @opindex mno-data-align
23894 @opindex mconst-align
23895 @opindex mno-const-align
23896 @item -mstack-align
23897 @itemx -mno-stack-align
23898 @itemx -mdata-align
23899 @itemx -mno-data-align
23900 @itemx -mconst-align
23901 @itemx -mno-const-align
23902 These options (@samp{no-} options) arrange (eliminate arrangements) for the
23903 stack frame, individual data and constants to be aligned for the maximum
23904 single data access size for the chosen CPU model.  The default is to
23905 arrange for 32-bit alignment.  ABI details such as structure layout are
23906 not affected by these options.
23908 @opindex m32-bit
23909 @opindex m16-bit
23910 @opindex m8-bit
23911 @item -m32-bit
23912 @itemx -m16-bit
23913 @itemx -m8-bit
23914 Similar to the stack- data- and const-align options above, these options
23915 arrange for stack frame, writable data and constants to all be 32-bit,
23916 16-bit or 8-bit aligned.  The default is 32-bit alignment.
23918 @opindex mno-prologue-epilogue
23919 @opindex mprologue-epilogue
23920 @item -mno-prologue-epilogue
23921 @itemx -mprologue-epilogue
23922 With @option{-mno-prologue-epilogue}, the normal function prologue and
23923 epilogue which set up the stack frame are omitted and no return
23924 instructions or return sequences are generated in the code.  Use this
23925 option only together with visual inspection of the compiled code: no
23926 warnings or errors are generated when call-saved registers must be saved,
23927 or storage for local variables needs to be allocated.
23929 @opindex melf
23930 @item -melf
23931 Legacy no-op option.
23933 @opindex sim
23934 @item -sim
23935 This option arranges
23936 to link with input-output functions from a simulator library.  Code,
23937 initialized data and zero-initialized data are allocated consecutively.
23939 @opindex sim2
23940 @item -sim2
23941 Like @option{-sim}, but pass linker options to locate initialized data at
23942 0x40000000 and zero-initialized data at 0x80000000.
23943 @end table
23945 @node C-SKY Options
23946 @subsection C-SKY Options
23947 @cindex C-SKY Options
23949 GCC supports these options when compiling for C-SKY V2 processors.
23951 @table @gcctabopt
23953 @opindex march=
23954 @item -march=@var{arch}
23955 Specify the C-SKY target architecture.  Valid values for @var{arch} are:
23956 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
23957 The default is @samp{ck810}.
23959 @opindex mcpu=
23960 @item -mcpu=@var{cpu}
23961 Specify the C-SKY target processor.  Valid values for @var{cpu} are:
23962 @samp{ck801}, @samp{ck801t},
23963 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
23964 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
23965 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
23966 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
23967 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
23968 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
23969 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
23970 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
23971 @samp{ck803eftr1}, @samp{ck803efhtr1},
23972 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
23973 @samp{ck803sef}, @samp{ck803seft},
23974 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
23975 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
23976 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
23977 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
23979 @opindex mbig-endian
23980 @opindex EB
23981 @opindex mlittle-endian
23982 @opindex EL
23983 @item -mbig-endian
23984 @itemx -EB
23985 @itemx -mlittle-endian
23986 @itemx -EL
23988 Select big- or little-endian code.  The default is little-endian.
23990 @opindex mfloat-abi
23991 @item -mfloat-abi=@var{name}
23992 Specifies which floating-point ABI to use.  Permissible values
23993 are: @samp{soft}, @samp{softfp} and @samp{hard}.
23995 Specifying @samp{soft} causes GCC to generate output containing
23996 library calls for floating-point operations.
23997 @samp{softfp} allows the generation of code using hardware floating-point
23998 instructions, but still uses the soft-float calling conventions.
23999 @samp{hard} allows generation of floating-point instructions
24000 and uses FPU-specific calling conventions.
24002 The default depends on the specific target configuration.  Note that
24003 the hard-float and soft-float ABIs are not link-compatible; you must
24004 compile your entire program with the same ABI, and link with a
24005 compatible set of libraries.
24007 @opindex mhard-float
24008 @opindex msoft-float
24009 @item -mhard-float
24010 @itemx -msoft-float
24012 Select hardware or software floating-point implementations.
24013 The default is soft float.
24015 @opindex mdouble-float
24016 @item -mdouble-float
24017 @itemx -mno-double-float
24018 When @option{-mhard-float} is in effect, enable generation of
24019 double-precision float instructions.  This is the default except
24020 when compiling for CK803.
24022 @opindex mfdivdu
24023 @item -mfdivdu
24024 @itemx -mno-fdivdu
24025 When @option{-mhard-float} is in effect, enable generation of
24026 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
24027 This is the default except when compiling for CK803.
24029 @opindex mfpu=
24030 @item -mfpu=@var{fpu}
24031 Select the floating-point processor.  This option can only be used with
24032 @option{-mhard-float}.
24033 Values for @var{fpu} are
24034 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
24035 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
24036 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
24038 @opindex melrw
24039 @item -melrw
24040 @itemx -mno-elrw
24041 Enable the extended @code{lrw} instruction.  This option defaults to on
24042 for CK801 and off otherwise.
24044 @opindex mistack
24045 @item -mistack
24046 @itemx -mno-istack
24047 Enable interrupt stack instructions; the default is off.
24049 The @option{-mistack} option is required to handle the
24050 @code{interrupt} and @code{isr} function attributes
24051 (@pxref{C-SKY Function Attributes}).
24053 @opindex mmp
24054 @item -mmp
24055 Enable multiprocessor instructions; the default is off.
24057 @opindex mcp
24058 @item -mcp
24059 Enable coprocessor instructions; the default is off.
24061 @opindex mcache
24062 @item -mcache
24063 Enable coprocessor instructions; the default is off.
24065 @opindex msecurity
24066 @item -msecurity
24067 Enable C-SKY security instructions; the default is off.
24069 @opindex mtrust
24070 @item -mtrust
24071 Enable C-SKY trust instructions; the default is off.
24073 @opindex mdsp
24074 @opindex medsp
24075 @opindex mvdsp
24076 @item -mdsp
24077 @itemx -medsp
24078 @itemx -mvdsp
24079 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
24080 All of these options default to off.
24082 @opindex mdiv
24083 @item -mdiv
24084 @itemx -mno-div
24085 Generate divide instructions.  Default is off.
24087 @opindex msmart
24088 @item -msmart
24089 @itemx -mno-smart
24090 Generate code for Smart Mode, using only registers numbered 0-7 to allow
24091 use of 16-bit instructions.  This option is ignored for CK801 where this
24092 is the required behavior, and it defaults to on for CK802.
24093 For other targets, the default is off.
24095 @opindex mhigh-registers
24096 @item -mhigh-registers
24097 @itemx -mno-high-registers
24098 Generate code using the high registers numbered 16-31.  This option
24099 is not supported on CK801, CK802, or CK803, and is enabled by default
24100 for other processors.
24102 @opindex manchor
24103 @item -manchor
24104 @itemx -mno-anchor
24105 Generate code using global anchor symbol addresses.
24107 @opindex mpushpop
24108 @item -mpushpop
24109 @itemx -mno-pushpop
24110 Generate code using @code{push} and @code{pop} instructions.  This option
24111 defaults to on.
24113 @opindex mmultiple-stld
24114 @item -mmultiple-stld
24115 @itemx -mstm
24116 @itemx -mno-multiple-stld
24117 @itemx -mno-stm
24118 Generate code using @code{stm} and @code{ldm} instructions.  This option
24119 isn't supported on CK801 but is enabled by default on other processors.
24121 @opindex mconstpool
24122 @item -mconstpool
24123 @itemx -mno-constpool
24124 Create constant pools in the compiler instead of deferring it to the
24125 assembler.  This option is the default and required for correct code
24126 generation on CK801 and CK802, and is optional on other processors.
24128 @opindex mstack-size
24129 @item -mstack-size
24130 @item -mno-stack-size
24131 Emit @code{.stack_size} directives for each function in the assembly
24132 output.  This option defaults to off.
24134 @opindex mccrt
24135 @item -mccrt
24136 @itemx -mno-ccrt
24137 Generate code for the C-SKY compiler runtime instead of libgcc.  This
24138 option defaults to off.
24140 @opindex mbranch-cost=
24141 @item -mbranch-cost=@var{n}
24142 Set the branch costs to roughly @code{n} instructions.  The default is 1.
24144 @opindex msched-prolog
24145 @item -msched-prolog
24146 @itemx -mno-sched-prolog
24147 Permit scheduling of function prologue and epilogue sequences.  Using
24148 this option can result in code that is not compliant with the C-SKY V2 ABI
24149 prologue requirements and that cannot be debugged or backtraced.
24150 It is disabled by default.
24152 @opindex msim
24153 @item -msim
24154 Links the library libsemi.a which is in compatible with simulator. Applicable
24155 to ELF compiler only.
24157 @end table
24159 @node Darwin Options
24160 @subsection Darwin Options
24161 @cindex Darwin options
24163 These options are defined for all architectures running the Darwin operating
24164 system.
24166 FSF GCC on Darwin does not create ``fat'' object files; it creates
24167 an object file for the single architecture that GCC was built to
24168 target.  Apple's GCC on Darwin does create ``fat'' files if multiple
24169 @option{-arch} options are used; it does so by running the compiler or
24170 linker multiple times and joining the results together with
24171 @file{lipo}.
24173 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
24174 @samp{i686}) is determined by the flags that specify the ISA
24175 that GCC is targeting, like @option{-mcpu} or @option{-march}.  The
24176 @option{-force_cpusubtype_ALL} option can be used to override this.
24178 The Darwin tools vary in their behavior when presented with an ISA
24179 mismatch.  The assembler, @file{as}, only permits instructions to
24180 be used that are valid for the subtype of the file it is generating,
24181 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
24182 The linker for shared libraries, @file{/usr/bin/libtool}, fails
24183 and prints an error if asked to create a shared library with a less
24184 restrictive subtype than its input files (for instance, trying to put
24185 a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
24186 for executables, @command{ld}, quietly gives the executable the most
24187 restrictive subtype of any of its input files.
24189 @table @gcctabopt
24190 @opindex F
24191 @item -F@var{dir}
24192 Add the framework directory @var{dir} to the head of the list of
24193 directories to be searched for header files.  These directories are
24194 interleaved with those specified by @option{-I} options and are
24195 scanned in a left-to-right order.
24197 A framework directory is a directory with frameworks in it.  A
24198 framework is a directory with a @file{Headers} and/or
24199 @file{PrivateHeaders} directory contained directly in it that ends
24200 in @file{.framework}.  The name of a framework is the name of this
24201 directory excluding the @file{.framework}.  Headers associated with
24202 the framework are found in one of those two directories, with
24203 @file{Headers} being searched first.  A subframework is a framework
24204 directory that is in a framework's @file{Frameworks} directory.
24205 Includes of subframework headers can only appear in a header of a
24206 framework that contains the subframework, or in a sibling subframework
24207 header.  Two subframeworks are siblings if they occur in the same
24208 framework.  A subframework should not have the same name as a
24209 framework; a warning is issued if this is violated.  Currently a
24210 subframework cannot have subframeworks; in the future, the mechanism
24211 may be extended to support this.  The standard frameworks can be found
24212 in @file{/System/Library/Frameworks} and
24213 @file{/Library/Frameworks}.  An example include looks like
24214 @code{#include <Framework/header.h>}, where @file{Framework} denotes
24215 the name of the framework and @file{header.h} is found in the
24216 @file{PrivateHeaders} or @file{Headers} directory.
24218 @opindex iframework
24219 @item -iframework@var{dir}
24220 Like @option{-F} except the directory is a treated as a system
24221 directory.  The main difference between this @option{-iframework} and
24222 @option{-F} is that with @option{-iframework} the compiler does not
24223 warn about constructs contained within header files found via
24224 @var{dir}.  This option is valid only for the C family of languages.
24226 @opindex gused
24227 @item -gused
24228 Emit debugging information for symbols that are used.  For stabs
24229 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
24230 This is by default ON@.
24232 @opindex gfull
24233 @item -gfull
24234 Emit debugging information for all symbols and types.
24236 @opindex fconstant-cfstrings
24237 @item -fconstant-cfstrings
24238 The @option{-fconstant-cfstrings} is an alias for @option{-mconstant-cfstrings}.
24240 @opindex mconstant-cfstrings
24241 @item -mconstant-cfstrings
24242 When the NeXT runtime is being used (the default on these systems), override
24243 any @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"}
24244 literals to be laid out as constant CoreFoundation strings.
24246 @opindex mmacosx-version-min
24247 @item -mmacosx-version-min=@var{version}
24248 The earliest version of MacOS X that this executable will run on is
24249 @var{version}.  Typical values supported for @var{version} include @code{12},
24250 @code{10.12}, and @code{10.5.8}.
24252 If the compiler was built to use the system's headers by default,
24253 then the default for this option is the system version on which the
24254 compiler is running, otherwise the default is to make choices that
24255 are compatible with as many systems and code bases as possible.
24257 @opindex mkernel
24258 @item -mkernel
24259 Enable kernel development mode.  The @option{-mkernel} option sets
24260 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
24261 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
24262 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
24263 applicable.  This mode also sets @option{-mno-altivec},
24264 @option{-msoft-float}, @option{-fno-builtin} and
24265 @option{-mlong-branch} for PowerPC targets.
24267 @opindex mone-byte-bool
24268 @item -mone-byte-bool
24269 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
24270 By default @code{sizeof(bool)} is @code{4} when compiling for
24271 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
24272 option has no effect on x86.
24274 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
24275 to generate code that is not binary compatible with code generated
24276 without that switch.  Using this switch may require recompiling all
24277 other modules in a program, including system libraries.  Use this
24278 switch to conform to a non-default data model.
24280 @opindex mfix-and-continue
24281 @opindex ffix-and-continue
24282 @opindex findirect-data
24283 @item -mfix-and-continue
24284 @itemx -ffix-and-continue
24285 @itemx -findirect-data
24286 Generate code suitable for fast turnaround development, such as to
24287 allow GDB to dynamically load @file{.o} files into already-running
24288 programs.  @option{-findirect-data} and @option{-ffix-and-continue}
24289 are provided for backwards compatibility.
24291 @opindex all_load
24292 @item -all_load
24293 Loads all members of static archive libraries.
24294 See man ld(1) for more information.
24296 @opindex arch_errors_fatal
24297 @item -arch_errors_fatal
24298 Cause the errors having to do with files that have the wrong architecture
24299 to be fatal.
24301 @opindex bind_at_load
24302 @item -bind_at_load
24303 Causes the output file to be marked such that the dynamic linker will
24304 bind all undefined references when the file is loaded or launched.
24306 @opindex bundle
24307 @item -bundle
24308 Produce a Mach-o bundle format file.
24309 See man ld(1) for more information.
24311 @opindex bundle_loader
24312 @item -bundle_loader @var{executable}
24313 This option specifies the @var{executable} that will load the build
24314 output file being linked.  See man ld(1) for more information.
24316 @opindex dynamiclib
24317 @item -dynamiclib
24318 When passed this option, GCC produces a dynamic library instead of
24319 an executable when linking, using the Darwin @file{libtool} command.
24321 @opindex force_cpusubtype_ALL
24322 @item -force_cpusubtype_ALL
24323 This causes GCC's output file to have the @samp{ALL} subtype, instead of
24324 one controlled by the @option{-mcpu} or @option{-march} option.
24326 @item -allowable_client  @var{client_name}
24327 @itemx -client_name
24328 @itemx -compatibility_version
24329 @itemx -current_version
24330 @itemx -dead_strip
24331 @itemx -dependency-file
24332 @itemx -dylib_file
24333 @itemx -dylinker_install_name
24334 @itemx -dynamic
24335 @itemx -exported_symbols_list
24336 @itemx -filelist
24337 @need 800
24338 @itemx -flat_namespace
24339 @itemx -force_flat_namespace
24340 @itemx -headerpad_max_install_names
24341 @itemx -image_base
24342 @itemx -init
24343 @itemx -install_name
24344 @itemx -keep_private_externs
24345 @itemx -multi_module
24346 @itemx -multiply_defined
24347 @itemx -multiply_defined_unused
24348 @need 800
24349 @itemx -noall_load
24350 @itemx -no_dead_strip_inits_and_terms
24351 @itemx -nofixprebinding
24352 @itemx -nomultidefs
24353 @itemx -noprebind
24354 @itemx -noseglinkedit
24355 @itemx -pagezero_size
24356 @itemx -prebind
24357 @itemx -prebind_all_twolevel_modules
24358 @itemx -private_bundle
24359 @need 800
24360 @itemx -read_only_relocs
24361 @itemx -sectalign
24362 @itemx -sectobjectsymbols
24363 @itemx -whyload
24364 @itemx -seg1addr
24365 @itemx -sectcreate
24366 @itemx -sectobjectsymbols
24367 @itemx -sectorder
24368 @itemx -segaddr
24369 @itemx -segs_read_only_addr
24370 @need 800
24371 @itemx -segs_read_write_addr
24372 @itemx -seg_addr_table
24373 @itemx -seg_addr_table_filename
24374 @itemx -seglinkedit
24375 @itemx -segprot
24376 @itemx -segs_read_only_addr
24377 @itemx -segs_read_write_addr
24378 @itemx -single_module
24379 @itemx -static
24380 @itemx -sub_library
24381 @need 800
24382 @opindex allowable_client
24383 @opindex client_name
24384 @opindex compatibility_version
24385 @opindex current_version
24386 @opindex dead_strip
24387 @opindex dependency-file
24388 @opindex dylib_file
24389 @opindex dylinker_install_name
24390 @opindex dynamic
24391 @opindex exported_symbols_list
24392 @opindex filelist
24393 @opindex flat_namespace
24394 @opindex force_flat_namespace
24395 @opindex headerpad_max_install_names
24396 @opindex image_base
24397 @opindex init
24398 @opindex install_name
24399 @opindex keep_private_externs
24400 @opindex multi_module
24401 @opindex multiply_defined
24402 @opindex multiply_defined_unused
24403 @opindex noall_load
24404 @opindex no_dead_strip_inits_and_terms
24405 @opindex nofixprebinding
24406 @opindex nomultidefs
24407 @opindex noprebind
24408 @opindex noseglinkedit
24409 @opindex pagezero_size
24410 @opindex prebind
24411 @opindex prebind_all_twolevel_modules
24412 @opindex private_bundle
24413 @opindex read_only_relocs
24414 @opindex sectalign
24415 @opindex sectobjectsymbols
24416 @opindex whyload
24417 @opindex seg1addr
24418 @opindex sectcreate
24419 @opindex sectobjectsymbols
24420 @opindex sectorder
24421 @opindex segaddr
24422 @opindex segs_read_only_addr
24423 @opindex segs_read_write_addr
24424 @opindex seg_addr_table
24425 @opindex seg_addr_table_filename
24426 @opindex seglinkedit
24427 @opindex segprot
24428 @opindex segs_read_only_addr
24429 @opindex segs_read_write_addr
24430 @opindex single_module
24431 @opindex static
24432 @opindex sub_library
24433 @opindex sub_umbrella
24434 @opindex twolevel_namespace
24435 @opindex umbrella
24436 @opindex undefined
24437 @opindex unexported_symbols_list
24438 @opindex weak_reference_mismatches
24439 @opindex whatsloaded
24440 @itemx -sub_umbrella
24441 @itemx -twolevel_namespace
24442 @itemx -umbrella
24443 @itemx -undefined
24444 @itemx -unexported_symbols_list
24445 @itemx -weak_reference_mismatches
24446 @itemx -whatsloaded
24447 These options are passed to the Darwin linker.  The Darwin linker man page
24448 describes them in detail.
24449 @end table
24451 @node DEC Alpha Options
24452 @subsection DEC Alpha Options
24454 These @samp{-m} options are defined for the DEC Alpha implementations:
24456 @table @gcctabopt
24457 @opindex mno-soft-float
24458 @opindex msoft-float
24459 @item -mno-soft-float
24460 @itemx -msoft-float
24461 Use (do not use) the hardware floating-point instructions for
24462 floating-point operations.  When @option{-msoft-float} is specified,
24463 functions in @file{libgcc.a} are used to perform floating-point
24464 operations.  Unless they are replaced by routines that emulate the
24465 floating-point operations, or compiled in such a way as to call such
24466 emulations routines, these routines issue floating-point
24467 operations.   If you are compiling for an Alpha without floating-point
24468 operations, you must ensure that the library is built so as not to call
24469 them.
24471 Note that Alpha implementations without floating-point operations are
24472 required to have floating-point registers.
24474 @opindex mfp-reg
24475 @opindex mno-fp-regs
24476 @item -mfp-reg
24477 @itemx -mno-fp-regs
24478 Generate code that uses (does not use) the floating-point register set.
24479 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
24480 register set is not used, floating-point operands are passed in integer
24481 registers as if they were integers and floating-point results are passed
24482 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
24483 so any function with a floating-point argument or return value called by code
24484 compiled with @option{-mno-fp-regs} must also be compiled with that
24485 option.
24487 A typical use of this option is building a kernel that does not use,
24488 and hence need not save and restore, any floating-point registers.
24490 @opindex mieee
24491 @item -mieee
24492 The Alpha architecture implements floating-point hardware optimized for
24493 maximum performance.  It is mostly compliant with the IEEE floating-point
24494 standard.  However, for full compliance, software assistance is
24495 required.  This option generates code fully IEEE-compliant code
24496 @emph{except} that the @var{inexact-flag} is not maintained (see below).
24497 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
24498 defined during compilation.  The resulting code is less efficient but is
24499 able to correctly support denormalized numbers and exceptional IEEE
24500 values such as not-a-number and plus/minus infinity.  Other Alpha
24501 compilers call this option @option{-ieee_with_no_inexact}.
24503 @opindex mieee-with-inexact
24504 @item -mieee-with-inexact
24505 This is like @option{-mieee} except the generated code also maintains
24506 the IEEE @var{inexact-flag}.  Turning on this option causes the
24507 generated code to implement fully-compliant IEEE math.  In addition to
24508 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
24509 macro.  On some Alpha implementations the resulting code may execute
24510 significantly slower than the code generated by default.  Since there is
24511 very little code that depends on the @var{inexact-flag}, you should
24512 normally not specify this option.  Other Alpha compilers call this
24513 option @option{-ieee_with_inexact}.
24515 @opindex mfp-trap-mode
24516 @item -mfp-trap-mode=@var{trap-mode}
24517 This option controls what floating-point related traps are enabled.
24518 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
24519 The trap mode can be set to one of four values:
24521 @table @samp
24522 @item n
24523 This is the default (normal) setting.  The only traps that are enabled
24524 are the ones that cannot be disabled in software (e.g., division by zero
24525 trap).
24527 @item u
24528 In addition to the traps enabled by @samp{n}, underflow traps are enabled
24529 as well.
24531 @item su
24532 Like @samp{u}, but the instructions are marked to be safe for software
24533 completion (see Alpha architecture manual for details).
24535 @item sui
24536 Like @samp{su}, but inexact traps are enabled as well.
24537 @end table
24539 @opindex mfp-rounding-mode
24540 @item -mfp-rounding-mode=@var{rounding-mode}
24541 Selects the IEEE rounding mode.  Other Alpha compilers call this option
24542 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
24545 @table @samp
24546 @item n
24547 Normal IEEE rounding mode.  Floating-point numbers are rounded towards
24548 the nearest machine number or towards the even machine number in case
24549 of a tie.
24551 @item m
24552 Round towards minus infinity.
24554 @item c
24555 Chopped rounding mode.  Floating-point numbers are rounded towards zero.
24557 @item d
24558 Dynamic rounding mode.  A field in the floating-point control register
24559 (@var{fpcr}, see Alpha architecture reference manual) controls the
24560 rounding mode in effect.  The C library initializes this register for
24561 rounding towards plus infinity.  Thus, unless your program modifies the
24562 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
24563 @end table
24565 @opindex mtrap-precision
24566 @item -mtrap-precision=@var{trap-precision}
24567 In the Alpha architecture, floating-point traps are imprecise.  This
24568 means without software assistance it is impossible to recover from a
24569 floating trap and program execution normally needs to be terminated.
24570 GCC can generate code that can assist operating system trap handlers
24571 in determining the exact location that caused a floating-point trap.
24572 Depending on the requirements of an application, different levels of
24573 precisions can be selected:
24575 @table @samp
24576 @item p
24577 Program precision.  This option is the default and means a trap handler
24578 can only identify which program caused a floating-point exception.
24580 @item f
24581 Function precision.  The trap handler can determine the function that
24582 caused a floating-point exception.
24584 @item i
24585 Instruction precision.  The trap handler can determine the exact
24586 instruction that caused a floating-point exception.
24587 @end table
24589 Other Alpha compilers provide the equivalent options called
24590 @option{-scope_safe} and @option{-resumption_safe}.
24592 @opindex mieee-conformant
24593 @item -mieee-conformant
24594 This option marks the generated code as IEEE conformant.  You must not
24595 use this option unless you also specify @option{-mtrap-precision=i} and either
24596 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
24597 is to emit the line @samp{.eflag 48} in the function prologue of the
24598 generated assembly file.
24600 @opindex mbuild-constants
24601 @item -mbuild-constants
24602 Normally GCC examines a 32- or 64-bit integer constant to
24603 see if it can construct it from smaller constants in two or three
24604 instructions.  If it cannot, it outputs the constant as a literal and
24605 generates code to load it from the data segment at run time.
24607 Use this option to require GCC to construct @emph{all} integer constants
24608 using code, even if it takes more instructions (the maximum is six).
24610 You typically use this option to build a shared library dynamic
24611 loader.  Itself a shared library, it must relocate itself in memory
24612 before it can find the variables and constants in its own data segment.
24614 @opindex mbwx
24615 @opindex mno-bwx
24616 @opindex mcix
24617 @opindex mno-cix
24618 @opindex mfix
24619 @opindex mno-fix
24620 @opindex mmax
24621 @opindex mno-max
24622 @item -mbwx
24623 @itemx -mno-bwx
24624 @itemx -mcix
24625 @itemx -mno-cix
24626 @itemx -mfix
24627 @itemx -mno-fix
24628 @itemx -mmax
24629 @itemx -mno-max
24630 Indicate whether GCC should generate code to use the optional BWX,
24631 CIX, FIX and MAX instruction sets.  The default is to use the instruction
24632 sets supported by the CPU type specified via @option{-mcpu=} option or that
24633 of the CPU on which GCC was built if none is specified.
24635 @opindex mfloat-vax
24636 @opindex mfloat-ieee
24637 @item -mfloat-vax
24638 @itemx -mfloat-ieee
24639 Generate code that uses (does not use) VAX F and G floating-point
24640 arithmetic instead of IEEE single and double precision.
24642 @opindex mexplicit-relocs
24643 @opindex mno-explicit-relocs
24644 @item -mexplicit-relocs
24645 @itemx -mno-explicit-relocs
24646 Older Alpha assemblers provided no way to generate symbol relocations
24647 except via assembler macros.  Use of these macros does not allow
24648 optimal instruction scheduling.  GNU binutils as of version 2.12
24649 supports a new syntax that allows the compiler to explicitly mark
24650 which relocations should apply to which instructions.  This option
24651 is mostly useful for debugging, as GCC detects the capabilities of
24652 the assembler when it is built and sets the default accordingly.
24654 @opindex msmall-data
24655 @opindex mlarge-data
24656 @item -msmall-data
24657 @itemx -mlarge-data
24658 When @option{-mexplicit-relocs} is in effect, static data is
24659 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
24660 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
24661 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
24662 16-bit relocations off of the @code{$gp} register.  This limits the
24663 size of the small data area to 64KB, but allows the variables to be
24664 directly accessed via a single instruction.
24666 The default is @option{-mlarge-data}.  With this option the data area
24667 is limited to just below 2GB@.  Programs that require more than 2GB of
24668 data must use @code{malloc} or @code{mmap} to allocate the data in the
24669 heap instead of in the program's data segment.
24671 When generating code for shared libraries, @option{-fpic} implies
24672 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
24674 @opindex msmall-text
24675 @opindex mlarge-text
24676 @item -msmall-text
24677 @itemx -mlarge-text
24678 When @option{-msmall-text} is used, the compiler assumes that the
24679 code of the entire program (or shared library) fits in 4MB, and is
24680 thus reachable with a branch instruction.  When @option{-msmall-data}
24681 is used, the compiler can assume that all local symbols share the
24682 same @code{$gp} value, and thus reduce the number of instructions
24683 required for a function call from 4 to 1.
24685 The default is @option{-mlarge-text}.
24687 @opindex mcpu
24688 @item -mcpu=@var{cpu_type}
24689 Set the instruction set and instruction scheduling parameters for
24690 machine type @var{cpu_type}.  You can specify either the @samp{EV}
24691 style name or the corresponding chip number.  GCC supports scheduling
24692 parameters for the EV4, EV5 and EV6 family of processors and
24693 chooses the default values for the instruction set from the processor
24694 you specify.  If you do not specify a processor type, GCC defaults
24695 to the processor on which the compiler was built.
24697 Supported values for @var{cpu_type} are
24699 @table @samp
24700 @item ev4
24701 @itemx ev45
24702 @itemx 21064
24703 Schedules as an EV4 and has no instruction set extensions.
24705 @item ev5
24706 @itemx 21164
24707 Schedules as an EV5 and has no instruction set extensions.
24709 @item ev56
24710 @itemx 21164a
24711 Schedules as an EV5 and supports the BWX extension.
24713 @item pca56
24714 @itemx 21164pc
24715 @itemx 21164PC
24716 Schedules as an EV5 and supports the BWX and MAX extensions.
24718 @item ev6
24719 @itemx 21264
24720 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
24722 @item ev67
24723 @itemx 21264a
24724 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
24725 @end table
24727 Native toolchains also support the value @samp{native},
24728 which selects the best architecture option for the host processor.
24729 @option{-mcpu=native} has no effect if GCC does not recognize
24730 the processor.
24732 @opindex mtune
24733 @item -mtune=@var{cpu_type}
24734 Set only the instruction scheduling parameters for machine type
24735 @var{cpu_type}.  The instruction set is not changed.
24737 Native toolchains also support the value @samp{native},
24738 which selects the best architecture option for the host processor.
24739 @option{-mtune=native} has no effect if GCC does not recognize
24740 the processor.
24742 @opindex mmemory-latency
24743 @item -mmemory-latency=@var{time}
24744 Sets the latency the scheduler should assume for typical memory
24745 references as seen by the application.  This number is highly
24746 dependent on the memory access patterns used by the application
24747 and the size of the external cache on the machine.
24749 Valid options for @var{time} are
24751 @table @samp
24752 @item @var{number}
24753 A decimal number representing clock cycles.
24755 @item L1
24756 @itemx L2
24757 @itemx L3
24758 @itemx main
24759 The compiler contains estimates of the number of clock cycles for
24760 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
24761 (also called Dcache, Scache, and Bcache), as well as to main memory.
24762 Note that L3 is only valid for EV5.
24764 @end table
24765 @end table
24767 @node eBPF Options
24768 @subsection eBPF Options
24769 @cindex eBPF Options
24771 @table @gcctabopt
24772 @item -mframe-limit=@var{bytes}
24773 This specifies the hard limit for frame sizes, in bytes.  Currently,
24774 the value that can be specified should be less than or equal to
24775 @samp{32767}.  Defaults to whatever limit is imposed by the version of
24776 the Linux kernel targeted.
24778 @opindex mbig-endian
24779 @item -mbig-endian
24780 Generate code for a big-endian target.
24782 @opindex mlittle-endian
24783 @item -mlittle-endian
24784 Generate code for a little-endian target.  This is the default.
24786 @opindex mjmpext
24787 @item -mjmpext
24788 @itemx -mno-jmpext
24789 Enable or disable generation of extra conditional-branch instructions.
24790 Enabled for CPU v2 and above.
24792 @opindex mjmp32
24793 @item -mjmp32
24794 @itemx -mno-jmp32
24795 Enable or disable generation of 32-bit jump instructions.
24796 Enabled for CPU v3 and above.
24798 @opindex malu32
24799 @item -malu32
24800 @itemx -mno-alu32
24801 Enable or disable generation of 32-bit ALU instructions.
24802 Enabled for CPU v3 and above.
24804 @opindex mv3-atomics
24805 @item -mv3-atomics
24806 @itemx -mno-v3-atomics
24807 Enable or disable instructions for general atomic operations introduced
24808 in CPU v3.  Enabled for CPU v3 and above.
24810 @opindex mbswap
24811 @item -mbswap
24812 @itemx -mno-bswap
24813 Enable or disable byte swap instructions.  Enabled for CPU v4 and above.
24815 @opindex msdiv
24816 @item -msdiv
24817 @itemx -mno-sdiv
24818 Enable or disable signed division and modulus instructions.  Enabled for
24819 CPU v4 and above.
24821 @opindex msmov
24822 @item -msmov
24823 @itemx -mno-smov
24824 Enable or disable sign-extending move and memory load instructions.
24825 Enabled for CPU v4 and above.
24827 @opindex mcpu
24828 @item -mcpu=@var{version}
24829 This specifies which version of the eBPF ISA to target. Newer versions
24830 may not be supported by all kernels. The default is @samp{v4}.
24832 Supported values for @var{version} are:
24834 @table @samp
24835 @item v1
24836 The first stable eBPF ISA with no special features or extensions.
24838 @item v2
24839 Supports the jump extensions, as in @option{-mjmpext}.
24841 @item v3
24842 All features of v2, plus:
24843 @itemize @minus
24844 @item 32-bit jump operations, as in @option{-mjmp32}
24845 @item 32-bit ALU operations, as in @option{-malu32}
24846 @item general atomic operations, as in @option{-mv3-atomics}
24847 @end itemize
24849 @item v4
24850 All features of v3, plus:
24851 @itemize @minus
24852 @item Byte swap instructions, as in @option{-mbswap}
24853 @item Signed division and modulus instructions, as in @option{-msdiv}
24854 @item Sign-extending move and memory load instructions, as in @option{-msmov}
24855 @end itemize
24856 @end table
24858 @opindex mco-re
24859 @item -mco-re
24860 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and
24861 is implied by @option{-gbtf}.
24863 @opindex mno-co-re
24864 @item -mno-co-re
24865 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE
24866 support is enabled by default when generating BTF debug information for
24867 the BPF target.
24869 @item -mxbpf
24870 Generate code for an expanded version of BPF, which relaxes some of
24871 the restrictions imposed by the BPF architecture:
24872 @itemize @minus
24873 @item Save and restore callee-saved registers at function entry and
24874 exit, respectively.
24875 @end itemize
24877 @opindex masm=@var{dialect}
24878 @item -masm=@var{dialect}
24879 Outputs assembly instructions using eBPF selected @var{dialect}.  The default
24880 is @samp{normal}.
24882 Supported values for @var{dialect} are:
24884 @table @samp
24885 @item normal
24886 Outputs normal assembly dialect.
24888 @item pseudoc
24889 Outputs pseudo-c assembly dialect.
24891 @end table
24893 @end table
24895 @node FR30 Options
24896 @subsection FR30 Options
24897 @cindex FR30 Options
24899 These options are defined specifically for the FR30 port.
24901 @table @gcctabopt
24903 @opindex msmall-model
24904 @item -msmall-model
24905 Use the small address space model.  This can produce smaller code, but
24906 it does assume that all symbolic values and addresses fit into a
24907 20-bit range.
24909 @opindex mno-lsim
24910 @item -mno-lsim
24911 Assume that runtime support has been provided and so there is no need
24912 to include the simulator library (@file{libsim.a}) on the linker
24913 command line.
24915 @end table
24917 @node FT32 Options
24918 @subsection FT32 Options
24919 @cindex FT32 Options
24921 These options are defined specifically for the FT32 port.
24923 @table @gcctabopt
24925 @opindex msim
24926 @item -msim
24927 Specifies that the program will be run on the simulator.  This causes
24928 an alternate runtime startup and library to be linked.
24929 You must not use this option when generating programs that will run on
24930 real hardware; you must provide your own runtime library for whatever
24931 I/O functions are needed.
24933 @opindex mlra
24934 @item -mlra
24935 Enable Local Register Allocation.  This is still experimental for FT32,
24936 so by default the compiler uses standard reload.
24938 @opindex mnodiv
24939 @item -mnodiv
24940 Do not use div and mod instructions.
24942 @opindex mft32b
24943 @item -mft32b
24944 Enable use of the extended instructions of the FT32B processor.
24946 @opindex mcompress
24947 @item -mcompress
24948 Compress all code using the Ft32B code compression scheme.
24950 @opindex  mnopm
24951 @item -mnopm
24952 Do not generate code that reads program memory.
24954 @end table
24956 @node FRV Options
24957 @subsection FRV Options
24958 @cindex FRV Options
24960 @table @gcctabopt
24961 @opindex mgpr-32
24962 @item -mgpr-32
24964 Only use the first 32 general-purpose registers.
24966 @opindex mgpr-64
24967 @item -mgpr-64
24969 Use all 64 general-purpose registers.
24971 @opindex mfpr-32
24972 @item -mfpr-32
24974 Use only the first 32 floating-point registers.
24976 @opindex mfpr-64
24977 @item -mfpr-64
24979 Use all 64 floating-point registers.
24981 @opindex mhard-float
24982 @item -mhard-float
24984 Use hardware instructions for floating-point operations.
24986 @opindex msoft-float
24987 @item -msoft-float
24989 Use library routines for floating-point operations.
24991 @opindex malloc-cc
24992 @item -malloc-cc
24994 Dynamically allocate condition code registers.
24996 @opindex mfixed-cc
24997 @item -mfixed-cc
24999 Do not try to dynamically allocate condition code registers, only
25000 use @code{icc0} and @code{fcc0}.
25002 @opindex mdword
25003 @item -mdword
25005 Change ABI to use double word insns.
25007 @opindex mno-dword
25008 @opindex mdword
25009 @item -mno-dword
25011 Do not use double word instructions.
25013 @opindex mdouble
25014 @item -mdouble
25016 Use floating-point double instructions.
25018 @opindex mno-double
25019 @item -mno-double
25021 Do not use floating-point double instructions.
25023 @opindex mmedia
25024 @item -mmedia
25026 Use media instructions.
25028 @opindex mno-media
25029 @item -mno-media
25031 Do not use media instructions.
25033 @opindex mmuladd
25034 @item -mmuladd
25036 Use multiply and add/subtract instructions.
25038 @opindex mno-muladd
25039 @item -mno-muladd
25041 Do not use multiply and add/subtract instructions.
25043 @opindex mfdpic
25044 @item -mfdpic
25046 Select the FDPIC ABI, which uses function descriptors to represent
25047 pointers to functions.  Without any PIC/PIE-related options, it
25048 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
25049 assumes GOT entries and small data are within a 12-bit range from the
25050 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
25051 are computed with 32 bits.
25052 With a @samp{bfin-elf} target, this option implies @option{-msim}.
25054 @opindex minline-plt
25055 @item -minline-plt
25057 Enable inlining of PLT entries in function calls to functions that are
25058 not known to bind locally.  It has no effect without @option{-mfdpic}.
25059 It's enabled by default if optimizing for speed and compiling for
25060 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
25061 optimization option such as @option{-O3} or above is present in the
25062 command line.
25064 @opindex mTLS
25065 @item -mTLS
25067 Assume a large TLS segment when generating thread-local code.
25069 @opindex mtls
25070 @item -mtls
25072 Do not assume a large TLS segment when generating thread-local code.
25074 @opindex mgprel-ro
25075 @item -mgprel-ro
25077 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
25078 that is known to be in read-only sections.  It's enabled by default,
25079 except for @option{-fpic} or @option{-fpie}: even though it may help
25080 make the global offset table smaller, it trades 1 instruction for 4.
25081 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
25082 one of which may be shared by multiple symbols, and it avoids the need
25083 for a GOT entry for the referenced symbol, so it's more likely to be a
25084 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
25086 @opindex multilib-library-pic
25087 @item -multilib-library-pic
25089 Link with the (library, not FD) pic libraries.  It's implied by
25090 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
25091 @option{-fpic} without @option{-mfdpic}.  You should never have to use
25092 it explicitly.
25094 @opindex mlinked-fp
25095 @item -mlinked-fp
25097 Follow the EABI requirement of always creating a frame pointer whenever
25098 a stack frame is allocated.  This option is enabled by default and can
25099 be disabled with @option{-mno-linked-fp}.
25101 @opindex mlong-calls
25102 @item -mlong-calls
25104 Use indirect addressing to call functions outside the current
25105 compilation unit.  This allows the functions to be placed anywhere
25106 within the 32-bit address space.
25108 @opindex malign-labels
25109 @item -malign-labels
25111 Try to align labels to an 8-byte boundary by inserting NOPs into the
25112 previous packet.  This option only has an effect when VLIW packing
25113 is enabled.  It doesn't create new packets; it merely adds NOPs to
25114 existing ones.
25116 @opindex mlibrary-pic
25117 @item -mlibrary-pic
25119 Generate position-independent EABI code.
25121 @opindex macc-4
25122 @item -macc-4
25124 Use only the first four media accumulator registers.
25126 @opindex macc-8
25127 @item -macc-8
25129 Use all eight media accumulator registers.
25131 @opindex mpack
25132 @item -mpack
25134 Pack VLIW instructions.
25136 @opindex mno-pack
25137 @item -mno-pack
25139 Do not pack VLIW instructions.
25141 @opindex mno-eflags
25142 @item -mno-eflags
25144 Do not mark ABI switches in e_flags.
25146 @opindex mcond-move
25147 @item -mcond-move
25149 Enable the use of conditional-move instructions (default).
25151 This switch is mainly for debugging the compiler and will likely be removed
25152 in a future version.
25154 @opindex mno-cond-move
25155 @item -mno-cond-move
25157 Disable the use of conditional-move instructions.
25159 This switch is mainly for debugging the compiler and will likely be removed
25160 in a future version.
25162 @opindex mscc
25163 @item -mscc
25165 Enable the use of conditional set instructions (default).
25167 This switch is mainly for debugging the compiler and will likely be removed
25168 in a future version.
25170 @opindex mno-scc
25171 @item -mno-scc
25173 Disable the use of conditional set instructions.
25175 This switch is mainly for debugging the compiler and will likely be removed
25176 in a future version.
25178 @opindex mcond-exec
25179 @item -mcond-exec
25181 Enable the use of conditional execution (default).
25183 This switch is mainly for debugging the compiler and will likely be removed
25184 in a future version.
25186 @opindex mno-cond-exec
25187 @item -mno-cond-exec
25189 Disable the use of conditional execution.
25191 This switch is mainly for debugging the compiler and will likely be removed
25192 in a future version.
25194 @opindex mvliw-branch
25195 @item -mvliw-branch
25197 Run a pass to pack branches into VLIW instructions (default).
25199 This switch is mainly for debugging the compiler and will likely be removed
25200 in a future version.
25202 @opindex mno-vliw-branch
25203 @item -mno-vliw-branch
25205 Do not run a pass to pack branches into VLIW instructions.
25207 This switch is mainly for debugging the compiler and will likely be removed
25208 in a future version.
25210 @opindex mmulti-cond-exec
25211 @item -mmulti-cond-exec
25213 Enable optimization of @code{&&} and @code{||} in conditional execution
25214 (default).
25216 This switch is mainly for debugging the compiler and will likely be removed
25217 in a future version.
25219 @opindex mno-multi-cond-exec
25220 @item -mno-multi-cond-exec
25222 Disable optimization of @code{&&} and @code{||} in conditional execution.
25224 This switch is mainly for debugging the compiler and will likely be removed
25225 in a future version.
25227 @opindex mnested-cond-exec
25228 @item -mnested-cond-exec
25230 Enable nested conditional execution optimizations (default).
25232 This switch is mainly for debugging the compiler and will likely be removed
25233 in a future version.
25235 @opindex mno-nested-cond-exec
25236 @item -mno-nested-cond-exec
25238 Disable nested conditional execution optimizations.
25240 This switch is mainly for debugging the compiler and will likely be removed
25241 in a future version.
25243 @opindex moptimize-membar
25244 @item -moptimize-membar
25246 This switch removes redundant @code{membar} instructions from the
25247 compiler-generated code.  It is enabled by default.
25249 @opindex mno-optimize-membar
25250 @opindex moptimize-membar
25251 @item -mno-optimize-membar
25253 This switch disables the automatic removal of redundant @code{membar}
25254 instructions from the generated code.
25256 @opindex mtomcat-stats
25257 @item -mtomcat-stats
25259 Cause gas to print out tomcat statistics.
25261 @opindex mcpu
25262 @item -mcpu=@var{cpu}
25264 Select the processor type for which to generate code.  Possible values are
25265 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
25266 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
25268 @end table
25270 @node GNU/Linux Options
25271 @subsection GNU/Linux Options
25273 These @samp{-m} options are defined for GNU/Linux targets:
25275 @table @gcctabopt
25276 @opindex mglibc
25277 @item -mglibc
25278 Use the GNU C library.  This is the default except
25279 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
25280 @samp{*-*-linux-*android*} targets.
25282 @opindex muclibc
25283 @item -muclibc
25284 Use uClibc C library.  This is the default on
25285 @samp{*-*-linux-*uclibc*} targets.
25287 @opindex mmusl
25288 @item -mmusl
25289 Use the musl C library.  This is the default on
25290 @samp{*-*-linux-*musl*} targets.
25292 @opindex mbionic
25293 @item -mbionic
25294 Use Bionic C library.  This is the default on
25295 @samp{*-*-linux-*android*} targets.
25297 @opindex mandroid
25298 @item -mandroid
25299 Compile code compatible with Android platform.  This is the default on
25300 @samp{*-*-linux-*android*} targets.
25302 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
25303 @option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
25304 this option makes the GCC driver pass Android-specific options to the linker.
25305 Finally, this option causes the preprocessor macro @code{__ANDROID__}
25306 to be defined.
25308 @opindex tno-android-cc
25309 @item -tno-android-cc
25310 Disable compilation effects of @option{-mandroid}, i.e., do not enable
25311 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
25312 @option{-fno-rtti} by default.
25314 @opindex tno-android-ld
25315 @item -tno-android-ld
25316 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
25317 linking options to the linker.
25319 @end table
25321 @node H8/300 Options
25322 @subsection H8/300 Options
25324 These @samp{-m} options are defined for the H8/300 implementations:
25326 @table @gcctabopt
25327 @opindex mrelax
25328 @item -mrelax
25329 Shorten some address references at link time, when possible; uses the
25330 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
25331 ld, Using ld}, for a fuller description.
25333 @opindex mh
25334 @item -mh
25335 Generate code for the H8/300H@.
25337 @opindex ms
25338 @item -ms
25339 Generate code for the H8S@.
25341 @opindex mn
25342 @item -mn
25343 Generate code for the H8S and H8/300H in the normal mode.  This switch
25344 must be used either with @option{-mh} or @option{-ms}.
25346 @opindex ms2600
25347 @item -ms2600
25348 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
25350 @opindex mexr
25351 @item -mexr
25352 Extended registers are stored on stack before execution of function
25353 with monitor attribute. Default option is @option{-mexr}.
25354 This option is valid only for H8S targets.
25356 @opindex mno-exr
25357 @opindex mexr
25358 @item -mno-exr
25359 Extended registers are not stored on stack before execution of function 
25360 with monitor attribute. Default option is @option{-mno-exr}. 
25361 This option is valid only for H8S targets.
25363 @opindex mint32
25364 @item -mint32
25365 Make @code{int} data 32 bits by default.
25367 @opindex malign-300
25368 @item -malign-300
25369 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
25370 The default for the H8/300H and H8S is to align longs and floats on
25371 4-byte boundaries.
25372 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
25373 This option has no effect on the H8/300.
25374 @end table
25376 @node HPPA Options
25377 @subsection HPPA Options
25378 @cindex HPPA Options
25380 These @samp{-m} options are defined for the HPPA family of computers:
25382 @table @gcctabopt
25383 @opindex march
25384 @item -march=@var{architecture-type}
25385 Generate code for the specified architecture.  The choices for
25386 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
25387 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
25388 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
25389 architecture option for your machine.  Code compiled for lower numbered
25390 architectures runs on higher numbered architectures, but not the
25391 other way around.
25393 @opindex mpa-risc-1-0
25394 @opindex mpa-risc-1-1
25395 @opindex mpa-risc-2-0
25396 @item -mpa-risc-1-0
25397 @itemx -mpa-risc-1-1
25398 @itemx -mpa-risc-2-0
25399 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
25401 @opindex matomic-libcalls
25402 @opindex mno-atomic-libcalls
25403 @item -matomic-libcalls
25404 Generate libcalls for atomic loads and stores when sync libcalls are disabled.
25405 This option is enabled by default.  It only affects the generation of
25406 atomic libcalls by the HPPA backend.
25408 Both the sync and @file{libatomic} libcall implementations use locking.
25409 As a result, processor stores are not atomic with respect to other
25410 atomic operations.  Processor loads up to DImode are atomic with
25411 respect to other atomic operations provided they are implemented as
25412 a single access.
25414 The PA-RISC architecture does not support any atomic operations in
25415 hardware except for the @code{ldcw} instruction.  Thus, all atomic
25416 support is implemented using sync and atomic libcalls.  Sync libcall
25417 support is in @file{libgcc.a}.  Atomic libcall support is in
25418 @file{libatomic}.
25420 This option generates @code{__atomic_exchange} calls for atomic stores.
25421 It also provides special handling for atomic DImode accesses on 32-bit
25422 targets.
25424 @opindex mbig-switch
25425 @item -mbig-switch
25426 Does nothing.  Preserved for backward compatibility.
25428 @opindex mcaller-copies
25429 @item -mcaller-copies
25430 The caller copies function arguments passed by hidden reference.  This
25431 option should be used with care as it is not compatible with the default
25432 32-bit runtime.  However, only aggregates larger than eight bytes are
25433 passed by hidden reference and the option provides better compatibility
25434 with OpenMP.
25436 @opindex mcoherent-ldcw
25437 @item -mcoherent-ldcw
25438 Use ldcw/ldcd coherent cache-control hint.
25440 @opindex mdisable-fpregs
25441 @item -mdisable-fpregs
25442 Disable floating-point registers.  Equivalent to @code{-msoft-float}.
25444 @opindex mdisable-indexing
25445 @item -mdisable-indexing
25446 Prevent the compiler from using indexing address modes.  This avoids some
25447 rather obscure problems when compiling MIG generated code under MACH@.
25449 @opindex mfast-indirect-calls
25450 @item -mfast-indirect-calls
25451 Generate code that assumes calls never cross space boundaries.  This
25452 allows GCC to emit code that performs faster indirect calls.
25454 This option does not work in the presence of shared libraries or nested
25455 functions.
25457 @opindex mfixed-range
25458 @item -mfixed-range=@var{register-range}
25459 Generate code treating the given register range as fixed registers.
25460 A fixed register is one that the register allocator cannot use.  This is
25461 useful when compiling kernel code.  A register range is specified as
25462 two registers separated by a dash.  Multiple register ranges can be
25463 specified separated by a comma.
25465 @opindex mgas
25466 @item -mgas
25467 Enable the use of assembler directives only GAS understands.
25469 @opindex mgnu-ld
25470 @item -mgnu-ld
25471 Use options specific to GNU @command{ld}.
25472 This passes @option{-shared} to @command{ld} when
25473 building a shared library.  It is the default when GCC is configured,
25474 explicitly or implicitly, with the GNU linker.  This option does not
25475 affect which @command{ld} is called; it only changes what parameters
25476 are passed to that @command{ld}.
25477 The @command{ld} that is called is determined by the
25478 @option{--with-ld} configure option, GCC's program search path, and
25479 finally by the user's @env{PATH}.  The linker used by GCC can be printed
25480 using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
25481 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
25483 @opindex mhp-ld
25484 @item -mhp-ld
25485 Use options specific to HP @command{ld}.
25486 This passes @option{-b} to @command{ld} when building
25487 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
25488 links.  It is the default when GCC is configured, explicitly or
25489 implicitly, with the HP linker.  This option does not affect
25490 which @command{ld} is called; it only changes what parameters are passed to that
25491 @command{ld}.
25492 The @command{ld} that is called is determined by the @option{--with-ld}
25493 configure option, GCC's program search path, and finally by the user's
25494 @env{PATH}.  The linker used by GCC can be printed using @samp{which
25495 `gcc -print-prog-name=ld`}.  This option is only available on the 64-bit
25496 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
25498 @opindex mlinker-opt
25499 @item -mlinker-opt
25500 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
25501 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
25502 linkers in which they give bogus error messages when linking some programs.
25504 @opindex mno-long-calls
25505 @opindex mlong-calls
25506 @item -mlong-calls
25507 Generate code that uses long call sequences.  This ensures that a call
25508 is always able to reach linker generated stubs.  The default is to generate
25509 long calls only when the distance from the call site to the beginning
25510 of the function or translation unit, as the case may be, exceeds a
25511 predefined limit set by the branch type being used.  The limits for
25512 normal calls are 7,600,000 and 240,000 bytes, respectively for the
25513 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
25514 240,000 bytes.
25516 Distances are measured from the beginning of functions when using the
25517 @option{-ffunction-sections} option, or when using the @option{-mgas}
25518 and @option{-mno-portable-runtime} options together under HP-UX with
25519 the SOM linker.
25521 It is normally not desirable to use this option as it degrades
25522 performance.  However, it may be useful in large applications,
25523 particularly when partial linking is used to build the application.
25525 The types of long calls used depends on the capabilities of the
25526 assembler and linker, and the type of code being generated.  The
25527 impact on systems that support long absolute calls, and long pic
25528 symbol-difference or pc-relative calls should be relatively small.
25529 However, an indirect call is used on 32-bit ELF systems in pic code
25530 and it is quite long.
25532 @opindex mlong-load-store
25533 @item -mlong-load-store
25534 Generate 3-instruction load and store sequences as sometimes required by
25535 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
25536 the HP compilers.
25538 @opindex mjump-in-delay
25539 @item -mjump-in-delay
25540 This option is ignored and provided for compatibility purposes only.
25542 @opindex mno-space-regs
25543 @opindex mspace-regs
25544 @item -mno-space-regs
25545 Generate code that assumes the target has no space registers.  This allows
25546 GCC to generate faster indirect calls and use unscaled index address modes.
25548 Such code is suitable for level 0 PA systems and kernels.
25550 @opindex mordered
25551 @item -mordered
25552 Assume memory references are ordered and barriers are not needed.
25554 @opindex mportable-runtime
25555 @item -mportable-runtime
25556 Use the portable calling conventions proposed by HP for ELF systems.
25558 @opindex mschedule
25559 @item -mschedule=@var{cpu-type}
25560 Schedule code according to the constraints for the machine type
25561 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
25562 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
25563 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
25564 proper scheduling option for your machine.  The default scheduling is
25565 @samp{8000}.
25567 @opindex msio
25568 @item -msio
25569 Generate the predefine, @code{_SIO}, for server IO@.  The default is
25570 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
25571 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
25572 options are available under HP-UX and HI-UX@.
25574 @opindex msoft-float
25575 @item -msoft-float
25576 Generate output containing library calls for floating point.
25577 @strong{Warning:} the requisite libraries are not available for all HPPA
25578 targets.  Normally the facilities of the machine's usual C compiler are
25579 used, but this cannot be done directly in cross-compilation.  You must make
25580 your own arrangements to provide suitable library functions for
25581 cross-compilation.
25583 @option{-msoft-float} changes the calling convention in the output file;
25584 therefore, it is only useful if you compile @emph{all} of a program with
25585 this option.  In particular, you need to compile @file{libgcc.a}, the
25586 library that comes with GCC, with @option{-msoft-float} in order for
25587 this to work.
25589 @opindex msoft-mult
25590 @item -msoft-mult
25591 Use software integer multiplication.
25593 This disables the use of the @code{xmpyu} instruction.
25595 @opindex march
25596 @item -munix=@var{unix-std}
25597 Generate compiler predefines and select a startfile for the specified
25598 UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
25599 and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
25600 is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
25601 11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
25602 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
25603 and later.
25605 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
25606 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
25607 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
25608 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
25609 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
25610 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
25612 It is @emph{important} to note that this option changes the interfaces
25613 for various library routines.  It also affects the operational behavior
25614 of the C library.  Thus, @emph{extreme} care is needed in using this
25615 option.
25617 Library code that is intended to operate with more than one UNIX
25618 standard must test, set and restore the variable @code{__xpg4_extended_mask}
25619 as appropriate.  Most GNU software doesn't provide this capability.
25621 @opindex nolibdld
25622 @item -nolibdld
25623 Suppress the generation of link options to search libdld.sl when the
25624 @option{-static} option is specified on HP-UX 10 and later.
25626 @opindex static
25627 @item -static
25628 The HP-UX implementation of setlocale in libc has a dependency on
25629 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
25630 when the @option{-static} option is specified, special link options
25631 are needed to resolve this dependency.
25633 On HP-UX 10 and later, the GCC driver adds the necessary options to
25634 link with libdld.sl when the @option{-static} option is specified.
25635 This causes the resulting binary to be dynamic.  On the 64-bit port,
25636 the linkers generate dynamic binaries by default in any case.  The
25637 @option{-nolibdld} option can be used to prevent the GCC driver from
25638 adding these link options.
25640 @opindex threads
25641 @item -threads
25642 Add support for multithreading with the @dfn{dce thread} library
25643 under HP-UX@.  This option sets flags for both the preprocessor and
25644 linker.
25645 @end table
25647 @node IA-64 Options
25648 @subsection IA-64 Options
25649 @cindex IA-64 Options
25651 These are the @samp{-m} options defined for the Intel IA-64 architecture.
25653 @table @gcctabopt
25654 @opindex mbig-endian
25655 @item -mbig-endian
25656 Generate code for a big-endian target.  This is the default for HP-UX@.
25658 @opindex mlittle-endian
25659 @item -mlittle-endian
25660 Generate code for a little-endian target.  This is the default for AIX5
25661 and GNU/Linux.
25663 @opindex mgnu-as
25664 @opindex mno-gnu-as
25665 @item -mgnu-as
25666 @itemx -mno-gnu-as
25667 Generate (or don't) code for the GNU assembler.  This is the default.
25668 @c Also, this is the default if the configure option @option{--with-gnu-as}
25669 @c is used.
25671 @opindex mgnu-ld
25672 @opindex mno-gnu-ld
25673 @item -mgnu-ld
25674 @itemx -mno-gnu-ld
25675 Generate (or don't) code for the GNU linker.  This is the default.
25676 @c Also, this is the default if the configure option @option{--with-gnu-ld}
25677 @c is used.
25679 @opindex mno-pic
25680 @item -mno-pic
25681 Generate code that does not use a global pointer register.  The result
25682 is not position independent code, and violates the IA-64 ABI@.
25684 @opindex mvolatile-asm-stop
25685 @opindex mno-volatile-asm-stop
25686 @item -mvolatile-asm-stop
25687 @itemx -mno-volatile-asm-stop
25688 Generate (or don't) a stop bit immediately before and after volatile asm
25689 statements.
25691 @opindex mregister-names
25692 @opindex mno-register-names
25693 @item -mregister-names
25694 @itemx -mno-register-names
25695 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
25696 the stacked registers.  This may make assembler output more readable.
25698 @opindex mno-sdata
25699 @opindex msdata
25700 @item -mno-sdata
25701 @itemx -msdata
25702 Disable (or enable) optimizations that use the small data section.  This may
25703 be useful for working around optimizer bugs.
25705 @opindex mconstant-gp
25706 @item -mconstant-gp
25707 Generate code that uses a single constant global pointer value.  This is
25708 useful when compiling kernel code.
25710 @opindex mauto-pic
25711 @item -mauto-pic
25712 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
25713 This is useful when compiling firmware code.
25715 @opindex minline-float-divide-min-latency
25716 @item -minline-float-divide-min-latency
25717 Generate code for inline divides of floating-point values
25718 using the minimum latency algorithm.
25720 @opindex minline-float-divide-max-throughput
25721 @item -minline-float-divide-max-throughput
25722 Generate code for inline divides of floating-point values
25723 using the maximum throughput algorithm.
25725 @opindex mno-inline-float-divide
25726 @item -mno-inline-float-divide
25727 Do not generate inline code for divides of floating-point values.
25729 @opindex minline-int-divide-min-latency
25730 @item -minline-int-divide-min-latency
25731 Generate code for inline divides of integer values
25732 using the minimum latency algorithm.
25734 @opindex minline-int-divide-max-throughput
25735 @item -minline-int-divide-max-throughput
25736 Generate code for inline divides of integer values
25737 using the maximum throughput algorithm.
25739 @opindex mno-inline-int-divide
25740 @opindex minline-int-divide
25741 @item -mno-inline-int-divide
25742 Do not generate inline code for divides of integer values.
25744 @opindex minline-sqrt-min-latency
25745 @item -minline-sqrt-min-latency
25746 Generate code for inline square roots
25747 using the minimum latency algorithm.
25749 @opindex minline-sqrt-max-throughput
25750 @item -minline-sqrt-max-throughput
25751 Generate code for inline square roots
25752 using the maximum throughput algorithm.
25754 @opindex mno-inline-sqrt
25755 @item -mno-inline-sqrt
25756 Do not generate inline code for @code{sqrt}.
25758 @opindex mfused-madd
25759 @opindex mno-fused-madd
25760 @item -mfused-madd
25761 @itemx -mno-fused-madd
25762 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
25763 instructions.  The default is to use these instructions.
25765 @opindex mno-dwarf2-asm
25766 @opindex mdwarf2-asm
25767 @item -mno-dwarf2-asm
25768 @itemx -mdwarf2-asm
25769 Don't (or do) generate assembler code for the DWARF line number debugging
25770 info.  This may be useful when not using the GNU assembler.
25772 @opindex mearly-stop-bits
25773 @opindex mno-early-stop-bits
25774 @item -mearly-stop-bits
25775 @itemx -mno-early-stop-bits
25776 Allow stop bits to be placed earlier than immediately preceding the
25777 instruction that triggered the stop bit.  This can improve instruction
25778 scheduling, but does not always do so.
25780 @opindex mfixed-range
25781 @item -mfixed-range=@var{register-range}
25782 Generate code treating the given register range as fixed registers.
25783 A fixed register is one that the register allocator cannot use.  This is
25784 useful when compiling kernel code.  A register range is specified as
25785 two registers separated by a dash.  Multiple register ranges can be
25786 specified separated by a comma.
25788 @opindex mtls-size
25789 @item -mtls-size=@var{tls-size}
25790 Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
25793 @opindex mtune
25794 @item -mtune=@var{cpu-type}
25795 Tune the instruction scheduling for a particular CPU, Valid values are
25796 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
25797 and @samp{mckinley}.
25799 @opindex milp32
25800 @opindex mlp64
25801 @item -milp32
25802 @itemx -mlp64
25803 Generate code for a 32-bit or 64-bit environment.
25804 The 32-bit environment sets int, long and pointer to 32 bits.
25805 The 64-bit environment sets int to 32 bits and long and pointer
25806 to 64 bits.  These are HP-UX specific flags.
25808 @opindex mno-sched-br-data-spec
25809 @opindex msched-br-data-spec
25810 @item -mno-sched-br-data-spec
25811 @itemx -msched-br-data-spec
25812 (Dis/En)able data speculative scheduling before reload.
25813 This results in generation of @code{ld.a} instructions and
25814 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
25815 The default setting is disabled.
25817 @opindex msched-ar-data-spec
25818 @opindex mno-sched-ar-data-spec
25819 @item -msched-ar-data-spec
25820 @itemx -mno-sched-ar-data-spec
25821 (En/Dis)able data speculative scheduling after reload.
25822 This results in generation of @code{ld.a} instructions and
25823 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
25824 The default setting is enabled.
25826 @opindex mno-sched-control-spec
25827 @opindex msched-control-spec
25828 @item -mno-sched-control-spec
25829 @itemx -msched-control-spec
25830 (Dis/En)able control speculative scheduling.  This feature is
25831 available only during region scheduling (i.e.@: before reload).
25832 This results in generation of the @code{ld.s} instructions and
25833 the corresponding check instructions @code{chk.s}.
25834 The default setting is disabled.
25836 @opindex msched-br-in-data-spec
25837 @opindex mno-sched-br-in-data-spec
25838 @item -msched-br-in-data-spec
25839 @itemx -mno-sched-br-in-data-spec
25840 (En/Dis)able speculative scheduling of the instructions that
25841 are dependent on the data speculative loads before reload.
25842 This is effective only with @option{-msched-br-data-spec} enabled.
25843 The default setting is enabled.
25845 @opindex msched-ar-in-data-spec
25846 @opindex mno-sched-ar-in-data-spec
25847 @item -msched-ar-in-data-spec
25848 @itemx -mno-sched-ar-in-data-spec
25849 (En/Dis)able speculative scheduling of the instructions that
25850 are dependent on the data speculative loads after reload.
25851 This is effective only with @option{-msched-ar-data-spec} enabled.
25852 The default setting is enabled.
25854 @opindex msched-in-control-spec
25855 @opindex mno-sched-in-control-spec
25856 @item -msched-in-control-spec
25857 @itemx -mno-sched-in-control-spec
25858 (En/Dis)able speculative scheduling of the instructions that
25859 are dependent on the control speculative loads.
25860 This is effective only with @option{-msched-control-spec} enabled.
25861 The default setting is enabled.
25863 @opindex mno-sched-prefer-non-data-spec-insns
25864 @opindex msched-prefer-non-data-spec-insns
25865 @item -mno-sched-prefer-non-data-spec-insns
25866 @itemx -msched-prefer-non-data-spec-insns
25867 If enabled, data-speculative instructions are chosen for schedule
25868 only if there are no other choices at the moment.  This makes
25869 the use of the data speculation much more conservative.
25870 The default setting is disabled.
25872 @opindex mno-sched-prefer-non-control-spec-insns
25873 @opindex msched-prefer-non-control-spec-insns
25874 @item -mno-sched-prefer-non-control-spec-insns
25875 @itemx -msched-prefer-non-control-spec-insns
25876 If enabled, control-speculative instructions are chosen for schedule
25877 only if there are no other choices at the moment.  This makes
25878 the use of the control speculation much more conservative.
25879 The default setting is disabled.
25881 @opindex mno-sched-count-spec-in-critical-path
25882 @opindex msched-count-spec-in-critical-path
25883 @item -mno-sched-count-spec-in-critical-path
25884 @itemx -msched-count-spec-in-critical-path
25885 If enabled, speculative dependencies are considered during
25886 computation of the instructions priorities.  This makes the use of the
25887 speculation a bit more conservative.
25888 The default setting is disabled.
25890 @opindex msched-spec-ldc
25891 @item -msched-spec-ldc
25892 Use a simple data speculation check.  This option is on by default.
25894 @opindex msched-spec-ldc
25895 @item -msched-control-spec-ldc
25896 Use a simple check for control speculation.  This option is on by default.
25898 @opindex msched-stop-bits-after-every-cycle
25899 @item -msched-stop-bits-after-every-cycle
25900 Place a stop bit after every cycle when scheduling.  This option is on
25901 by default.
25903 @opindex msched-fp-mem-deps-zero-cost
25904 @item -msched-fp-mem-deps-zero-cost
25905 Assume that floating-point stores and loads are not likely to cause a conflict
25906 when placed into the same instruction group.  This option is disabled by
25907 default.
25909 @opindex msel-sched-dont-check-control-spec
25910 @item -msel-sched-dont-check-control-spec
25911 Generate checks for control speculation in selective scheduling.
25912 This flag is disabled by default.
25914 @opindex msched-max-memory-insns
25915 @item -msched-max-memory-insns=@var{max-insns}
25916 Limit on the number of memory insns per instruction group, giving lower
25917 priority to subsequent memory insns attempting to schedule in the same
25918 instruction group. Frequently useful to prevent cache bank conflicts.
25919 The default value is 1.
25921 @opindex msched-max-memory-insns-hard-limit
25922 @item -msched-max-memory-insns-hard-limit
25923 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
25924 disallowing more than that number in an instruction group.
25925 Otherwise, the limit is ``soft'', meaning that non-memory operations
25926 are preferred when the limit is reached, but memory operations may still
25927 be scheduled.
25929 @end table
25931 @node LM32 Options
25932 @subsection LM32 Options
25933 @cindex LM32 options
25935 These @option{-m} options are defined for the LatticeMico32 architecture:
25937 @table @gcctabopt
25938 @opindex mbarrel-shift-enabled
25939 @item -mbarrel-shift-enabled
25940 Enable barrel-shift instructions.
25942 @opindex mdivide-enabled
25943 @item -mdivide-enabled
25944 Enable divide and modulus instructions.
25946 @opindex multiply-enabled
25947 @item -mmultiply-enabled
25948 Enable multiply instructions.
25950 @opindex msign-extend-enabled
25951 @item -msign-extend-enabled
25952 Enable sign extend instructions.
25954 @opindex muser-enabled
25955 @item -muser-enabled
25956 Enable user-defined instructions.
25958 @end table
25960 @node LoongArch Options
25961 @subsection LoongArch Options
25962 @cindex LoongArch Options
25964 These command-line options are defined for LoongArch targets:
25966 @table @gcctabopt
25967 @opindex march
25968 @item -march=@var{cpu-type}
25969 Generate instructions for the machine type @var{cpu-type}.  In contrast to
25970 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
25971 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
25972 to generate code that may not run at all on processors other than the one
25973 indicated.  Specifying @option{-march=@var{cpu-type}} implies
25974 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
25976 The choices for @var{cpu-type} are:
25978 @table @samp
25979 @item native
25980 This selects the CPU to generate code for at compilation time by determining
25981 the processor type of the compiling machine.  Using @option{-march=native}
25982 enables all instruction subsets supported by the local machine (hence
25983 the result might not run on different machines).  Using @option{-mtune=native}
25984 produces code optimized for the local machine under the constraints
25985 of the selected instruction set.
25986 @item loongarch64
25987 A generic CPU with 64-bit extensions.
25988 @item la464
25989 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
25990 @end table
25992 @opindex mtune
25993 @item -mtune=@var{cpu-type}
25994 Optimize the output for the given processor, specified by microarchitecture
25995 name.
25997 @opindex mabi
25998 @item -mabi=@var{base-abi-type}
25999 Generate code for the specified calling convention.
26000 @var{base-abi-type} can be one of:
26001 @table @samp
26002 @item lp64d
26003 Uses 64-bit general purpose registers and 32/64-bit floating-point
26004 registers for parameter passing.  Data model is LP64, where @samp{int}
26005 is 32 bits, while @samp{long int} and pointers are 64 bits.
26006 @item lp64f
26007 Uses 64-bit general purpose registers and 32-bit floating-point
26008 registers for parameter passing.  Data model is LP64, where @samp{int}
26009 is 32 bits, while @samp{long int} and pointers are 64 bits.
26010 @item lp64s
26011 Uses 64-bit general purpose registers and no floating-point
26012 registers for parameter passing.  Data model is LP64, where @samp{int}
26013 is 32 bits, while @samp{long int} and pointers are 64 bits.
26014 @end table
26016 @opindex mfpu
26017 @item -mfpu=@var{fpu-type}
26018 Generate code for the specified FPU type, which can be one of:
26019 @table @samp
26020 @item 64
26021 Allow the use of hardware floating-point instructions for 32-bit
26022 and 64-bit operations.
26023 @item 32
26024 Allow the use of hardware floating-point instructions for 32-bit
26025 operations.
26026 @item none
26027 @item 0
26028 Prevent the use of hardware floating-point instructions.
26029 @end table
26031 @opindex msimd
26032 @item -msimd=@var{simd-type}
26033 Enable generation of LoongArch SIMD instructions for vectorization
26034 and via builtin functions.  The value can be one of:
26035 @table @samp
26036 @item lasx
26037 Enable generating instructions from the 256-bit LoongArch Advanced
26038 SIMD Extension (LASX) and the 128-bit LoongArch SIMD Extension (LSX).
26039 @item lsx
26040 Enable generating instructions from the 128-bit LoongArch SIMD
26041 Extension (LSX).
26042 @item none
26043 No LoongArch SIMD instruction may be generated.
26044 @end table
26046 @opindex msoft-float
26047 @item -msoft-float
26048 Force @option{-mfpu=none} and prevents the use of floating-point
26049 registers for parameter passing.  This option may change the target
26050 ABI.
26052 @opindex msingle-float
26053 @item -msingle-float
26054 Force @option{-mfpu=32} and allow the use of 32-bit floating-point
26055 registers for parameter passing.  This option may change the target
26056 ABI.
26058 @opindex mdouble-float
26059 @item -mdouble-float
26060 Force @option{-mfpu=64} and allow the use of 32/64-bit floating-point
26061 registers for parameter passing.  This option may change the target
26062 ABI.
26064 @opindex ml[a]sx
26065 @item -mlasx
26066 @itemx -mno-lasx
26067 @item -mlsx
26068 @itemx -mno-lsx
26069 Incrementally adjust the scope of the SIMD extensions (none / LSX / LASX)
26070 that can be used by the compiler for code generation.  Enabling LASX with
26071 @option{mlasx} automatically enables LSX, and diabling LSX with @option{mno-lsx}
26072 automatically disables LASX.  These driver-only options act upon the final
26073 @option{msimd} configuration state and make incremental chagnes in the order
26074 they appear on the GCC driver's command line, deriving the final / canonicalized
26075 @option{msimd} option that is passed to the compiler proper.
26077 @opindex mbranch-cost
26078 @item -mbranch-cost=@var{n}
26079 Set the cost of branches to roughly @var{n} instructions.
26081 @opindex mcheck-zero-division
26082 @item -mcheck-zero-division
26083 @itemx -mno-check-zero-divison
26084 Trap (do not trap) on integer division by zero.  The default is
26085 @option{-mcheck-zero-division} for @option{-O0} or @option{-Og}, and
26086 @option{-mno-check-zero-division} for other optimization levels.
26088 @opindex mcond-move-int
26089 @item -mcond-move-int
26090 @itemx -mno-cond-move-int
26091 Conditional moves for integral data in general-purpose registers
26092 are enabled (disabled).  The default is @option{-mcond-move-int}.
26094 @opindex mcond-move-float
26095 @item -mcond-move-float
26096 @itemx -mno-cond-move-float
26097 Conditional moves for floating-point registers are enabled (disabled).
26098 The default is @option{-mcond-move-float}.
26100 @opindex mmemcpy
26101 @item -mmemcpy
26102 @itemx -mno-memcpy
26103 Force (do not force) the use of @code{memcpy} for non-trivial block moves.
26104 The default is @option{-mno-memcpy}, which allows GCC to inline most
26105 constant-sized copies.  Setting optimization level to @option{-Os} also
26106 forces the use of @code{memcpy}, but @option{-mno-memcpy} may override this
26107 behavior if explicitly specified, regardless of the order these options on
26108 the command line.
26110 @opindex mstrict-align
26111 @item -mstrict-align
26112 @itemx -mno-strict-align
26113 Avoid or allow generating memory accesses that may not be aligned on a natural
26114 object boundary as described in the architecture specification. The default is
26115 @option{-mno-strict-align}.
26117 @opindex msmall-data-limit
26118 @item -msmall-data-limit=@var{number}
26119 Put global and static data smaller than @var{number} bytes into a special
26120 section (on some targets).  The default value is 0.
26122 @opindex mmax-inline-memcpy-size
26123 @item -mmax-inline-memcpy-size=@var{n}
26124 Inline all block moves (such as calls to @code{memcpy} or structure copies)
26125 less than or equal to @var{n} bytes.  The default value of @var{n} is 1024.
26127 @item -mcmodel=@var{code-model}
26128 Set the code model to one of:
26129 @table @samp
26130 @item tiny-static (Not implemented yet)
26131 @item tiny (Not implemented yet)
26133 @item normal
26134 The text segment must be within 128MB addressing space.  The data segment must
26135 be within 2GB addressing space.
26137 @item medium
26138 The text segment and data segment must be within 2GB addressing space.
26140 @item large (Not implemented yet)
26142 @item extreme
26143 This mode does not limit the size of the code segment and data segment.
26144 The @option{-mcmodel=extreme} option is incompatible with @option{-fplt} and
26145 @option{-mno-explicit-relocs}.
26146 @end table
26147 The default code model is @code{normal}.
26149 @opindex mexplicit-relocs
26150 @opindex mno-explicit-relocs
26151 @item -mexplicit-relocs
26152 @itemx -mno-explicit-relocs
26153 Use or do not use assembler relocation operators when dealing with symbolic
26154 addresses.  The alternative is to use assembler macros instead, which may
26155 limit optimization.  The default value for the option is determined during
26156 GCC build-time by detecting corresponding assembler support:
26157 @code{-mexplicit-relocs} if said support is present,
26158 @code{-mno-explicit-relocs} otherwise.  This option is mostly useful for
26159 debugging, or interoperation with assemblers different from the build-time
26160 one.
26162 @opindex mdirect-extern-access
26163 @item -mdirect-extern-access
26164 @itemx -mno-direct-extern-access
26165 Do not use or use GOT to access external symbols.  The default is
26166 @option{-mno-direct-extern-access}: GOT is used for external symbols with
26167 default visibility, but not used for other external symbols.
26169 With @option{-mdirect-extern-access}, GOT is not used and all external
26170 symbols are PC-relatively addressed.  It is @strong{only} suitable for
26171 environments where no dynamic link is performed, like firmwares, OS
26172 kernels, executables linked with @option{-static} or @option{-static-pie}.
26173 @option{-mdirect-extern-access} is not compatible with @option{-fPIC} or
26174 @option{-fpic}.
26175 @end table
26178 @node M32C Options
26179 @subsection M32C Options
26180 @cindex M32C options
26182 @table @gcctabopt
26183 @opindex mcpu=
26184 @item -mcpu=@var{name}
26185 Select the CPU for which code is generated.  @var{name} may be one of
26186 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
26187 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
26188 the M32C/80 series.
26190 @opindex msim
26191 @item -msim
26192 Specifies that the program will be run on the simulator.  This causes
26193 an alternate runtime library to be linked in which supports, for
26194 example, file I/O@.  You must not use this option when generating
26195 programs that will run on real hardware; you must provide your own
26196 runtime library for whatever I/O functions are needed.
26198 @opindex memregs=
26199 @item -memregs=@var{number}
26200 Specifies the number of memory-based pseudo-registers GCC uses
26201 during code generation.  These pseudo-registers are used like real
26202 registers, so there is a tradeoff between GCC's ability to fit the
26203 code into available registers, and the performance penalty of using
26204 memory instead of registers.  Note that all modules in a program must
26205 be compiled with the same value for this option.  Because of that, you
26206 must not use this option with GCC's default runtime libraries.
26208 @end table
26210 @node M32R/D Options
26211 @subsection M32R/D Options
26212 @cindex M32R/D options
26214 These @option{-m} options are defined for Renesas M32R/D architectures:
26216 @table @gcctabopt
26217 @opindex m32r2
26218 @item -m32r2
26219 Generate code for the M32R/2@.
26221 @opindex m32rx
26222 @item -m32rx
26223 Generate code for the M32R/X@.
26225 @opindex m32r
26226 @item -m32r
26227 Generate code for the M32R@.  This is the default.
26229 @opindex mmodel=small
26230 @item -mmodel=small
26231 Assume all objects live in the lower 16MB of memory (so that their addresses
26232 can be loaded with the @code{ld24} instruction), and assume all subroutines
26233 are reachable with the @code{bl} instruction.
26234 This is the default.
26236 The addressability of a particular object can be set with the
26237 @code{model} attribute.
26239 @opindex mmodel=medium
26240 @item -mmodel=medium
26241 Assume objects may be anywhere in the 32-bit address space (the compiler
26242 generates @code{seth/add3} instructions to load their addresses), and
26243 assume all subroutines are reachable with the @code{bl} instruction.
26245 @opindex mmodel=large
26246 @item -mmodel=large
26247 Assume objects may be anywhere in the 32-bit address space (the compiler
26248 generates @code{seth/add3} instructions to load their addresses), and
26249 assume subroutines may not be reachable with the @code{bl} instruction
26250 (the compiler generates the much slower @code{seth/add3/jl}
26251 instruction sequence).
26253 @opindex msdata=none
26254 @item -msdata=none
26255 Disable use of the small data area.  Variables are put into
26256 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
26257 @code{section} attribute has been specified).
26258 This is the default.
26260 The small data area consists of sections @code{.sdata} and @code{.sbss}.
26261 Objects may be explicitly put in the small data area with the
26262 @code{section} attribute using one of these sections.
26264 @opindex msdata=sdata
26265 @item -msdata=sdata
26266 Put small global and static data in the small data area, but do not
26267 generate special code to reference them.
26269 @opindex msdata=use
26270 @item -msdata=use
26271 Put small global and static data in the small data area, and generate
26272 special instructions to reference them.
26274 @opindex G
26275 @cindex smaller data references
26276 @item -G @var{num}
26277 Put global and static objects less than or equal to @var{num} bytes
26278 into the small data or BSS sections instead of the normal data or BSS
26279 sections.  The default value of @var{num} is 8.
26280 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
26281 for this option to have any effect.
26283 All modules should be compiled with the same @option{-G @var{num}} value.
26284 Compiling with different values of @var{num} may or may not work; if it
26285 doesn't the linker gives an error message---incorrect code is not
26286 generated.
26288 @opindex mdebug
26289 @item -mdebug
26290 Makes the M32R-specific code in the compiler display some statistics
26291 that might help in debugging programs.
26293 @opindex malign-loops
26294 @item -malign-loops
26295 Align all loops to a 32-byte boundary.
26297 @opindex mno-align-loops
26298 @item -mno-align-loops
26299 Do not enforce a 32-byte alignment for loops.  This is the default.
26301 @opindex missue-rate=@var{number}
26302 @item -missue-rate=@var{number}
26303 Issue @var{number} instructions per cycle.  @var{number} can only be 1
26304 or 2.
26306 @opindex mbranch-cost=@var{number}
26307 @item -mbranch-cost=@var{number}
26308 @var{number} can only be 1 or 2.  If it is 1 then branches are
26309 preferred over conditional code, if it is 2, then the opposite applies.
26311 @opindex mflush-trap=@var{number}
26312 @item -mflush-trap=@var{number}
26313 Specifies the trap number to use to flush the cache.  The default is
26314 12.  Valid numbers are between 0 and 15 inclusive.
26316 @opindex mno-flush-trap
26317 @item -mno-flush-trap
26318 Specifies that the cache cannot be flushed by using a trap.
26320 @opindex mflush-func=@var{name}
26321 @item -mflush-func=@var{name}
26322 Specifies the name of the operating system function to call to flush
26323 the cache.  The default is @samp{_flush_cache}, but a function call
26324 is only used if a trap is not available.
26326 @opindex mno-flush-func
26327 @item -mno-flush-func
26328 Indicates that there is no OS function for flushing the cache.
26330 @end table
26332 @node M680x0 Options
26333 @subsection M680x0 Options
26334 @cindex M680x0 options
26336 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
26337 The default settings depend on which architecture was selected when
26338 the compiler was configured; the defaults for the most common choices
26339 are given below.
26341 @table @gcctabopt
26342 @opindex march
26343 @item -march=@var{arch}
26344 Generate code for a specific M680x0 or ColdFire instruction set
26345 architecture.  Permissible values of @var{arch} for M680x0
26346 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
26347 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
26348 architectures are selected according to Freescale's ISA classification
26349 and the permissible values are: @samp{isaa}, @samp{isaaplus},
26350 @samp{isab} and @samp{isac}.
26352 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
26353 code for a ColdFire target.  The @var{arch} in this macro is one of the
26354 @option{-march} arguments given above.
26356 When used together, @option{-march} and @option{-mtune} select code
26357 that runs on a family of similar processors but that is optimized
26358 for a particular microarchitecture.
26360 @opindex mcpu
26361 @item -mcpu=@var{cpu}
26362 Generate code for a specific M680x0 or ColdFire processor.
26363 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
26364 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
26365 and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
26366 below, which also classifies the CPUs into families:
26368 @multitable @columnfractions 0.20 0.80
26369 @headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments}
26370 @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}
26371 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
26372 @item @samp{5206e} @tab @samp{5206e}
26373 @item @samp{5208} @tab @samp{5207} @samp{5208}
26374 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
26375 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
26376 @item @samp{5216} @tab @samp{5214} @samp{5216}
26377 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
26378 @item @samp{5225} @tab @samp{5224} @samp{5225}
26379 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
26380 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
26381 @item @samp{5249} @tab @samp{5249}
26382 @item @samp{5250} @tab @samp{5250}
26383 @item @samp{5271} @tab @samp{5270} @samp{5271}
26384 @item @samp{5272} @tab @samp{5272}
26385 @item @samp{5275} @tab @samp{5274} @samp{5275}
26386 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
26387 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
26388 @item @samp{5307} @tab @samp{5307}
26389 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
26390 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
26391 @item @samp{5407} @tab @samp{5407}
26392 @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}
26393 @end multitable
26395 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
26396 @var{arch} is compatible with @var{cpu}.  Other combinations of
26397 @option{-mcpu} and @option{-march} are rejected.
26399 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
26400 @var{cpu} is selected.  It also defines @code{__mcf_family_@var{family}},
26401 where the value of @var{family} is given by the table above.
26403 @opindex mtune
26404 @item -mtune=@var{tune}
26405 Tune the code for a particular microarchitecture within the
26406 constraints set by @option{-march} and @option{-mcpu}.
26407 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
26408 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
26409 and @samp{cpu32}.  The ColdFire microarchitectures
26410 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
26412 You can also use @option{-mtune=68020-40} for code that needs
26413 to run relatively well on 68020, 68030 and 68040 targets.
26414 @option{-mtune=68020-60} is similar but includes 68060 targets
26415 as well.  These two options select the same tuning decisions as
26416 @option{-m68020-40} and @option{-m68020-60} respectively.
26418 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
26419 when tuning for 680x0 architecture @var{arch}.  It also defines
26420 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
26421 option is used.  If GCC is tuning for a range of architectures,
26422 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
26423 it defines the macros for every architecture in the range.
26425 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
26426 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
26427 of the arguments given above.
26429 @opindex m68000
26430 @opindex mc68000
26431 @item -m68000
26432 @itemx -mc68000
26433 Generate output for a 68000.  This is the default
26434 when the compiler is configured for 68000-based systems.
26435 It is equivalent to @option{-march=68000}.
26437 Use this option for microcontrollers with a 68000 or EC000 core,
26438 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
26440 @opindex m68010
26441 @item -m68010
26442 Generate output for a 68010.  This is the default
26443 when the compiler is configured for 68010-based systems.
26444 It is equivalent to @option{-march=68010}.
26446 @opindex m68020
26447 @opindex mc68020
26448 @item -m68020
26449 @itemx -mc68020
26450 Generate output for a 68020.  This is the default
26451 when the compiler is configured for 68020-based systems.
26452 It is equivalent to @option{-march=68020}.
26454 @opindex m68030
26455 @item -m68030
26456 Generate output for a 68030.  This is the default when the compiler is
26457 configured for 68030-based systems.  It is equivalent to
26458 @option{-march=68030}.
26460 @opindex m68040
26461 @item -m68040
26462 Generate output for a 68040.  This is the default when the compiler is
26463 configured for 68040-based systems.  It is equivalent to
26464 @option{-march=68040}.
26466 This option inhibits the use of 68881/68882 instructions that have to be
26467 emulated by software on the 68040.  Use this option if your 68040 does not
26468 have code to emulate those instructions.
26470 @opindex m68060
26471 @item -m68060
26472 Generate output for a 68060.  This is the default when the compiler is
26473 configured for 68060-based systems.  It is equivalent to
26474 @option{-march=68060}.
26476 This option inhibits the use of 68020 and 68881/68882 instructions that
26477 have to be emulated by software on the 68060.  Use this option if your 68060
26478 does not have code to emulate those instructions.
26480 @opindex mcpu32
26481 @item -mcpu32
26482 Generate output for a CPU32.  This is the default
26483 when the compiler is configured for CPU32-based systems.
26484 It is equivalent to @option{-march=cpu32}.
26486 Use this option for microcontrollers with a
26487 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
26488 68336, 68340, 68341, 68349 and 68360.
26490 @opindex m5200
26491 @item -m5200
26492 Generate output for a 520X ColdFire CPU@.  This is the default
26493 when the compiler is configured for 520X-based systems.
26494 It is equivalent to @option{-mcpu=5206}, and is now deprecated
26495 in favor of that option.
26497 Use this option for microcontroller with a 5200 core, including
26498 the MCF5202, MCF5203, MCF5204 and MCF5206.
26500 @opindex m5206e
26501 @item -m5206e
26502 Generate output for a 5206e ColdFire CPU@.  The option is now
26503 deprecated in favor of the equivalent @option{-mcpu=5206e}.
26505 @opindex m528x
26506 @item -m528x
26507 Generate output for a member of the ColdFire 528X family.
26508 The option is now deprecated in favor of the equivalent
26509 @option{-mcpu=528x}.
26511 @opindex m5307
26512 @item -m5307
26513 Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
26514 in favor of the equivalent @option{-mcpu=5307}.
26516 @opindex m5407
26517 @item -m5407
26518 Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
26519 in favor of the equivalent @option{-mcpu=5407}.
26521 @opindex mcfv4e
26522 @item -mcfv4e
26523 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
26524 This includes use of hardware floating-point instructions.
26525 The option is equivalent to @option{-mcpu=547x}, and is now
26526 deprecated in favor of that option.
26528 @opindex m68020-40
26529 @item -m68020-40
26530 Generate output for a 68040, without using any of the new instructions.
26531 This results in code that can run relatively efficiently on either a
26532 68020/68881 or a 68030 or a 68040.  The generated code does use the
26533 68881 instructions that are emulated on the 68040.
26535 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
26537 @opindex m68020-60
26538 @item -m68020-60
26539 Generate output for a 68060, without using any of the new instructions.
26540 This results in code that can run relatively efficiently on either a
26541 68020/68881 or a 68030 or a 68040.  The generated code does use the
26542 68881 instructions that are emulated on the 68060.
26544 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
26546 @opindex mhard-float
26547 @opindex m68881
26548 @item -mhard-float
26549 @itemx -m68881
26550 Generate floating-point instructions.  This is the default for 68020
26551 and above, and for ColdFire devices that have an FPU@.  It defines the
26552 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
26553 on ColdFire targets.
26555 @opindex msoft-float
26556 @item -msoft-float
26557 Do not generate floating-point instructions; use library calls instead.
26558 This is the default for 68000, 68010, and 68832 targets.  It is also
26559 the default for ColdFire devices that have no FPU.
26561 @opindex mdiv
26562 @opindex mno-div
26563 @item -mdiv
26564 @itemx -mno-div
26565 Generate (do not generate) ColdFire hardware divide and remainder
26566 instructions.  If @option{-march} is used without @option{-mcpu},
26567 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
26568 architectures.  Otherwise, the default is taken from the target CPU
26569 (either the default CPU, or the one specified by @option{-mcpu}).  For
26570 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
26571 @option{-mcpu=5206e}.
26573 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
26575 @opindex mshort
26576 @item -mshort
26577 Consider type @code{int} to be 16 bits wide, like @code{short int}.
26578 Additionally, parameters passed on the stack are also aligned to a
26579 16-bit boundary even on targets whose API mandates promotion to 32-bit.
26581 @opindex mno-short
26582 @item -mno-short
26583 Do not consider type @code{int} to be 16 bits wide.  This is the default.
26585 @opindex mnobitfield
26586 @opindex mno-bitfield
26587 @item -mnobitfield
26588 @itemx -mno-bitfield
26589 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
26590 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
26592 @opindex mbitfield
26593 @item -mbitfield
26594 Do use the bit-field instructions.  The @option{-m68020} option implies
26595 @option{-mbitfield}.  This is the default if you use a configuration
26596 designed for a 68020.
26598 @opindex mrtd
26599 @item -mrtd
26600 Use a different function-calling convention, in which functions
26601 that take a fixed number of arguments return with the @code{rtd}
26602 instruction, which pops their arguments while returning.  This
26603 saves one instruction in the caller since there is no need to pop
26604 the arguments there.
26606 This calling convention is incompatible with the one normally
26607 used on Unix, so you cannot use it if you need to call libraries
26608 compiled with the Unix compiler.
26610 Also, you must provide function prototypes for all functions that
26611 take variable numbers of arguments (including @code{printf});
26612 otherwise incorrect code is generated for calls to those
26613 functions.
26615 In addition, seriously incorrect code results if you call a
26616 function with too many arguments.  (Normally, extra arguments are
26617 harmlessly ignored.)
26619 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
26620 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
26622 The default is @option{-mno-rtd}.
26624 @opindex malign-int
26625 @opindex mno-align-int
26626 @item -malign-int
26627 @itemx -mno-align-int
26628 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
26629 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
26630 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
26631 Aligning variables on 32-bit boundaries produces code that runs somewhat
26632 faster on processors with 32-bit busses at the expense of more memory.
26634 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
26635 aligns structures containing the above types differently than
26636 most published application binary interface specifications for the m68k.
26638 @opindex mpcrel
26639 Use the pc-relative addressing mode of the 68000 directly, instead of
26640 using a global offset table.  At present, this option implies @option{-fpic},
26641 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
26642 not presently supported with @option{-mpcrel}, though this could be supported for
26643 68020 and higher processors.
26645 @opindex mno-strict-align
26646 @opindex mstrict-align
26647 @item -mno-strict-align
26648 @itemx -mstrict-align
26649 Do not (do) assume that unaligned memory references are handled by
26650 the system.
26652 @item -msep-data
26653 Generate code that allows the data segment to be located in a different
26654 area of memory from the text segment.  This allows for execute-in-place in
26655 an environment without virtual memory management.  This option implies
26656 @option{-fPIC}.
26658 @item -mno-sep-data
26659 Generate code that assumes that the data segment follows the text segment.
26660 This is the default.
26662 @item -mid-shared-library
26663 Generate code that supports shared libraries via the library ID method.
26664 This allows for execute-in-place and shared libraries in an environment
26665 without virtual memory management.  This option implies @option{-fPIC}.
26667 @item -mno-id-shared-library
26668 Generate code that doesn't assume ID-based shared libraries are being used.
26669 This is the default.
26671 @item -mshared-library-id=n
26672 Specifies the identification number of the ID-based shared library being
26673 compiled.  Specifying a value of 0 generates more compact code; specifying
26674 other values forces the allocation of that number to the current
26675 library, but is no more space- or time-efficient than omitting this option.
26677 @opindex mxgot
26678 @opindex mno-xgot
26679 @item -mxgot
26680 @itemx -mno-xgot
26681 When generating position-independent code for ColdFire, generate code
26682 that works if the GOT has more than 8192 entries.  This code is
26683 larger and slower than code generated without this option.  On M680x0
26684 processors, this option is not needed; @option{-fPIC} suffices.
26686 GCC normally uses a single instruction to load values from the GOT@.
26687 While this is relatively efficient, it only works if the GOT
26688 is smaller than about 64k.  Anything larger causes the linker
26689 to report an error such as:
26691 @cindex relocation truncated to fit (ColdFire)
26692 @smallexample
26693 relocation truncated to fit: R_68K_GOT16O foobar
26694 @end smallexample
26696 If this happens, you should recompile your code with @option{-mxgot}.
26697 It should then work with very large GOTs.  However, code generated with
26698 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
26699 the value of a global symbol.
26701 Note that some linkers, including newer versions of the GNU linker,
26702 can create multiple GOTs and sort GOT entries.  If you have such a linker,
26703 you should only need to use @option{-mxgot} when compiling a single
26704 object file that accesses more than 8192 GOT entries.  Very few do.
26706 These options have no effect unless GCC is generating
26707 position-independent code.
26709 @opindex mlong-jump-table-offsets
26710 @item -mlong-jump-table-offsets
26711 Use 32-bit offsets in @code{switch} tables.  The default is to use
26712 16-bit offsets.
26714 @end table
26716 @node MCore Options
26717 @subsection MCore Options
26718 @cindex MCore options
26720 These are the @samp{-m} options defined for the Motorola M*Core
26721 processors.
26723 @table @gcctabopt
26725 @opindex mhardlit
26726 @opindex mno-hardlit
26727 @item -mhardlit
26728 @itemx -mno-hardlit
26729 Inline constants into the code stream if it can be done in two
26730 instructions or less.
26732 @opindex mdiv
26733 @opindex mno-div
26734 @item -mdiv
26735 @itemx -mno-div
26736 Use the divide instruction.  (Enabled by default).
26738 @opindex mrelax-immediate
26739 @opindex mno-relax-immediate
26740 @item -mrelax-immediate
26741 @itemx -mno-relax-immediate
26742 Allow arbitrary-sized immediates in bit operations.
26744 @opindex mwide-bitfields
26745 @opindex mno-wide-bitfields
26746 @item -mwide-bitfields
26747 @itemx -mno-wide-bitfields
26748 Always treat bit-fields as @code{int}-sized.
26750 @opindex m4byte-functions
26751 @opindex mno-4byte-functions
26752 @item -m4byte-functions
26753 @itemx -mno-4byte-functions
26754 Force all functions to be aligned to a 4-byte boundary.
26756 @opindex mcallgraph-data
26757 @opindex mno-callgraph-data
26758 @item -mcallgraph-data
26759 @itemx -mno-callgraph-data
26760 Emit callgraph information.
26762 @opindex mslow-bytes
26763 @opindex mno-slow-bytes
26764 @item -mslow-bytes
26765 @itemx -mno-slow-bytes
26766 Prefer word access when reading byte quantities.
26768 @opindex mlittle-endian
26769 @opindex mbig-endian
26770 @item -mlittle-endian
26771 @itemx -mbig-endian
26772 Generate code for a little-endian target.
26774 @opindex m210
26775 @opindex m340
26776 @item -m210
26777 @itemx -m340
26778 Generate code for the 210 processor.
26780 @opindex mno-lsim
26781 @item -mno-lsim
26782 Assume that runtime support has been provided and so omit the
26783 simulator library (@file{libsim.a)} from the linker command line.
26785 @opindex mstack-increment
26786 @item -mstack-increment=@var{size}
26787 Set the maximum amount for a single stack increment operation.  Large
26788 values can increase the speed of programs that contain functions
26789 that need a large amount of stack space, but they can also trigger a
26790 segmentation fault if the stack is extended too much.  The default
26791 value is 0x1000.
26793 @end table
26795 @node MicroBlaze Options
26796 @subsection MicroBlaze Options
26797 @cindex MicroBlaze Options
26799 @table @gcctabopt
26801 @opindex msoft-float
26802 @item -msoft-float
26803 Use software emulation for floating point (default).
26805 @opindex mhard-float
26806 @item -mhard-float
26807 Use hardware floating-point instructions.
26809 @opindex mmemcpy
26810 @item -mmemcpy
26811 Do not optimize block moves, use @code{memcpy}.
26813 @opindex mno-clearbss
26814 @item -mno-clearbss
26815 This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
26817 @opindex mcpu=
26818 @item -mcpu=@var{cpu-type}
26819 Use features of, and schedule code for, the given CPU.
26820 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
26821 where @var{X} is a major version, @var{YY} is the minor version, and
26822 @var{Z} is compatibility code.  Example values are @samp{v3.00.a},
26823 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
26825 @opindex mxl-soft-mul
26826 @item -mxl-soft-mul
26827 Use software multiply emulation (default).
26829 @opindex mxl-soft-div
26830 @item -mxl-soft-div
26831 Use software emulation for divides (default).
26833 @opindex mxl-barrel-shift
26834 @item -mxl-barrel-shift
26835 Use the hardware barrel shifter.
26837 @opindex mxl-pattern-compare
26838 @item -mxl-pattern-compare
26839 Use pattern compare instructions.
26841 @opindex msmall-divides
26842 @item -msmall-divides
26843 Use table lookup optimization for small signed integer divisions.
26845 @opindex mxl-stack-check
26846 @item -mxl-stack-check
26847 This option is deprecated.  Use @option{-fstack-check} instead.
26849 @opindex mxl-gp-opt
26850 @item -mxl-gp-opt
26851 Use GP-relative @code{.sdata}/@code{.sbss} sections.
26853 @opindex mxl-multiply-high
26854 @item -mxl-multiply-high
26855 Use multiply high instructions for high part of 32x32 multiply.
26857 @opindex mxl-float-convert
26858 @item -mxl-float-convert
26859 Use hardware floating-point conversion instructions.
26861 @opindex mxl-float-sqrt
26862 @item -mxl-float-sqrt
26863 Use hardware floating-point square root instruction.
26865 @opindex mbig-endian
26866 @item -mbig-endian
26867 Generate code for a big-endian target.
26869 @opindex mlittle-endian
26870 @item -mlittle-endian
26871 Generate code for a little-endian target.
26873 @opindex mxl-reorder
26874 @item -mxl-reorder
26875 Use reorder instructions (swap and byte reversed load/store).
26877 @item -mxl-mode-@var{app-model}
26878 Select application model @var{app-model}.  Valid models are
26879 @table @samp
26880 @item executable
26881 normal executable (default), uses startup code @file{crt0.o}.
26883 @item xmdstub
26884 for use with Xilinx Microprocessor Debugger (XMD) based
26885 software intrusive debug agent called xmdstub. This uses startup file
26886 @file{crt1.o} and sets the start address of the program to 0x800.
26888 @item bootstrap
26889 for applications that are loaded using a bootloader.
26890 This model uses startup file @file{crt2.o} which does not contain a processor
26891 reset vector handler. This is suitable for transferring control on a
26892 processor reset to the bootloader rather than the application.
26894 @item novectors
26895 for applications that do not require any of the
26896 MicroBlaze vectors. This option may be useful for applications running
26897 within a monitoring application. This model uses @file{crt3.o} as a startup file.
26898 @end table
26900 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
26901 @option{-mxl-mode-@var{app-model}}.
26903 @opindex mpic-data-is-text-relative
26904 @item -mpic-data-is-text-relative
26905 Assume that the displacement between the text and data segments is fixed
26906 at static link time.  This allows data to be referenced by offset from start of
26907 text address instead of GOT since PC-relative addressing is not supported.
26909 @end table
26911 @node MIPS Options
26912 @subsection MIPS Options
26913 @cindex MIPS options
26915 @table @gcctabopt
26917 @opindex EB
26918 @item -EB
26919 Generate big-endian code.
26921 @opindex EL
26922 @item -EL
26923 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
26924 configurations.
26926 @opindex march
26927 @item -march=@var{arch}
26928 Generate code that runs on @var{arch}, which can be the name of a
26929 generic MIPS ISA, or the name of a particular processor.
26930 The ISA names are:
26931 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
26932 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
26933 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
26934 @samp{mips64r5} and @samp{mips64r6}.
26935 The processor names are:
26936 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
26937 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
26938 @samp{5kc}, @samp{5kf},
26939 @samp{20kc},
26940 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
26941 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
26942 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
26943 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
26944 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
26945 @samp{i6400}, @samp{i6500},
26946 @samp{interaptiv},
26947 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
26948 @samp{gs464e}, @samp{gs264e},
26949 @samp{m4k},
26950 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
26951 @samp{m5100}, @samp{m5101},
26952 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
26953 @samp{orion},
26954 @samp{p5600}, @samp{p6600},
26955 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
26956 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
26957 @samp{r6000}, @samp{r8000},
26958 @samp{rm7000}, @samp{rm9000},
26959 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
26960 @samp{sb1},
26961 @samp{sr71000},
26962 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
26963 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
26964 @samp{xlr} and @samp{xlp}.
26965 The special value @samp{from-abi} selects the
26966 most compatible architecture for the selected ABI (that is,
26967 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
26969 The native Linux/GNU toolchain also supports the value @samp{native},
26970 which selects the best architecture option for the host processor.
26971 @option{-march=native} has no effect if GCC does not recognize
26972 the processor.
26974 In processor names, a final @samp{000} can be abbreviated as @samp{k}
26975 (for example, @option{-march=r2k}).  Prefixes are optional, and
26976 @samp{vr} may be written @samp{r}.
26978 Names of the form @samp{@var{n}f2_1} refer to processors with
26979 FPUs clocked at half the rate of the core, names of the form
26980 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
26981 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
26982 processors with FPUs clocked a ratio of 3:2 with respect to the core.
26983 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
26984 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
26985 accepted as synonyms for @samp{@var{n}f1_1}.
26987 GCC defines two macros based on the value of this option.  The first
26988 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
26989 a string.  The second has the form @code{_MIPS_ARCH_@var{foo}},
26990 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
26991 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
26992 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
26994 Note that the @code{_MIPS_ARCH} macro uses the processor names given
26995 above.  In other words, it has the full prefix and does not
26996 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
26997 the macro names the resolved architecture (either @code{"mips1"} or
26998 @code{"mips3"}).  It names the default architecture when no
26999 @option{-march} option is given.
27001 @opindex mtune
27002 @item -mtune=@var{arch}
27003 Optimize for @var{arch}.  Among other things, this option controls
27004 the way instructions are scheduled, and the perceived cost of arithmetic
27005 operations.  The list of @var{arch} values is the same as for
27006 @option{-march}.
27008 When this option is not used, GCC optimizes for the processor
27009 specified by @option{-march}.  By using @option{-march} and
27010 @option{-mtune} together, it is possible to generate code that
27011 runs on a family of processors, but optimize the code for one
27012 particular member of that family.
27014 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
27015 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
27016 @option{-march} ones described above.
27018 @opindex mips1
27019 @item -mips1
27020 Equivalent to @option{-march=mips1}.
27022 @opindex mips2
27023 @item -mips2
27024 Equivalent to @option{-march=mips2}.
27026 @opindex mips3
27027 @item -mips3
27028 Equivalent to @option{-march=mips3}.
27030 @opindex mips4
27031 @item -mips4
27032 Equivalent to @option{-march=mips4}.
27034 @opindex mips32
27035 @item -mips32
27036 Equivalent to @option{-march=mips32}.
27038 @opindex mips32r3
27039 @item -mips32r3
27040 Equivalent to @option{-march=mips32r3}.
27042 @opindex mips32r5
27043 @item -mips32r5
27044 Equivalent to @option{-march=mips32r5}.
27046 @opindex mips32r6
27047 @item -mips32r6
27048 Equivalent to @option{-march=mips32r6}.
27050 @opindex mips64
27051 @item -mips64
27052 Equivalent to @option{-march=mips64}.
27054 @opindex mips64r2
27055 @item -mips64r2
27056 Equivalent to @option{-march=mips64r2}.
27058 @opindex mips64r3
27059 @item -mips64r3
27060 Equivalent to @option{-march=mips64r3}.
27062 @opindex mips64r5
27063 @item -mips64r5
27064 Equivalent to @option{-march=mips64r5}.
27066 @opindex mips64r6
27067 @item -mips64r6
27068 Equivalent to @option{-march=mips64r6}.
27070 @opindex mips16
27071 @opindex mno-mips16
27072 @item -mips16
27073 @itemx -mno-mips16
27074 Generate (do not generate) MIPS16 code.  If GCC is targeting a
27075 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
27077 MIPS16 code generation can also be controlled on a per-function basis
27078 by means of @code{mips16} and @code{nomips16} attributes.
27079 @xref{Function Attributes}, for more information.
27081 @opindex mmips16e2
27082 @opindex mno-mips16e2
27083 @item -mmips16e2
27084 @itemx -mno-mips16e2
27085 Use (do not use) the MIPS16e2 ASE.  This option modifies the behavior
27086 of the @option{-mips16} option such that it targets the MIPS16e2 ASE@.
27088 @opindex mflip-mips16
27089 @item -mflip-mips16
27090 Generate MIPS16 code on alternating functions.  This option is provided
27091 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
27092 not intended for ordinary use in compiling user code.
27094 @opindex minterlink-compressed
27095 @opindex mno-interlink-compressed
27096 @item -minterlink-compressed
27097 @itemx -mno-interlink-compressed
27098 Require (do not require) that code using the standard (uncompressed) MIPS ISA
27099 be link-compatible with MIPS16 and microMIPS code, and vice versa.
27101 For example, code using the standard ISA encoding cannot jump directly
27102 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
27103 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
27104 knows that the target of the jump is not compressed.
27106 @opindex minterlink-mips16
27107 @opindex mno-interlink-mips16
27108 @item -minterlink-mips16
27109 @itemx -mno-interlink-mips16
27110 Aliases of @option{-minterlink-compressed} and
27111 @option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
27112 and are retained for backwards compatibility.
27114 @opindex mabi=32
27115 @opindex mabi=o64
27116 @opindex mabi=n32
27117 @opindex mabi=64
27118 @opindex mabi=eabi
27119 @item -mabi=32
27120 @itemx -mabi=o64
27121 @itemx -mabi=n32
27122 @itemx -mabi=64
27123 @itemx -mabi=eabi
27124 Generate code for the given ABI@.
27126 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
27127 generates 64-bit code when you select a 64-bit architecture, but you
27128 can use @option{-mgp32} to get 32-bit code instead.
27130 For information about the O64 ABI, see
27131 @uref{https://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
27133 GCC supports a variant of the o32 ABI in which floating-point registers
27134 are 64 rather than 32 bits wide.  You can select this combination with
27135 @option{-mabi=32} @option{-mfp64}.  This ABI relies on the @code{mthc1}
27136 and @code{mfhc1} instructions and is therefore only supported for
27137 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
27139 The register assignments for arguments and return values remain the
27140 same, but each scalar value is passed in a single 64-bit register
27141 rather than a pair of 32-bit registers.  For example, scalar
27142 floating-point values are returned in @samp{$f0} only, not a
27143 @samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
27144 remains the same in that the even-numbered double-precision registers
27145 are saved.
27147 Two additional variants of the o32 ABI are supported to enable
27148 a transition from 32-bit to 64-bit registers.  These are FPXX
27149 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
27150 The FPXX extension mandates that all code must execute correctly
27151 when run using 32-bit or 64-bit registers.  The code can be interlinked
27152 with either FP32 or FP64, but not both.
27153 The FP64A extension is similar to the FP64 extension but forbids the
27154 use of odd-numbered single-precision registers.  This can be used
27155 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
27156 processors and allows both FP32 and FP64A code to interlink and
27157 run in the same process without changing FPU modes.
27159 @opindex mabicalls
27160 @opindex mno-abicalls
27161 @item -mabicalls
27162 @itemx -mno-abicalls
27163 Generate (do not generate) code that is suitable for SVR4-style
27164 dynamic objects.  @option{-mabicalls} is the default for SVR4-based
27165 systems.
27167 @item -mshared
27168 @itemx -mno-shared
27169 Generate (do not generate) code that is fully position-independent,
27170 and that can therefore be linked into shared libraries.  This option
27171 only affects @option{-mabicalls}.
27173 All @option{-mabicalls} code has traditionally been position-independent,
27174 regardless of options like @option{-fPIC} and @option{-fpic}.  However,
27175 as an extension, the GNU toolchain allows executables to use absolute
27176 accesses for locally-binding symbols.  It can also use shorter GP
27177 initialization sequences and generate direct calls to locally-defined
27178 functions.  This mode is selected by @option{-mno-shared}.
27180 @option{-mno-shared} depends on binutils 2.16 or higher and generates
27181 objects that can only be linked by the GNU linker.  However, the option
27182 does not affect the ABI of the final executable; it only affects the ABI
27183 of relocatable objects.  Using @option{-mno-shared} generally makes
27184 executables both smaller and quicker.
27186 @option{-mshared} is the default.
27188 @opindex mplt
27189 @opindex mno-plt
27190 @item -mplt
27191 @itemx -mno-plt
27192 Assume (do not assume) that the static and dynamic linkers
27193 support PLTs and copy relocations.  This option only affects
27194 @option{-mno-shared -mabicalls}.  For the n64 ABI, this option
27195 has no effect without @option{-msym32}.
27197 You can make @option{-mplt} the default by configuring
27198 GCC with @option{--with-mips-plt}.  The default is
27199 @option{-mno-plt} otherwise.
27201 @opindex mxgot
27202 @opindex mno-xgot
27203 @item -mxgot
27204 @itemx -mno-xgot
27205 Lift (do not lift) the usual restrictions on the size of the global
27206 offset table.
27208 GCC normally uses a single instruction to load values from the GOT@.
27209 While this is relatively efficient, it only works if the GOT
27210 is smaller than about 64k.  Anything larger causes the linker
27211 to report an error such as:
27213 @cindex relocation truncated to fit (MIPS)
27214 @smallexample
27215 relocation truncated to fit: R_MIPS_GOT16 foobar
27216 @end smallexample
27218 If this happens, you should recompile your code with @option{-mxgot}.
27219 This works with very large GOTs, although the code is also
27220 less efficient, since it takes three instructions to fetch the
27221 value of a global symbol.
27223 Note that some linkers can create multiple GOTs.  If you have such a
27224 linker, you should only need to use @option{-mxgot} when a single object
27225 file accesses more than 64k's worth of GOT entries.  Very few do.
27227 These options have no effect unless GCC is generating position
27228 independent code.
27230 @opindex mgp32
27231 @item -mgp32
27232 Assume that general-purpose registers are 32 bits wide.
27234 @opindex mgp64
27235 @item -mgp64
27236 Assume that general-purpose registers are 64 bits wide.
27238 @opindex mfp32
27239 @item -mfp32
27240 Assume that floating-point registers are 32 bits wide.
27242 @opindex mfp64
27243 @item -mfp64
27244 Assume that floating-point registers are 64 bits wide.
27246 @opindex mfpxx
27247 @item -mfpxx
27248 Do not assume the width of floating-point registers.
27250 @opindex mhard-float
27251 @item -mhard-float
27252 Use floating-point coprocessor instructions.
27254 @opindex msoft-float
27255 @item -msoft-float
27256 Do not use floating-point coprocessor instructions.  Implement
27257 floating-point calculations using library calls instead.
27259 @opindex mno-float
27260 @item -mno-float
27261 Equivalent to @option{-msoft-float}, but additionally asserts that the
27262 program being compiled does not perform any floating-point operations.
27263 This option is presently supported only by some bare-metal MIPS
27264 configurations, where it may select a special set of libraries
27265 that lack all floating-point support (including, for example, the
27266 floating-point @code{printf} formats).  
27267 If code compiled with @option{-mno-float} accidentally contains
27268 floating-point operations, it is likely to suffer a link-time
27269 or run-time failure.
27271 @opindex msingle-float
27272 @item -msingle-float
27273 Assume that the floating-point coprocessor only supports single-precision
27274 operations.
27276 @opindex mdouble-float
27277 @item -mdouble-float
27278 Assume that the floating-point coprocessor supports double-precision
27279 operations.  This is the default.
27281 @opindex modd-spreg
27282 @opindex mno-odd-spreg
27283 @item -modd-spreg
27284 @itemx -mno-odd-spreg
27285 Enable the use of odd-numbered single-precision floating-point registers
27286 for the o32 ABI.  This is the default for processors that are known to
27287 support these registers.  When using the o32 FPXX ABI, @option{-mno-odd-spreg}
27288 is set by default.
27290 @opindex mabs=2008
27291 @opindex mabs=legacy
27292 @item -mabs=2008
27293 @itemx -mabs=legacy
27294 These options control the treatment of the special not-a-number (NaN)
27295 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
27296 @code{neg.@i{fmt}} machine instructions.
27298 By default or when @option{-mabs=legacy} is used the legacy
27299 treatment is selected.  In this case these instructions are considered
27300 arithmetic and avoided where correct operation is required and the
27301 input operand might be a NaN.  A longer sequence of instructions that
27302 manipulate the sign bit of floating-point datum manually is used
27303 instead unless the @option{-ffinite-math-only} option has also been
27304 specified.
27306 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment.  In
27307 this case these instructions are considered non-arithmetic and therefore
27308 operating correctly in all cases, including in particular where the
27309 input operand is a NaN.  These instructions are therefore always used
27310 for the respective operations.
27312 @opindex mnan=2008
27313 @opindex mnan=legacy
27314 @item -mnan=2008
27315 @itemx -mnan=legacy
27316 These options control the encoding of the special not-a-number (NaN)
27317 IEEE 754 floating-point data.
27319 The @option{-mnan=legacy} option selects the legacy encoding.  In this
27320 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
27321 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
27322 by the first bit of their trailing significand field being 1.
27324 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding.  In
27325 this case qNaNs are denoted by the first bit of their trailing
27326 significand field being 1, whereas sNaNs are denoted by the first bit of
27327 their trailing significand field being 0.
27329 The default is @option{-mnan=legacy} unless GCC has been configured with
27330 @option{--with-nan=2008}.
27332 @opindex mllsc
27333 @opindex mno-llsc
27334 @item -mllsc
27335 @itemx -mno-llsc
27336 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
27337 implement atomic memory built-in functions.  When neither option is
27338 specified, GCC uses the instructions if the target architecture
27339 supports them.
27341 @option{-mllsc} is useful if the runtime environment can emulate the
27342 instructions and @option{-mno-llsc} can be useful when compiling for
27343 nonstandard ISAs.  You can make either option the default by
27344 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
27345 respectively.  @option{--with-llsc} is the default for some
27346 configurations; see the installation documentation for details.
27348 @opindex mdsp
27349 @opindex mno-dsp
27350 @item -mdsp
27351 @itemx -mno-dsp
27352 Use (do not use) revision 1 of the MIPS DSP ASE@.
27353 @xref{MIPS DSP Built-in Functions}.  This option defines the
27354 preprocessor macro @code{__mips_dsp}.  It also defines
27355 @code{__mips_dsp_rev} to 1.
27357 @opindex mdspr2
27358 @opindex mno-dspr2
27359 @item -mdspr2
27360 @itemx -mno-dspr2
27361 Use (do not use) revision 2 of the MIPS DSP ASE@.
27362 @xref{MIPS DSP Built-in Functions}.  This option defines the
27363 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
27364 It also defines @code{__mips_dsp_rev} to 2.
27366 @opindex msmartmips
27367 @opindex mno-smartmips
27368 @item -msmartmips
27369 @itemx -mno-smartmips
27370 Use (do not use) the MIPS SmartMIPS ASE.
27372 @opindex mpaired-single
27373 @opindex mno-paired-single
27374 @item -mpaired-single
27375 @itemx -mno-paired-single
27376 Use (do not use) paired-single floating-point instructions.
27377 @xref{MIPS Paired-Single Support}.  This option requires
27378 hardware floating-point support to be enabled.
27380 @opindex mdmx
27381 @opindex mno-mdmx
27382 @item -mdmx
27383 @itemx -mno-mdmx
27384 Use (do not use) MIPS Digital Media Extension instructions.
27385 This option can only be used when generating 64-bit code and requires
27386 hardware floating-point support to be enabled.
27388 @opindex mips3d
27389 @opindex mno-mips3d
27390 @item -mips3d
27391 @itemx -mno-mips3d
27392 Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
27393 The option @option{-mips3d} implies @option{-mpaired-single}.
27395 @opindex mmicromips
27396 @opindex mno-mmicromips
27397 @item -mmicromips
27398 @itemx -mno-micromips
27399 Generate (do not generate) microMIPS code.
27401 MicroMIPS code generation can also be controlled on a per-function basis
27402 by means of @code{micromips} and @code{nomicromips} attributes.
27403 @xref{Function Attributes}, for more information.
27405 @opindex mmt
27406 @opindex mno-mt
27407 @item -mmt
27408 @itemx -mno-mt
27409 Use (do not use) MT Multithreading instructions.
27411 @opindex mmcu
27412 @opindex mno-mcu
27413 @item -mmcu
27414 @itemx -mno-mcu
27415 Use (do not use) the MIPS MCU ASE instructions.
27417 @opindex meva
27418 @opindex mno-eva
27419 @item -meva
27420 @itemx -mno-eva
27421 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
27423 @opindex mvirt
27424 @opindex mno-virt
27425 @item -mvirt
27426 @itemx -mno-virt
27427 Use (do not use) the MIPS Virtualization (VZ) instructions.
27429 @opindex mxpa
27430 @opindex mno-xpa
27431 @item -mxpa
27432 @itemx -mno-xpa
27433 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
27435 @opindex mcrc
27436 @opindex mno-crc
27437 @item -mcrc
27438 @itemx -mno-crc
27439 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
27441 @opindex mginv
27442 @opindex mno-ginv
27443 @item -mginv
27444 @itemx -mno-ginv
27445 Use (do not use) the MIPS Global INValidate (GINV) instructions.
27447 @opindex mloongson-mmi
27448 @opindex mno-loongson-mmi
27449 @item -mloongson-mmi
27450 @itemx -mno-loongson-mmi
27451 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
27453 @opindex mloongson-ext
27454 @opindex mno-loongson-ext
27455 @item -mloongson-ext
27456 @itemx -mno-loongson-ext
27457 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
27459 @opindex mloongson-ext2
27460 @opindex mno-loongson-ext2
27461 @item -mloongson-ext2
27462 @itemx -mno-loongson-ext2
27463 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
27465 @opindex mlong64
27466 @item -mlong64
27467 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
27468 an explanation of the default and the way that the pointer size is
27469 determined.
27471 @opindex mlong32
27472 @item -mlong32
27473 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
27475 The default size of @code{int}s, @code{long}s and pointers depends on
27476 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
27477 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
27478 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
27479 or the same size as integer registers, whichever is smaller.
27481 @opindex msym32
27482 @opindex mno-sym32
27483 @item -msym32
27484 @itemx -mno-sym32
27485 Assume (do not assume) that all symbols have 32-bit values, regardless
27486 of the selected ABI@.  This option is useful in combination with
27487 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
27488 to generate shorter and faster references to symbolic addresses.
27490 @opindex G
27491 @item -G @var{num}
27492 Put definitions of externally-visible data in a small data section
27493 if that data is no bigger than @var{num} bytes.  GCC can then generate
27494 more efficient accesses to the data; see @option{-mgpopt} for details.
27496 The default @option{-G} option depends on the configuration.
27498 @opindex mlocal-sdata
27499 @opindex mno-local-sdata
27500 @item -mlocal-sdata
27501 @itemx -mno-local-sdata
27502 Extend (do not extend) the @option{-G} behavior to local data too,
27503 such as to static variables in C@.  @option{-mlocal-sdata} is the
27504 default for all configurations.
27506 If the linker complains that an application is using too much small data,
27507 you might want to try rebuilding the less performance-critical parts with
27508 @option{-mno-local-sdata}.  You might also want to build large
27509 libraries with @option{-mno-local-sdata}, so that the libraries leave
27510 more room for the main program.
27512 @opindex mextern-sdata
27513 @opindex mno-extern-sdata
27514 @item -mextern-sdata
27515 @itemx -mno-extern-sdata
27516 Assume (do not assume) that externally-defined data is in
27517 a small data section if the size of that data is within the @option{-G} limit.
27518 @option{-mextern-sdata} is the default for all configurations.
27520 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
27521 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
27522 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
27523 is placed in a small data section.  If @var{Var} is defined by another
27524 module, you must either compile that module with a high-enough
27525 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
27526 definition.  If @var{Var} is common, you must link the application
27527 with a high-enough @option{-G} setting.
27529 The easiest way of satisfying these restrictions is to compile
27530 and link every module with the same @option{-G} option.  However,
27531 you may wish to build a library that supports several different
27532 small data limits.  You can do this by compiling the library with
27533 the highest supported @option{-G} setting and additionally using
27534 @option{-mno-extern-sdata} to stop the library from making assumptions
27535 about externally-defined data.
27537 @opindex mgpopt
27538 @opindex mno-gpopt
27539 @item -mgpopt
27540 @itemx -mno-gpopt
27541 Use (do not use) GP-relative accesses for symbols that are known to be
27542 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
27543 @option{-mextern-sdata}.  @option{-mgpopt} is the default for all
27544 configurations.
27546 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
27547 might not hold the value of @code{_gp}.  For example, if the code is
27548 part of a library that might be used in a boot monitor, programs that
27549 call boot monitor routines pass an unknown value in @code{$gp}.
27550 (In such situations, the boot monitor itself is usually compiled
27551 with @option{-G0}.)
27553 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
27554 @option{-mno-extern-sdata}.
27556 @opindex membedded-data
27557 @opindex mno-embedded-data
27558 @item -membedded-data
27559 @itemx -mno-embedded-data
27560 Allocate variables to the read-only data section first if possible, then
27561 next in the small data section if possible, otherwise in data.  This gives
27562 slightly slower code than the default, but reduces the amount of RAM required
27563 when executing, and thus may be preferred for some embedded systems.
27565 @opindex muninit-const-in-rodata
27566 @opindex mno-uninit-const-in-rodata
27567 @item -muninit-const-in-rodata
27568 @itemx -mno-uninit-const-in-rodata
27569 Put uninitialized @code{const} variables in the read-only data section.
27570 This option is only meaningful in conjunction with @option{-membedded-data}.
27572 @opindex mcode-readable
27573 @item -mcode-readable=@var{setting}
27574 Specify whether GCC may generate code that reads from executable sections.
27575 There are three possible settings:
27577 @table @gcctabopt
27578 @item -mcode-readable=yes
27579 Instructions may freely access executable sections.  This is the
27580 default setting.
27582 @item -mcode-readable=pcrel
27583 MIPS16 PC-relative load instructions can access executable sections,
27584 but other instructions must not do so.  This option is useful on 4KSc
27585 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
27586 It is also useful on processors that can be configured to have a dual
27587 instruction/data SRAM interface and that, like the M4K, automatically
27588 redirect PC-relative loads to the instruction RAM.
27590 @item -mcode-readable=no
27591 Instructions must not access executable sections.  This option can be
27592 useful on targets that are configured to have a dual instruction/data
27593 SRAM interface but that (unlike the M4K) do not automatically redirect
27594 PC-relative loads to the instruction RAM.
27595 @end table
27597 @opindex msplit-addresses
27598 @opindex mno-split-addresses
27599 @item -msplit-addresses
27600 @itemx -mno-split-addresses
27601 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
27602 relocation operators.  This option has been superseded by
27603 @option{-mexplicit-relocs} but is retained for backwards compatibility.
27605 @opindex mexplicit-relocs
27606 @opindex mno-explicit-relocs
27607 @item -mexplicit-relocs
27608 @itemx -mno-explicit-relocs
27609 Use (do not use) assembler relocation operators when dealing with symbolic
27610 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
27611 is to use assembler macros instead.
27613 @option{-mexplicit-relocs} is the default if GCC was configured
27614 to use an assembler that supports relocation operators.
27616 @opindex mcheck-zero-division
27617 @opindex mno-check-zero-division
27618 @item -mcheck-zero-division
27619 @itemx -mno-check-zero-division
27620 Trap (do not trap) on integer division by zero.
27622 The default is @option{-mcheck-zero-division}.
27624 @opindex mdivide-traps
27625 @opindex mdivide-breaks
27626 @item -mdivide-traps
27627 @itemx -mdivide-breaks
27628 MIPS systems check for division by zero by generating either a
27629 conditional trap or a break instruction.  Using traps results in
27630 smaller code, but is only supported on MIPS II and later.  Also, some
27631 versions of the Linux kernel have a bug that prevents trap from
27632 generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
27633 allow conditional traps on architectures that support them and
27634 @option{-mdivide-breaks} to force the use of breaks.
27636 The default is usually @option{-mdivide-traps}, but this can be
27637 overridden at configure time using @option{--with-divide=breaks}.
27638 Divide-by-zero checks can be completely disabled using
27639 @option{-mno-check-zero-division}.
27641 @opindex mload-store-pairs
27642 @opindex mno-load-store-pairs
27643 @item -mload-store-pairs
27644 @itemx -mno-load-store-pairs
27645 Enable (disable) an optimization that pairs consecutive load or store
27646 instructions to enable load/store bonding.  This option is enabled by
27647 default but only takes effect when the selected architecture is known
27648 to support bonding.
27650 @opindex munaligned-access
27651 @opindex mno-unaligned-access
27652 @item -munaligned-access
27653 @itemx -mno-unaligned-access
27654 Enable (disable) direct unaligned access for MIPS Release 6.
27655 MIPSr6 requires load/store unaligned-access support,
27656 by hardware or trap&emulate.
27657 So @option{-mno-unaligned-access} may be needed by kernel.
27659 @opindex mmemcpy
27660 @opindex mno-memcpy
27661 @item -mmemcpy
27662 @itemx -mno-memcpy
27663 Force (do not force) the use of @code{memcpy} for non-trivial block
27664 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
27665 most constant-sized copies.
27667 @opindex mlong-calls
27668 @opindex mno-long-calls
27669 @item -mlong-calls
27670 @itemx -mno-long-calls
27671 Disable (do not disable) use of the @code{jal} instruction.  Calling
27672 functions using @code{jal} is more efficient but requires the caller
27673 and callee to be in the same 256 megabyte segment.
27675 This option has no effect on abicalls code.  The default is
27676 @option{-mno-long-calls}.
27678 @opindex mmad
27679 @opindex mno-mad
27680 @item -mmad
27681 @itemx -mno-mad
27682 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
27683 instructions, as provided by the R4650 ISA@.
27685 @opindex mimadd
27686 @opindex mno-imadd
27687 @item -mimadd
27688 @itemx -mno-imadd
27689 Enable (disable) use of the @code{madd} and @code{msub} integer
27690 instructions.  The default is @option{-mimadd} on architectures
27691 that support @code{madd} and @code{msub} except for the 74k 
27692 architecture where it was found to generate slower code.
27694 @opindex mfused-madd
27695 @opindex mno-fused-madd
27696 @item -mfused-madd
27697 @itemx -mno-fused-madd
27698 Enable (disable) use of the floating-point multiply-accumulate
27699 instructions, when they are available.  The default is
27700 @option{-mfused-madd}.
27702 On the R8000 CPU when multiply-accumulate instructions are used,
27703 the intermediate product is calculated to infinite precision
27704 and is not subject to the FCSR Flush to Zero bit.  This may be
27705 undesirable in some circumstances.  On other processors the result
27706 is numerically identical to the equivalent computation using
27707 separate multiply, add, subtract and negate instructions.
27709 @opindex nocpp
27710 @item -nocpp
27711 Tell the MIPS assembler to not run its preprocessor over user
27712 assembler files (with a @samp{.s} suffix) when assembling them.
27714 @opindex mfix-24k
27715 @opindex mno-fix-24k
27716 @item -mfix-24k
27717 @itemx -mno-fix-24k
27718 Work around the 24K E48 (lost data on stores during refill) errata.
27719 The workarounds are implemented by the assembler rather than by GCC@.
27721 @opindex mfix-r4000
27722 @opindex mno-fix-r4000
27723 @item -mfix-r4000
27724 @itemx -mno-fix-r4000
27725 Work around certain R4000 CPU errata:
27726 @itemize @minus
27727 @item
27728 A double-word or a variable shift may give an incorrect result if executed
27729 immediately after starting an integer division.
27730 @item
27731 A double-word or a variable shift may give an incorrect result if executed
27732 while an integer multiplication is in progress.
27733 @item
27734 An integer division may give an incorrect result if started in a delay slot
27735 of a taken branch or a jump.
27736 @end itemize
27738 @opindex mfix-r4400
27739 @opindex mno-fix-r4400
27740 @item -mfix-r4400
27741 @itemx -mno-fix-r4400
27742 Work around certain R4400 CPU errata:
27743 @itemize @minus
27744 @item
27745 A double-word or a variable shift may give an incorrect result if executed
27746 immediately after starting an integer division.
27747 @end itemize
27749 @opindex mfix-r10000
27750 @opindex mno-fix-r10000
27751 @item -mfix-r10000
27752 @itemx -mno-fix-r10000
27753 Work around certain R10000 errata:
27754 @itemize @minus
27755 @item
27756 @code{ll}/@code{sc} sequences may not behave atomically on revisions
27757 prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
27758 @end itemize
27760 This option can only be used if the target architecture supports
27761 branch-likely instructions.  @option{-mfix-r10000} is the default when
27762 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
27763 otherwise.
27765 @opindex mfix-r5900
27766 @item -mfix-r5900
27767 @itemx -mno-fix-r5900
27768 Do not attempt to schedule the preceding instruction into the delay slot
27769 of a branch instruction placed at the end of a short loop of six
27770 instructions or fewer and always schedule a @code{nop} instruction there
27771 instead.  The short loop bug under certain conditions causes loops to
27772 execute only once or twice, due to a hardware bug in the R5900 chip.  The
27773 workaround is implemented by the assembler rather than by GCC@.
27775 @opindex mfix-rm7000
27776 @item -mfix-rm7000
27777 @itemx -mno-fix-rm7000
27778 Work around the RM7000 @code{dmult}/@code{dmultu} errata.  The
27779 workarounds are implemented by the assembler rather than by GCC@.
27781 @opindex mfix-vr4120
27782 @item -mfix-vr4120
27783 @itemx -mno-fix-vr4120
27784 Work around certain VR4120 errata:
27785 @itemize @minus
27786 @item
27787 @code{dmultu} does not always produce the correct result.
27788 @item
27789 @code{div} and @code{ddiv} do not always produce the correct result if one
27790 of the operands is negative.
27791 @end itemize
27792 The workarounds for the division errata rely on special functions in
27793 @file{libgcc.a}.  At present, these functions are only provided by
27794 the @code{mips64vr*-elf} configurations.
27796 Other VR4120 errata require a NOP to be inserted between certain pairs of
27797 instructions.  These errata are handled by the assembler, not by GCC itself.
27799 @opindex mfix-vr4130
27800 @item -mfix-vr4130
27801 Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
27802 workarounds are implemented by the assembler rather than by GCC,
27803 although GCC avoids using @code{mflo} and @code{mfhi} if the
27804 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
27805 instructions are available instead.
27807 @opindex mfix-sb1
27808 @item -mfix-sb1
27809 @itemx -mno-fix-sb1
27810 Work around certain SB-1 CPU core errata.
27811 (This flag currently works around the SB-1 revision 2
27812 ``F1'' and ``F2'' floating-point errata.)
27814 @opindex mr10k-cache-barrier
27815 @item -mr10k-cache-barrier=@var{setting}
27816 Specify whether GCC should insert cache barriers to avoid the
27817 side effects of speculation on R10K processors.
27819 In common with many processors, the R10K tries to predict the outcome
27820 of a conditional branch and speculatively executes instructions from
27821 the ``taken'' branch.  It later aborts these instructions if the
27822 predicted outcome is wrong.  However, on the R10K, even aborted
27823 instructions can have side effects.
27825 This problem only affects kernel stores and, depending on the system,
27826 kernel loads.  As an example, a speculatively-executed store may load
27827 the target memory into cache and mark the cache line as dirty, even if
27828 the store itself is later aborted.  If a DMA operation writes to the
27829 same area of memory before the ``dirty'' line is flushed, the cached
27830 data overwrites the DMA-ed data.  See the R10K processor manual
27831 for a full description, including other potential problems.
27833 One workaround is to insert cache barrier instructions before every memory
27834 access that might be speculatively executed and that might have side
27835 effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
27836 controls GCC's implementation of this workaround.  It assumes that
27837 aborted accesses to any byte in the following regions does not have
27838 side effects:
27840 @enumerate
27841 @item
27842 the memory occupied by the current function's stack frame;
27844 @item
27845 the memory occupied by an incoming stack argument;
27847 @item
27848 the memory occupied by an object with a link-time-constant address.
27849 @end enumerate
27851 It is the kernel's responsibility to ensure that speculative
27852 accesses to these regions are indeed safe.
27854 If the input program contains a function declaration such as:
27856 @smallexample
27857 void foo (void);
27858 @end smallexample
27860 then the implementation of @code{foo} must allow @code{j foo} and
27861 @code{jal foo} to be executed speculatively.  GCC honors this
27862 restriction for functions it compiles itself.  It expects non-GCC
27863 functions (such as hand-written assembly code) to do the same.
27865 The option has three forms:
27867 @table @gcctabopt
27868 @item -mr10k-cache-barrier=load-store
27869 Insert a cache barrier before a load or store that might be
27870 speculatively executed and that might have side effects even
27871 if aborted.
27873 @item -mr10k-cache-barrier=store
27874 Insert a cache barrier before a store that might be speculatively
27875 executed and that might have side effects even if aborted.
27877 @item -mr10k-cache-barrier=none
27878 Disable the insertion of cache barriers.  This is the default setting.
27879 @end table
27881 @opindex mflush-func
27882 @item -mflush-func=@var{func}
27883 @itemx -mno-flush-func
27884 Specifies the function to call to flush the I and D caches, or to not
27885 call any such function.  If called, the function must take the same
27886 arguments as the common @code{_flush_func}, that is, the address of the
27887 memory range for which the cache is being flushed, the size of the
27888 memory range, and the number 3 (to flush both caches).  The default
27889 depends on the target GCC was configured for, but commonly is either
27890 @code{_flush_func} or @code{__cpu_flush}.
27892 @opindex mbranch-cost
27893 @item mbranch-cost=@var{num}
27894 Set the cost of branches to roughly @var{num} ``simple'' instructions.
27895 This cost is only a heuristic and is not guaranteed to produce
27896 consistent results across releases.  A zero cost redundantly selects
27897 the default, which is based on the @option{-mtune} setting.
27899 @opindex mbranch-likely
27900 @opindex mno-branch-likely
27901 @item -mbranch-likely
27902 @itemx -mno-branch-likely
27903 Enable or disable use of Branch Likely instructions, regardless of the
27904 default for the selected architecture.  By default, Branch Likely
27905 instructions may be generated if they are supported by the selected
27906 architecture.  An exception is for the MIPS32 and MIPS64 architectures
27907 and processors that implement those architectures; for those, Branch
27908 Likely instructions are not be generated by default because the MIPS32
27909 and MIPS64 architectures specifically deprecate their use.
27911 @opindex mcompact-branches=never
27912 @opindex mcompact-branches=optimal
27913 @opindex mcompact-branches=always
27914 @item -mcompact-branches=never
27915 @itemx -mcompact-branches=optimal
27916 @itemx -mcompact-branches=always
27917 These options control which form of branches will be generated.  The
27918 default is @option{-mcompact-branches=optimal}.
27920 The @option{-mcompact-branches=never} option ensures that compact branch
27921 instructions will never be generated.
27923 The @option{-mcompact-branches=always} option ensures that a compact
27924 branch instruction will be generated if available for MIPS Release 6 onwards.
27925 If a compact branch instruction is not available (or pre-R6),
27926 a delay slot form of the branch will be used instead.
27928 If it is used for MIPS16/microMIPS targets, it will be just ignored now.
27929 The behaviour for MIPS16/microMIPS may change in future,
27930 since they do have some compact branch instructions.
27932 The @option{-mcompact-branches=optimal} option will cause a delay slot
27933 branch to be used if one is available in the current ISA and the delay
27934 slot is successfully filled.  If the delay slot is not filled, a compact
27935 branch will be chosen if one is available.
27937 @opindex mfp-exceptions
27938 @item -mfp-exceptions
27939 @itemx -mno-fp-exceptions
27940 Specifies whether FP exceptions are enabled.  This affects how
27941 FP instructions are scheduled for some processors.
27942 The default is that FP exceptions are
27943 enabled.
27945 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
27946 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
27947 FP pipe.
27949 @opindex mvr4130-align
27950 @item -mvr4130-align
27951 @itemx -mno-vr4130-align
27952 The VR4130 pipeline is two-way superscalar, but can only issue two
27953 instructions together if the first one is 8-byte aligned.  When this
27954 option is enabled, GCC aligns pairs of instructions that it
27955 thinks should execute in parallel.
27957 This option only has an effect when optimizing for the VR4130.
27958 It normally makes code faster, but at the expense of making it bigger.
27959 It is enabled by default at optimization level @option{-O3}.
27961 @opindex msynci
27962 @item -msynci
27963 @itemx -mno-synci
27964 Enable (disable) generation of @code{synci} instructions on
27965 architectures that support it.  The @code{synci} instructions (if
27966 enabled) are generated when @code{__builtin___clear_cache} is
27967 compiled.
27969 This option defaults to @option{-mno-synci}, but the default can be
27970 overridden by configuring GCC with @option{--with-synci}.
27972 When compiling code for single processor systems, it is generally safe
27973 to use @code{synci}.  However, on many multi-core (SMP) systems, it
27974 does not invalidate the instruction caches on all cores and may lead
27975 to undefined behavior.
27977 @opindex mrelax-pic-calls
27978 @item -mrelax-pic-calls
27979 @itemx -mno-relax-pic-calls
27980 Try to turn PIC calls that are normally dispatched via register
27981 @code{$25} into direct calls.  This is only possible if the linker can
27982 resolve the destination at link time and if the destination is within
27983 range for a direct call.
27985 @option{-mrelax-pic-calls} is the default if GCC was configured to use
27986 an assembler and a linker that support the @code{.reloc} assembly
27987 directive and @option{-mexplicit-relocs} is in effect.  With
27988 @option{-mno-explicit-relocs}, this optimization can be performed by the
27989 assembler and the linker alone without help from the compiler.
27991 @opindex mmcount-ra-address
27992 @opindex mno-mcount-ra-address
27993 @item -mmcount-ra-address
27994 @itemx -mno-mcount-ra-address
27995 Emit (do not emit) code that allows @code{_mcount} to modify the
27996 calling function's return address.  When enabled, this option extends
27997 the usual @code{_mcount} interface with a new @var{ra-address}
27998 parameter, which has type @code{intptr_t *} and is passed in register
27999 @code{$12}.  @code{_mcount} can then modify the return address by
28000 doing both of the following:
28001 @itemize
28002 @item
28003 Returning the new address in register @code{$31}.
28004 @item
28005 Storing the new address in @code{*@var{ra-address}},
28006 if @var{ra-address} is nonnull.
28007 @end itemize
28009 The default is @option{-mno-mcount-ra-address}.
28011 @opindex mframe-header-opt
28012 @item -mframe-header-opt
28013 @itemx -mno-frame-header-opt
28014 Enable (disable) frame header optimization in the o32 ABI.  When using the
28015 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
28016 function to write out register arguments.  When enabled, this optimization
28017 will suppress the allocation of the frame header if it can be determined that
28018 it is unused.
28020 This optimization is off by default at all optimization levels.
28022 @opindex mlxc1-sxc1
28023 @item -mlxc1-sxc1
28024 @itemx -mno-lxc1-sxc1
28025 When applicable, enable (disable) the generation of @code{lwxc1},
28026 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions.  Enabled by default.
28028 @opindex mmadd4
28029 @item -mmadd4
28030 @itemx -mno-madd4
28031 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
28032 @code{madd.d} and related instructions.  Enabled by default.
28034 @end table
28036 @node MMIX Options
28037 @subsection MMIX Options
28038 @cindex MMIX Options
28040 These options are defined for the MMIX:
28042 @table @gcctabopt
28043 @opindex mlibfuncs
28044 @opindex mno-libfuncs
28045 @item -mlibfuncs
28046 @itemx -mno-libfuncs
28047 Specify that intrinsic library functions are being compiled, passing all
28048 values in registers, no matter the size.
28050 @opindex mepsilon
28051 @opindex mno-epsilon
28052 @item -mepsilon
28053 @itemx -mno-epsilon
28054 Generate floating-point comparison instructions that compare with respect
28055 to the @code{rE} epsilon register.
28057 @opindex mabi=mmixware
28058 @opindex mabi=gnu
28059 @item -mabi=mmixware
28060 @itemx -mabi=gnu
28061 Generate code that passes function parameters and return values that (in
28062 the called function) are seen as registers @code{$0} and up, as opposed to
28063 the GNU ABI which uses global registers @code{$231} and up.
28065 @opindex mzero-extend
28066 @opindex mno-zero-extend
28067 @item -mzero-extend
28068 @itemx -mno-zero-extend
28069 When reading data from memory in sizes shorter than 64 bits, use (do not
28070 use) zero-extending load instructions by default, rather than
28071 sign-extending ones.
28073 @opindex mknuthdiv
28074 @opindex mno-knuthdiv
28075 @item -mknuthdiv
28076 @itemx -mno-knuthdiv
28077 Make the result of a division yielding a remainder have the same sign as
28078 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
28079 remainder follows the sign of the dividend.  Both methods are
28080 arithmetically valid, the latter being almost exclusively used.
28082 @opindex mtoplevel-symbols
28083 @opindex mno-toplevel-symbols
28084 @item -mtoplevel-symbols
28085 @itemx -mno-toplevel-symbols
28086 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
28087 code can be used with the @code{PREFIX} assembly directive.
28089 @opindex melf
28090 @item -melf
28091 Generate an executable in the ELF format, rather than the default
28092 @samp{mmo} format used by the @command{mmix} simulator.
28094 @opindex mbranch-predict
28095 @opindex mno-branch-predict
28096 @item -mbranch-predict
28097 @itemx -mno-branch-predict
28098 Use (do not use) the probable-branch instructions, when static branch
28099 prediction indicates a probable branch.
28101 @opindex mbase-addresses
28102 @opindex mno-base-addresses
28103 @item -mbase-addresses
28104 @itemx -mno-base-addresses
28105 Generate (do not generate) code that uses @emph{base addresses}.  Using a
28106 base address automatically generates a request (handled by the assembler
28107 and the linker) for a constant to be set up in a global register.  The
28108 register is used for one or more base address requests within the range 0
28109 to 255 from the value held in the register.  The generally leads to short
28110 and fast code, but the number of different data items that can be
28111 addressed is limited.  This means that a program that uses lots of static
28112 data may require @option{-mno-base-addresses}.
28114 @opindex msingle-exit
28115 @opindex mno-single-exit
28116 @item -msingle-exit
28117 @itemx -mno-single-exit
28118 Force (do not force) generated code to have a single exit point in each
28119 function.
28120 @end table
28122 @node MN10300 Options
28123 @subsection MN10300 Options
28124 @cindex MN10300 options
28126 These @option{-m} options are defined for Matsushita MN10300 architectures:
28128 @table @gcctabopt
28129 @opindex mmult-bug
28130 @item -mmult-bug
28131 Generate code to avoid bugs in the multiply instructions for the MN10300
28132 processors.  This is the default.
28134 @opindex mno-mult-bug
28135 @item -mno-mult-bug
28136 Do not generate code to avoid bugs in the multiply instructions for the
28137 MN10300 processors.
28139 @opindex mam33
28140 @item -mam33
28141 Generate code using features specific to the AM33 processor.
28143 @opindex mno-am33
28144 @item -mno-am33
28145 Do not generate code using features specific to the AM33 processor.  This
28146 is the default.
28148 @opindex mam33-2
28149 @item -mam33-2
28150 Generate code using features specific to the AM33/2.0 processor.
28152 @opindex mam34
28153 @item -mam34
28154 Generate code using features specific to the AM34 processor.
28156 @opindex mtune
28157 @item -mtune=@var{cpu-type}
28158 Use the timing characteristics of the indicated CPU type when
28159 scheduling instructions.  This does not change the targeted processor
28160 type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
28161 @samp{am33-2} or @samp{am34}.
28163 @opindex mreturn-pointer-on-d0
28164 @item -mreturn-pointer-on-d0
28165 When generating a function that returns a pointer, return the pointer
28166 in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
28167 only in @code{a0}, and attempts to call such functions without a prototype
28168 result in errors.  Note that this option is on by default; use
28169 @option{-mno-return-pointer-on-d0} to disable it.
28171 @opindex mno-crt0
28172 @item -mno-crt0
28173 Do not link in the C run-time initialization object file.
28175 @opindex mrelax
28176 @item -mrelax
28177 Indicate to the linker that it should perform a relaxation optimization pass
28178 to shorten branches, calls and absolute memory addresses.  This option only
28179 has an effect when used on the command line for the final link step.
28181 This option makes symbolic debugging impossible.
28183 @opindex mliw
28184 @item -mliw
28185 Allow the compiler to generate @emph{Long Instruction Word}
28186 instructions if the target is the @samp{AM33} or later.  This is the
28187 default.  This option defines the preprocessor macro @code{__LIW__}.
28189 @opindex mno-liw
28190 @item -mno-liw
28191 Do not allow the compiler to generate @emph{Long Instruction Word}
28192 instructions.  This option defines the preprocessor macro
28193 @code{__NO_LIW__}.
28195 @opindex msetlb
28196 @item -msetlb
28197 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
28198 instructions if the target is the @samp{AM33} or later.  This is the
28199 default.  This option defines the preprocessor macro @code{__SETLB__}.
28201 @opindex mno-setlb
28202 @item -mno-setlb
28203 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
28204 instructions.  This option defines the preprocessor macro
28205 @code{__NO_SETLB__}.
28207 @end table
28209 @node Moxie Options
28210 @subsection Moxie Options
28211 @cindex Moxie Options
28213 @table @gcctabopt
28215 @opindex meb
28216 @item -meb
28217 Generate big-endian code.  This is the default for @samp{moxie-*-*}
28218 configurations.
28220 @opindex mel
28221 @item -mel
28222 Generate little-endian code.
28224 @opindex mmul.x
28225 @item -mmul.x
28226 Generate mul.x and umul.x instructions.  This is the default for
28227 @samp{moxiebox-*-*} configurations.
28229 @opindex mno-crt0
28230 @item -mno-crt0
28231 Do not link in the C run-time initialization object file.
28233 @end table
28235 @node MSP430 Options
28236 @subsection MSP430 Options
28237 @cindex MSP430 Options
28239 These options are defined for the MSP430:
28241 @table @gcctabopt
28243 @opindex masm-hex
28244 @item -masm-hex
28245 Force assembly output to always use hex constants.  Normally such
28246 constants are signed decimals, but this option is available for
28247 testsuite and/or aesthetic purposes.
28249 @opindex mmcu=
28250 @item -mmcu=
28251 Select the MCU to target.  This is used to create a C preprocessor
28252 symbol based upon the MCU name, converted to upper case and pre- and
28253 post-fixed with @samp{__}.  This in turn is used by the
28254 @file{msp430.h} header file to select an MCU-specific supplementary
28255 header file.
28257 The option also sets the ISA to use.  If the MCU name is one that is
28258 known to only support the 430 ISA then that is selected, otherwise the
28259 430X ISA is selected.  A generic MCU name of @samp{msp430} can also be
28260 used to select the 430 ISA.  Similarly the generic @samp{msp430x} MCU
28261 name selects the 430X ISA.
28263 In addition an MCU-specific linker script is added to the linker
28264 command line.  The script's name is the name of the MCU with
28265 @file{.ld} appended.  Thus specifying @option{-mmcu=xxx} on the @command{gcc}
28266 command line defines the C preprocessor symbol @code{__XXX__} and
28267 cause the linker to search for a script called @file{xxx.ld}.
28269 The ISA and hardware multiply supported for the different MCUs is hard-coded
28270 into GCC.  However, an external @samp{devices.csv} file can be used to
28271 extend device support beyond those that have been hard-coded.
28273 GCC searches for the @samp{devices.csv} file using the following methods in the
28274 given precedence order, where the first method takes precendence over the
28275 second which takes precedence over the third.
28277 @table @asis
28278 @item Include path specified with @code{-I} and @code{-L}
28279 @samp{devices.csv} will be searched for in each of the directories specified by
28280 include paths and linker library search paths.
28281 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
28282 Define the value of the global environment variable
28283 @samp{MSP430_GCC_INCLUDE_DIR}
28284 to the full path to the directory containing devices.csv, and GCC will search
28285 this directory for devices.csv.  If devices.csv is found, this directory will
28286 also be registered as an include path, and linker library path.  Header files
28287 and linker scripts in this directory can therefore be used without manually
28288 specifying @code{-I} and @code{-L} on the command line.
28289 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
28290 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
28291 toolchain root directory.  This directory does not exist in a default
28292 installation, but if the user has created it and copied @samp{devices.csv}
28293 there, then the MCU data will be read.  As above, this directory will
28294 also be registered as an include path, and linker library path.
28296 @end table
28297 If none of the above search methods find @samp{devices.csv}, then the
28298 hard-coded MCU data is used.
28301 @opindex mwarn-mcu
28302 @opindex mno-warn-mcu
28303 @item -mwarn-mcu
28304 @itemx -mno-warn-mcu
28305 This option enables or disables warnings about conflicts between the
28306 MCU name specified by the @option{-mmcu} option and the ISA set by the
28307 @option{-mcpu} option and/or the hardware multiply support set by the
28308 @option{-mhwmult} option.  It also toggles warnings about unrecognized
28309 MCU names.  This option is on by default.
28311 @opindex mcpu=
28312 @item -mcpu=
28313 Specifies the ISA to use.  Accepted values are @samp{msp430},
28314 @samp{msp430x} and @samp{msp430xv2}.  This option is deprecated.  The
28315 @option{-mmcu=} option should be used to select the ISA.
28317 @opindex msim
28318 @item -msim
28319 Link to the simulator runtime libraries and linker script.  Overrides
28320 any scripts that would be selected by the @option{-mmcu=} option.
28322 @opindex mlarge
28323 @item -mlarge
28324 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
28326 @opindex msmall
28327 @item -msmall
28328 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
28330 @opindex mrelax
28331 @item -mrelax
28332 This option is passed to the assembler and linker, and allows the
28333 linker to perform certain optimizations that cannot be done until
28334 the final link.
28336 @opindex mhwmult=
28337 @item mhwmult=
28338 Describes the type of hardware multiply supported by the target.
28339 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
28340 for the original 16-bit-only multiply supported by early MCUs.
28341 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
28342 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
28343 A value of @samp{auto} can also be given.  This tells GCC to deduce
28344 the hardware multiply support based upon the MCU name provided by the
28345 @option{-mmcu} option.  If no @option{-mmcu} option is specified or if
28346 the MCU name is not recognized then no hardware multiply support is
28347 assumed.  @code{auto} is the default setting.
28349 Hardware multiplies are normally performed by calling a library
28350 routine.  This saves space in the generated code.  When compiling at
28351 @option{-O3} or higher however the hardware multiplier is invoked
28352 inline.  This makes for bigger, but faster code.
28354 The hardware multiply routines disable interrupts whilst running and
28355 restore the previous interrupt state when they finish.  This makes
28356 them safe to use inside interrupt handlers as well as in normal code.
28358 @opindex minrt
28359 @item -minrt
28360 Enable the use of a minimum runtime environment - no static
28361 initializers or constructors.  This is intended for memory-constrained
28362 devices.  The compiler includes special symbols in some objects
28363 that tell the linker and runtime which code fragments are required.
28365 @opindex mtiny-printf
28366 @item -mtiny-printf
28367 Enable reduced code size @code{printf} and @code{puts} library functions.
28368 The @samp{tiny} implementations of these functions are not reentrant, so
28369 must be used with caution in multi-threaded applications.
28371 Support for streams has been removed and the string to be printed will
28372 always be sent to stdout via the @code{write} syscall.  The string is not
28373 buffered before it is sent to write.
28375 This option requires Newlib Nano IO, so GCC must be configured with
28376 @samp{--enable-newlib-nano-formatted-io}.
28378 @opindex mmax-inline-shift=
28379 @item -mmax-inline-shift=
28380 This option takes an integer between 0 and 64 inclusive, and sets
28381 the maximum number of inline shift instructions which should be emitted to
28382 perform a shift operation by a constant amount.  When this value needs to be
28383 exceeded, an mspabi helper function is used instead.  The default value is 4.
28385 This only affects cases where a shift by multiple positions cannot be
28386 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
28388 Shifts of a 32-bit value are at least twice as costly, so the value passed for
28389 this option is divided by 2 and the resulting value used instead.
28391 @opindex mcode-region
28392 @opindex mdata-region
28393 @item -mcode-region=
28394 @itemx -mdata-region=
28395 These options tell the compiler where to place functions and data that
28396 do not have one of the @code{lower}, @code{upper}, @code{either} or
28397 @code{section} attributes.  Possible values are @code{lower},
28398 @code{upper}, @code{either} or @code{any}.  The first three behave
28399 like the corresponding attribute.  The fourth possible value -
28400 @code{any} - is the default.  It leaves placement entirely up to the
28401 linker script and how it assigns the standard sections
28402 (@code{.text}, @code{.data}, etc) to the memory regions.
28404 @opindex msilicon-errata
28405 @item -msilicon-errata=
28406 This option passes on a request to assembler to enable the fixes for
28407 the named silicon errata.
28409 @opindex msilicon-errata-warn
28410 @item -msilicon-errata-warn=
28411 This option passes on a request to the assembler to enable warning
28412 messages when a silicon errata might need to be applied.
28414 @opindex mwarn-devices-csv
28415 @opindex mno-warn-devices-csv
28416 @item -mwarn-devices-csv
28417 @itemx -mno-warn-devices-csv
28418 Warn if @samp{devices.csv} is not found or there are problem parsing it
28419 (default: on).
28421 @end table
28423 @node NDS32 Options
28424 @subsection NDS32 Options
28425 @cindex NDS32 Options
28427 These options are defined for NDS32 implementations:
28429 @table @gcctabopt
28431 @opindex mbig-endian
28432 @item -mbig-endian
28433 Generate code in big-endian mode.
28435 @opindex mlittle-endian
28436 @item -mlittle-endian
28437 Generate code in little-endian mode.
28439 @opindex mreduced-regs
28440 @item -mreduced-regs
28441 Use reduced-set registers for register allocation.
28443 @opindex mfull-regs
28444 @item -mfull-regs
28445 Use full-set registers for register allocation.
28447 @opindex mcmov
28448 @item -mcmov
28449 Generate conditional move instructions.
28451 @opindex mno-cmov
28452 @item -mno-cmov
28453 Do not generate conditional move instructions.
28455 @opindex mext-perf
28456 @item -mext-perf
28457 Generate performance extension instructions.
28459 @opindex mno-ext-perf
28460 @item -mno-ext-perf
28461 Do not generate performance extension instructions.
28463 @opindex mext-perf2
28464 @item -mext-perf2
28465 Generate performance extension 2 instructions.
28467 @opindex mno-ext-perf2
28468 @item -mno-ext-perf2
28469 Do not generate performance extension 2 instructions.
28471 @opindex mext-string
28472 @item -mext-string
28473 Generate string extension instructions.
28475 @opindex mno-ext-string
28476 @item -mno-ext-string
28477 Do not generate string extension instructions.
28479 @opindex mv3push
28480 @item -mv3push
28481 Generate v3 push25/pop25 instructions.
28483 @opindex mno-v3push
28484 @item -mno-v3push
28485 Do not generate v3 push25/pop25 instructions.
28487 @opindex m16-bit
28488 @item -m16-bit
28489 Generate 16-bit instructions.
28491 @opindex mno-16-bit
28492 @item -mno-16-bit
28493 Do not generate 16-bit instructions.
28495 @opindex misr-vector-size
28496 @item -misr-vector-size=@var{num}
28497 Specify the size of each interrupt vector, which must be 4 or 16.
28499 @opindex mcache-block-size
28500 @item -mcache-block-size=@var{num}
28501 Specify the size of each cache block,
28502 which must be a power of 2 between 4 and 512.
28504 @opindex march
28505 @item -march=@var{arch}
28506 Specify the name of the target architecture.
28508 @opindex mcmodel
28509 @item -mcmodel=@var{code-model}
28510 Set the code model to one of
28511 @table @asis
28512 @item @samp{small}
28513 All the data and read-only data segments must be within 512KB addressing space.
28514 The text segment must be within 16MB addressing space.
28515 @item @samp{medium}
28516 The data segment must be within 512KB while the read-only data segment can be
28517 within 4GB addressing space.  The text segment should be still within 16MB
28518 addressing space.
28519 @item @samp{large}
28520 All the text and data segments can be within 4GB addressing space.
28521 @end table
28523 @opindex mctor-dtor
28524 @item -mctor-dtor
28525 Enable constructor/destructor feature.
28527 @opindex mrelax
28528 @item -mrelax
28529 Guide linker to relax instructions.
28531 @end table
28533 @node Nios II Options
28534 @subsection Nios II Options
28535 @cindex Nios II options
28536 @cindex Altera Nios II options
28538 These are the options defined for the Altera Nios II processor.
28540 @table @gcctabopt
28542 @opindex G
28543 @cindex smaller data references
28544 @item -G @var{num}
28545 Put global and static objects less than or equal to @var{num} bytes
28546 into the small data or BSS sections instead of the normal data or BSS
28547 sections.  The default value of @var{num} is 8.
28549 @opindex mgpopt
28550 @opindex mno-gpopt
28551 @item -mgpopt=@var{option}
28552 @itemx -mgpopt
28553 @itemx -mno-gpopt
28554 Generate (do not generate) GP-relative accesses.  The following 
28555 @var{option} names are recognized:
28557 @table @samp
28559 @item none
28560 Do not generate GP-relative accesses.
28562 @item local
28563 Generate GP-relative accesses for small data objects that are not 
28564 external, weak, or uninitialized common symbols.  
28565 Also use GP-relative addressing for objects that
28566 have been explicitly placed in a small data section via a @code{section}
28567 attribute.
28569 @item global
28570 As for @samp{local}, but also generate GP-relative accesses for
28571 small data objects that are external, weak, or common.  If you use this option,
28572 you must ensure that all parts of your program (including libraries) are
28573 compiled with the same @option{-G} setting.
28575 @item data
28576 Generate GP-relative accesses for all data objects in the program.  If you
28577 use this option, the entire data and BSS segments
28578 of your program must fit in 64K of memory and you must use an appropriate
28579 linker script to allocate them within the addressable range of the
28580 global pointer.
28582 @item all
28583 Generate GP-relative addresses for function pointers as well as data
28584 pointers.  If you use this option, the entire text, data, and BSS segments
28585 of your program must fit in 64K of memory and you must use an appropriate
28586 linker script to allocate them within the addressable range of the
28587 global pointer.
28589 @end table
28591 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
28592 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
28594 The default is @option{-mgpopt} except when @option{-fpic} or
28595 @option{-fPIC} is specified to generate position-independent code.
28596 Note that the Nios II ABI does not permit GP-relative accesses from
28597 shared libraries.
28599 You may need to specify @option{-mno-gpopt} explicitly when building
28600 programs that include large amounts of small data, including large
28601 GOT data sections.  In this case, the 16-bit offset for GP-relative
28602 addressing may not be large enough to allow access to the entire 
28603 small data section.
28605 @opindex mgprel-sec
28606 @item -mgprel-sec=@var{regexp}
28607 This option specifies additional section names that can be accessed via
28608 GP-relative addressing.  It is most useful in conjunction with 
28609 @code{section} attributes on variable declarations 
28610 (@pxref{Common Variable Attributes}) and a custom linker script.  
28611 The @var{regexp} is a POSIX Extended Regular Expression.
28613 This option does not affect the behavior of the @option{-G} option, and 
28614 the specified sections are in addition to the standard @code{.sdata}
28615 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
28617 @opindex mr0rel-sec
28618 @item -mr0rel-sec=@var{regexp}
28619 This option specifies names of sections that can be accessed via a 
28620 16-bit offset from @code{r0}; that is, in the low 32K or high 32K 
28621 of the 32-bit address space.  It is most useful in conjunction with 
28622 @code{section} attributes on variable declarations 
28623 (@pxref{Common Variable Attributes}) and a custom linker script.  
28624 The @var{regexp} is a POSIX Extended Regular Expression.
28626 In contrast to the use of GP-relative addressing for small data, 
28627 zero-based addressing is never generated by default and there are no 
28628 conventional section names used in standard linker scripts for sections
28629 in the low or high areas of memory.
28631 @opindex mel
28632 @opindex meb
28633 @item -mel
28634 @itemx -meb
28635 Generate little-endian (default) or big-endian (experimental) code,
28636 respectively.
28638 @opindex march
28639 @item -march=@var{arch}
28640 This specifies the name of the target Nios II architecture.  GCC uses this
28641 name to determine what kind of instructions it can emit when generating
28642 assembly code.  Permissible names are: @samp{r1}, @samp{r2}.
28644 The preprocessor macro @code{__nios2_arch__} is available to programs,
28645 with value 1 or 2, indicating the targeted ISA level.
28647 @opindex mno-bypass-cache
28648 @opindex mbypass-cache
28649 @item -mbypass-cache
28650 @itemx -mno-bypass-cache
28651 Force all load and store instructions to always bypass cache by 
28652 using I/O variants of the instructions. The default is not to
28653 bypass the cache.
28655 @opindex mcache-volatile 
28656 @opindex mno-cache-volatile
28657 @item -mno-cache-volatile 
28658 @itemx -mcache-volatile       
28659 Volatile memory access bypass the cache using the I/O variants of 
28660 the load and store instructions. The default is not to bypass the cache.
28662 @opindex mno-fast-sw-div
28663 @opindex mfast-sw-div
28664 @item -mno-fast-sw-div
28665 @itemx -mfast-sw-div
28666 Do not use table-based fast divide for small numbers. The default 
28667 is to use the fast divide at @option{-O3} and above.
28669 @opindex mno-hw-mul
28670 @opindex mhw-mul
28671 @opindex mno-hw-mulx
28672 @opindex mhw-mulx
28673 @opindex mno-hw-div
28674 @opindex mhw-div
28675 @item -mno-hw-mul
28676 @itemx -mhw-mul
28677 @itemx -mno-hw-mulx
28678 @itemx -mhw-mulx
28679 @itemx -mno-hw-div
28680 @itemx -mhw-div
28681 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 
28682 instructions by the compiler. The default is to emit @code{mul}
28683 and not emit @code{div} and @code{mulx}.
28685 @item -mbmx
28686 @itemx -mno-bmx
28687 @itemx -mcdx
28688 @itemx -mno-cdx
28689 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
28690 CDX (code density) instructions.  Enabling these instructions also
28691 requires @option{-march=r2}.  Since these instructions are optional
28692 extensions to the R2 architecture, the default is not to emit them.
28694 @opindex mcustom-@var{insn}
28695 @opindex mno-custom-@var{insn}
28696 @item -mcustom-@var{insn}=@var{N}
28697 @itemx -mno-custom-@var{insn}
28698 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
28699 custom instruction with encoding @var{N} when generating code that uses 
28700 @var{insn}.  For example, @option{-mcustom-fadds=253} generates custom
28701 instruction 253 for single-precision floating-point add operations instead
28702 of the default behavior of using a library call.
28704 The following values of @var{insn} are supported.  Except as otherwise
28705 noted, floating-point operations are expected to be implemented with
28706 normal IEEE 754 semantics and correspond directly to the C operators or the
28707 equivalent GCC built-in functions (@pxref{Other Builtins}).
28709 Single-precision floating point:
28710 @table @asis
28712 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
28713 Binary arithmetic operations.
28715 @item @samp{fnegs}
28716 Unary negation.
28718 @item @samp{fabss}
28719 Unary absolute value.
28721 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
28722 Comparison operations.
28724 @item @samp{fmins}, @samp{fmaxs}
28725 Floating-point minimum and maximum.  These instructions are only
28726 generated if @option{-ffinite-math-only} is specified.
28728 @item @samp{fsqrts}
28729 Unary square root operation.
28731 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
28732 Floating-point trigonometric and exponential functions.  These instructions
28733 are only generated if @option{-funsafe-math-optimizations} is also specified.
28735 @end table
28737 Double-precision floating point:
28738 @table @asis
28740 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
28741 Binary arithmetic operations.
28743 @item @samp{fnegd}
28744 Unary negation.
28746 @item @samp{fabsd}
28747 Unary absolute value.
28749 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
28750 Comparison operations.
28752 @item @samp{fmind}, @samp{fmaxd}
28753 Double-precision minimum and maximum.  These instructions are only
28754 generated if @option{-ffinite-math-only} is specified.
28756 @item @samp{fsqrtd}
28757 Unary square root operation.
28759 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
28760 Double-precision trigonometric and exponential functions.  These instructions
28761 are only generated if @option{-funsafe-math-optimizations} is also specified.
28763 @end table
28765 Conversions:
28766 @table @asis
28767 @item @samp{fextsd}
28768 Conversion from single precision to double precision.
28770 @item @samp{ftruncds}
28771 Conversion from double precision to single precision.
28773 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
28774 Conversion from floating point to signed or unsigned integer types, with
28775 truncation towards zero.
28777 @item @samp{round}
28778 Conversion from single-precision floating point to signed integer,
28779 rounding to the nearest integer and ties away from zero.
28780 This corresponds to the @code{__builtin_lroundf} function when
28781 @option{-fno-math-errno} is used.
28783 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
28784 Conversion from signed or unsigned integer types to floating-point types.
28786 @end table
28788 In addition, all of the following transfer instructions for internal
28789 registers X and Y must be provided to use any of the double-precision
28790 floating-point instructions.  Custom instructions taking two
28791 double-precision source operands expect the first operand in the
28792 64-bit register X.  The other operand (or only operand of a unary
28793 operation) is given to the custom arithmetic instruction with the
28794 least significant half in source register @var{src1} and the most
28795 significant half in @var{src2}.  A custom instruction that returns a
28796 double-precision result returns the most significant 32 bits in the
28797 destination register and the other half in 32-bit register Y.  
28798 GCC automatically generates the necessary code sequences to write
28799 register X and/or read register Y when double-precision floating-point
28800 instructions are used.
28802 @table @asis
28804 @item @samp{fwrx}
28805 Write @var{src1} into the least significant half of X and @var{src2} into
28806 the most significant half of X.
28808 @item @samp{fwry}
28809 Write @var{src1} into Y.
28811 @item @samp{frdxhi}, @samp{frdxlo}
28812 Read the most or least (respectively) significant half of X and store it in
28813 @var{dest}.
28815 @item @samp{frdy}
28816 Read the value of Y and store it into @var{dest}.
28817 @end table
28819 Note that you can gain more local control over generation of Nios II custom
28820 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
28821 and @code{target("no-custom-@var{insn}")} function attributes
28822 (@pxref{Function Attributes})
28823 or pragmas (@pxref{Function Specific Option Pragmas}).
28825 @opindex mcustom-fpu-cfg
28826 @item -mcustom-fpu-cfg=@var{name}
28828 This option enables a predefined, named set of custom instruction encodings
28829 (see @option{-mcustom-@var{insn}} above).  
28830 Currently, the following sets are defined:
28832 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
28833 @gccoptlist{-mcustom-fmuls=252
28834 -mcustom-fadds=253
28835 -mcustom-fsubs=254
28836 -fsingle-precision-constant}
28838 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
28839 @gccoptlist{-mcustom-fmuls=252
28840 -mcustom-fadds=253
28841 -mcustom-fsubs=254
28842 -mcustom-fdivs=255
28843 -fsingle-precision-constant}
28845 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
28846 @gccoptlist{-mcustom-floatus=243
28847 -mcustom-fixsi=244
28848 -mcustom-floatis=245
28849 -mcustom-fcmpgts=246
28850 -mcustom-fcmples=249
28851 -mcustom-fcmpeqs=250
28852 -mcustom-fcmpnes=251
28853 -mcustom-fmuls=252
28854 -mcustom-fadds=253
28855 -mcustom-fsubs=254
28856 -mcustom-fdivs=255
28857 -fsingle-precision-constant}
28859 @option{-mcustom-fpu-cfg=fph2} is equivalent to:
28860 @gccoptlist{-mcustom-fabss=224
28861 -mcustom-fnegs=225
28862 -mcustom-fcmpnes=226
28863 -mcustom-fcmpeqs=227
28864 -mcustom-fcmpges=228
28865 -mcustom-fcmpgts=229
28866 -mcustom-fcmples=230
28867 -mcustom-fcmplts=231
28868 -mcustom-fmaxs=232
28869 -mcustom-fmins=233
28870 -mcustom-round=248
28871 -mcustom-fixsi=249
28872 -mcustom-floatis=250
28873 -mcustom-fsqrts=251
28874 -mcustom-fmuls=252
28875 -mcustom-fadds=253
28876 -mcustom-fsubs=254
28877 -mcustom-fdivs=255}
28879 Custom instruction assignments given by individual
28880 @option{-mcustom-@var{insn}=} options override those given by
28881 @option{-mcustom-fpu-cfg=}, regardless of the
28882 order of the options on the command line.
28884 Note that you can gain more local control over selection of a FPU
28885 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
28886 function attribute (@pxref{Function Attributes})
28887 or pragma (@pxref{Function Specific Option Pragmas}).
28889 The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
28890 Hardware 2 Component}.  Please note that the custom instructions enabled by
28891 @option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
28892 if @option{-ffinite-math-only} is specified.  The custom instruction enabled by
28893 @option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
28894 specified.  In contrast to the other configurations,
28895 @option{-fsingle-precision-constant} is not set.
28897 @end table
28899 These additional @samp{-m} options are available for the Altera Nios II
28900 ELF (bare-metal) target:
28902 @table @gcctabopt
28904 @opindex mhal
28905 @item -mhal
28906 Link with HAL BSP.  This suppresses linking with the GCC-provided C runtime
28907 startup and termination code, and is typically used in conjunction with
28908 @option{-msys-crt0=} to specify the location of the alternate startup code
28909 provided by the HAL BSP.
28911 @opindex msmallc
28912 @item -msmallc
28913 Link with a limited version of the C library, @option{-lsmallc}, rather than
28914 Newlib.
28916 @opindex msys-crt0
28917 @item -msys-crt0=@var{startfile}
28918 @var{startfile} is the file name of the startfile (crt0) to use 
28919 when linking.  This option is only useful in conjunction with @option{-mhal}.
28921 @opindex msys-lib
28922 @item -msys-lib=@var{systemlib}
28923 @var{systemlib} is the library name of the library that provides
28924 low-level system calls required by the C library,
28925 e.g.@: @code{read} and @code{write}.
28926 This option is typically used to link with a library provided by a HAL BSP.
28928 @end table
28930 @node Nvidia PTX Options
28931 @subsection Nvidia PTX Options
28932 @cindex Nvidia PTX options
28933 @cindex nvptx options
28935 These options are defined for Nvidia PTX:
28937 @table @gcctabopt
28939 @opindex m64
28940 @item -m64
28941 Ignored, but preserved for backward compatibility.  Only 64-bit ABI is
28942 supported.
28944 @opindex march
28945 @item -march=@var{architecture-string}
28946 Generate code for the specified PTX ISA target architecture
28947 (e.g.@: @samp{sm_35}).  Valid architecture strings are @samp{sm_30},
28948 @samp{sm_35}, @samp{sm_53}, @samp{sm_70}, @samp{sm_75} and
28949 @samp{sm_80}.
28950 The default depends on how the compiler has been configured, see
28951 @option{--with-arch}.
28953 This option sets the value of the preprocessor macro
28954 @code{__PTX_SM__}; for instance, for @samp{sm_35}, it has the value
28955 @samp{350}.
28957 @opindex misa
28958 @item -misa=@var{architecture-string}
28959 Alias of @option{-march=}.
28961 @opindex march
28962 @item -march-map=@var{architecture-string}
28963 Select the closest available @option{-march=} value that is not more
28964 capable.  For instance, for @option{-march-map=sm_50} select
28965 @option{-march=sm_35}, and for @option{-march-map=sm_53} select
28966 @option{-march=sm_53}.
28968 @opindex mptx
28969 @item -mptx=@var{version-string}
28970 Generate code for the specified PTX ISA version (e.g.@: @samp{7.0}).
28971 Valid version strings include @samp{3.1}, @samp{6.0}, @samp{6.3}, and
28972 @samp{7.0}.  The default PTX ISA version is 6.0, unless a higher
28973 version is required for specified PTX ISA target architecture via
28974 option @option{-march=}.
28976 This option sets the values of the preprocessor macros
28977 @code{__PTX_ISA_VERSION_MAJOR__} and @code{__PTX_ISA_VERSION_MINOR__};
28978 for instance, for @samp{3.1} the macros have the values @samp{3} and
28979 @samp{1}, respectively.
28981 @opindex mmainkernel
28982 @item -mmainkernel
28983 Link in code for a __main kernel.  This is for stand-alone instead of
28984 offloading execution.
28986 @opindex moptimize
28987 @item -moptimize
28988 Apply partitioned execution optimizations.  This is the default when any
28989 level of optimization is selected.
28991 @opindex msoft-stack
28992 @item -msoft-stack
28993 Generate code that does not use @code{.local} memory
28994 directly for stack storage. Instead, a per-warp stack pointer is
28995 maintained explicitly. This enables variable-length stack allocation (with
28996 variable-length arrays or @code{alloca}), and when global memory is used for
28997 underlying storage, makes it possible to access automatic variables from other
28998 threads, or with atomic instructions. This code generation variant is used
28999 for OpenMP offloading, but the option is exposed on its own for the purpose
29000 of testing the compiler; to generate code suitable for linking into programs
29001 using OpenMP offloading, use option @option{-mgomp}.
29003 @opindex muniform-simt
29004 @item -muniform-simt
29005 Switch to code generation variant that allows to execute all threads in each
29006 warp, while maintaining memory state and side effects as if only one thread
29007 in each warp was active outside of OpenMP SIMD regions.  All atomic operations
29008 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
29009 current lane index equals the master lane index), and the register being
29010 assigned is copied via a shuffle instruction from the master lane.  Outside of
29011 SIMD regions lane 0 is the master; inside, each thread sees itself as the
29012 master.  Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
29013 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
29014 regions).  Each thread can bitwise-and the bitmask at position @code{tid.y}
29015 with current lane index to compute the master lane index.
29017 @opindex mgomp
29018 @item -mgomp
29019 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
29020 @option{-muniform-simt} options, and selects corresponding multilib variant.
29022 @end table
29024 @node OpenRISC Options
29025 @subsection OpenRISC Options
29026 @cindex OpenRISC Options
29028 These options are defined for OpenRISC:
29030 @table @gcctabopt
29032 @opindex mboard
29033 @item -mboard=@var{name}
29034 Configure a board specific runtime.  This will be passed to the linker for
29035 newlib board library linking.  The default is @code{or1ksim}.
29037 @opindex mnewlib
29038 @item -mnewlib
29039 This option is ignored; it is for compatibility purposes only.  This used to
29040 select linker and preprocessor options for use with newlib.
29042 @opindex msoft-div
29043 @opindex mhard-div
29044 @item -msoft-div
29045 @itemx -mhard-div
29046 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
29047 This default is hardware divide.
29049 @opindex msoft-mul
29050 @opindex mhard-mul
29051 @item -msoft-mul
29052 @itemx -mhard-mul
29053 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
29054 This default is hardware multiply.
29056 @opindex msoft-float
29057 @opindex mhard-float
29058 @item -msoft-float
29059 @itemx -mhard-float
29060 Select software or hardware for floating point operations.
29061 The default is software.
29063 @opindex mdouble-float
29064 @item -mdouble-float
29065 When @option{-mhard-float} is selected, enables generation of double-precision
29066 floating point instructions.  By default functions from @file{libgcc} are used
29067 to perform double-precision floating point operations.
29069 @opindex munordered-float
29070 @item -munordered-float
29071 When @option{-mhard-float} is selected, enables generation of unordered
29072 floating point compare and set flag (@code{lf.sfun*}) instructions.  By default
29073 functions from @file{libgcc} are used to perform unordered floating point
29074 compare and set flag operations.
29076 @opindex mcmov
29077 @item -mcmov
29078 Enable generation of conditional move (@code{l.cmov}) instructions.  By
29079 default the equivalent will be generated using set and branch.
29081 @opindex mror
29082 @item -mror
29083 Enable generation of rotate right (@code{l.ror}) instructions.  By default
29084 functions from @file{libgcc} are used to perform rotate right operations.
29086 @opindex mrori
29087 @item -mrori
29088 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
29089 By default functions from @file{libgcc} are used to perform rotate right with
29090 immediate operations.
29092 @opindex msext
29093 @item -msext
29094 Enable generation of sign extension (@code{l.ext*}) instructions.  By default
29095 memory loads are used to perform sign extension.
29097 @opindex msfimm
29098 @item -msfimm
29099 Enable generation of compare and set flag with immediate (@code{l.sf*i})
29100 instructions.  By default extra instructions will be generated to store the
29101 immediate to a register first.
29103 @opindex mshftimm
29104 @item -mshftimm
29105 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
29106 @code{l.slli}) instructions.  By default extra instructions will be generated
29107 to store the immediate to a register first.
29109 @opindex mcmodel=small
29110 @item -mcmodel=small
29111 Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
29112 the default model.
29114 @opindex mcmodel=large
29115 @item -mcmodel=large
29116 Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
29119 @end table
29121 @node PDP-11 Options
29122 @subsection PDP-11 Options
29123 @cindex PDP-11 Options
29125 These options are defined for the PDP-11:
29127 @table @gcctabopt
29128 @opindex mfpu
29129 @item -mfpu
29130 Use hardware FPP floating point.  This is the default.  (FIS floating
29131 point on the PDP-11/40 is not supported.)  Implies -m45.
29133 @opindex msoft-float
29134 @item -msoft-float
29135 Do not use hardware floating point.
29137 @opindex mac0
29138 @item -mac0
29139 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
29141 @opindex mno-ac0
29142 @item -mno-ac0
29143 Return floating-point results in memory.  This is the default.
29145 @opindex m40
29146 @item -m40
29147 Generate code for a PDP-11/40.  Implies -msoft-float -mno-split.
29149 @opindex m45
29150 @item -m45
29151 Generate code for a PDP-11/45.  This is the default.
29153 @opindex m10
29154 @item -m10
29155 Generate code for a PDP-11/10.  Implies -msoft-float -mno-split.
29157 @opindex mint16
29158 @opindex mno-int32
29159 @item -mint16
29160 @itemx -mno-int32
29161 Use 16-bit @code{int}.  This is the default.
29163 @opindex mint32
29164 @opindex mno-int16
29165 @item -mint32
29166 @itemx -mno-int16
29167 Use 32-bit @code{int}.
29169 @opindex msplit
29170 @item -msplit
29171 Target has split instruction and data space.  Implies -m45.
29173 @opindex munix-asm
29174 @item -munix-asm
29175 Use Unix assembler syntax.
29177 @opindex mdec-asm
29178 @item -mdec-asm
29179 Use DEC assembler syntax.
29181 @opindex mgnu-asm
29182 @item -mgnu-asm
29183 Use GNU assembler syntax.  This is the default.
29185 @opindex mlra
29186 @item -mlra
29187 Use the new LRA register allocator.  By default, the old ``reload''
29188 allocator is used.
29189 @end table
29191 @node PowerPC Options
29192 @subsection PowerPC Options
29193 @cindex PowerPC options
29195 These are listed under @xref{RS/6000 and PowerPC Options}.
29197 @node PRU Options
29198 @subsection PRU Options
29199 @cindex PRU Options
29201 These command-line options are defined for PRU target:
29203 @table @gcctabopt
29204 @opindex minrt
29205 @item -minrt
29206 Link with a minimum runtime environment, with no support for static
29207 initializers and constructors.  Using this option can significantly reduce
29208 the size of the final ELF binary.  Beware that the compiler could still
29209 generate code with static initializers and constructors.  It is up to the
29210 programmer to ensure that the source program will not use those features.
29212 @opindex mmcu
29213 @item -mmcu=@var{mcu}
29214 Specify the PRU MCU variant to use.  Check Newlib for the exact list of
29215 supported MCUs.
29217 @opindex mno-relax
29218 @item -mno-relax
29219 Make GCC pass the @option{--no-relax} command-line option to the linker
29220 instead of the @option{--relax} option.
29222 @opindex mloop
29223 @item -mloop
29224 Allow (or do not allow) GCC to use the LOOP instruction.
29226 @opindex mabi
29227 @item -mabi=@var{variant}
29228 Specify the ABI variant to output code for.  @option{-mabi=ti} selects the
29229 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
29230 more naturally with certain GCC assumptions.  These are the differences:
29232 @table @samp
29233 @item Function Pointer Size
29234 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
29235 supports only 32-bit data and code pointers.
29237 @item Optional Return Value Pointer
29238 Function return values larger than 64 bits are passed by using a hidden
29239 pointer as the first argument of the function.  TI ABI, though, mandates that
29240 the pointer can be NULL in case the caller is not using the returned value.
29241 GNU always passes and expects a valid return value pointer.
29243 @end table
29245 The current @option{-mabi=ti} implementation simply raises a compile error
29246 when any of the above code constructs is detected.  As a consequence
29247 the standard C library cannot be built and it is omitted when linking with
29248 @option{-mabi=ti}.
29250 Relaxation is a GNU feature and for safety reasons is disabled when using
29251 @option{-mabi=ti}.  The TI toolchain does not emit relocations for QBBx
29252 instructions, so the GNU linker cannot adjust them when shortening adjacent
29253 LDI32 pseudo instructions.
29255 @end table
29257 @node RISC-V Options
29258 @subsection RISC-V Options
29259 @cindex RISC-V Options
29261 These command-line options are defined for RISC-V targets:
29263 @table @gcctabopt
29264 @opindex mbranch-cost
29265 @item -mbranch-cost=@var{n}
29266 Set the cost of branches to roughly @var{n} instructions.
29268 @opindex plt
29269 @item -mplt
29270 @itemx -mno-plt
29271 When generating PIC code, do or don't allow the use of PLTs. Ignored for
29272 non-PIC.  The default is @option{-mplt}.
29274 @opindex mabi
29275 @item -mabi=@var{ABI-string}
29276 Specify integer and floating-point calling convention.  @var{ABI-string}
29277 contains two parts: the size of integer types and the registers used for
29278 floating-point types.  For example @samp{-march=rv64ifd -mabi=lp64d} means that
29279 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
29280 32-bit), and that floating-point values up to 64 bits wide are passed in F
29281 registers.  Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
29282 allows the compiler to generate code that uses the F and D extensions but only
29283 allows floating-point values up to 32 bits long to be passed in registers; or
29284 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
29285 passed in registers.
29287 The default for this argument is system dependent, users who want a specific
29288 calling convention should specify one explicitly.  The valid calling
29289 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
29290 @samp{lp64f}, and @samp{lp64d}.  Some calling conventions are impossible to
29291 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
29292 invalid because the ABI requires 64-bit values be passed in F registers, but F
29293 registers are only 32 bits wide.  There is also the @samp{ilp32e} ABI that can
29294 only be used with the @samp{rv32e} architecture.  This ABI is not well
29295 specified at present, and is subject to change.
29297 @opindex mfdiv
29298 @item -mfdiv
29299 @itemx -mno-fdiv
29300 Do or don't use hardware floating-point divide and square root instructions.
29301 This requires the F or D extensions for floating-point registers.  The default
29302 is to use them if the specified architecture has these instructions.
29304 @opindex mdiv
29305 @item -mdiv
29306 @itemx -mno-div
29307 Do or don't use hardware instructions for integer division.  This requires the
29308 M extension.  The default is to use them if the specified architecture has
29309 these instructions.
29311 @opindex misa-spec
29312 @item -misa-spec=@var{ISA-spec-string}
29313 Specify the version of the RISC-V Unprivileged (formerly User-Level)
29314 ISA specification to produce code conforming to.  The possibilities
29315 for @var{ISA-spec-string} are:
29316 @table @code
29317 @item 2.2
29318 Produce code conforming to version 2.2.
29319 @item 20190608
29320 Produce code conforming to version 20190608.
29321 @item 20191213
29322 Produce code conforming to version 20191213.
29323 @end table
29324 The default is @option{-misa-spec=20191213} unless GCC has been configured
29325 with @option{--with-isa-spec=} specifying a different default version.
29327 @opindex march
29328 @item -march=@var{ISA-string}
29329 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}).  ISA strings must be
29330 lower-case.  Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
29331 @samp{rv32imaf}.
29333 When @option{-march=} is not specified, use the setting from @option{-mcpu}.
29335 If both @option{-march} and @option{-mcpu=} are not specified, the default for
29336 this argument is system dependent, users who want a specific architecture
29337 extensions should specify one explicitly.
29339 @opindex mcpu
29340 @item -mcpu=@var{processor-string}
29341 Use architecture of and optimize the output for the given processor, specified
29342 by particular CPU name.
29343 Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
29344 @samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
29345 @samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
29346 @samp{sifive-u54}, and @samp{sifive-u74}.
29348 @opindex mtune
29349 @item -mtune=@var{processor-string}
29350 Optimize the output for the given processor, specified by microarchitecture or
29351 particular CPU name.  Permissible values for this option are: @samp{rocket},
29352 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
29353 @samp{thead-c906}, @samp{size}, and all valid options for @option{-mcpu=}.
29355 When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
29356 the default is @samp{rocket} if both are not specified.
29358 The @samp{size} choice is not intended for use by end-users.  This is used
29359 when @option{-Os} is specified.  It overrides the instruction cost info
29360 provided by @option{-mtune=}, but does not override the pipeline info.  This
29361 helps reduce code size while still giving good performance.
29363 @opindex mpreferred-stack-boundary
29364 @item -mpreferred-stack-boundary=@var{num}
29365 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
29366 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
29367 the default is 4 (16 bytes or 128-bits).
29369 @strong{Warning:} If you use this switch, then you must build all modules with
29370 the same value, including any libraries.  This includes the system libraries
29371 and startup modules.
29373 @opindex msmall-data-limit
29374 @item -msmall-data-limit=@var{n}
29375 Put global and static data smaller than @var{n} bytes into a special section
29376 (on some targets).
29378 @opindex msave-restore
29379 @item -msave-restore
29380 @itemx -mno-save-restore
29381 Do or don't use smaller but slower prologue and epilogue code that uses
29382 library function calls.  The default is to use fast inline prologues and
29383 epilogues.
29385 @opindex minline-atomics
29386 @item -minline-atomics
29387 @itemx -mno-inline-atomics
29388 Do or don't use smaller but slower subword atomic emulation code that uses
29389 libatomic function calls.  The default is to use fast inline subword atomics
29390 that do not require libatomic.
29392 @opindex minline-strlen
29393 @item -minline-strlen
29394 @itemx -mno-inline-strlen
29395 Do or do not attempt to inline strlen calls if possible.
29396 Inlining will only be done if the string is properly aligned
29397 and instructions for accelerated processing are available.
29398 The default is to not inline strlen calls.
29400 @opindex minline-strcmp
29401 @item -minline-strcmp
29402 @itemx -mno-inline-strcmp
29403 Do or do not attempt to inline strcmp calls if possible.
29404 Inlining will only be done if the strings are properly aligned
29405 and instructions for accelerated processing are available.
29406 The default is to not inline strcmp calls.
29408 @opindex minline-strncmp
29409 @item -minline-strncmp
29410 @itemx -mno-inline-strncmp
29411 Do or do not attempt to inline strncmp calls if possible.
29412 Inlining will only be done if the strings are properly aligned
29413 and instructions for accelerated processing are available.
29414 The default is to not inline strncmp calls.
29416 @opindex mshorten-memrefs
29417 @item -mshorten-memrefs
29418 @itemx -mno-shorten-memrefs
29419 Do or do not attempt to make more use of compressed load/store instructions by
29420 replacing a load/store of 'base register + large offset' with a new load/store
29421 of 'new base + small offset'.  If the new base gets stored in a compressed
29422 register, then the new load/store can be compressed.  Currently targets 32-bit
29423 integer load/stores only.
29425 @opindex mstrict-align
29426 @item -mstrict-align
29427 @itemx -mno-strict-align
29428 Do not or do generate unaligned memory accesses.  The default is set depending
29429 on whether the processor we are optimizing for supports fast unaligned access
29430 or not.
29432 @opindex mcmodel=medlow
29433 @item -mcmodel=medlow
29434 Generate code for the medium-low code model. The program and its statically
29435 defined symbols must lie within a single 2 GiB address range and must lie
29436 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
29437 statically or dynamically linked. This is the default code model.
29439 @opindex mcmodel=medany
29440 @item -mcmodel=medany
29441 Generate code for the medium-any code model. The program and its statically
29442 defined symbols must be within any single 2 GiB address range. Programs can be
29443 statically or dynamically linked.
29445 The code generated by the medium-any code model is position-independent, but is
29446 not guaranteed to function correctly when linked into position-independent
29447 executables or libraries.
29449 @item -mexplicit-relocs
29450 @itemx -mno-exlicit-relocs
29451 Use or do not use assembler relocation operators when dealing with symbolic
29452 addresses.  The alternative is to use assembler macros instead, which may
29453 limit optimization.
29455 @opindex mrelax
29456 @item -mrelax
29457 @itemx -mno-relax
29458 Take advantage of linker relaxations to reduce the number of instructions
29459 required to materialize symbol addresses. The default is to take advantage of
29460 linker relaxations.
29462 @opindex mriscv-attribute
29463 @item -mriscv-attribute
29464 @itemx -mno-riscv-attribute
29465 Emit (do not emit) RISC-V attribute to record extra information into ELF
29466 objects.  This feature requires at least binutils 2.32.
29468 @opindex mcsr-check
29469 @item -mcsr-check
29470 @itemx -mno-csr-check
29471 Enables or disables the CSR checking.
29473 @opindex malign-data
29474 @item -malign-data=@var{type}
29475 Control how GCC aligns variables and constants of array, structure, or union
29476 types.  Supported values for @var{type} are @samp{xlen} which uses x register
29477 width as the alignment value, and @samp{natural} which uses natural alignment.
29478 @samp{xlen} is the default.
29480 @opindex mbig-endian
29481 @item -mbig-endian
29482 Generate big-endian code.  This is the default when GCC is configured for a
29483 @samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
29485 @opindex mlittle-endian
29486 @item -mlittle-endian
29487 Generate little-endian code.  This is the default when GCC is configured for a
29488 @samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
29489 @samp{riscv32be-*-*} target.
29491 @opindex mstack-protector-guard
29492 @opindex mstack-protector-guard-reg
29493 @opindex mstack-protector-guard-offset
29494 @item -mstack-protector-guard=@var{guard}
29495 @itemx -mstack-protector-guard-reg=@var{reg}
29496 @itemx -mstack-protector-guard-offset=@var{offset}
29497 Generate stack protection code using canary at @var{guard}.  Supported
29498 locations are @samp{global} for a global canary or @samp{tls} for per-thread
29499 canary in the TLS block.
29501 With the latter choice the options
29502 @option{-mstack-protector-guard-reg=@var{reg}} and
29503 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
29504 which register to use as base register for reading the canary,
29505 and from what offset from that base register. There is no default
29506 register or offset as this is entirely for use within the Linux
29507 kernel.
29508 @end table
29510 @node RL78 Options
29511 @subsection RL78 Options
29512 @cindex RL78 Options
29514 @table @gcctabopt
29516 @opindex msim
29517 @item -msim
29518 Links in additional target libraries to support operation within a
29519 simulator.
29521 @opindex mmul
29522 @item -mmul=none
29523 @itemx -mmul=g10
29524 @itemx -mmul=g13
29525 @itemx -mmul=g14
29526 @itemx -mmul=rl78
29527 Specifies the type of hardware multiplication and division support to
29528 be used.  The simplest is @code{none}, which uses software for both
29529 multiplication and division.  This is the default.  The @code{g13}
29530 value is for the hardware multiply/divide peripheral found on the
29531 RL78/G13 (S2 core) targets.  The @code{g14} value selects the use of
29532 the multiplication and division instructions supported by the RL78/G14
29533 (S3 core) parts.  The value @code{rl78} is an alias for @code{g14} and
29534 the value @code{mg10} is an alias for @code{none}.
29536 In addition a C preprocessor macro is defined, based upon the setting
29537 of this option.  Possible values are: @code{__RL78_MUL_NONE__},
29538 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
29540 @opindex mcpu
29541 @item -mcpu=g10
29542 @itemx -mcpu=g13
29543 @itemx -mcpu=g14
29544 @itemx -mcpu=rl78
29545 Specifies the RL78 core to target.  The default is the G14 core, also
29546 known as an S3 core or just RL78.  The G13 or S2 core does not have
29547 multiply or divide instructions, instead it uses a hardware peripheral
29548 for these operations.  The G10 or S1 core does not have register
29549 banks, so it uses a different calling convention.
29551 If this option is set it also selects the type of hardware multiply
29552 support to use, unless this is overridden by an explicit
29553 @option{-mmul=none} option on the command line.  Thus specifying
29554 @option{-mcpu=g13} enables the use of the G13 hardware multiply
29555 peripheral and specifying @option{-mcpu=g10} disables the use of
29556 hardware multiplications altogether.
29558 Note, although the RL78/G14 core is the default target, specifying
29559 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
29560 change the behavior of the toolchain since it also enables G14
29561 hardware multiply support.  If these options are not specified on the
29562 command line then software multiplication routines will be used even
29563 though the code targets the RL78 core.  This is for backwards
29564 compatibility with older toolchains which did not have hardware
29565 multiply and divide support.
29567 In addition a C preprocessor macro is defined, based upon the setting
29568 of this option.  Possible values are: @code{__RL78_G10__},
29569 @code{__RL78_G13__} or @code{__RL78_G14__}.
29571 @opindex mg10
29572 @opindex mg13
29573 @opindex mg14
29574 @opindex mrl78
29575 @item -mg10
29576 @itemx -mg13
29577 @itemx -mg14
29578 @itemx -mrl78
29579 These are aliases for the corresponding @option{-mcpu=} option.  They
29580 are provided for backwards compatibility.
29582 @opindex mallregs
29583 @item -mallregs
29584 Allow the compiler to use all of the available registers.  By default
29585 registers @code{r24..r31} are reserved for use in interrupt handlers.
29586 With this option enabled these registers can be used in ordinary
29587 functions as well.
29589 @opindex m64bit-doubles
29590 @opindex m32bit-doubles
29591 @item -m64bit-doubles
29592 @itemx -m32bit-doubles
29593 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
29594 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
29595 @option{-m32bit-doubles}.
29597 @opindex msave-mduc-in-interrupts
29598 @opindex mno-save-mduc-in-interrupts
29599 @item -msave-mduc-in-interrupts
29600 @itemx -mno-save-mduc-in-interrupts
29601 Specifies that interrupt handler functions should preserve the
29602 MDUC registers.  This is only necessary if normal code might use
29603 the MDUC registers, for example because it performs multiplication
29604 and division operations.  The default is to ignore the MDUC registers
29605 as this makes the interrupt handlers faster.  The target option -mg13
29606 needs to be passed for this to work as this feature is only available
29607 on the G13 target (S2 core).  The MDUC registers will only be saved
29608 if the interrupt handler performs a multiplication or division
29609 operation or it calls another function.
29611 @end table
29613 @node RS/6000 and PowerPC Options
29614 @subsection IBM RS/6000 and PowerPC Options
29615 @cindex RS/6000 and PowerPC Options
29616 @cindex IBM RS/6000 and PowerPC Options
29618 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
29619 @table @gcctabopt
29620 @item -mpowerpc-gpopt
29621 @itemx -mno-powerpc-gpopt
29622 @itemx -mpowerpc-gfxopt
29623 @itemx -mno-powerpc-gfxopt
29624 @need 800
29625 @itemx -mpowerpc64
29626 @itemx -mno-powerpc64
29627 @itemx -mmfcrf
29628 @itemx -mno-mfcrf
29629 @itemx -mpopcntb
29630 @itemx -mno-popcntb
29631 @itemx -mpopcntd
29632 @itemx -mno-popcntd
29633 @itemx -mfprnd
29634 @itemx -mno-fprnd
29635 @need 800
29636 @opindex mpowerpc-gpopt
29637 @opindex mno-powerpc-gpopt
29638 @opindex mpowerpc-gfxopt
29639 @opindex mno-powerpc-gfxopt
29640 @opindex mpowerpc64
29641 @opindex mno-powerpc64
29642 @opindex mmfcrf
29643 @opindex mno-mfcrf
29644 @opindex mpopcntb
29645 @opindex mno-popcntb
29646 @opindex mpopcntd
29647 @opindex mno-popcntd
29648 @opindex mfprnd
29649 @opindex mno-fprnd
29650 @opindex mcmpb
29651 @opindex mno-cmpb
29652 @opindex mhard-dfp
29653 @opindex mno-hard-dfp
29654 @itemx -mcmpb
29655 @itemx -mno-cmpb
29656 @itemx -mhard-dfp
29657 @itemx -mno-hard-dfp
29658 You use these options to specify which instructions are available on the
29659 processor you are using.  The default value of these options is
29660 determined when configuring GCC@.  Specifying the
29661 @option{-mcpu=@var{cpu_type}} overrides the specification of these
29662 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
29663 rather than the options listed above.
29665 Specifying @option{-mpowerpc-gpopt} allows
29666 GCC to use the optional PowerPC architecture instructions in the
29667 General Purpose group, including floating-point square root.  Specifying
29668 @option{-mpowerpc-gfxopt} allows GCC to
29669 use the optional PowerPC architecture instructions in the Graphics
29670 group, including floating-point select.
29672 The @option{-mmfcrf} option allows GCC to generate the move from
29673 condition register field instruction implemented on the POWER4
29674 processor and other processors that support the PowerPC V2.01
29675 architecture.
29676 The @option{-mpopcntb} option allows GCC to generate the popcount and
29677 double-precision FP reciprocal estimate instruction implemented on the
29678 POWER5 processor and other processors that support the PowerPC V2.02
29679 architecture.
29680 The @option{-mpopcntd} option allows GCC to generate the popcount
29681 instruction implemented on the POWER7 processor and other processors
29682 that support the PowerPC V2.06 architecture.
29683 The @option{-mfprnd} option allows GCC to generate the FP round to
29684 integer instructions implemented on the POWER5+ processor and other
29685 processors that support the PowerPC V2.03 architecture.
29686 The @option{-mcmpb} option allows GCC to generate the compare bytes
29687 instruction implemented on the POWER6 processor and other processors
29688 that support the PowerPC V2.05 architecture.
29689 The @option{-mhard-dfp} option allows GCC to generate the decimal
29690 floating-point instructions implemented on some POWER processors.
29692 The @option{-mpowerpc64} option allows GCC to generate the additional
29693 64-bit instructions that are found in the full PowerPC64 architecture
29694 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
29695 @option{-mno-powerpc64}.
29697 @opindex mcpu
29698 @item -mcpu=@var{cpu_type}
29699 Set architecture type, register usage, and
29700 instruction scheduling parameters for machine type @var{cpu_type}.
29701 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
29702 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
29703 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
29704 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
29705 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
29706 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
29707 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
29708 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
29709 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
29710 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
29711 @samp{power9}, @samp{power10}, @samp{powerpc}, @samp{powerpc64},
29712 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
29714 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
29715 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
29716 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
29717 architecture machine types, with an appropriate, generic processor
29718 model assumed for scheduling purposes.
29720 Specifying @samp{native} as cpu type detects and selects the
29721 architecture option that corresponds to the host processor of the
29722 system performing the compilation.
29723 @option{-mcpu=native} has no effect if GCC does not recognize the
29724 processor.
29726 The other options specify a specific processor.  Code generated under
29727 those options runs best on that processor, and may not run at all on
29728 others.
29730 The @option{-mcpu} options automatically enable or disable the
29731 following options:
29733 @gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple
29734 -mpopcntb  -mpopcntd  -mpowerpc64
29735 -mpowerpc-gpopt  -mpowerpc-gfxopt
29736 -mmulhw  -mdlmzb  -mmfpgpr  -mvsx
29737 -mcrypto  -mhtm  -mpower8-fusion  -mpower8-vector
29738 -mquad-memory  -mquad-memory-atomic  -mfloat128
29739 -mfloat128-hardware -mprefixed -mpcrel -mmma
29740 -mrop-protect}
29742 The particular options set for any particular CPU varies between
29743 compiler versions, depending on what setting seems to produce optimal
29744 code for that CPU; it doesn't necessarily reflect the actual hardware's
29745 capabilities.  If you wish to set an individual option to a particular
29746 value, you may specify it after the @option{-mcpu} option, like
29747 @option{-mcpu=970 -mno-altivec}.
29749 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
29750 not enabled or disabled by the @option{-mcpu} option at present because
29751 AIX does not have full support for these options.  You may still
29752 enable or disable them individually if you're sure it'll work in your
29753 environment.
29755 @opindex mtune
29756 @item -mtune=@var{cpu_type}
29757 Set the instruction scheduling parameters for machine type
29758 @var{cpu_type}, but do not set the architecture type or register usage,
29759 as @option{-mcpu=@var{cpu_type}} does.  The same
29760 values for @var{cpu_type} are used for @option{-mtune} as for
29761 @option{-mcpu}.  If both are specified, the code generated uses the
29762 architecture and registers set by @option{-mcpu}, but the
29763 scheduling parameters set by @option{-mtune}.
29765 @opindex mcmodel=small
29766 @item -mcmodel=small
29767 Generate PowerPC64 code for the small model: The TOC is limited to
29768 64k.
29770 @opindex mcmodel=medium
29771 @item -mcmodel=medium
29772 Generate PowerPC64 code for the medium model: The TOC and other static
29773 data may be up to a total of 4G in size.  This is the default for 64-bit
29774 Linux.
29776 @opindex mcmodel=large
29777 @item -mcmodel=large
29778 Generate PowerPC64 code for the large model: The TOC may be up to 4G
29779 in size.  Other data and code is only limited by the 64-bit address
29780 space.
29782 @opindex maltivec
29783 @opindex mno-altivec
29784 @item -maltivec
29785 @itemx -mno-altivec
29786 Generate code that uses (does not use) AltiVec instructions, and also
29787 enable the use of built-in functions that allow more direct access to
29788 the AltiVec instruction set.  You may also need to set
29789 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
29790 enhancements.
29792 When @option{-maltivec} is used, the element order for AltiVec intrinsics
29793 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 
29794 match array element order corresponding to the endianness of the
29795 target.  That is, element zero identifies the leftmost element in a
29796 vector register when targeting a big-endian platform, and identifies
29797 the rightmost element in a vector register when targeting a
29798 little-endian platform.
29800 @opindex mvrsave
29801 @opindex mno-vrsave
29802 @item -mvrsave
29803 @itemx -mno-vrsave
29804 Generate VRSAVE instructions when generating AltiVec code.
29806 @opindex msecure-plt
29807 @item -msecure-plt
29808 Generate code that allows @command{ld} and @command{ld.so}
29809 to build executables and shared
29810 libraries with non-executable @code{.plt} and @code{.got} sections.
29811 This is a PowerPC
29812 32-bit SYSV ABI option.
29814 @opindex mbss-plt
29815 @item -mbss-plt
29816 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
29817 fills in, and
29818 requires @code{.plt} and @code{.got}
29819 sections that are both writable and executable.
29820 This is a PowerPC 32-bit SYSV ABI option.
29822 @opindex misel
29823 @opindex mno-isel
29824 @item -misel
29825 @itemx -mno-isel
29826 This switch enables or disables the generation of ISEL instructions.
29828 @opindex mvsx
29829 @opindex mno-vsx
29830 @item -mvsx
29831 @itemx -mno-vsx
29832 Generate code that uses (does not use) vector/scalar (VSX)
29833 instructions, and also enable the use of built-in functions that allow
29834 more direct access to the VSX instruction set.
29836 @opindex mcrypto
29837 @opindex mno-crypto
29838 @item -mcrypto
29839 @itemx -mno-crypto
29840 Enable the use (disable) of the built-in functions that allow direct
29841 access to the cryptographic instructions that were added in version
29842 2.07 of the PowerPC ISA.
29844 @opindex mhtm
29845 @opindex mno-htm
29846 @item -mhtm
29847 @itemx -mno-htm
29848 Enable (disable) the use of the built-in functions that allow direct
29849 access to the Hardware Transactional Memory (HTM) instructions that
29850 were added in version 2.07 of the PowerPC ISA.
29852 @opindex mpower8-fusion
29853 @opindex mno-power8-fusion
29854 @item -mpower8-fusion
29855 @itemx -mno-power8-fusion
29856 Generate code that keeps (does not keeps) some integer operations
29857 adjacent so that the instructions can be fused together on power8 and
29858 later processors.
29860 @opindex mpower8-vector
29861 @opindex mno-power8-vector
29862 @item -mpower8-vector
29863 @itemx -mno-power8-vector
29864 Generate code that uses (does not use) the vector and scalar
29865 instructions that were added in version 2.07 of the PowerPC ISA.  Also
29866 enable the use of built-in functions that allow more direct access to
29867 the vector instructions.
29869 @opindex mquad-memory
29870 @opindex mno-quad-memory
29871 @item -mquad-memory
29872 @itemx -mno-quad-memory
29873 Generate code that uses (does not use) the non-atomic quad word memory
29874 instructions.  The @option{-mquad-memory} option requires use of
29875 64-bit mode.
29877 @opindex mquad-memory-atomic
29878 @opindex mno-quad-memory-atomic
29879 @item -mquad-memory-atomic
29880 @itemx -mno-quad-memory-atomic
29881 Generate code that uses (does not use) the atomic quad word memory
29882 instructions.  The @option{-mquad-memory-atomic} option requires use of
29883 64-bit mode.
29885 @opindex mfloat128
29886 @opindex mno-float128
29887 @item -mfloat128
29888 @itemx -mno-float128
29889 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
29890 and use either software emulation for IEEE 128-bit floating point or
29891 hardware instructions.
29893 The VSX instruction set (@option{-mvsx}) must be enabled to use the IEEE
29894 128-bit floating point support.  The IEEE 128-bit floating point is only
29895 supported on Linux.
29897 The default for @option{-mfloat128} is enabled on PowerPC Linux
29898 systems using the VSX instruction set, and disabled on other systems.
29900 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
29901 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
29902 point support will also enable the generation of ISA 3.0 IEEE 128-bit
29903 floating point instructions.  Otherwise, if you do not specify to
29904 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
29905 system, IEEE 128-bit floating point will be done with software
29906 emulation.
29908 @opindex mfloat128-hardware
29909 @opindex mno-float128-hardware
29910 @item -mfloat128-hardware
29911 @itemx -mno-float128-hardware
29912 Enable/disable using ISA 3.0 hardware instructions to support the
29913 @var{__float128} data type.
29915 The default for @option{-mfloat128-hardware} is enabled on PowerPC
29916 Linux systems using the ISA 3.0 instruction set, and disabled on other
29917 systems.
29919 @opindex m32
29920 @opindex m64
29921 @item -m32
29922 @itemx -m64
29923 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
29924 targets (including GNU/Linux).  The 32-bit environment sets int, long
29925 and pointer to 32 bits and generates code that runs on any PowerPC
29926 variant.  The 64-bit environment sets int to 32 bits and long and
29927 pointer to 64 bits, and generates code for PowerPC64, as for
29928 @option{-mpowerpc64}.
29930 @opindex mfull-toc
29931 @opindex mno-fp-in-toc
29932 @opindex mno-sum-in-toc
29933 @opindex mminimal-toc
29934 @item -mfull-toc
29935 @itemx -mno-fp-in-toc
29936 @itemx -mno-sum-in-toc
29937 @itemx -mminimal-toc
29938 Modify generation of the TOC (Table Of Contents), which is created for
29939 every executable file.  The @option{-mfull-toc} option is selected by
29940 default.  In that case, GCC allocates at least one TOC entry for
29941 each unique non-automatic variable reference in your program.  GCC
29942 also places floating-point constants in the TOC@.  However, only
29943 16,384 entries are available in the TOC@.
29945 If you receive a linker error message that saying you have overflowed
29946 the available TOC space, you can reduce the amount of TOC space used
29947 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
29948 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
29949 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
29950 generate code to calculate the sum of an address and a constant at
29951 run time instead of putting that sum into the TOC@.  You may specify one
29952 or both of these options.  Each causes GCC to produce very slightly
29953 slower and larger code at the expense of conserving TOC space.
29955 If you still run out of space in the TOC even when you specify both of
29956 these options, specify @option{-mminimal-toc} instead.  This option causes
29957 GCC to make only one TOC entry for every file.  When you specify this
29958 option, GCC produces code that is slower and larger but which
29959 uses extremely little TOC space.  You may wish to use this option
29960 only on files that contain less frequently-executed code.
29962 @opindex maix64
29963 @opindex maix32
29964 @item -maix64
29965 @itemx -maix32
29966 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
29967 @code{long} type, and the infrastructure needed to support them.
29968 Specifying @option{-maix64} implies @option{-mpowerpc64},
29969 while @option{-maix32} disables the 64-bit ABI and
29970 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
29972 @opindex mxl-compat
29973 @opindex mno-xl-compat
29974 @item -mxl-compat
29975 @itemx -mno-xl-compat
29976 Produce code that conforms more closely to IBM XL compiler semantics
29977 when using AIX-compatible ABI@.  Pass floating-point arguments to
29978 prototyped functions beyond the register save area (RSA) on the stack
29979 in addition to argument FPRs.  Do not assume that most significant
29980 double in 128-bit long double value is properly rounded when comparing
29981 values and converting to double.  Use XL symbol names for long double
29982 support routines.
29984 The AIX calling convention was extended but not initially documented to
29985 handle an obscure K&R C case of calling a function that takes the
29986 address of its arguments with fewer arguments than declared.  IBM XL
29987 compilers access floating-point arguments that do not fit in the
29988 RSA from the stack when a subroutine is compiled without
29989 optimization.  Because always storing floating-point arguments on the
29990 stack is inefficient and rarely needed, this option is not enabled by
29991 default and only is necessary when calling subroutines compiled by IBM
29992 XL compilers without optimization.
29994 @opindex mpe
29995 @item -mpe
29996 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
29997 application written to use message passing with special startup code to
29998 enable the application to run.  The system must have PE installed in the
29999 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
30000 must be overridden with the @option{-specs=} option to specify the
30001 appropriate directory location.  The Parallel Environment does not
30002 support threads, so the @option{-mpe} option and the @option{-pthread}
30003 option are incompatible.
30005 @opindex malign-natural
30006 @opindex malign-power
30007 @item -malign-natural
30008 @itemx -malign-power
30009 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
30010 @option{-malign-natural} overrides the ABI-defined alignment of larger
30011 types, such as floating-point doubles, on their natural size-based boundary.
30012 The option @option{-malign-power} instructs GCC to follow the ABI-specified
30013 alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
30015 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
30016 is not supported.
30018 @opindex msoft-float
30019 @opindex mhard-float
30020 @item -msoft-float
30021 @itemx -mhard-float
30022 Generate code that does not use (uses) the floating-point register set.
30023 Software floating-point emulation is provided if you use the
30024 @option{-msoft-float} option, and pass the option to GCC when linking.
30026 @opindex mmultiple
30027 @opindex mno-multiple
30028 @item -mmultiple
30029 @itemx -mno-multiple
30030 Generate code that uses (does not use) the load multiple word
30031 instructions and the store multiple word instructions.  These
30032 instructions are generated by default on POWER systems, and not
30033 generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
30034 PowerPC systems, since those instructions do not work when the
30035 processor is in little-endian mode.  The exceptions are PPC740 and
30036 PPC750 which permit these instructions in little-endian mode.
30038 @opindex mupdate
30039 @opindex mno-update
30040 @item -mupdate
30041 @itemx -mno-update
30042 Generate code that uses (does not use) the load or store instructions
30043 that update the base register to the address of the calculated memory
30044 location.  These instructions are generated by default.  If you use
30045 @option{-mno-update}, there is a small window between the time that the
30046 stack pointer is updated and the address of the previous frame is
30047 stored, which means code that walks the stack frame across interrupts or
30048 signals may get corrupted data.
30050 @opindex mavoid-indexed-addresses
30051 @opindex mno-avoid-indexed-addresses
30052 @item -mavoid-indexed-addresses
30053 @itemx -mno-avoid-indexed-addresses
30054 Generate code that tries to avoid (not avoid) the use of indexed load
30055 or store instructions. These instructions can incur a performance
30056 penalty on Power6 processors in certain situations, such as when
30057 stepping through large arrays that cross a 16M boundary.  This option
30058 is enabled by default when targeting Power6 and disabled otherwise.
30060 @opindex mfused-madd
30061 @opindex mno-fused-madd
30062 @item -mfused-madd
30063 @itemx -mno-fused-madd
30064 Generate code that uses (does not use) the floating-point multiply and
30065 accumulate instructions.  These instructions are generated by default
30066 if hardware floating point is used.  The machine-dependent
30067 @option{-mfused-madd} option is now mapped to the machine-independent
30068 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
30069 mapped to @option{-ffp-contract=off}.
30071 @opindex mmulhw
30072 @opindex mno-mulhw
30073 @item -mmulhw
30074 @itemx -mno-mulhw
30075 Generate code that uses (does not use) the half-word multiply and
30076 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
30077 These instructions are generated by default when targeting those
30078 processors.
30080 @opindex mdlmzb
30081 @opindex mno-dlmzb
30082 @item -mdlmzb
30083 @itemx -mno-dlmzb
30084 Generate code that uses (does not use) the string-search @samp{dlmzb}
30085 instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
30086 generated by default when targeting those processors.
30088 @opindex mno-bit-align
30089 @opindex mbit-align
30090 @item -mno-bit-align
30091 @itemx -mbit-align
30092 On System V.4 and embedded PowerPC systems do not (do) force structures
30093 and unions that contain bit-fields to be aligned to the base type of the
30094 bit-field.
30096 For example, by default a structure containing nothing but 8
30097 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
30098 boundary and has a size of 4 bytes.  By using @option{-mno-bit-align},
30099 the structure is aligned to a 1-byte boundary and is 1 byte in
30100 size.
30102 @opindex mno-strict-align
30103 @opindex mstrict-align
30104 @item -mno-strict-align
30105 @itemx -mstrict-align
30106 On System V.4 and embedded PowerPC systems do not (do) assume that
30107 unaligned memory references are handled by the system.
30109 @opindex mrelocatable
30110 @opindex mno-relocatable
30111 @item -mrelocatable
30112 @itemx -mno-relocatable
30113 Generate code that allows (does not allow) a static executable to be
30114 relocated to a different address at run time.  A simple embedded
30115 PowerPC system loader should relocate the entire contents of
30116 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
30117 a table of 32-bit addresses generated by this option.  For this to
30118 work, all objects linked together must be compiled with
30119 @option{-mrelocatable} or @option{-mrelocatable-lib}.
30120 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
30122 @opindex mrelocatable-lib
30123 @opindex mno-relocatable-lib
30124 @item -mrelocatable-lib
30125 @itemx -mno-relocatable-lib
30126 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
30127 @code{.fixup} section to allow static executables to be relocated at
30128 run time, but @option{-mrelocatable-lib} does not use the smaller stack
30129 alignment of @option{-mrelocatable}.  Objects compiled with
30130 @option{-mrelocatable-lib} may be linked with objects compiled with
30131 any combination of the @option{-mrelocatable} options.
30133 @opindex mno-toc
30134 @opindex mtoc
30135 @item -mno-toc
30136 @itemx -mtoc
30137 On System V.4 and embedded PowerPC systems do not (do) assume that
30138 register 2 contains a pointer to a global area pointing to the addresses
30139 used in the program.
30141 @opindex mlittle
30142 @opindex mlittle-endian
30143 @item -mlittle
30144 @itemx -mlittle-endian
30145 On System V.4 and embedded PowerPC systems compile code for the
30146 processor in little-endian mode.  The @option{-mlittle-endian} option is
30147 the same as @option{-mlittle}.
30149 @opindex mbig
30150 @opindex mbig-endian
30151 @item -mbig
30152 @itemx -mbig-endian
30153 On System V.4 and embedded PowerPC systems compile code for the
30154 processor in big-endian mode.  The @option{-mbig-endian} option is
30155 the same as @option{-mbig}.
30157 @opindex mdynamic-no-pic
30158 @item -mdynamic-no-pic
30159 On Darwin / macOS systems, compile code so that it is not
30160 relocatable, but that its external references are relocatable.  The
30161 resulting code is suitable for applications, but not shared
30162 libraries.
30164 @opindex msingle-pic-base
30165 @item -msingle-pic-base
30166 Treat the register used for PIC addressing as read-only, rather than
30167 loading it in the prologue for each function.  The runtime system is
30168 responsible for initializing this register with an appropriate value
30169 before execution begins.
30171 @opindex mprioritize-restricted-insns
30172 @item -mprioritize-restricted-insns=@var{priority}
30173 This option controls the priority that is assigned to
30174 dispatch-slot restricted instructions during the second scheduling
30175 pass.  The argument @var{priority} takes the value @samp{0}, @samp{1},
30176 or @samp{2} to assign no, highest, or second-highest (respectively) 
30177 priority to dispatch-slot restricted
30178 instructions.
30180 @opindex msched-costly-dep
30181 @item -msched-costly-dep=@var{dependence_type}
30182 This option controls which dependences are considered costly
30183 by the target during instruction scheduling.  The argument
30184 @var{dependence_type} takes one of the following values:
30186 @table @asis
30187 @item @samp{no}
30188 No dependence is costly.
30190 @item @samp{all}
30191 All dependences are costly.
30193 @item @samp{true_store_to_load}
30194 A true dependence from store to load is costly.
30196 @item @samp{store_to_load}
30197 Any dependence from store to load is costly.
30199 @item @var{number}
30200 Any dependence for which the latency is greater than or equal to 
30201 @var{number} is costly.
30202 @end table
30204 @opindex minsert-sched-nops
30205 @item -minsert-sched-nops=@var{scheme}
30206 This option controls which NOP insertion scheme is used during
30207 the second scheduling pass.  The argument @var{scheme} takes one of the
30208 following values:
30210 @table @asis
30211 @item @samp{no}
30212 Don't insert NOPs.
30214 @item @samp{pad}
30215 Pad with NOPs any dispatch group that has vacant issue slots,
30216 according to the scheduler's grouping.
30218 @item @samp{regroup_exact}
30219 Insert NOPs to force costly dependent insns into
30220 separate groups.  Insert exactly as many NOPs as needed to force an insn
30221 to a new group, according to the estimated processor grouping.
30223 @item @var{number}
30224 Insert NOPs to force costly dependent insns into
30225 separate groups.  Insert @var{number} NOPs to force an insn to a new group.
30226 @end table
30228 @opindex mcall-sysv
30229 @item -mcall-sysv
30230 On System V.4 and embedded PowerPC systems compile code using calling
30231 conventions that adhere to the March 1995 draft of the System V
30232 Application Binary Interface, PowerPC processor supplement.  This is the
30233 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
30235 @opindex mcall-sysv-eabi
30236 @opindex mcall-eabi
30237 @item -mcall-sysv-eabi
30238 @itemx -mcall-eabi
30239 Specify both @option{-mcall-sysv} and @option{-meabi} options.
30241 @opindex mcall-sysv-noeabi
30242 @item -mcall-sysv-noeabi
30243 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
30245 @opindex mcall-aixdesc
30246 @item -mcall-aixdesc
30247 On System V.4 and embedded PowerPC systems compile code for the AIX
30248 operating system.
30250 @opindex mcall-linux
30251 @item -mcall-linux
30252 On System V.4 and embedded PowerPC systems compile code for the
30253 Linux-based GNU system.
30255 @opindex mcall-freebsd
30256 @item -mcall-freebsd
30257 On System V.4 and embedded PowerPC systems compile code for the
30258 FreeBSD operating system.
30260 @opindex mcall-netbsd
30261 @item -mcall-netbsd
30262 On System V.4 and embedded PowerPC systems compile code for the
30263 NetBSD operating system.
30265 @opindex mcall-openbsd
30266 @item -mcall-openbsd
30267 On System V.4 and embedded PowerPC systems compile code for the
30268 OpenBSD operating system.
30270 @opindex mtraceback
30271 @item -mtraceback=@var{traceback_type}
30272 Select the type of traceback table. Valid values for @var{traceback_type}
30273 are @samp{full}, @samp{part}, and @samp{no}.
30275 @opindex maix-struct-return
30276 @item -maix-struct-return
30277 Return all structures in memory (as specified by the AIX ABI)@.
30279 @opindex msvr4-struct-return
30280 @item -msvr4-struct-return
30281 Return structures smaller than 8 bytes in registers (as specified by the
30282 SVR4 ABI)@.
30284 @opindex mabi
30285 @item -mabi=@var{abi-type}
30286 Extend the current ABI with a particular extension, or remove such extension.
30287 Valid values are: @samp{altivec}, @samp{no-altivec},
30288 @samp{ibmlongdouble}, @samp{ieeelongdouble},
30289 @samp{elfv1}, @samp{elfv2},
30290 and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
30292 @opindex mabi=ibmlongdouble
30293 @item -mabi=ibmlongdouble
30294 Change the current ABI to use IBM extended-precision long double.
30295 This is not likely to work if your system defaults to using IEEE
30296 extended-precision long double.  If you change the long double type
30297 from IEEE extended-precision, the compiler will issue a warning unless
30298 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
30299 to be enabled.
30301 @opindex mabi=ieeelongdouble
30302 @item -mabi=ieeelongdouble
30303 Change the current ABI to use IEEE extended-precision long double.
30304 This is not likely to work if your system defaults to using IBM
30305 extended-precision long double.  If you change the long double type
30306 from IBM extended-precision, the compiler will issue a warning unless
30307 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
30308 to be enabled.
30310 @opindex mabi=elfv1
30311 @item -mabi=elfv1
30312 Change the current ABI to use the ELFv1 ABI.
30313 This is the default ABI for big-endian PowerPC 64-bit Linux.
30314 Overriding the default ABI requires special system support and is
30315 likely to fail in spectacular ways.
30317 @opindex mabi=elfv2
30318 @item -mabi=elfv2
30319 Change the current ABI to use the ELFv2 ABI.
30320 This is the default ABI for little-endian PowerPC 64-bit Linux.
30321 Overriding the default ABI requires special system support and is
30322 likely to fail in spectacular ways.
30324 @opindex mgnu-attribute
30325 @opindex mno-gnu-attribute
30326 @item -mgnu-attribute
30327 @itemx -mno-gnu-attribute
30328 Emit .gnu_attribute assembly directives to set tag/value pairs in a
30329 .gnu.attributes section that specify ABI variations in function
30330 parameters or return values.
30332 @opindex mprototype
30333 @opindex mno-prototype
30334 @item -mprototype
30335 @itemx -mno-prototype
30336 On System V.4 and embedded PowerPC systems assume that all calls to
30337 variable argument functions are properly prototyped.  Otherwise, the
30338 compiler must insert an instruction before every non-prototyped call to
30339 set or clear bit 6 of the condition code register (@code{CR}) to
30340 indicate whether floating-point values are passed in the floating-point
30341 registers in case the function takes variable arguments.  With
30342 @option{-mprototype}, only calls to prototyped variable argument functions
30343 set or clear the bit.
30345 @opindex msim
30346 @item -msim
30347 On embedded PowerPC systems, assume that the startup module is called
30348 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
30349 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
30350 configurations.
30352 @opindex mmvme
30353 @item -mmvme
30354 On embedded PowerPC systems, assume that the startup module is called
30355 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
30356 @file{libc.a}.
30358 @opindex mads
30359 @item -mads
30360 On embedded PowerPC systems, assume that the startup module is called
30361 @file{crt0.o} and the standard C libraries are @file{libads.a} and
30362 @file{libc.a}.
30364 @opindex myellowknife
30365 @item -myellowknife
30366 On embedded PowerPC systems, assume that the startup module is called
30367 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
30368 @file{libc.a}.
30370 @opindex mvxworks
30371 @item -mvxworks
30372 On System V.4 and embedded PowerPC systems, specify that you are
30373 compiling for a VxWorks system.
30375 @opindex memb
30376 @item -memb
30377 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
30378 header to indicate that @samp{eabi} extended relocations are used.
30380 @opindex meabi
30381 @opindex mno-eabi
30382 @item -meabi
30383 @itemx -mno-eabi
30384 On System V.4 and embedded PowerPC systems do (do not) adhere to the
30385 Embedded Applications Binary Interface (EABI), which is a set of
30386 modifications to the System V.4 specifications.  Selecting @option{-meabi}
30387 means that the stack is aligned to an 8-byte boundary, a function
30388 @code{__eabi} is called from @code{main} to set up the EABI
30389 environment, and the @option{-msdata} option can use both @code{r2} and
30390 @code{r13} to point to two separate small data areas.  Selecting
30391 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
30392 no EABI initialization function is called from @code{main}, and the
30393 @option{-msdata} option only uses @code{r13} to point to a single
30394 small data area.  The @option{-meabi} option is on by default if you
30395 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
30397 @opindex msdata=eabi
30398 @item -msdata=eabi
30399 On System V.4 and embedded PowerPC systems, put small initialized
30400 @code{const} global and static data in the @code{.sdata2} section, which
30401 is pointed to by register @code{r2}.  Put small initialized
30402 non-@code{const} global and static data in the @code{.sdata} section,
30403 which is pointed to by register @code{r13}.  Put small uninitialized
30404 global and static data in the @code{.sbss} section, which is adjacent to
30405 the @code{.sdata} section.  The @option{-msdata=eabi} option is
30406 incompatible with the @option{-mrelocatable} option.  The
30407 @option{-msdata=eabi} option also sets the @option{-memb} option.
30409 @opindex msdata=sysv
30410 @item -msdata=sysv
30411 On System V.4 and embedded PowerPC systems, put small global and static
30412 data in the @code{.sdata} section, which is pointed to by register
30413 @code{r13}.  Put small uninitialized global and static data in the
30414 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
30415 The @option{-msdata=sysv} option is incompatible with the
30416 @option{-mrelocatable} option.
30418 @opindex msdata=default
30419 @opindex msdata
30420 @item -msdata=default
30421 @itemx -msdata
30422 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
30423 compile code the same as @option{-msdata=eabi}, otherwise compile code the
30424 same as @option{-msdata=sysv}.
30426 @opindex msdata=data
30427 @item -msdata=data
30428 On System V.4 and embedded PowerPC systems, put small global
30429 data in the @code{.sdata} section.  Put small uninitialized global
30430 data in the @code{.sbss} section.  Do not use register @code{r13}
30431 to address small data however.  This is the default behavior unless
30432 other @option{-msdata} options are used.
30434 @opindex msdata=none
30435 @opindex mno-sdata
30436 @item -msdata=none
30437 @itemx -mno-sdata
30438 On embedded PowerPC systems, put all initialized global and static data
30439 in the @code{.data} section, and all uninitialized data in the
30440 @code{.bss} section.
30442 @opindex mreadonly-in-sdata
30443 @opindex mno-readonly-in-sdata
30444 @item -mreadonly-in-sdata
30445 Put read-only objects in the @code{.sdata} section as well.  This is the
30446 default.
30448 @opindex mblock-move-inline-limit
30449 @item -mblock-move-inline-limit=@var{num}
30450 Inline all block moves (such as calls to @code{memcpy} or structure
30451 copies) less than or equal to @var{num} bytes.  The minimum value for
30452 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
30453 targets.  The default value is target-specific.
30455 @opindex mblock-compare-inline-limit
30456 @item -mblock-compare-inline-limit=@var{num}
30457 Generate non-looping inline code for all block compares (such as calls
30458 to @code{memcmp} or structure compares) less than or equal to @var{num}
30459 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
30460 block compare is disabled. The default value is target-specific.
30462 @opindex mblock-compare-inline-loop-limit
30463 @item -mblock-compare-inline-loop-limit=@var{num}
30464 Generate an inline expansion using loop code for all block compares that
30465 are less than or equal to @var{num} bytes, but greater than the limit
30466 for non-loop inline block compare expansion. If the block length is not
30467 constant, at most @var{num} bytes will be compared before @code{memcmp}
30468 is called to compare the remainder of the block. The default value is
30469 target-specific.
30471 @opindex mstring-compare-inline-limit
30472 @item -mstring-compare-inline-limit=@var{num}
30473 Compare at most @var{num} string bytes with inline code.
30474 If the difference or end of string is not found at the
30475 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
30476 take care of the rest of the comparison. The default is 64 bytes.
30478 @opindex G
30479 @cindex smaller data references (PowerPC)
30480 @cindex .sdata/.sdata2 references (PowerPC)
30481 @item -G @var{num}
30482 On embedded PowerPC systems, put global and static items less than or
30483 equal to @var{num} bytes into the small data or BSS sections instead of
30484 the normal data or BSS section.  By default, @var{num} is 8.  The
30485 @option{-G @var{num}} switch is also passed to the linker.
30486 All modules should be compiled with the same @option{-G @var{num}} value.
30488 @opindex mregnames
30489 @opindex mno-regnames
30490 @item -mregnames
30491 @itemx -mno-regnames
30492 On System V.4 and embedded PowerPC systems do (do not) emit register
30493 names in the assembly language output using symbolic forms.
30495 @opindex mlongcall
30496 @opindex mno-longcall
30497 @item -mlongcall
30498 @itemx -mno-longcall
30499 By default assume that all calls are far away so that a longer and more
30500 expensive calling sequence is required.  This is required for calls
30501 farther than 32 megabytes (33,554,432 bytes) from the current location.
30502 A short call is generated if the compiler knows
30503 the call cannot be that far away.  This setting can be overridden by
30504 the @code{shortcall} function attribute, or by @code{#pragma
30505 longcall(0)}.
30507 Some linkers are capable of detecting out-of-range calls and generating
30508 glue code on the fly.  On these systems, long calls are unnecessary and
30509 generate slower code.  As of this writing, the AIX linker can do this,
30510 as can the GNU linker for PowerPC/64.  It is planned to add this feature
30511 to the GNU linker for 32-bit PowerPC systems as well.
30513 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
30514 GCC can generate long calls using an inline PLT call sequence (see
30515 @option{-mpltseq}).  PowerPC with @option{-mbss-plt} and PowerPC64
30516 ELFv1 (big-endian) do not support inline PLT calls.
30518 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
30519 callee, L42}, plus a @dfn{branch island} (glue code).  The two target
30520 addresses represent the callee and the branch island.  The
30521 Darwin/PPC linker prefers the first address and generates a @code{bl
30522 callee} if the PPC @code{bl} instruction reaches the callee directly;
30523 otherwise, the linker generates @code{bl L42} to call the branch
30524 island.  The branch island is appended to the body of the
30525 calling function; it computes the full 32-bit address of the callee
30526 and jumps to it.
30528 On Mach-O (Darwin) systems, this option directs the compiler emit to
30529 the glue for every direct call, and the Darwin linker decides whether
30530 to use or discard it.
30532 In the future, GCC may ignore all longcall specifications
30533 when the linker is known to generate glue.
30535 @opindex mpltseq
30536 @opindex mno-pltseq
30537 @item -mpltseq
30538 @itemx -mno-pltseq
30539 Implement (do not implement) -fno-plt and long calls using an inline
30540 PLT call sequence that supports lazy linking and long calls to
30541 functions in dlopen'd shared libraries.  Inline PLT calls are only
30542 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
30543 linkers, and are enabled by default if the support is detected when
30544 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
30545 configured with @option{--enable-secureplt}.  @option{-mpltseq} code
30546 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
30547 linked together.
30549 @opindex mtls-markers
30550 @opindex mno-tls-markers
30551 @item -mtls-markers
30552 @itemx -mno-tls-markers
30553 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
30554 specifying the function argument.  The relocation allows the linker to
30555 reliably associate function call with argument setup instructions for
30556 TLS optimization, which in turn allows GCC to better schedule the
30557 sequence.
30559 @opindex mrecip
30560 @item -mrecip
30561 @itemx -mno-recip
30562 This option enables use of the reciprocal estimate and
30563 reciprocal square root estimate instructions with additional
30564 Newton-Raphson steps to increase precision instead of doing a divide or
30565 square root and divide for floating-point arguments.  You should use
30566 the @option{-ffast-math} option when using @option{-mrecip} (or at
30567 least @option{-funsafe-math-optimizations},
30568 @option{-ffinite-math-only}, @option{-freciprocal-math} and
30569 @option{-fno-trapping-math}).  Note that while the throughput of the
30570 sequence is generally higher than the throughput of the non-reciprocal
30571 instruction, the precision of the sequence can be decreased by up to 2
30572 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
30573 roots.
30575 @opindex mrecip=opt
30576 @item -mrecip=@var{opt}
30577 This option controls which reciprocal estimate instructions
30578 may be used.  @var{opt} is a comma-separated list of options, which may
30579 be preceded by a @code{!} to invert the option:
30581 @table @samp
30583 @item all
30584 Enable all estimate instructions.
30586 @item default 
30587 Enable the default instructions, equivalent to @option{-mrecip}.
30589 @item none 
30590 Disable all estimate instructions, equivalent to @option{-mno-recip}.
30592 @item div 
30593 Enable the reciprocal approximation instructions for both 
30594 single and double precision.
30596 @item divf 
30597 Enable the single-precision reciprocal approximation instructions.
30599 @item divd 
30600 Enable the double-precision reciprocal approximation instructions.
30602 @item rsqrt 
30603 Enable the reciprocal square root approximation instructions for both
30604 single and double precision.
30606 @item rsqrtf 
30607 Enable the single-precision reciprocal square root approximation instructions.
30609 @item rsqrtd 
30610 Enable the double-precision reciprocal square root approximation instructions.
30612 @end table
30614 So, for example, @option{-mrecip=all,!rsqrtd} enables
30615 all of the reciprocal estimate instructions, except for the
30616 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
30617 which handle the double-precision reciprocal square root calculations.
30619 @opindex mrecip-precision
30620 @item -mrecip-precision
30621 @itemx -mno-recip-precision
30622 Assume (do not assume) that the reciprocal estimate instructions
30623 provide higher-precision estimates than is mandated by the PowerPC
30624 ABI.  Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
30625 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
30626 The double-precision square root estimate instructions are not generated by
30627 default on low-precision machines, since they do not provide an
30628 estimate that converges after three steps.
30630 @opindex mveclibabi
30631 @item -mveclibabi=@var{type}
30632 Specifies the ABI type to use for vectorizing intrinsics using an
30633 external library.  The only type supported at present is @samp{mass},
30634 which specifies to use IBM's Mathematical Acceleration Subsystem
30635 (MASS) libraries for vectorizing intrinsics using external libraries.
30636 GCC currently emits calls to @code{acosd2}, @code{acosf4},
30637 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
30638 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
30639 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
30640 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
30641 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
30642 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
30643 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
30644 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
30645 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
30646 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
30647 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
30648 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
30649 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
30650 for power7.  Both @option{-ftree-vectorize} and
30651 @option{-funsafe-math-optimizations} must also be enabled.  The MASS
30652 libraries must be specified at link time.
30654 @opindex mfriz
30655 @item -mfriz
30656 @itemx -mno-friz
30657 Generate (do not generate) the @code{friz} instruction when the
30658 @option{-funsafe-math-optimizations} option is used to optimize
30659 rounding of floating-point values to 64-bit integer and back to floating
30660 point.  The @code{friz} instruction does not return the same value if
30661 the floating-point number is too large to fit in an integer.
30663 @opindex mpointers-to-nested-functions
30664 @item -mpointers-to-nested-functions
30665 @itemx -mno-pointers-to-nested-functions
30666 Generate (do not generate) code to load up the static chain register
30667 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
30668 systems where a function pointer points to a 3-word descriptor giving
30669 the function address, TOC value to be loaded in register @code{r2}, and
30670 static chain value to be loaded in register @code{r11}.  The
30671 @option{-mpointers-to-nested-functions} is on by default.  You cannot
30672 call through pointers to nested functions or pointers
30673 to functions compiled in other languages that use the static chain if
30674 you use @option{-mno-pointers-to-nested-functions}.
30676 @opindex msave-toc-indirect
30677 @item -msave-toc-indirect
30678 @itemx -mno-save-toc-indirect
30679 Generate (do not generate) code to save the TOC value in the reserved
30680 stack location in the function prologue if the function calls through
30681 a pointer on AIX and 64-bit Linux systems.  If the TOC value is not
30682 saved in the prologue, it is saved just before the call through the
30683 pointer.  The @option{-mno-save-toc-indirect} option is the default.
30685 @opindex mcompat-align-parm
30686 @item -mcompat-align-parm
30687 @itemx -mno-compat-align-parm
30688 Generate (do not generate) code to pass structure parameters with a
30689 maximum alignment of 64 bits, for compatibility with older versions
30690 of GCC.
30692 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
30693 structure parameter on a 128-bit boundary when that structure contained
30694 a member requiring 128-bit alignment.  This is corrected in more
30695 recent versions of GCC.  This option may be used to generate code
30696 that is compatible with functions compiled with older versions of
30697 GCC.
30699 The @option{-mno-compat-align-parm} option is the default.
30701 @opindex mstack-protector-guard
30702 @opindex mstack-protector-guard-reg
30703 @opindex mstack-protector-guard-offset
30704 @opindex mstack-protector-guard-symbol
30705 @item -mstack-protector-guard=@var{guard}
30706 @itemx -mstack-protector-guard-reg=@var{reg}
30707 @itemx -mstack-protector-guard-offset=@var{offset}
30708 @itemx -mstack-protector-guard-symbol=@var{symbol}
30709 Generate stack protection code using canary at @var{guard}.  Supported
30710 locations are @samp{global} for global canary or @samp{tls} for per-thread
30711 canary in the TLS block (the default with GNU libc version 2.4 or later).
30713 With the latter choice the options
30714 @option{-mstack-protector-guard-reg=@var{reg}} and
30715 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
30716 which register to use as base register for reading the canary, and from what
30717 offset from that base register. The default for those is as specified in the
30718 relevant ABI.  @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
30719 the offset with a symbol reference to a canary in the TLS block.
30721 @opindex mpcrel
30722 @opindex mno-pcrel
30723 @item -mpcrel
30724 @itemx -mno-pcrel
30725 Generate (do not generate) pc-relative addressing.  The @option{-mpcrel}
30726 option requires that the medium code model (@option{-mcmodel=medium})
30727 and prefixed addressing (@option{-mprefixed}) options are enabled.
30729 @opindex mprefixed
30730 @opindex mno-prefixed
30731 @item -mprefixed
30732 @itemx -mno-prefixed
30733 Generate (do not generate) addressing modes using prefixed load and
30734 store instructions.  The @option{-mprefixed} option requires that
30735 the option @option{-mcpu=power10} (or later) is enabled.
30737 @opindex mmma
30738 @opindex mno-mma
30739 @item -mmma
30740 @itemx -mno-mma
30741 Generate (do not generate) the MMA instructions.  The @option{-mma}
30742 option requires that the option @option{-mcpu=power10} (or later)
30743 is enabled.
30745 @opindex mrop-protect
30746 @opindex mno-rop-protect
30747 @item -mrop-protect
30748 @itemx -mno-rop-protect
30749 Generate (do not generate) ROP protection instructions when the target
30750 processor supports them.  Currently this option disables the shrink-wrap
30751 optimization (@option{-fshrink-wrap}).
30753 @opindex mprivileged
30754 @opindex mno-privileged
30755 @item -mprivileged
30756 @itemx -mno-privileged
30757 Generate (do not generate) code that will run in privileged state.
30759 @opindex block-ops-unaligned-vsx
30760 @opindex no-block-ops-unaligned-vsx
30761 @item -mblock-ops-unaligned-vsx
30762 @itemx -mno-block-ops-unaligned-vsx
30763 Generate (do not generate) unaligned vsx loads and stores for
30764 inline expansion of @code{memcpy} and @code{memmove}.
30766 @item --param rs6000-vect-unroll-limit=
30767 The vectorizer will check with target information to determine whether it
30768 would be beneficial to unroll the main vectorized loop and by how much.  This
30769 parameter sets the upper bound of how much the vectorizer will unroll the main
30770 loop.  The default value is four.
30772 @end table
30774 @node RX Options
30775 @subsection RX Options
30776 @cindex RX Options
30778 These command-line options are defined for RX targets:
30780 @table @gcctabopt
30781 @opindex m64bit-doubles
30782 @opindex m32bit-doubles
30783 @item -m64bit-doubles
30784 @itemx -m32bit-doubles
30785 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
30786 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
30787 @option{-m32bit-doubles}.  @emph{Note} RX floating-point hardware only
30788 works on 32-bit values, which is why the default is
30789 @option{-m32bit-doubles}.
30791 @opindex fpu
30792 @opindex nofpu
30793 @item -fpu
30794 @itemx -nofpu
30795 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
30796 floating-point hardware.  The default is enabled for the RX600
30797 series and disabled for the RX200 series.
30799 Floating-point instructions are only generated for 32-bit floating-point 
30800 values, however, so the FPU hardware is not used for doubles if the
30801 @option{-m64bit-doubles} option is used.
30803 @emph{Note} If the @option{-fpu} option is enabled then
30804 @option{-funsafe-math-optimizations} is also enabled automatically.
30805 This is because the RX FPU instructions are themselves unsafe.
30807 @opindex mcpu
30808 @item -mcpu=@var{name}
30809 Selects the type of RX CPU to be targeted.  Currently three types are
30810 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
30811 the specific @samp{RX610} CPU.  The default is @samp{RX600}.
30813 The only difference between @samp{RX600} and @samp{RX610} is that the
30814 @samp{RX610} does not support the @code{MVTIPL} instruction.
30816 The @samp{RX200} series does not have a hardware floating-point unit
30817 and so @option{-nofpu} is enabled by default when this type is
30818 selected.
30820 @opindex mbig-endian-data
30821 @opindex mlittle-endian-data
30822 @item -mbig-endian-data
30823 @itemx -mlittle-endian-data
30824 Store data (but not code) in the big-endian format.  The default is
30825 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
30826 format.
30828 @opindex msmall-data-limit
30829 @item -msmall-data-limit=@var{N}
30830 Specifies the maximum size in bytes of global and static variables
30831 which can be placed into the small data area.  Using the small data
30832 area can lead to smaller and faster code, but the size of area is
30833 limited and it is up to the programmer to ensure that the area does
30834 not overflow.  Also when the small data area is used one of the RX's
30835 registers (usually @code{r13}) is reserved for use pointing to this
30836 area, so it is no longer available for use by the compiler.  This
30837 could result in slower and/or larger code if variables are pushed onto
30838 the stack instead of being held in this register.
30840 Note, common variables (variables that have not been initialized) and
30841 constants are not placed into the small data area as they are assigned
30842 to other sections in the output executable.
30844 The default value is zero, which disables this feature.  Note, this
30845 feature is not enabled by default with higher optimization levels
30846 (@option{-O2} etc) because of the potentially detrimental effects of
30847 reserving a register.  It is up to the programmer to experiment and
30848 discover whether this feature is of benefit to their program.  See the
30849 description of the @option{-mpid} option for a description of how the
30850 actual register to hold the small data area pointer is chosen.
30852 @opindex msim
30853 @opindex mno-sim
30854 @item -msim
30855 @itemx -mno-sim
30856 Use the simulator runtime.  The default is to use the libgloss
30857 board-specific runtime.
30859 @opindex mas100-syntax
30860 @opindex mno-as100-syntax
30861 @item -mas100-syntax
30862 @itemx -mno-as100-syntax
30863 When generating assembler output use a syntax that is compatible with
30864 Renesas's AS100 assembler.  This syntax can also be handled by the GAS
30865 assembler, but it has some restrictions so it is not generated by default.
30867 @opindex mmax-constant-size
30868 @item -mmax-constant-size=@var{N}
30869 Specifies the maximum size, in bytes, of a constant that can be used as
30870 an operand in a RX instruction.  Although the RX instruction set does
30871 allow constants of up to 4 bytes in length to be used in instructions,
30872 a longer value equates to a longer instruction.  Thus in some
30873 circumstances it can be beneficial to restrict the size of constants
30874 that are used in instructions.  Constants that are too big are instead
30875 placed into a constant pool and referenced via register indirection.
30877 The value @var{N} can be between 0 and 4.  A value of 0 (the default)
30878 or 4 means that constants of any size are allowed.
30880 @opindex mrelax
30881 @item -mrelax
30882 Enable linker relaxation.  Linker relaxation is a process whereby the
30883 linker attempts to reduce the size of a program by finding shorter
30884 versions of various instructions.  Disabled by default.
30886 @opindex mint-register
30887 @item -mint-register=@var{N}
30888 Specify the number of registers to reserve for fast interrupt handler
30889 functions.  The value @var{N} can be between 0 and 4.  A value of 1
30890 means that register @code{r13} is reserved for the exclusive use
30891 of fast interrupt handlers.  A value of 2 reserves @code{r13} and
30892 @code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
30893 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
30894 A value of 0, the default, does not reserve any registers.
30896 @opindex msave-acc-in-interrupts
30897 @item -msave-acc-in-interrupts
30898 Specifies that interrupt handler functions should preserve the
30899 accumulator register.  This is only necessary if normal code might use
30900 the accumulator register, for example because it performs 64-bit
30901 multiplications.  The default is to ignore the accumulator as this
30902 makes the interrupt handlers faster.
30904 @opindex mpid
30905 @opindex mno-pid
30906 @item -mpid
30907 @itemx -mno-pid
30908 Enables the generation of position independent data.  When enabled any
30909 access to constant data is done via an offset from a base address
30910 held in a register.  This allows the location of constant data to be
30911 determined at run time without requiring the executable to be
30912 relocated, which is a benefit to embedded applications with tight
30913 memory constraints.  Data that can be modified is not affected by this
30914 option.
30916 Note, using this feature reserves a register, usually @code{r13}, for
30917 the constant data base address.  This can result in slower and/or
30918 larger code, especially in complicated functions.
30920 The actual register chosen to hold the constant data base address
30921 depends upon whether the @option{-msmall-data-limit} and/or the
30922 @option{-mint-register} command-line options are enabled.  Starting
30923 with register @code{r13} and proceeding downwards, registers are
30924 allocated first to satisfy the requirements of @option{-mint-register},
30925 then @option{-mpid} and finally @option{-msmall-data-limit}.  Thus it
30926 is possible for the small data area register to be @code{r8} if both
30927 @option{-mint-register=4} and @option{-mpid} are specified on the
30928 command line.
30930 By default this feature is not enabled.  The default can be restored
30931 via the @option{-mno-pid} command-line option.
30933 @opindex mno-warn-multiple-fast-interrupts
30934 @opindex mwarn-multiple-fast-interrupts
30935 @item -mno-warn-multiple-fast-interrupts
30936 @itemx -mwarn-multiple-fast-interrupts
30937 Prevents GCC from issuing a warning message if it finds more than one
30938 fast interrupt handler when it is compiling a file.  The default is to
30939 issue a warning for each extra fast interrupt handler found, as the RX
30940 only supports one such interrupt.
30942 @opindex mallow-string-insns
30943 @opindex mno-allow-string-insns
30944 @item -mallow-string-insns
30945 @itemx -mno-allow-string-insns
30946 Enables or disables the use of the string manipulation instructions
30947 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
30948 @code{SWHILE} and also the @code{RMPA} instruction.  These
30949 instructions may prefetch data, which is not safe to do if accessing
30950 an I/O register.  (See section 12.2.7 of the RX62N Group User's Manual
30951 for more information).
30953 The default is to allow these instructions, but it is not possible for
30954 GCC to reliably detect all circumstances where a string instruction
30955 might be used to access an I/O register, so their use cannot be
30956 disabled automatically.  Instead it is reliant upon the programmer to
30957 use the @option{-mno-allow-string-insns} option if their program
30958 accesses I/O space.
30960 When the instructions are enabled GCC defines the C preprocessor
30961 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
30962 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
30964 @opindex mjsr
30965 @opindex mno-jsr
30966 @item -mjsr
30967 @itemx -mno-jsr
30968 Use only (or not only) @code{JSR} instructions to access functions.
30969 This option can be used when code size exceeds the range of @code{BSR}
30970 instructions.  Note that @option{-mno-jsr} does not mean to not use
30971 @code{JSR} but instead means that any type of branch may be used.
30972 @end table
30974 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
30975 has special significance to the RX port when used with the
30976 @code{interrupt} function attribute.  This attribute indicates a
30977 function intended to process fast interrupts.  GCC ensures
30978 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
30979 and/or @code{r13} and only provided that the normal use of the
30980 corresponding registers have been restricted via the
30981 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
30982 options.
30984 @node S/390 and zSeries Options
30985 @subsection S/390 and zSeries Options
30986 @cindex S/390 and zSeries Options
30988 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
30990 @table @gcctabopt
30991 @opindex mhard-float
30992 @opindex msoft-float
30993 @item -mhard-float
30994 @itemx -msoft-float
30995 Use (do not use) the hardware floating-point instructions and registers
30996 for floating-point operations.  When @option{-msoft-float} is specified,
30997 functions in @file{libgcc.a} are used to perform floating-point
30998 operations.  When @option{-mhard-float} is specified, the compiler
30999 generates IEEE floating-point instructions.  This is the default.
31001 @opindex mhard-dfp
31002 @opindex mno-hard-dfp
31003 @item -mhard-dfp
31004 @itemx -mno-hard-dfp
31005 Use (do not use) the hardware decimal-floating-point instructions for
31006 decimal-floating-point operations.  When @option{-mno-hard-dfp} is
31007 specified, functions in @file{libgcc.a} are used to perform
31008 decimal-floating-point operations.  When @option{-mhard-dfp} is
31009 specified, the compiler generates decimal-floating-point hardware
31010 instructions.  This is the default for @option{-march=z9-ec} or higher.
31012 @opindex mlong-double-64
31013 @opindex mlong-double-128
31014 @item -mlong-double-64
31015 @itemx -mlong-double-128
31016 These switches control the size of @code{long double} type. A size
31017 of 64 bits makes the @code{long double} type equivalent to the @code{double}
31018 type. This is the default.
31020 @opindex mbackchain
31021 @opindex mno-backchain
31022 @item -mbackchain
31023 @itemx -mno-backchain
31024 Store (do not store) the address of the caller's frame as backchain pointer
31025 into the callee's stack frame.
31026 A backchain may be needed to allow debugging using tools that do not understand
31027 DWARF call frame information.
31028 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
31029 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
31030 the backchain is placed into the topmost word of the 96/160 byte register
31031 save area.
31033 In general, code compiled with @option{-mbackchain} is call-compatible with
31034 code compiled with @option{-mno-backchain}; however, use of the backchain
31035 for debugging purposes usually requires that the whole binary is built with
31036 @option{-mbackchain}.  Note that the combination of @option{-mbackchain},
31037 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
31038 to build a linux kernel use @option{-msoft-float}.
31040 The default is to not maintain the backchain.
31042 @opindex mpacked-stack
31043 @opindex mno-packed-stack
31044 @item -mpacked-stack
31045 @itemx -mno-packed-stack
31046 Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
31047 specified, the compiler uses the all fields of the 96/160 byte register save
31048 area only for their default purpose; unused fields still take up stack space.
31049 When @option{-mpacked-stack} is specified, register save slots are densely
31050 packed at the top of the register save area; unused space is reused for other
31051 purposes, allowing for more efficient use of the available stack space.
31052 However, when @option{-mbackchain} is also in effect, the topmost word of
31053 the save area is always used to store the backchain, and the return address
31054 register is always saved two words below the backchain.
31056 As long as the stack frame backchain is not used, code generated with
31057 @option{-mpacked-stack} is call-compatible with code generated with
31058 @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
31059 S/390 or zSeries generated code that uses the stack frame backchain at run
31060 time, not just for debugging purposes.  Such code is not call-compatible
31061 with code compiled with @option{-mpacked-stack}.  Also, note that the
31062 combination of @option{-mbackchain},
31063 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
31064 to build a linux kernel use @option{-msoft-float}.
31066 The default is to not use the packed stack layout.
31068 @opindex msmall-exec
31069 @opindex mno-small-exec
31070 @item -msmall-exec
31071 @itemx -mno-small-exec
31072 Generate (or do not generate) code using the @code{bras} instruction
31073 to do subroutine calls.
31074 This only works reliably if the total executable size does not
31075 exceed 64k.  The default is to use the @code{basr} instruction instead,
31076 which does not have this limitation.
31078 @opindex m64
31079 @opindex m31
31080 @item -m64
31081 @itemx -m31
31082 When @option{-m31} is specified, generate code compliant to the
31083 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
31084 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
31085 particular to generate 64-bit instructions.  For the @samp{s390}
31086 targets, the default is @option{-m31}, while the @samp{s390x}
31087 targets default to @option{-m64}.
31089 @opindex mzarch
31090 @opindex mesa
31091 @item -mzarch
31092 @itemx -mesa
31093 When @option{-mzarch} is specified, generate code using the
31094 instructions available on z/Architecture.
31095 When @option{-mesa} is specified, generate code using the
31096 instructions available on ESA/390.  Note that @option{-mesa} is
31097 not possible with @option{-m64}.
31098 When generating code compliant to the GNU/Linux for S/390 ABI,
31099 the default is @option{-mesa}.  When generating code compliant
31100 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
31102 @opindex mhtm
31103 @opindex mno-htm
31104 @item -mhtm
31105 @itemx -mno-htm
31106 The @option{-mhtm} option enables a set of builtins making use of
31107 instructions available with the transactional execution facility
31108 introduced with the IBM zEnterprise EC12 machine generation
31109 @ref{S/390 System z Built-in Functions}.
31110 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
31112 @opindex mvx
31113 @opindex mno-vx
31114 @item -mvx
31115 @itemx -mno-vx
31116 When @option{-mvx} is specified, generate code using the instructions
31117 available with the vector extension facility introduced with the IBM
31118 z13 machine generation.
31119 This option changes the ABI for some vector type values with regard to
31120 alignment and calling conventions.  In case vector type values are
31121 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
31122 command will be added to mark the resulting binary with the ABI used.
31123 @option{-mvx} is enabled by default when using @option{-march=z13}.
31125 @opindex mzvector
31126 @opindex mno-zvector
31127 @item -mzvector
31128 @itemx -mno-zvector
31129 The @option{-mzvector} option enables vector language extensions and
31130 builtins using instructions available with the vector extension
31131 facility introduced with the IBM z13 machine generation.
31132 This option adds support for @samp{vector} to be used as a keyword to
31133 define vector type variables and arguments.  @samp{vector} is only
31134 available when GNU extensions are enabled.  It will not be expanded
31135 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
31136 In addition to the GCC low-level builtins @option{-mzvector} enables
31137 a set of builtins added for compatibility with AltiVec-style
31138 implementations like Power and Cell.  In order to make use of these
31139 builtins the header file @file{vecintrin.h} needs to be included.
31140 @option{-mzvector} is disabled by default.
31142 @opindex mmvcle
31143 @opindex mno-mvcle
31144 @item -mmvcle
31145 @itemx -mno-mvcle
31146 Generate (or do not generate) code using the @code{mvcle} instruction
31147 to perform block moves.  When @option{-mno-mvcle} is specified,
31148 use a @code{mvc} loop instead.  This is the default unless optimizing for
31149 size.
31151 @opindex mdebug
31152 @opindex mno-debug
31153 @item -mdebug
31154 @itemx -mno-debug
31155 Print (or do not print) additional debug information when compiling.
31156 The default is to not print debug information.
31158 @opindex march
31159 @item -march=@var{cpu-type}
31160 Generate code that runs on @var{cpu-type}, which is the name of a
31161 system representing a certain processor type.  Possible values for
31162 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
31163 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
31164 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
31165 @samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13},
31166 @samp{z16}/@samp{arch14}, and @samp{native}.
31168 The default is @option{-march=z900}.
31170 Specifying @samp{native} as cpu type can be used to select the best
31171 architecture option for the host processor.
31172 @option{-march=native} has no effect if GCC does not recognize the
31173 processor.
31175 @opindex mtune
31176 @item -mtune=@var{cpu-type}
31177 Tune to @var{cpu-type} everything applicable about the generated code,
31178 except for the ABI and the set of available instructions.
31179 The list of @var{cpu-type} values is the same as for @option{-march}.
31180 The default is the value used for @option{-march}.
31182 @opindex mtpf-trace
31183 @opindex mno-tpf-trace
31184 @item -mtpf-trace
31185 @itemx -mno-tpf-trace
31186 Generate code that adds (does not add) in TPF OS specific branches to trace
31187 routines in the operating system.  This option is off by default, even
31188 when compiling for the TPF OS@.
31190 @opindex mtpf-trace-skip
31191 @opindex mno-tpf-trace-skip
31192 @item -mtpf-trace-skip
31193 @itemx -mno-tpf-trace-skip
31194 Generate code that changes (does not change) the default branch
31195 targets enabled by @option{-mtpf-trace} to point to specialized trace
31196 routines providing the ability of selectively skipping function trace
31197 entries for the TPF OS.  This option is off by default, even when
31198 compiling for the TPF OS and specifying @option{-mtpf-trace}.
31200 @opindex mfused-madd
31201 @opindex mno-fused-madd
31202 @item -mfused-madd
31203 @itemx -mno-fused-madd
31204 Generate code that uses (does not use) the floating-point multiply and
31205 accumulate instructions.  These instructions are generated by default if
31206 hardware floating point is used.
31208 @opindex mwarn-framesize
31209 @item -mwarn-framesize=@var{framesize}
31210 Emit a warning if the current function exceeds the given frame size.  Because
31211 this is a compile-time check it doesn't need to be a real problem when the program
31212 runs.  It is intended to identify functions that most probably cause
31213 a stack overflow.  It is useful to be used in an environment with limited stack
31214 size e.g.@: the linux kernel.
31216 @opindex mwarn-dynamicstack
31217 @item -mwarn-dynamicstack
31218 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
31219 arrays.  This is generally a bad idea with a limited stack size.
31221 @opindex mstack-guard
31222 @opindex mstack-size
31223 @item -mstack-guard=@var{stack-guard}
31224 @itemx -mstack-size=@var{stack-size}
31225 If these options are provided the S/390 back end emits additional instructions in
31226 the function prologue that trigger a trap if the stack size is @var{stack-guard}
31227 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
31228 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
31229 the frame size of the compiled function is chosen.
31230 These options are intended to be used to help debugging stack overflow problems.
31231 The additionally emitted code causes only little overhead and hence can also be
31232 used in production-like systems without greater performance degradation.  The given
31233 values have to be exact powers of 2 and @var{stack-size} has to be greater than
31234 @var{stack-guard} without exceeding 64k.
31235 In order to be efficient the extra code makes the assumption that the stack starts
31236 at an address aligned to the value given by @var{stack-size}.
31237 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
31239 @opindex mhotpatch
31240 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
31241 If the hotpatch option is enabled, a ``hot-patching'' function
31242 prologue is generated for all functions in the compilation unit.
31243 The funtion label is prepended with the given number of two-byte
31244 NOP instructions (@var{pre-halfwords}, maximum 1000000).  After
31245 the label, 2 * @var{post-halfwords} bytes are appended, using the
31246 largest NOP like instructions the architecture allows (maximum
31247 1000000).
31249 If both arguments are zero, hotpatching is disabled.
31251 This option can be overridden for individual functions with the
31252 @code{hotpatch} attribute.
31253 @end table
31255 @node SH Options
31256 @subsection SH Options
31258 These @samp{-m} options are defined for the SH implementations:
31260 @table @gcctabopt
31261 @opindex m1
31262 @item -m1
31263 Generate code for the SH1.
31265 @opindex m2
31266 @item -m2
31267 Generate code for the SH2.
31269 @item -m2e
31270 Generate code for the SH2e.
31272 @opindex m2a-nofpu
31273 @item -m2a-nofpu
31274 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
31275 that the floating-point unit is not used.
31277 @opindex m2a-single-only
31278 @item -m2a-single-only
31279 Generate code for the SH2a-FPU, in such a way that no double-precision
31280 floating-point operations are used.
31282 @opindex m2a-single
31283 @item -m2a-single
31284 Generate code for the SH2a-FPU assuming the floating-point unit is in
31285 single-precision mode by default.
31287 @opindex m2a
31288 @item -m2a
31289 Generate code for the SH2a-FPU assuming the floating-point unit is in
31290 double-precision mode by default.
31292 @opindex m3
31293 @item -m3
31294 Generate code for the SH3.
31296 @opindex m3e
31297 @item -m3e
31298 Generate code for the SH3e.
31300 @opindex m4-nofpu
31301 @item -m4-nofpu
31302 Generate code for the SH4 without a floating-point unit.
31304 @opindex m4-single-only
31305 @item -m4-single-only
31306 Generate code for the SH4 with a floating-point unit that only
31307 supports single-precision arithmetic.
31309 @opindex m4-single
31310 @item -m4-single
31311 Generate code for the SH4 assuming the floating-point unit is in
31312 single-precision mode by default.
31314 @opindex m4
31315 @item -m4
31316 Generate code for the SH4.
31318 @opindex m4-100
31319 @item -m4-100
31320 Generate code for SH4-100.
31322 @opindex m4-100-nofpu
31323 @item -m4-100-nofpu
31324 Generate code for SH4-100 in such a way that the
31325 floating-point unit is not used.
31327 @opindex m4-100-single
31328 @item -m4-100-single
31329 Generate code for SH4-100 assuming the floating-point unit is in
31330 single-precision mode by default.
31332 @opindex m4-100-single-only
31333 @item -m4-100-single-only
31334 Generate code for SH4-100 in such a way that no double-precision
31335 floating-point operations are used.
31337 @opindex m4-200
31338 @item -m4-200
31339 Generate code for SH4-200.
31341 @opindex m4-200-nofpu
31342 @item -m4-200-nofpu
31343 Generate code for SH4-200 without in such a way that the
31344 floating-point unit is not used.
31346 @opindex m4-200-single
31347 @item -m4-200-single
31348 Generate code for SH4-200 assuming the floating-point unit is in
31349 single-precision mode by default.
31351 @opindex m4-200-single-only
31352 @item -m4-200-single-only
31353 Generate code for SH4-200 in such a way that no double-precision
31354 floating-point operations are used.
31356 @opindex m4-300
31357 @item -m4-300
31358 Generate code for SH4-300.
31360 @opindex m4-300-nofpu
31361 @item -m4-300-nofpu
31362 Generate code for SH4-300 without in such a way that the
31363 floating-point unit is not used.
31365 @opindex m4-300-single
31366 @item -m4-300-single
31367 Generate code for SH4-300 in such a way that no double-precision
31368 floating-point operations are used.
31370 @opindex m4-300-single-only
31371 @item -m4-300-single-only
31372 Generate code for SH4-300 in such a way that no double-precision
31373 floating-point operations are used.
31375 @opindex m4-340
31376 @item -m4-340
31377 Generate code for SH4-340 (no MMU, no FPU).
31379 @opindex m4-500
31380 @item -m4-500
31381 Generate code for SH4-500 (no FPU).  Passes @option{-isa=sh4-nofpu} to the
31382 assembler.
31384 @opindex m4a-nofpu
31385 @item -m4a-nofpu
31386 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
31387 floating-point unit is not used.
31389 @opindex m4a-single-only
31390 @item -m4a-single-only
31391 Generate code for the SH4a, in such a way that no double-precision
31392 floating-point operations are used.
31394 @opindex m4a-single
31395 @item -m4a-single
31396 Generate code for the SH4a assuming the floating-point unit is in
31397 single-precision mode by default.
31399 @opindex m4a
31400 @item -m4a
31401 Generate code for the SH4a.
31403 @opindex m4al
31404 @item -m4al
31405 Same as @option{-m4a-nofpu}, except that it implicitly passes
31406 @option{-dsp} to the assembler.  GCC doesn't generate any DSP
31407 instructions at the moment.
31409 @opindex mb
31410 @item -mb
31411 Compile code for the processor in big-endian mode.
31413 @opindex ml
31414 @item -ml
31415 Compile code for the processor in little-endian mode.
31417 @opindex mdalign
31418 @item -mdalign
31419 Align doubles at 64-bit boundaries.  Note that this changes the calling
31420 conventions, and thus some functions from the standard C library do
31421 not work unless you recompile it first with @option{-mdalign}.
31423 @opindex mrelax
31424 @item -mrelax
31425 Shorten some address references at link time, when possible; uses the
31426 linker option @option{-relax}.
31428 @opindex mbigtable
31429 @item -mbigtable
31430 Use 32-bit offsets in @code{switch} tables.  The default is to use
31431 16-bit offsets.
31433 @opindex mbitops
31434 @item -mbitops
31435 Enable the use of bit manipulation instructions on SH2A.
31437 @opindex mfmovd
31438 @item -mfmovd
31439 Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
31440 alignment constraints.
31442 @opindex mrenesas
31443 @item -mrenesas
31444 Comply with the calling conventions defined by Renesas.
31446 @opindex mno-renesas
31447 @item -mno-renesas
31448 Comply with the calling conventions defined for GCC before the Renesas
31449 conventions were available.  This option is the default for all
31450 targets of the SH toolchain.
31452 @opindex mnomacsave
31453 @item -mnomacsave
31454 Mark the @code{MAC} register as call-clobbered, even if
31455 @option{-mrenesas} is given.
31457 @opindex mieee
31458 @opindex mno-ieee
31459 @item -mieee
31460 @itemx -mno-ieee
31461 Control the IEEE compliance of floating-point comparisons, which affects the
31462 handling of cases where the result of a comparison is unordered.  By default
31463 @option{-mieee} is implicitly enabled.  If @option{-ffinite-math-only} is
31464 enabled @option{-mno-ieee} is implicitly set, which results in faster
31465 floating-point greater-equal and less-equal comparisons.  The implicit settings
31466 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
31468 @opindex minline-ic_invalidate
31469 @item -minline-ic_invalidate
31470 Inline code to invalidate instruction cache entries after setting up
31471 nested function trampolines.
31472 This option has no effect if @option{-musermode} is in effect and the selected
31473 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
31474 instruction.
31475 If the selected code generation option does not allow the use of the @code{icbi}
31476 instruction, and @option{-musermode} is not in effect, the inlined code
31477 manipulates the instruction cache address array directly with an associative
31478 write.  This not only requires privileged mode at run time, but it also
31479 fails if the cache line had been mapped via the TLB and has become unmapped.
31481 @opindex misize
31482 @item -misize
31483 Dump instruction size and location in the assembly code.
31485 @opindex mpadstruct
31486 @item -mpadstruct
31487 This option is deprecated.  It pads structures to multiple of 4 bytes,
31488 which is incompatible with the SH ABI@.
31490 @opindex matomic-model=@var{model}
31491 @item -matomic-model=@var{model}
31492 Sets the model of atomic operations and additional parameters as a comma
31493 separated list.  For details on the atomic built-in functions see
31494 @ref{__atomic Builtins}.  The following models and parameters are supported:
31496 @table @samp
31498 @item none
31499 Disable compiler generated atomic sequences and emit library calls for atomic
31500 operations.  This is the default if the target is not @code{sh*-*-linux*}.
31502 @item soft-gusa
31503 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
31504 built-in functions.  The generated atomic sequences require additional support
31505 from the interrupt/exception handling code of the system and are only suitable
31506 for SH3* and SH4* single-core systems.  This option is enabled by default when
31507 the target is @code{sh*-*-linux*} and SH3* or SH4*.  When the target is SH4A,
31508 this option also partially utilizes the hardware atomic instructions
31509 @code{movli.l} and @code{movco.l} to create more efficient code, unless
31510 @samp{strict} is specified.  
31512 @item soft-tcb
31513 Generate software atomic sequences that use a variable in the thread control
31514 block.  This is a variation of the gUSA sequences which can also be used on
31515 SH1* and SH2* targets.  The generated atomic sequences require additional
31516 support from the interrupt/exception handling code of the system and are only
31517 suitable for single-core systems.  When using this model, the @samp{gbr-offset=}
31518 parameter has to be specified as well.
31520 @item soft-imask
31521 Generate software atomic sequences that temporarily disable interrupts by
31522 setting @code{SR.IMASK = 1111}.  This model works only when the program runs
31523 in privileged mode and is only suitable for single-core systems.  Additional
31524 support from the interrupt/exception handling code of the system is not
31525 required.  This model is enabled by default when the target is
31526 @code{sh*-*-linux*} and SH1* or SH2*.
31528 @item hard-llcs
31529 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
31530 instructions only.  This is only available on SH4A and is suitable for
31531 multi-core systems.  Since the hardware instructions support only 32 bit atomic
31532 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
31533 Code compiled with this option is also compatible with other software
31534 atomic model interrupt/exception handling systems if executed on an SH4A
31535 system.  Additional support from the interrupt/exception handling code of the
31536 system is not required for this model.
31538 @item gbr-offset=
31539 This parameter specifies the offset in bytes of the variable in the thread
31540 control block structure that should be used by the generated atomic sequences
31541 when the @samp{soft-tcb} model has been selected.  For other models this
31542 parameter is ignored.  The specified value must be an integer multiple of four
31543 and in the range 0-1020.
31545 @item strict
31546 This parameter prevents mixed usage of multiple atomic models, even if they
31547 are compatible, and makes the compiler generate atomic sequences of the
31548 specified model only.
31550 @end table
31552 @opindex mtas
31553 @item -mtas
31554 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
31555 Notice that depending on the particular hardware and software configuration
31556 this can degrade overall performance due to the operand cache line flushes
31557 that are implied by the @code{tas.b} instruction.  On multi-core SH4A
31558 processors the @code{tas.b} instruction must be used with caution since it
31559 can result in data corruption for certain cache configurations.
31561 @opindex mprefergot
31562 @item -mprefergot
31563 When generating position-independent code, emit function calls using
31564 the Global Offset Table instead of the Procedure Linkage Table.
31566 @opindex musermode
31567 @opindex mno-usermode
31568 @item -musermode
31569 @itemx -mno-usermode
31570 Don't allow (allow) the compiler generating privileged mode code.  Specifying
31571 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
31572 inlined code would not work in user mode.  @option{-musermode} is the default
31573 when the target is @code{sh*-*-linux*}.  If the target is SH1* or SH2*
31574 @option{-musermode} has no effect, since there is no user mode.
31576 @opindex multcost=@var{number}
31577 @item -multcost=@var{number}
31578 Set the cost to assume for a multiply insn.
31580 @opindex mdiv=@var{strategy}
31581 @item -mdiv=@var{strategy}
31582 Set the division strategy to be used for integer division operations.
31583 @var{strategy} can be one of: 
31585 @table @samp
31587 @item call-div1
31588 Calls a library function that uses the single-step division instruction
31589 @code{div1} to perform the operation.  Division by zero calculates an
31590 unspecified result and does not trap.  This is the default except for SH4,
31591 SH2A and SHcompact.
31593 @item call-fp
31594 Calls a library function that performs the operation in double precision
31595 floating point.  Division by zero causes a floating-point exception.  This is
31596 the default for SHcompact with FPU.  Specifying this for targets that do not
31597 have a double precision FPU defaults to @code{call-div1}.
31599 @item call-table
31600 Calls a library function that uses a lookup table for small divisors and
31601 the @code{div1} instruction with case distinction for larger divisors.  Division
31602 by zero calculates an unspecified result and does not trap.  This is the default
31603 for SH4.  Specifying this for targets that do not have dynamic shift
31604 instructions defaults to @code{call-div1}.
31606 @end table
31608 When a division strategy has not been specified the default strategy is
31609 selected based on the current target.  For SH2A the default strategy is to
31610 use the @code{divs} and @code{divu} instructions instead of library function
31611 calls.
31613 @opindex maccumulate-outgoing-args
31614 @item -maccumulate-outgoing-args
31615 Reserve space once for outgoing arguments in the function prologue rather
31616 than around each call.  Generally beneficial for performance and size.  Also
31617 needed for unwinding to avoid changing the stack frame around conditional code.
31619 @opindex mdivsi3_libfunc=@var{name}
31620 @item -mdivsi3_libfunc=@var{name}
31621 Set the name of the library function used for 32-bit signed division to
31622 @var{name}.
31623 This only affects the name used in the @samp{call} division strategies, and
31624 the compiler still expects the same sets of input/output/clobbered registers as
31625 if this option were not present.
31627 @opindex mfixed-range
31628 @item -mfixed-range=@var{register-range}
31629 Generate code treating the given register range as fixed registers.
31630 A fixed register is one that the register allocator cannot use.  This is
31631 useful when compiling kernel code.  A register range is specified as
31632 two registers separated by a dash.  Multiple register ranges can be
31633 specified separated by a comma.
31635 @opindex mbranch-cost=@var{num}
31636 @item -mbranch-cost=@var{num}
31637 Assume @var{num} to be the cost for a branch instruction.  Higher numbers
31638 make the compiler try to generate more branch-free code if possible.  
31639 If not specified the value is selected depending on the processor type that
31640 is being compiled for.
31642 @opindex mzdcbranch
31643 @opindex mno-zdcbranch
31644 @item -mzdcbranch
31645 @itemx -mno-zdcbranch
31646 Assume (do not assume) that zero displacement conditional branch instructions
31647 @code{bt} and @code{bf} are fast.  If @option{-mzdcbranch} is specified, the
31648 compiler prefers zero displacement branch code sequences.  This is
31649 enabled by default when generating code for SH4 and SH4A.  It can be explicitly
31650 disabled by specifying @option{-mno-zdcbranch}.
31652 @opindex mcbranch-force-delay-slot
31653 @item -mcbranch-force-delay-slot
31654 Force the usage of delay slots for conditional branches, which stuffs the delay
31655 slot with a @code{nop} if a suitable instruction cannot be found.  By default
31656 this option is disabled.  It can be enabled to work around hardware bugs as
31657 found in the original SH7055.
31659 @opindex mfused-madd
31660 @opindex mno-fused-madd
31661 @item -mfused-madd
31662 @itemx -mno-fused-madd
31663 Generate code that uses (does not use) the floating-point multiply and
31664 accumulate instructions.  These instructions are generated by default
31665 if hardware floating point is used.  The machine-dependent
31666 @option{-mfused-madd} option is now mapped to the machine-independent
31667 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
31668 mapped to @option{-ffp-contract=off}.
31670 @opindex mfsca
31671 @opindex mno-fsca
31672 @item -mfsca
31673 @itemx -mno-fsca
31674 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
31675 and cosine approximations.  The option @option{-mfsca} must be used in
31676 combination with @option{-funsafe-math-optimizations}.  It is enabled by default
31677 when generating code for SH4A.  Using @option{-mno-fsca} disables sine and cosine
31678 approximations even if @option{-funsafe-math-optimizations} is in effect.
31680 @opindex mfsrra
31681 @opindex mno-fsrra
31682 @item -mfsrra
31683 @itemx -mno-fsrra
31684 Allow or disallow the compiler to emit the @code{fsrra} instruction for
31685 reciprocal square root approximations.  The option @option{-mfsrra} must be used
31686 in combination with @option{-funsafe-math-optimizations} and
31687 @option{-ffinite-math-only}.  It is enabled by default when generating code for
31688 SH4A.  Using @option{-mno-fsrra} disables reciprocal square root approximations
31689 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
31690 in effect.
31692 @opindex mpretend-cmove
31693 @item -mpretend-cmove
31694 Prefer zero-displacement conditional branches for conditional move instruction
31695 patterns.  This can result in faster code on the SH4 processor.
31697 @opindex fdpic
31698 @item -mfdpic
31699 Generate code using the FDPIC ABI.
31701 @end table
31703 @node Solaris 2 Options
31704 @subsection Solaris 2 Options
31705 @cindex Solaris 2 options
31707 These @samp{-m} options are supported on Solaris 2:
31709 @table @gcctabopt
31710 @opindex mclear-hwcap
31711 @item -mclear-hwcap
31712 @option{-mclear-hwcap} tells the compiler to remove the hardware
31713 capabilities generated by the Solaris assembler.  This is only necessary
31714 when object files use ISA extensions not supported by the current
31715 machine, but check at runtime whether or not to use them.
31717 @opindex mimpure-text
31718 @item -mimpure-text
31719 @option{-mimpure-text}, used in addition to @option{-shared}, tells
31720 the compiler to not pass @option{-z text} to the linker when linking a
31721 shared object.  Using this option, you can link position-dependent
31722 code into a shared object.
31724 @option{-mimpure-text} suppresses the ``relocations remain against
31725 allocatable but non-writable sections'' linker error message.
31726 However, the necessary relocations trigger copy-on-write, and the
31727 shared object is not actually shared across processes.  Instead of
31728 using @option{-mimpure-text}, you should compile all source code with
31729 @option{-fpic} or @option{-fPIC}.
31731 @end table
31733 These switches are supported in addition to the above on Solaris 2:
31735 @table @gcctabopt
31736 @opindex pthreads
31737 @item -pthreads
31738 This is a synonym for @option{-pthread}.
31739 @end table
31741 @node SPARC Options
31742 @subsection SPARC Options
31743 @cindex SPARC options
31745 These @samp{-m} options are supported on the SPARC:
31747 @table @gcctabopt
31748 @opindex mno-app-regs
31749 @opindex mapp-regs
31750 @item -mno-app-regs
31751 @itemx -mapp-regs
31752 Specify @option{-mapp-regs} to generate output using the global registers
31753 2 through 4, which the SPARC SVR4 ABI reserves for applications.  Like the
31754 global register 1, each global register 2 through 4 is then treated as an
31755 allocable register that is clobbered by function calls.  This is the default.
31757 To be fully SVR4 ABI-compliant at the cost of some performance loss,
31758 specify @option{-mno-app-regs}.  You should compile libraries and system
31759 software with this option.
31761 @opindex mflat
31762 @opindex mno-flat
31763 @item -mflat
31764 @itemx -mno-flat
31765 With @option{-mflat}, the compiler does not generate save/restore instructions
31766 and uses a ``flat'' or single register window model.  This model is compatible
31767 with the regular register window model.  The local registers and the input
31768 registers (0--5) are still treated as ``call-saved'' registers and are
31769 saved on the stack as needed.
31771 With @option{-mno-flat} (the default), the compiler generates save/restore
31772 instructions (except for leaf functions).  This is the normal operating mode.
31774 @opindex mfpu
31775 @opindex mhard-float
31776 @item -mfpu
31777 @itemx -mhard-float
31778 Generate output containing floating-point instructions.  This is the
31779 default.
31781 @opindex mno-fpu
31782 @opindex msoft-float
31783 @item -mno-fpu
31784 @itemx -msoft-float
31785 Generate output containing library calls for floating point.
31786 @strong{Warning:} the requisite libraries are not available for all SPARC
31787 targets.  Normally the facilities of the machine's usual C compiler are
31788 used, but this cannot be done directly in cross-compilation.  You must make
31789 your own arrangements to provide suitable library functions for
31790 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
31791 @samp{sparclite-*-*} do provide software floating-point support.
31793 @option{-msoft-float} changes the calling convention in the output file;
31794 therefore, it is only useful if you compile @emph{all} of a program with
31795 this option.  In particular, you need to compile @file{libgcc.a}, the
31796 library that comes with GCC, with @option{-msoft-float} in order for
31797 this to work.
31799 @opindex mhard-quad-float
31800 @item -mhard-quad-float
31801 Generate output containing quad-word (long double) floating-point
31802 instructions.
31804 @opindex msoft-quad-float
31805 @item -msoft-quad-float
31806 Generate output containing library calls for quad-word (long double)
31807 floating-point instructions.  The functions called are those specified
31808 in the SPARC ABI@.  This is the default.
31810 As of this writing, there are no SPARC implementations that have hardware
31811 support for the quad-word floating-point instructions.  They all invoke
31812 a trap handler for one of these instructions, and then the trap handler
31813 emulates the effect of the instruction.  Because of the trap handler overhead,
31814 this is much slower than calling the ABI library routines.  Thus the
31815 @option{-msoft-quad-float} option is the default.
31817 @opindex mno-unaligned-doubles
31818 @opindex munaligned-doubles
31819 @item -mno-unaligned-doubles
31820 @itemx -munaligned-doubles
31821 Assume that doubles have 8-byte alignment.  This is the default.
31823 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
31824 alignment only if they are contained in another type, or if they have an
31825 absolute address.  Otherwise, it assumes they have 4-byte alignment.
31826 Specifying this option avoids some rare compatibility problems with code
31827 generated by other compilers.  It is not the default because it results
31828 in a performance loss, especially for floating-point code.
31830 @opindex muser-mode
31831 @opindex mno-user-mode
31832 @item -muser-mode
31833 @itemx -mno-user-mode
31834 Do not generate code that can only run in supervisor mode.  This is relevant
31835 only for the @code{casa} instruction emitted for the LEON3 processor.  This
31836 is the default.
31838 @opindex mfaster-structs
31839 @opindex mno-faster-structs
31840 @item -mfaster-structs
31841 @itemx -mno-faster-structs
31842 With @option{-mfaster-structs}, the compiler assumes that structures
31843 should have 8-byte alignment.  This enables the use of pairs of
31844 @code{ldd} and @code{std} instructions for copies in structure
31845 assignment, in place of twice as many @code{ld} and @code{st} pairs.
31846 However, the use of this changed alignment directly violates the SPARC
31847 ABI@.  Thus, it's intended only for use on targets where the developer
31848 acknowledges that their resulting code is not directly in line with
31849 the rules of the ABI@.
31851 @opindex mstd-struct-return
31852 @opindex mno-std-struct-return
31853 @item -mstd-struct-return
31854 @itemx -mno-std-struct-return
31855 With @option{-mstd-struct-return}, the compiler generates checking code
31856 in functions returning structures or unions to detect size mismatches
31857 between the two sides of function calls, as per the 32-bit ABI@.
31859 The default is @option{-mno-std-struct-return}.  This option has no effect
31860 in 64-bit mode.
31862 @opindex mlra
31863 @opindex mno-lra
31864 @item -mlra
31865 @itemx -mno-lra
31866 Enable Local Register Allocation.  This is the default for SPARC since GCC 7
31867 so @option{-mno-lra} needs to be passed to get old Reload.
31869 @opindex mcpu
31870 @item -mcpu=@var{cpu_type}
31871 Set the instruction set, register set, and instruction scheduling parameters
31872 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
31873 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
31874 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
31875 @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
31876 @samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
31877 @samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
31878 @samp{m8}.
31880 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
31881 which selects the best architecture option for the host processor.
31882 @option{-mcpu=native} has no effect if GCC does not recognize
31883 the processor.
31885 Default instruction scheduling parameters are used for values that select
31886 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
31887 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
31889 Here is a list of each supported architecture and their supported
31890 implementations.
31892 @table @asis
31893 @item v7
31894 cypress, leon3v7
31896 @item v8
31897 supersparc, hypersparc, leon, leon3, leon5
31899 @item sparclite
31900 f930, f934, sparclite86x
31902 @item sparclet
31903 tsc701
31905 @item v9
31906 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
31907 niagara7, m8
31908 @end table
31910 By default (unless configured otherwise), GCC generates code for the V7
31911 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
31912 additionally optimizes it for the Cypress CY7C602 chip, as used in the
31913 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
31914 SPARCStation 1, 2, IPX etc.
31916 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
31917 architecture.  The only difference from V7 code is that the compiler emits
31918 the integer multiply and integer divide instructions which exist in SPARC-V8
31919 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
31920 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
31921 2000 series.
31923 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
31924 the SPARC architecture.  This adds the integer multiply, integer divide step
31925 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
31926 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
31927 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
31928 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
31929 MB86934 chip, which is the more recent SPARClite with FPU@.
31931 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
31932 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
31933 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
31934 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
31935 optimizes it for the TEMIC SPARClet chip.
31937 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
31938 architecture.  This adds 64-bit integer and floating-point move instructions,
31939 3 additional floating-point condition code registers and conditional move
31940 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
31941 optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
31942 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
31943 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
31944 @option{-mcpu=niagara}, the compiler additionally optimizes it for
31945 Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
31946 additionally optimizes it for Sun UltraSPARC T2 chips. With
31947 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
31948 UltraSPARC T3 chips.  With @option{-mcpu=niagara4}, the compiler
31949 additionally optimizes it for Sun UltraSPARC T4 chips.  With
31950 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
31951 Oracle SPARC M7 chips.  With @option{-mcpu=m8}, the compiler
31952 additionally optimizes it for Oracle M8 chips.
31954 @opindex mtune
31955 @item -mtune=@var{cpu_type}
31956 Set the instruction scheduling parameters for machine type
31957 @var{cpu_type}, but do not set the instruction set or register set that the
31958 option @option{-mcpu=@var{cpu_type}} does.
31960 The same values for @option{-mcpu=@var{cpu_type}} can be used for
31961 @option{-mtune=@var{cpu_type}}, but the only useful values are those
31962 that select a particular CPU implementation.  Those are
31963 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
31964 @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
31965 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
31966 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
31967 @samp{niagara4}, @samp{niagara7} and @samp{m8}.  With native Solaris
31968 and GNU/Linux toolchains, @samp{native} can also be used.
31970 @opindex mv8plus
31971 @opindex mno-v8plus
31972 @item -mv8plus
31973 @itemx -mno-v8plus
31974 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
31975 difference from the V8 ABI is that the global and out registers are
31976 considered 64 bits wide.  This is enabled by default on Solaris in 32-bit
31977 mode for all SPARC-V9 processors.
31979 @opindex mvis
31980 @opindex mno-vis
31981 @item -mvis
31982 @itemx -mno-vis
31983 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
31984 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
31986 @opindex mvis2
31987 @opindex mno-vis2
31988 @item -mvis2
31989 @itemx -mno-vis2
31990 With @option{-mvis2}, GCC generates code that takes advantage of
31991 version 2.0 of the UltraSPARC Visual Instruction Set extensions.  The
31992 default is @option{-mvis2} when targeting a cpu that supports such
31993 instructions, such as UltraSPARC-III and later.  Setting @option{-mvis2}
31994 also sets @option{-mvis}.
31996 @opindex mvis3
31997 @opindex mno-vis3
31998 @item -mvis3
31999 @itemx -mno-vis3
32000 With @option{-mvis3}, GCC generates code that takes advantage of
32001 version 3.0 of the UltraSPARC Visual Instruction Set extensions.  The
32002 default is @option{-mvis3} when targeting a cpu that supports such
32003 instructions, such as niagara-3 and later.  Setting @option{-mvis3}
32004 also sets @option{-mvis2} and @option{-mvis}.
32006 @opindex mvis4
32007 @opindex mno-vis4
32008 @item -mvis4
32009 @itemx -mno-vis4
32010 With @option{-mvis4}, GCC generates code that takes advantage of
32011 version 4.0 of the UltraSPARC Visual Instruction Set extensions.  The
32012 default is @option{-mvis4} when targeting a cpu that supports such
32013 instructions, such as niagara-7 and later.  Setting @option{-mvis4}
32014 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
32016 @opindex mvis4b
32017 @opindex mno-vis4b
32018 @item -mvis4b
32019 @itemx -mno-vis4b
32020 With @option{-mvis4b}, GCC generates code that takes advantage of
32021 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
32022 the additional VIS instructions introduced in the Oracle SPARC
32023 Architecture 2017.  The default is @option{-mvis4b} when targeting a
32024 cpu that supports such instructions, such as m8 and later.  Setting
32025 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
32026 @option{-mvis2} and @option{-mvis}.
32028 @opindex mcbcond
32029 @opindex mno-cbcond
32030 @item -mcbcond
32031 @itemx -mno-cbcond
32032 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
32033 Compare-and-Branch-on-Condition instructions.  The default is @option{-mcbcond}
32034 when targeting a CPU that supports such instructions, such as Niagara-4 and
32035 later.
32037 @opindex mfmaf
32038 @opindex mno-fmaf
32039 @item -mfmaf
32040 @itemx -mno-fmaf
32041 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
32042 Fused Multiply-Add Floating-point instructions.  The default is @option{-mfmaf}
32043 when targeting a CPU that supports such instructions, such as Niagara-3 and
32044 later.
32046 @opindex mfsmuld
32047 @opindex mno-fsmuld
32048 @item -mfsmuld
32049 @itemx -mno-fsmuld
32050 With @option{-mfsmuld}, GCC generates code that takes advantage of the
32051 Floating-point Multiply Single to Double (FsMULd) instruction.  The default is
32052 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
32053 or V9 with FPU except @option{-mcpu=leon}.
32055 @opindex mpopc
32056 @opindex mno-popc
32057 @item -mpopc
32058 @itemx -mno-popc
32059 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
32060 Population Count instruction.  The default is @option{-mpopc}
32061 when targeting a CPU that supports such an instruction, such as Niagara-2 and
32062 later.
32064 @opindex msubxc
32065 @opindex mno-subxc
32066 @item -msubxc
32067 @itemx -mno-subxc
32068 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
32069 Subtract-Extended-with-Carry instruction.  The default is @option{-msubxc}
32070 when targeting a CPU that supports such an instruction, such as Niagara-7 and
32071 later.
32073 @opindex mfix-at697f
32074 @item -mfix-at697f
32075 Enable the documented workaround for the single erratum of the Atmel AT697F
32076 processor (which corresponds to erratum #13 of the AT697E processor).
32078 @opindex mfix-ut699
32079 @item -mfix-ut699
32080 Enable the documented workarounds for the floating-point errata and the data
32081 cache nullify errata of the UT699 processor.
32083 @opindex mfix-ut700
32084 @item -mfix-ut700
32085 Enable the documented workaround for the back-to-back store errata of
32086 the UT699E/UT700 processor.
32088 @opindex mfix-gr712rc
32089 @item -mfix-gr712rc
32090 Enable the documented workaround for the back-to-back store errata of
32091 the GR712RC processor.
32092 @end table
32094 These @samp{-m} options are supported in addition to the above
32095 on SPARC-V9 processors in 64-bit environments:
32097 @table @gcctabopt
32098 @opindex m32
32099 @opindex m64
32100 @item -m32
32101 @itemx -m64
32102 Generate code for a 32-bit or 64-bit environment.
32103 The 32-bit environment sets int, long and pointer to 32 bits.
32104 The 64-bit environment sets int to 32 bits and long and pointer
32105 to 64 bits.
32107 @opindex mcmodel
32108 @item -mcmodel=@var{which}
32109 Set the code model to one of
32111 @table @samp
32112 @item medlow
32113 The Medium/Low code model: 64-bit addresses, programs
32114 must be linked in the low 32 bits of memory.  Programs can be statically
32115 or dynamically linked.
32117 @item medmid
32118 The Medium/Middle code model: 64-bit addresses, programs
32119 must be linked in the low 44 bits of memory, the text and data segments must
32120 be less than 2GB in size and the data segment must be located within 2GB of
32121 the text segment.
32123 @item medany
32124 The Medium/Anywhere code model: 64-bit addresses, programs
32125 may be linked anywhere in memory, the text and data segments must be less
32126 than 2GB in size and the data segment must be located within 2GB of the
32127 text segment.
32129 @item embmedany
32130 The Medium/Anywhere code model for embedded systems:
32131 64-bit addresses, the text and data segments must be less than 2GB in
32132 size, both starting anywhere in memory (determined at link time).  The
32133 global register %g4 points to the base of the data segment.  Programs
32134 are statically linked and PIC is not supported.
32135 @end table
32137 @opindex mmemory-model
32138 @item -mmemory-model=@var{mem-model}
32139 Set the memory model in force on the processor to one of
32141 @table @samp
32142 @item default
32143 The default memory model for the processor and operating system.
32145 @item rmo
32146 Relaxed Memory Order
32148 @item pso
32149 Partial Store Order
32151 @item tso
32152 Total Store Order
32154 @item sc
32155 Sequential Consistency
32156 @end table
32158 These memory models are formally defined in Appendix D of the SPARC-V9
32159 architecture manual, as set in the processor's @code{PSTATE.MM} field.
32161 @opindex mstack-bias
32162 @opindex mno-stack-bias
32163 @item -mstack-bias
32164 @itemx -mno-stack-bias
32165 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
32166 frame pointer if present, are offset by @minus{}2047 which must be added back
32167 when making stack frame references.  This is the default in 64-bit mode.
32168 Otherwise, assume no such offset is present.
32169 @end table
32171 @node System V Options
32172 @subsection Options for System V
32174 These additional options are available on System V Release 4 for
32175 compatibility with other compilers on those systems:
32177 @table @gcctabopt
32178 @opindex G
32179 @item -G
32180 Create a shared object.
32181 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
32183 @opindex Qy
32184 @item -Qy
32185 Identify the versions of each tool used by the compiler, in a
32186 @code{.ident} assembler directive in the output.
32188 @opindex Qn
32189 @item -Qn
32190 Refrain from adding @code{.ident} directives to the output file (this is
32191 the default).
32193 @opindex YP
32194 @item -YP,@var{dirs}
32195 Search the directories @var{dirs}, and no others, for libraries
32196 specified with @option{-l}.
32198 @opindex Ym
32199 @item -Ym,@var{dir}
32200 Look in the directory @var{dir} to find the M4 preprocessor.
32201 The assembler uses this option.
32202 @c This is supposed to go with a -Yd for predefined M4 macro files, but
32203 @c the generic assembler that comes with Solaris takes just -Ym.
32204 @end table
32206 @node V850 Options
32207 @subsection V850 Options
32208 @cindex V850 Options
32210 These @samp{-m} options are defined for V850 implementations:
32212 @table @gcctabopt
32213 @opindex mlong-calls
32214 @opindex mno-long-calls
32215 @item -mlong-calls
32216 @itemx -mno-long-calls
32217 Treat all calls as being far away (near).  If calls are assumed to be
32218 far away, the compiler always loads the function's address into a
32219 register, and calls indirect through the pointer.
32221 @opindex mno-ep
32222 @opindex mep
32223 @item -mno-ep
32224 @itemx -mep
32225 Do not optimize (do optimize) basic blocks that use the same index
32226 pointer 4 or more times to copy pointer into the @code{ep} register, and
32227 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
32228 option is on by default if you optimize.
32230 @opindex mno-prolog-function
32231 @opindex mprolog-function
32232 @item -mno-prolog-function
32233 @itemx -mprolog-function
32234 Do not use (do use) external functions to save and restore registers
32235 at the prologue and epilogue of a function.  The external functions
32236 are slower, but use less code space if more than one function saves
32237 the same number of registers.  The @option{-mprolog-function} option
32238 is on by default if you optimize.
32240 @opindex mspace
32241 @item -mspace
32242 Try to make the code as small as possible.  At present, this just turns
32243 on the @option{-mep} and @option{-mprolog-function} options.
32245 @opindex mtda
32246 @item -mtda=@var{n}
32247 Put static or global variables whose size is @var{n} bytes or less into
32248 the tiny data area that register @code{ep} points to.  The tiny data
32249 area can hold up to 256 bytes in total (128 bytes for byte references).
32251 @opindex msda
32252 @item -msda=@var{n}
32253 Put static or global variables whose size is @var{n} bytes or less into
32254 the small data area that register @code{gp} points to.  The small data
32255 area can hold up to 64 kilobytes.
32257 @opindex mzda
32258 @item -mzda=@var{n}
32259 Put static or global variables whose size is @var{n} bytes or less into
32260 the first 32 kilobytes of memory.
32262 @opindex mv850
32263 @item -mv850
32264 Specify that the target processor is the V850.
32266 @opindex mv850e3v5
32267 @item -mv850e3v5
32268 Specify that the target processor is the V850E3V5.  The preprocessor
32269 constant @code{__v850e3v5__} is defined if this option is used.
32271 @opindex mv850e2v4
32272 @item -mv850e2v4
32273 Specify that the target processor is the V850E3V5.  This is an alias for
32274 the @option{-mv850e3v5} option.
32276 @opindex mv850e2v3
32277 @item -mv850e2v3
32278 Specify that the target processor is the V850E2V3.  The preprocessor
32279 constant @code{__v850e2v3__} is defined if this option is used.
32281 @opindex mv850e2
32282 @item -mv850e2
32283 Specify that the target processor is the V850E2.  The preprocessor
32284 constant @code{__v850e2__} is defined if this option is used.
32286 @opindex mv850e1
32287 @item -mv850e1
32288 Specify that the target processor is the V850E1.  The preprocessor
32289 constants @code{__v850e1__} and @code{__v850e__} are defined if
32290 this option is used.
32292 @opindex mv850es
32293 @item -mv850es
32294 Specify that the target processor is the V850ES.  This is an alias for
32295 the @option{-mv850e1} option.
32297 @opindex mv850e
32298 @item -mv850e
32299 Specify that the target processor is the V850E@.  The preprocessor
32300 constant @code{__v850e__} is defined if this option is used.
32302 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
32303 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
32304 are defined then a default target processor is chosen and the
32305 relevant @samp{__v850*__} preprocessor constant is defined.
32307 The preprocessor constants @code{__v850} and @code{__v851__} are always
32308 defined, regardless of which processor variant is the target.
32310 @opindex mdisable-callt
32311 @opindex mno-disable-callt
32312 @item -mdisable-callt
32313 @itemx -mno-disable-callt
32314 This option suppresses generation of the @code{CALLT} instruction for the
32315 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
32316 architecture.
32318 This option is enabled by default when the RH850 ABI is
32319 in use (see @option{-mrh850-abi}), and disabled by default when the
32320 GCC ABI is in use.  If @code{CALLT} instructions are being generated
32321 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
32323 @opindex mrelax
32324 @opindex mno-relax
32325 @item -mrelax
32326 @itemx -mno-relax
32327 Pass on (or do not pass on) the @option{-mrelax} command-line option
32328 to the assembler.
32330 @opindex mlong-jumps
32331 @opindex mno-long-jumps
32332 @item -mlong-jumps
32333 @itemx -mno-long-jumps
32334 Disable (or re-enable) the generation of PC-relative jump instructions.
32336 @opindex msoft-float
32337 @opindex mhard-float
32338 @item -msoft-float
32339 @itemx -mhard-float
32340 Disable (or re-enable) the generation of hardware floating point
32341 instructions.  This option is only significant when the target
32342 architecture is @samp{V850E2V3} or higher.  If hardware floating point
32343 instructions are being generated then the C preprocessor symbol
32344 @code{__FPU_OK__} is defined, otherwise the symbol
32345 @code{__NO_FPU__} is defined.
32347 @opindex mloop
32348 @item -mloop
32349 Enables the use of the e3v5 LOOP instruction.  The use of this
32350 instruction is not enabled by default when the e3v5 architecture is
32351 selected because its use is still experimental.
32353 @opindex mrh850-abi
32354 @opindex mghs
32355 @item -mrh850-abi
32356 @itemx -mghs
32357 Enables support for the RH850 version of the V850 ABI.  This is the
32358 default.  With this version of the ABI the following rules apply:
32360 @itemize
32361 @item
32362 Integer sized structures and unions are returned via a memory pointer
32363 rather than a register.
32365 @item
32366 Large structures and unions (more than 8 bytes in size) are passed by
32367 value.
32369 @item
32370 Functions are aligned to 16-bit boundaries.
32372 @item
32373 The @option{-m8byte-align} command-line option is supported.
32375 @item
32376 The @option{-mdisable-callt} command-line option is enabled by
32377 default.  The @option{-mno-disable-callt} command-line option is not
32378 supported.
32379 @end itemize
32381 When this version of the ABI is enabled the C preprocessor symbol
32382 @code{__V850_RH850_ABI__} is defined.
32384 @opindex mgcc-abi
32385 @item -mgcc-abi
32386 Enables support for the old GCC version of the V850 ABI.  With this
32387 version of the ABI the following rules apply:
32389 @itemize
32390 @item
32391 Integer sized structures and unions are returned in register @code{r10}.
32393 @item
32394 Large structures and unions (more than 8 bytes in size) are passed by
32395 reference.
32397 @item
32398 Functions are aligned to 32-bit boundaries, unless optimizing for
32399 size.
32401 @item
32402 The @option{-m8byte-align} command-line option is not supported.
32404 @item
32405 The @option{-mdisable-callt} command-line option is supported but not
32406 enabled by default.
32407 @end itemize
32409 When this version of the ABI is enabled the C preprocessor symbol
32410 @code{__V850_GCC_ABI__} is defined.
32412 @opindex m8byte-align
32413 @opindex mno-8byte-align
32414 @item -m8byte-align
32415 @itemx -mno-8byte-align
32416 Enables support for @code{double} and @code{long long} types to be
32417 aligned on 8-byte boundaries.  The default is to restrict the
32418 alignment of all objects to at most 4-bytes.  When
32419 @option{-m8byte-align} is in effect the C preprocessor symbol
32420 @code{__V850_8BYTE_ALIGN__} is defined.
32422 @opindex mbig-switch
32423 @item -mbig-switch
32424 Generate code suitable for big switch tables.  Use this option only if
32425 the assembler/linker complain about out of range branches within a switch
32426 table.
32428 @opindex mapp-regs
32429 @item -mapp-regs
32430 This option causes r2 and r5 to be used in the code generated by
32431 the compiler.  This setting is the default.
32433 @opindex mno-app-regs
32434 @item -mno-app-regs
32435 This option causes r2 and r5 to be treated as fixed registers.
32437 @end table
32439 @node VAX Options
32440 @subsection VAX Options
32441 @cindex VAX options
32443 These @samp{-m} options are defined for the VAX:
32445 @table @gcctabopt
32446 @opindex munix
32447 @item -munix
32448 Do not output certain jump instructions (@code{aobleq} and so on)
32449 that the Unix assembler for the VAX cannot handle across long
32450 ranges.
32452 @opindex mgnu
32453 @item -mgnu
32454 Do output those jump instructions, on the assumption that the
32455 GNU assembler is being used.
32457 @opindex mg
32458 @item -mg
32459 Output code for G-format floating-point numbers instead of D-format.
32461 @opindex mlra
32462 @opindex mno-lra
32463 @item -mlra
32464 @itemx -mno-lra
32465 Enable Local Register Allocation.  This is still experimental for the VAX,
32466 so by default the compiler uses standard reload.
32467 @end table
32469 @node Visium Options
32470 @subsection Visium Options
32471 @cindex Visium options
32473 @table @gcctabopt
32475 @opindex mdebug
32476 @item -mdebug
32477 A program which performs file I/O and is destined to run on an MCM target
32478 should be linked with this option.  It causes the libraries libc.a and
32479 libdebug.a to be linked.  The program should be run on the target under
32480 the control of the GDB remote debugging stub.
32482 @opindex msim
32483 @item -msim
32484 A program which performs file I/O and is destined to run on the simulator
32485 should be linked with option.  This causes libraries libc.a and libsim.a to
32486 be linked.
32488 @opindex mfpu
32489 @opindex mhard-float
32490 @item -mfpu
32491 @itemx -mhard-float
32492 Generate code containing floating-point instructions.  This is the
32493 default.
32495 @opindex mno-fpu
32496 @opindex msoft-float
32497 @item -mno-fpu
32498 @itemx -msoft-float
32499 Generate code containing library calls for floating-point.
32501 @option{-msoft-float} changes the calling convention in the output file;
32502 therefore, it is only useful if you compile @emph{all} of a program with
32503 this option.  In particular, you need to compile @file{libgcc.a}, the
32504 library that comes with GCC, with @option{-msoft-float} in order for
32505 this to work.
32507 @opindex mcpu
32508 @item -mcpu=@var{cpu_type}
32509 Set the instruction set, register set, and instruction scheduling parameters
32510 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
32511 @samp{mcm}, @samp{gr5} and @samp{gr6}.
32513 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
32515 By default (unless configured otherwise), GCC generates code for the GR5
32516 variant of the Visium architecture.  
32518 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
32519 architecture.  The only difference from GR5 code is that the compiler will
32520 generate block move instructions.
32522 @opindex mtune
32523 @item -mtune=@var{cpu_type}
32524 Set the instruction scheduling parameters for machine type @var{cpu_type},
32525 but do not set the instruction set or register set that the option
32526 @option{-mcpu=@var{cpu_type}} would.
32528 @opindex msv-mode
32529 @item -msv-mode
32530 Generate code for the supervisor mode, where there are no restrictions on
32531 the access to general registers.  This is the default.
32533 @opindex muser-mode
32534 @item -muser-mode
32535 Generate code for the user mode, where the access to some general registers
32536 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
32537 mode; on the GR6, only registers r29 to r31 are affected.
32538 @end table
32540 @node VMS Options
32541 @subsection VMS Options
32543 These @samp{-m} options are defined for the VMS implementations:
32545 @table @gcctabopt
32546 @opindex mvms-return-codes
32547 @item -mvms-return-codes
32548 Return VMS condition codes from @code{main}. The default is to return POSIX-style
32549 condition (e.g.@: error) codes.
32551 @opindex mdebug-main=@var{prefix}
32552 @item -mdebug-main=@var{prefix}
32553 Flag the first routine whose name starts with @var{prefix} as the main
32554 routine for the debugger.
32556 @opindex mmalloc64
32557 @item -mmalloc64
32558 Default to 64-bit memory allocation routines.
32560 @opindex mpointer-size=@var{size}
32561 @item -mpointer-size=@var{size}
32562 Set the default size of pointers. Possible options for @var{size} are
32563 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
32564 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
32565 The later option disables @code{pragma pointer_size}.
32566 @end table
32568 @node VxWorks Options
32569 @subsection VxWorks Options
32570 @cindex VxWorks Options
32572 The options in this section are defined for all VxWorks targets.
32573 Options specific to the target hardware are listed with the other
32574 options for that target.
32576 @table @gcctabopt
32577 @opindex mrtp
32578 @item -mrtp
32579 GCC can generate code for both VxWorks kernels and real time processes
32580 (RTPs).  This option switches from the former to the latter.  It also
32581 defines the preprocessor macro @code{__RTP__}.
32583 @opindex msmp
32584 @item -msmp
32585 Select SMP runtimes for linking.  Not available on architectures other
32586 than PowerPC, nor on VxWorks version 7 or later, in which the selection
32587 is part of the VxWorks build configuration and the library paths are the
32588 same for either choice.
32590 @opindex non-static
32591 @item -non-static
32592 Link an RTP executable against shared libraries rather than static
32593 libraries.  The options @option{-static} and @option{-shared} can
32594 also be used for RTPs (@pxref{Link Options}); @option{-static}
32595 is the default.
32597 @opindex Bstatic
32598 @opindex Bdynamic
32599 @item -Bstatic
32600 @itemx -Bdynamic
32601 These options are passed down to the linker.  They are defined for
32602 compatibility with Diab.
32604 @opindex Xbind-lazy
32605 @item -Xbind-lazy
32606 Enable lazy binding of function calls.  This option is equivalent to
32607 @option{-Wl,-z,now} and is defined for compatibility with Diab.
32609 @opindex Xbind-now
32610 @item -Xbind-now
32611 Disable lazy binding of function calls.  This option is the default and
32612 is defined for compatibility with Diab.
32613 @end table
32615 @node x86 Options
32616 @subsection x86 Options
32617 @cindex x86 Options
32619 These @samp{-m} options are defined for the x86 family of computers.
32621 @table @gcctabopt
32623 @opindex march
32624 @item -march=@var{cpu-type}
32625 Generate instructions for the machine type @var{cpu-type}.  In contrast to
32626 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code 
32627 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
32628 to generate code that may not run at all on processors other than the one
32629 indicated.  Specifying @option{-march=@var{cpu-type}} implies 
32630 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
32632 The choices for @var{cpu-type} are:
32634 @table @samp
32635 @item native
32636 This selects the CPU to generate code for at compilation time by determining
32637 the processor type of the compiling machine.  Using @option{-march=native}
32638 enables all instruction subsets supported by the local machine (hence
32639 the result might not run on different machines).  Using @option{-mtune=native}
32640 produces code optimized for the local machine under the constraints
32641 of the selected instruction set.  
32643 @item x86-64
32644 A generic CPU with 64-bit extensions.
32646 @item x86-64-v2
32647 @itemx x86-64-v3
32648 @itemx x86-64-v4
32649 These choices for @var{cpu-type} select the corresponding
32650 micro-architecture level from the x86-64 psABI.  On ABIs other than
32651 the x86-64 psABI they select the same CPU features as the x86-64 psABI
32652 documents for the particular micro-architecture level.
32654 Since these @var{cpu-type} values do not have a corresponding
32655 @option{-mtune} setting, using @option{-march} with these values enables
32656 generic tuning.  Specific tuning can be enabled using the
32657 @option{-mtune=@var{other-cpu-type}} option with an appropriate
32658 @var{other-cpu-type} value.
32660 @item i386
32661 Original Intel i386 CPU@.
32663 @item i486
32664 Intel i486 CPU@.  (No scheduling is implemented for this chip.)
32666 @item i586
32667 @itemx pentium
32668 Intel Pentium CPU with no MMX support.
32670 @item lakemont
32671 Intel Lakemont MCU, based on Intel Pentium CPU.
32673 @item pentium-mmx
32674 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
32676 @item pentiumpro
32677 Intel Pentium Pro CPU@.
32679 @item i686
32680 When used with @option{-march}, the Pentium Pro
32681 instruction set is used, so the code runs on all i686 family chips.
32682 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
32684 @item pentium2
32685 Intel Pentium II CPU, based on Pentium Pro core with MMX and FXSR instruction
32686 set support.
32688 @item pentium3
32689 @itemx pentium3m
32690 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR and SSE
32691 instruction set support.
32693 @item pentium-m
32694 Intel Pentium M; low-power version of Intel Pentium III CPU
32695 with MMX, SSE, SSE2 and FXSR instruction set support.  Used by Centrino
32696 notebooks.
32698 @item pentium4
32699 @itemx pentium4m
32700 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction set support.
32702 @item prescott
32703 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2, SSE3 and FXSR
32704 instruction set support.
32706 @item nocona
32707 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
32708 SSE2, SSE3 and FXSR instruction set support.
32710 @item core2
32711 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, CX16,
32712 SAHF and FXSR instruction set support.
32714 @item nehalem
32715 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32716 SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction set support.
32718 @item westmere
32719 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32720 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and PCLMUL instruction set support.
32722 @item sandybridge
32723 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32724 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE and PCLMUL instruction set
32725 support.
32727 @item ivybridge
32728 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32729 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND
32730 and F16C instruction set support.
32732 @item haswell
32733 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32734 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32735 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE and HLE instruction set support.
32737 @item broadwell
32738 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32739 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32740 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW
32741 instruction set support.
32743 @item skylake
32744 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32745 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32746 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32747 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
32749 @item bonnell
32750 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
32751 instruction set support.
32753 @item silvermont
32754 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32755 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW and RDRND
32756 instruction set support.
32758 @item goldmont
32759 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32760 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32761 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction
32762 set support.
32764 @item goldmont-plus
32765 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32766 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES,
32767 SHA, RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE,
32768 RDPID and SGX instruction set support.
32770 @item tremont
32771 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32772 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32773 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID,
32774 SGX, CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG instruction set
32775 support.
32777 @item sierraforest
32778 Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32779 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32780 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32781 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32782 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32783 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, ENQCMD and UINTR instruction set
32784 support.
32786 @item grandridge
32787 Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32788 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32789 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32790 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32791 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32792 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, ENQCMD, UINTR and RAOINT
32793 instruction set support.
32795 @item arrowlake
32796 Intel Arrow Lake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32797 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32798 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32799 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32800 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32801 AVXIFMA, AVXVNNIINT8, AVXNECONVERT and CMPCCXADD instruction set support.
32803 @item arrowlake-s
32804 Intel Arrow Lake S CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32805 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32806 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32807 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32808 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32809 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16, SHA512, SM3
32810 and SM4 instruction set support.
32812 @item knl
32813 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32814 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32815 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32816 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1 instruction set support.
32818 @item knm
32819 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32820 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32821 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32822 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
32823 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
32825 @item skylake-avx512
32826 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32827 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32828 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32829 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW,
32830 AVX512DQ and AVX512CD instruction set support.
32832 @item cannonlake
32833 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
32834 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL,
32835 FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX,
32836 PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
32837 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA instruction set
32838 support.
32840 @item icelake-client
32841 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32842 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32843 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32844 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32845 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
32846 , VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
32848 @item icelake-server
32849 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32850 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32851 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32852 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32853 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
32854 , VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB
32855 instruction set support.
32857 @item cascadelake
32858 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32859 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32860 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32861 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
32862 AVX512CD and AVX512VNNI instruction set support.
32864 @item cooperlake
32865 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32866 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32867 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32868 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
32869 AVX512CD, AVX512VNNI and AVX512BF16 instruction set support.
32871 @item tigerlake
32872 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32873 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32874 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32875 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
32876 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32877 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
32878 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
32880 @item sapphirerapids
32881 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32882 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32883 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32884 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32885 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32886 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
32887 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
32888 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16 and AVX512BF16
32889 instruction set support.
32891 @item alderlake
32892 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32893 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
32894 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
32895 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, PCONFIG, PKU,
32896 VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI instruction set
32897 support.
32899 @item rocketlake
32900 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3
32901 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32902 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32903 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
32904 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32905 VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
32907 @item graniterapids
32908 Intel graniterapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32909 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32910 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32911 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32912 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32913 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
32914 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
32915 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16, AVX512BF16, AMX-FP16
32916 and PREFETCHI instruction set support.
32918 @item graniterapids-d
32919 Intel graniterapids D CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32920 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32921 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32922 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32923 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32924 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
32925 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
32926 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16, AVX512BF16, AMX-FP16,
32927 PREFETCHI and AMX-COMPLEX instruction set support.
32929 @item k6
32930 AMD K6 CPU with MMX instruction set support.
32932 @item k6-2
32933 @itemx k6-3
32934 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
32936 @item athlon
32937 @itemx athlon-tbird
32938 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
32939 support.
32941 @item athlon-4
32942 @itemx athlon-xp
32943 @itemx athlon-mp
32944 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
32945 instruction set support.
32947 @item k8
32948 @itemx opteron
32949 @itemx athlon64
32950 @itemx athlon-fx
32951 Processors based on the AMD K8 core with x86-64 instruction set support,
32952 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
32953 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
32954 instruction set extensions.)
32956 @item k8-sse3
32957 @itemx opteron-sse3
32958 @itemx athlon64-sse3
32959 Improved versions of AMD K8 cores with SSE3 instruction set support.
32961 @item amdfam10
32962 @itemx barcelona
32963 CPUs based on AMD Family 10h cores with x86-64 instruction set support.  (This
32964 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
32965 instruction set extensions.)
32967 @item bdver1
32968 CPUs based on AMD Family 15h cores with x86-64 instruction set support.  (This
32969 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
32970 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
32972 @item bdver2
32973 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
32974 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
32975 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 
32976 extensions.)
32978 @item bdver3
32979 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
32980 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 
32981 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
32982 64-bit instruction set extensions.)
32984 @item bdver4
32985 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
32986 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 
32987 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
32988 SSE4.2, ABM and 64-bit instruction set extensions.)
32990 @item znver1
32991 AMD Family 17h core based CPUs with x86-64 instruction set support.  (This
32992 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
32993 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
32994 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
32995 instruction set extensions.)
32997 @item znver2
32998 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
32999 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
33000 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
33001 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
33002 WBNOINVD, and 64-bit instruction set extensions.)
33004 @item znver3
33005 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
33006 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
33007 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
33008 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
33009 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
33011 @item znver4
33012 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
33013 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
33014 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
33015 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
33016 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD,
33017 AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, AVX512VNNI,
33018 AVX512BITALG, AVX512VPOPCNTDQ, GFNI and 64-bit instruction set extensions.)
33020 @item btver1
33021 CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
33022 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
33023 instruction set extensions.)
33025 @item btver2
33026 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
33027 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
33028 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
33030 @item winchip-c6
33031 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
33032 set support.
33034 @item winchip2
33035 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
33036 instruction set support.
33038 @item c3
33039 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
33040 (No scheduling is implemented for this chip.)
33042 @item c3-2
33043 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
33044 (No scheduling is implemented for this chip.)
33046 @item c7
33047 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
33048 (No scheduling is implemented for this chip.)
33050 @item samuel-2
33051 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
33052 (No scheduling is implemented for this chip.)
33054 @item nehemiah
33055 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
33056 (No scheduling is implemented for this chip.)
33058 @item esther
33059 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
33060 (No scheduling is implemented for this chip.)
33062 @item eden-x2
33063 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
33064 (No scheduling is implemented for this chip.)
33066 @item eden-x4
33067 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
33068 AVX and AVX2 instruction set support.
33069 (No scheduling is implemented for this chip.)
33071 @item nano
33072 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
33073 instruction set support.
33074 (No scheduling is implemented for this chip.)
33076 @item nano-1000
33077 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
33078 instruction set support.
33079 (No scheduling is implemented for this chip.)
33081 @item nano-2000
33082 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
33083 instruction set support.
33084 (No scheduling is implemented for this chip.)
33086 @item nano-3000
33087 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
33088 instruction set support.
33089 (No scheduling is implemented for this chip.)
33091 @item nano-x2
33092 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
33093 instruction set support.
33094 (No scheduling is implemented for this chip.)
33096 @item nano-x4
33097 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
33098 instruction set support.
33099 (No scheduling is implemented for this chip.)
33101 @item lujiazui
33102 ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
33103 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
33104 ABM, BMI, BMI2, F16C, FXSR, RDSEED instruction set support.
33106 @item geode
33107 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
33108 @end table
33110 @opindex mtune
33111 @item -mtune=@var{cpu-type}
33112 Tune to @var{cpu-type} everything applicable about the generated code, except
33113 for the ABI and the set of available instructions.  
33114 While picking a specific @var{cpu-type} schedules things appropriately
33115 for that particular chip, the compiler does not generate any code that
33116 cannot run on the default machine type unless you use a
33117 @option{-march=@var{cpu-type}} option.
33118 For example, if GCC is configured for i686-pc-linux-gnu
33119 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
33120 but still runs on i686 machines.
33122 The choices for @var{cpu-type} are the same as for @option{-march}.
33123 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
33125 @table @samp
33126 @item generic
33127 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
33128 If you know the CPU on which your code will run, then you should use
33129 the corresponding @option{-mtune} or @option{-march} option instead of
33130 @option{-mtune=generic}.  But, if you do not know exactly what CPU users
33131 of your application will have, then you should use this option.
33133 As new processors are deployed in the marketplace, the behavior of this
33134 option will change.  Therefore, if you upgrade to a newer version of
33135 GCC, code generation controlled by this option will change to reflect
33136 the processors
33137 that are most common at the time that version of GCC is released.
33139 There is no @option{-march=generic} option because @option{-march}
33140 indicates the instruction set the compiler can use, and there is no
33141 generic instruction set applicable to all processors.  In contrast,
33142 @option{-mtune} indicates the processor (or, in this case, collection of
33143 processors) for which the code is optimized.
33145 @item intel
33146 Produce code optimized for the most current Intel processors, which are
33147 Haswell and Silvermont for this version of GCC.  If you know the CPU
33148 on which your code will run, then you should use the corresponding
33149 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
33150 But, if you want your application performs better on both Haswell and
33151 Silvermont, then you should use this option.
33153 As new Intel processors are deployed in the marketplace, the behavior of
33154 this option will change.  Therefore, if you upgrade to a newer version of
33155 GCC, code generation controlled by this option will change to reflect
33156 the most current Intel processors at the time that version of GCC is
33157 released.
33159 There is no @option{-march=intel} option because @option{-march} indicates
33160 the instruction set the compiler can use, and there is no common
33161 instruction set applicable to all processors.  In contrast,
33162 @option{-mtune} indicates the processor (or, in this case, collection of
33163 processors) for which the code is optimized.
33164 @end table
33166 @opindex mcpu
33167 @item -mcpu=@var{cpu-type}
33168 A deprecated synonym for @option{-mtune}.
33170 @opindex mfpmath
33171 @item -mfpmath=@var{unit}
33172 Generate floating-point arithmetic for selected unit @var{unit}.  The choices
33173 for @var{unit} are:
33175 @table @samp
33176 @item 387
33177 Use the standard 387 floating-point coprocessor present on the majority of chips and
33178 emulated otherwise.  Code compiled with this option runs almost everywhere.
33179 The temporary results are computed in 80-bit precision instead of the precision
33180 specified by the type, resulting in slightly different results compared to most
33181 of other chips.  See @option{-ffloat-store} for more detailed description.
33183 This is the default choice for non-Darwin x86-32 targets.
33185 @item sse
33186 Use scalar floating-point instructions present in the SSE instruction set.
33187 This instruction set is supported by Pentium III and newer chips,
33188 and in the AMD line
33189 by Athlon-4, Athlon XP and Athlon MP chips.  The earlier version of the SSE
33190 instruction set supports only single-precision arithmetic, thus the double and
33191 extended-precision arithmetic are still done using 387.  A later version, present
33192 only in Pentium 4 and AMD x86-64 chips, supports double-precision
33193 arithmetic too.
33195 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
33196 or @option{-msse2} switches to enable SSE extensions and make this option
33197 effective.  For the x86-64 compiler, these extensions are enabled by default.
33199 The resulting code should be considerably faster in the majority of cases and avoid
33200 the numerical instability problems of 387 code, but may break some existing
33201 code that expects temporaries to be 80 bits.
33203 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
33204 and the default choice for x86-32 targets with the SSE2 instruction set
33205 when @option{-ffast-math} is enabled.
33207 @item sse,387
33208 @itemx sse+387
33209 @itemx both
33210 Attempt to utilize both instruction sets at once.  This effectively doubles the
33211 amount of available registers, and on chips with separate execution units for
33212 387 and SSE the execution resources too.  Use this option with care, as it is
33213 still experimental, because the GCC register allocator does not model separate
33214 functional units well, resulting in unstable performance.
33215 @end table
33217 @opindex masm=@var{dialect}
33218 @item -masm=@var{dialect}
33219 Output assembly instructions using selected @var{dialect}.  Also affects
33220 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
33221 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
33222 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
33223 not support @samp{intel}.
33225 @opindex mieee-fp
33226 @opindex mno-ieee-fp
33227 @item -mieee-fp
33228 @itemx -mno-ieee-fp
33229 Control whether or not the compiler uses IEEE floating-point
33230 comparisons.  These correctly handle the case where the result of a
33231 comparison is unordered.
33233 @opindex m80387
33234 @opindex mhard-float
33235 @item -m80387
33236 @itemx -mhard-float
33237 Generate output containing 80387 instructions for floating point.
33239 @opindex no-80387
33240 @opindex msoft-float
33241 @item -mno-80387
33242 @itemx -msoft-float
33243 Generate output containing library calls for floating point.
33245 @strong{Warning:} the requisite libraries are not part of GCC@.
33246 Normally the facilities of the machine's usual C compiler are used, but
33247 this cannot be done directly in cross-compilation.  You must make your
33248 own arrangements to provide suitable library functions for
33249 cross-compilation.
33251 On machines where a function returns floating-point results in the 80387
33252 register stack, some floating-point opcodes may be emitted even if
33253 @option{-msoft-float} is used.
33255 @opindex mno-fp-ret-in-387
33256 @opindex mfp-ret-in-387
33257 @item -mno-fp-ret-in-387
33258 Do not use the FPU registers for return values of functions.
33260 The usual calling convention has functions return values of types
33261 @code{float} and @code{double} in an FPU register, even if there
33262 is no FPU@.  The idea is that the operating system should emulate
33263 an FPU@.
33265 The option @option{-mno-fp-ret-in-387} causes such values to be returned
33266 in ordinary CPU registers instead.
33268 @opindex mno-fancy-math-387
33269 @opindex mfancy-math-387
33270 @item -mno-fancy-math-387
33271 Some 387 emulators do not support the @code{sin}, @code{cos} and
33272 @code{sqrt} instructions for the 387.  Specify this option to avoid
33273 generating those instructions.
33274 This option is overridden when @option{-march}
33275 indicates that the target CPU always has an FPU and so the
33276 instruction does not need emulation.  These
33277 instructions are not generated unless you also use the
33278 @option{-funsafe-math-optimizations} switch.
33280 @opindex malign-double
33281 @opindex mno-align-double
33282 @item -malign-double
33283 @itemx -mno-align-double
33284 Control whether GCC aligns @code{double}, @code{long double}, and
33285 @code{long long} variables on a two-word boundary or a one-word
33286 boundary.  Aligning @code{double} variables on a two-word boundary
33287 produces code that runs somewhat faster on a Pentium at the
33288 expense of more memory.
33290 On x86-64, @option{-malign-double} is enabled by default.
33292 @strong{Warning:} if you use the @option{-malign-double} switch,
33293 structures containing the above types are aligned differently than
33294 the published application binary interface specifications for the x86-32
33295 and are not binary compatible with structures in code compiled
33296 without that switch.
33298 @opindex m96bit-long-double
33299 @opindex m128bit-long-double
33300 @item -m96bit-long-double
33301 @itemx -m128bit-long-double
33302 These switches control the size of @code{long double} type.  The x86-32
33303 application binary interface specifies the size to be 96 bits,
33304 so @option{-m96bit-long-double} is the default in 32-bit mode.
33306 Modern architectures (Pentium and newer) prefer @code{long double}
33307 to be aligned to an 8- or 16-byte boundary.  In arrays or structures
33308 conforming to the ABI, this is not possible.  So specifying
33309 @option{-m128bit-long-double} aligns @code{long double}
33310 to a 16-byte boundary by padding the @code{long double} with an additional
33311 32-bit zero.
33313 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
33314 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
33316 Notice that neither of these options enable any extra precision over the x87
33317 standard of 80 bits for a @code{long double}.
33319 @strong{Warning:} if you override the default value for your target ABI, this
33320 changes the size of 
33321 structures and arrays containing @code{long double} variables,
33322 as well as modifying the function calling convention for functions taking
33323 @code{long double}.  Hence they are not binary-compatible
33324 with code compiled without that switch.
33326 @opindex mlong-double-64
33327 @opindex mlong-double-80
33328 @opindex mlong-double-128
33329 @item -mlong-double-64
33330 @itemx -mlong-double-80
33331 @itemx -mlong-double-128
33332 These switches control the size of @code{long double} type. A size
33333 of 64 bits makes the @code{long double} type equivalent to the @code{double}
33334 type. This is the default for 32-bit Bionic C library.  A size
33335 of 128 bits makes the @code{long double} type equivalent to the
33336 @code{__float128} type. This is the default for 64-bit Bionic C library.
33338 @strong{Warning:} if you override the default value for your target ABI, this
33339 changes the size of
33340 structures and arrays containing @code{long double} variables,
33341 as well as modifying the function calling convention for functions taking
33342 @code{long double}.  Hence they are not binary-compatible
33343 with code compiled without that switch.
33345 @opindex malign-data
33346 @item -malign-data=@var{type}
33347 Control how GCC aligns variables.  Supported values for @var{type} are
33348 @samp{compat} uses increased alignment value compatible uses GCC 4.8
33349 and earlier, @samp{abi} uses alignment value as specified by the
33350 psABI, and @samp{cacheline} uses increased alignment value to match
33351 the cache line size.  @samp{compat} is the default.
33353 @opindex mlarge-data-threshold
33354 @item -mlarge-data-threshold=@var{threshold}
33355 When @option{-mcmodel=medium} is specified, data objects larger than
33356 @var{threshold} are placed in the large data section.  This value must be the
33357 same across all objects linked into the binary, and defaults to 65535.
33359 @opindex mrtd
33360 @item -mrtd
33361 Use a different function-calling convention, in which functions that
33362 take a fixed number of arguments return with the @code{ret @var{num}}
33363 instruction, which pops their arguments while returning.  This saves one
33364 instruction in the caller since there is no need to pop the arguments
33365 there.
33367 You can specify that an individual function is called with this calling
33368 sequence with the function attribute @code{stdcall}.  You can also
33369 override the @option{-mrtd} option by using the function attribute
33370 @code{cdecl}.  @xref{Function Attributes}.
33372 @strong{Warning:} this calling convention is incompatible with the one
33373 normally used on Unix, so you cannot use it if you need to call
33374 libraries compiled with the Unix compiler.
33376 Also, you must provide function prototypes for all functions that
33377 take variable numbers of arguments (including @code{printf});
33378 otherwise incorrect code is generated for calls to those
33379 functions.
33381 In addition, seriously incorrect code results if you call a
33382 function with too many arguments.  (Normally, extra arguments are
33383 harmlessly ignored.)
33385 @opindex mregparm
33386 @item -mregparm=@var{num}
33387 Control how many registers are used to pass integer arguments.  By
33388 default, no registers are used to pass arguments, and at most 3
33389 registers can be used.  You can control this behavior for a specific
33390 function by using the function attribute @code{regparm}.
33391 @xref{Function Attributes}.
33393 @strong{Warning:} if you use this switch, and
33394 @var{num} is nonzero, then you must build all modules with the same
33395 value, including any libraries.  This includes the system libraries and
33396 startup modules.
33398 @opindex msseregparm
33399 @item -msseregparm
33400 Use SSE register passing conventions for float and double arguments
33401 and return values.  You can control this behavior for a specific
33402 function by using the function attribute @code{sseregparm}.
33403 @xref{Function Attributes}.
33405 @strong{Warning:} if you use this switch then you must build all
33406 modules with the same value, including any libraries.  This includes
33407 the system libraries and startup modules.
33409 @opindex mvect8-ret-in-mem
33410 @item -mvect8-ret-in-mem
33411 Return 8-byte vectors in memory instead of MMX registers.  This is the
33412 default on VxWorks to match the ABI of the Sun Studio compilers until
33413 version 12.  @emph{Only} use this option if you need to remain
33414 compatible with existing code produced by those previous compiler
33415 versions or older versions of GCC@.
33417 @opindex mpc32
33418 @opindex mpc64
33419 @opindex mpc80
33420 @item -mpc32
33421 @itemx -mpc64
33422 @itemx -mpc80
33424 Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
33425 is specified, the significands of results of floating-point operations are
33426 rounded to 24 bits (single precision); @option{-mpc64} rounds the
33427 significands of results of floating-point operations to 53 bits (double
33428 precision) and @option{-mpc80} rounds the significands of results of
33429 floating-point operations to 64 bits (extended double precision), which is
33430 the default.  When this option is used, floating-point operations in higher
33431 precisions are not available to the programmer without setting the FPU
33432 control word explicitly.
33434 Setting the rounding of floating-point operations to less than the default
33435 80 bits can speed some programs by 2% or more.  Note that some mathematical
33436 libraries assume that extended-precision (80-bit) floating-point operations
33437 are enabled by default; routines in such libraries could suffer significant
33438 loss of accuracy, typically through so-called ``catastrophic cancellation'',
33439 when this option is used to set the precision to less than extended precision.
33441 @opindex mdaz-ftz
33442 @item -mdaz-ftz
33444 The flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the MXCSR register
33445 are used to control floating-point calculations.SSE and AVX instructions
33446 including scalar and vector instructions could benefit from enabling the FTZ
33447 and DAZ flags when @option{-mdaz-ftz} is specified. Don't set FTZ/DAZ flags
33448 when @option{-mno-daz-ftz} or @option{-shared} is specified, @option{-mdaz-ftz}
33449 will set FTZ/DAZ flags even with @option{-shared}.
33451 @opindex mstackrealign
33452 @item -mstackrealign
33453 Realign the stack at entry.  On the x86, the @option{-mstackrealign}
33454 option generates an alternate prologue and epilogue that realigns the
33455 run-time stack if necessary.  This supports mixing legacy codes that keep
33456 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
33457 SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
33458 applicable to individual functions.
33460 @opindex mpreferred-stack-boundary
33461 @item -mpreferred-stack-boundary=@var{num}
33462 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
33463 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
33464 the default is 4 (16 bytes or 128 bits).
33466 @strong{Warning:} When generating code for the x86-64 architecture with
33467 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
33468 used to keep the stack boundary aligned to 8 byte boundary.  Since
33469 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
33470 intended to be used in controlled environment where stack space is
33471 important limitation.  This option leads to wrong code when functions
33472 compiled with 16 byte stack alignment (such as functions from a standard
33473 library) are called with misaligned stack.  In this case, SSE
33474 instructions may lead to misaligned memory access traps.  In addition,
33475 variable arguments are handled incorrectly for 16 byte aligned
33476 objects (including x87 long double and __int128), leading to wrong
33477 results.  You must build all modules with
33478 @option{-mpreferred-stack-boundary=3}, including any libraries.  This
33479 includes the system libraries and startup modules.
33481 @opindex mincoming-stack-boundary
33482 @item -mincoming-stack-boundary=@var{num}
33483 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
33484 boundary.  If @option{-mincoming-stack-boundary} is not specified,
33485 the one specified by @option{-mpreferred-stack-boundary} is used.
33487 On Pentium and Pentium Pro, @code{double} and @code{long double} values
33488 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
33489 suffer significant run time performance penalties.  On Pentium III, the
33490 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
33491 properly if it is not 16-byte aligned.
33493 To ensure proper alignment of this values on the stack, the stack boundary
33494 must be as aligned as that required by any value stored on the stack.
33495 Further, every function must be generated such that it keeps the stack
33496 aligned.  Thus calling a function compiled with a higher preferred
33497 stack boundary from a function compiled with a lower preferred stack
33498 boundary most likely misaligns the stack.  It is recommended that
33499 libraries that use callbacks always use the default setting.
33501 This extra alignment does consume extra stack space, and generally
33502 increases code size.  Code that is sensitive to stack space usage, such
33503 as embedded systems and operating system kernels, may want to reduce the
33504 preferred alignment to @option{-mpreferred-stack-boundary=2}.
33506 @need 200
33507 @opindex mmmx
33508 @item -mmmx
33509 @need 200
33510 @opindex msse
33511 @itemx -msse
33512 @need 200
33513 @opindex msse2
33514 @itemx -msse2
33515 @need 200
33516 @opindex msse3
33517 @itemx -msse3
33518 @need 200
33519 @opindex mssse3
33520 @itemx -mssse3
33521 @need 200
33522 @opindex msse4
33523 @itemx -msse4
33524 @need 200
33525 @opindex msse4a
33526 @itemx -msse4a
33527 @need 200
33528 @opindex msse4.1
33529 @itemx -msse4.1
33530 @need 200
33531 @opindex msse4.2
33532 @itemx -msse4.2
33533 @need 200
33534 @opindex mavx
33535 @itemx -mavx
33536 @need 200
33537 @opindex mavx2
33538 @itemx -mavx2
33539 @need 200
33540 @opindex mavx512f
33541 @itemx -mavx512f
33542 @need 200
33543 @opindex mavx512pf
33544 @itemx -mavx512pf
33545 @need 200
33546 @opindex mavx512er
33547 @itemx -mavx512er
33548 @need 200
33549 @opindex mavx512cd
33550 @itemx -mavx512cd
33551 @need 200
33552 @opindex mavx512vl
33553 @itemx -mavx512vl
33554 @need 200
33555 @opindex mavx512bw
33556 @itemx -mavx512bw
33557 @need 200
33558 @opindex mavx512dq
33559 @itemx -mavx512dq
33560 @need 200
33561 @opindex mavx512ifma
33562 @itemx -mavx512ifma
33563 @need 200
33564 @opindex mavx512vbmi
33565 @itemx -mavx512vbmi
33566 @need 200
33567 @opindex msha
33568 @itemx -msha
33569 @need 200
33570 @opindex maes
33571 @itemx -maes
33572 @need 200
33573 @opindex mpclmul
33574 @itemx -mpclmul
33575 @need 200
33576 @opindex mclflushopt
33577 @itemx -mclflushopt
33578 @need 200
33579 @opindex mclwb
33580 @itemx -mclwb
33581 @need 200
33582 @opindex mfsgsbase
33583 @itemx -mfsgsbase
33584 @need 200
33585 @opindex mptwrite
33586 @itemx -mptwrite
33587 @need 200
33588 @opindex mrdrnd
33589 @itemx -mrdrnd
33590 @need 200
33591 @opindex mf16c
33592 @itemx -mf16c
33593 @need 200
33594 @opindex mfma
33595 @itemx -mfma
33596 @need 200
33597 @opindex mpconfig
33598 @itemx -mpconfig
33599 @need 200
33600 @opindex mwbnoinvd
33601 @itemx -mwbnoinvd
33602 @need 200
33603 @opindex mfma4
33604 @itemx -mfma4
33605 @need 200
33606 @opindex mprfchw
33607 @itemx -mprfchw
33608 @need 200
33609 @opindex mrdpid
33610 @itemx -mrdpid
33611 @need 200
33612 @opindex mprefetchwt1
33613 @itemx -mprefetchwt1
33614 @need 200
33615 @opindex mrdseed
33616 @itemx -mrdseed
33617 @need 200
33618 @opindex msgx
33619 @itemx -msgx
33620 @need 200
33621 @opindex mxop
33622 @itemx -mxop
33623 @need 200
33624 @opindex mlwp
33625 @itemx -mlwp
33626 @need 200
33627 @opindex m3dnow
33628 @itemx -m3dnow
33629 @need 200
33630 @opindex m3dnowa
33631 @itemx -m3dnowa
33632 @need 200
33633 @opindex mpopcnt
33634 @itemx -mpopcnt
33635 @need 200
33636 @opindex mabm
33637 @itemx -mabm
33638 @need 200
33639 @opindex madx
33640 @itemx -madx
33641 @need 200
33642 @opindex mbmi
33643 @itemx -mbmi
33644 @need 200
33645 @opindex mbmi2
33646 @itemx -mbmi2
33647 @need 200
33648 @opindex mlzcnt
33649 @itemx -mlzcnt
33650 @need 200
33651 @opindex mfxsr
33652 @itemx -mfxsr
33653 @need 200
33654 @opindex mxsave
33655 @itemx -mxsave
33656 @need 200
33657 @opindex mxsaveopt
33658 @itemx -mxsaveopt
33659 @need 200
33660 @opindex mxsavec
33661 @itemx -mxsavec
33662 @need 200
33663 @opindex mxsaves
33664 @itemx -mxsaves
33665 @need 200
33666 @opindex mrtm
33667 @itemx -mrtm
33668 @need 200
33669 @opindex mhle
33670 @itemx -mhle
33671 @need 200
33672 @opindex mtbm
33673 @itemx -mtbm
33674 @need 200
33675 @opindex mmwaitx
33676 @itemx -mmwaitx
33677 @need 200
33678 @opindex mclzero
33679 @itemx -mclzero
33680 @need 200
33681 @opindex mpku
33682 @itemx -mpku
33683 @need 200
33684 @opindex mavx512vbmi2
33685 @itemx -mavx512vbmi2
33686 @need 200
33687 @opindex mavx512bf16
33688 @itemx -mavx512bf16
33689 @need 200
33690 @opindex mavx512fp16
33691 @itemx -mavx512fp16
33692 @need 200
33693 @opindex mgfni
33694 @itemx -mgfni
33695 @need 200
33696 @opindex mvaes
33697 @itemx -mvaes
33698 @need 200
33699 @opindex mwaitpkg
33700 @itemx -mwaitpkg
33701 @need 200
33702 @opindex mvpclmulqdq
33703 @itemx -mvpclmulqdq
33704 @need 200
33705 @opindex mavx512bitalg
33706 @itemx -mavx512bitalg
33707 @need 200
33708 @opindex mmovdiri
33709 @itemx -mmovdiri
33710 @need 200
33711 @opindex mmovdir64b
33712 @itemx -mmovdir64b
33713 @need 200
33714 @opindex menqcmd
33715 @opindex muintr
33716 @itemx -menqcmd
33717 @itemx -muintr
33718 @need 200
33719 @opindex mtsxldtrk
33720 @itemx -mtsxldtrk
33721 @need 200
33722 @opindex mavx512vpopcntdq
33723 @itemx -mavx512vpopcntdq
33724 @need 200
33725 @opindex mavx512vp2intersect
33726 @itemx -mavx512vp2intersect
33727 @need 200
33728 @opindex mavx5124fmaps
33729 @itemx -mavx5124fmaps
33730 @need 200
33731 @opindex mavx512vnni
33732 @itemx -mavx512vnni
33733 @need 200
33734 @opindex mavxvnni
33735 @itemx -mavxvnni
33736 @need 200
33737 @opindex mavx5124vnniw
33738 @itemx -mavx5124vnniw
33739 @need 200
33740 @opindex mcldemote
33741 @itemx -mcldemote
33742 @need 200
33743 @opindex mserialize
33744 @itemx -mserialize
33745 @need 200
33746 @opindex mamx-tile
33747 @itemx -mamx-tile
33748 @need 200
33749 @opindex mamx-int8
33750 @itemx -mamx-int8
33751 @need 200
33752 @opindex mamx-bf16
33753 @itemx -mamx-bf16
33754 @need 200
33755 @opindex mhreset
33756 @opindex mkl
33757 @itemx -mhreset
33758 @itemx -mkl
33759 @need 200
33760 @opindex mwidekl
33761 @itemx -mwidekl
33762 @need 200
33763 @opindex mavxifma
33764 @itemx -mavxifma
33765 @need 200
33766 @opindex mavxvnniint8
33767 @itemx -mavxvnniint8
33768 @need 200
33769 @opindex mavxneconvert
33770 @itemx -mavxneconvert
33771 @need 200
33772 @opindex mcmpccxadd
33773 @itemx -mcmpccxadd
33774 @need 200
33775 @opindex mamx-fp16
33776 @itemx -mamx-fp16
33777 @need 200
33778 @opindex mprefetchi
33779 @itemx -mprefetchi
33780 @need 200
33781 @opindex mraoint
33782 @itemx -mraoint
33783 @need 200
33784 @opindex mamx-complex
33785 @itemx -mamx-complex
33786 @need 200
33787 @opindex mavxvnniint16
33788 @itemx -mavxvnniint16
33789 @need 200
33790 @opindex msm3
33791 @itemx -msm3
33792 @need 200
33793 @opindex msha512
33794 @itemx -msha512
33795 @need 200
33796 @opindex msm4
33797 @itemx -msm4
33798 These switches enable the use of instructions in the MMX, SSE,
33799 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
33800 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
33801 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
33802 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
33803 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
33804 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
33805 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
33806 UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512-FP16,
33807 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AMX-FP16, PREFETCHI, RAOINT,
33808 AMX-COMPLEX, AVXVNNIINT16, SM3, SHA512, SM4 or CLDEMOTE extended instruction
33809 sets. Each has a corresponding @option{-mno-} option to disable use of these
33810 instructions.
33812 These extensions are also available as built-in functions: see
33813 @ref{x86 Built-in Functions}, for details of the functions enabled and
33814 disabled by these switches.
33816 To generate SSE/SSE2 instructions automatically from floating-point
33817 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
33819 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
33820 generates new AVX instructions or AVX equivalence for all SSEx instructions
33821 when needed.
33823 These options enable GCC to use these extended instructions in
33824 generated code, even without @option{-mfpmath=sse}.  Applications that
33825 perform run-time CPU detection must compile separate files for each
33826 supported architecture, using the appropriate flags.  In particular,
33827 the file containing the CPU detection code should be compiled without
33828 these options.
33830 @opindex mdump-tune-features
33831 @item -mdump-tune-features
33832 This option instructs GCC to dump the names of the x86 performance 
33833 tuning features and default settings. The names can be used in 
33834 @option{-mtune-ctrl=@var{feature-list}}.
33836 @opindex mtune-ctrl=@var{feature-list}
33837 @item -mtune-ctrl=@var{feature-list}
33838 This option is used to do fine grain control of x86 code generation features.
33839 @var{feature-list} is a comma separated list of @var{feature} names. See also
33840 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
33841 on if it is not preceded with @samp{^}, otherwise, it is turned off. 
33842 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
33843 developers. Using it may lead to code paths not covered by testing and can
33844 potentially result in compiler ICEs or runtime errors.
33846 @opindex mno-default
33847 @item -mno-default
33848 This option instructs GCC to turn off all tunable features. See also 
33849 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
33851 @opindex mcld
33852 @item -mcld
33853 This option instructs GCC to emit a @code{cld} instruction in the prologue
33854 of functions that use string instructions.  String instructions depend on
33855 the DF flag to select between autoincrement or autodecrement mode.  While the
33856 ABI specifies the DF flag to be cleared on function entry, some operating
33857 systems violate this specification by not clearing the DF flag in their
33858 exception dispatchers.  The exception handler can be invoked with the DF flag
33859 set, which leads to wrong direction mode when string instructions are used.
33860 This option can be enabled by default on 32-bit x86 targets by configuring
33861 GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
33862 instructions can be suppressed with the @option{-mno-cld} compiler option
33863 in this case.
33865 @opindex mvzeroupper
33866 @item -mvzeroupper
33867 This option instructs GCC to emit a @code{vzeroupper} instruction
33868 before a transfer of control flow out of the function to minimize
33869 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
33870 intrinsics.
33872 @opindex mprefer-avx128
33873 @item -mprefer-avx128
33874 This option instructs GCC to use 128-bit AVX instructions instead of
33875 256-bit AVX instructions in the auto-vectorizer.
33877 @opindex mprefer-vector-width
33878 @item -mprefer-vector-width=@var{opt}
33879 This option instructs GCC to use @var{opt}-bit vector width in instructions
33880 instead of default on the selected platform.
33882 @opindex mpartial-vector-fp-math
33883 @item -mpartial-vector-fp-math
33884 This option enables GCC to generate floating-point operations that might
33885 affect the set of floating-point status flags on partial vectors, where
33886 vector elements reside in the low part of the 128-bit SSE register.  Unless
33887 @option{-fno-trapping-math} is specified, the compiler guarantees correct
33888 behavior by sanitizing all input operands to have zeroes in the unused
33889 upper part of the vector register.  Note that by using built-in functions
33890 or inline assembly with partial vector arguments, NaNs, denormal or invalid
33891 values can leak into the upper part of the vector, causing possible
33892 performance issues when @option{-fno-trapping-math} is in effect.  These
33893 issues can be mitigated by manually sanitizing the upper part of the partial
33894 vector argument register or by using @option{-mdaz-ftz} to set
33895 denormals-are-zero (DAZ) flag in the MXCSR register.
33897 This option is enabled by default.
33899 @opindex mmove-max
33900 @item -mmove-max=@var{bits}
33901 This option instructs GCC to set the maximum number of bits can be
33902 moved from memory to memory efficiently to @var{bits}.  The valid
33903 @var{bits} are 128, 256 and 512.
33905 @opindex mstore-max
33906 @item -mstore-max=@var{bits}
33907 This option instructs GCC to set the maximum number of bits can be
33908 stored to memory efficiently to @var{bits}.  The valid @var{bits} are
33909 128, 256 and 512.
33911 @table @samp
33912 @item none
33913 No extra limitations applied to GCC other than defined by the selected platform.
33915 @item 128
33916 Prefer 128-bit vector width for instructions.
33918 @item 256
33919 Prefer 256-bit vector width for instructions.
33921 @item 512
33922 Prefer 512-bit vector width for instructions.
33923 @end table
33925 @opindex mcx16
33926 @item -mcx16
33927 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
33928 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
33929 objects.  This is useful for atomic updates of data structures exceeding one
33930 machine word in size.  The compiler uses this instruction to implement
33931 @ref{__sync Builtins}.  However, for @ref{__atomic Builtins} operating on
33932 128-bit integers, a library call is always used.
33934 @opindex msahf
33935 @item -msahf
33936 This option enables generation of @code{SAHF} instructions in 64-bit code.
33937 Early Intel Pentium 4 CPUs with Intel 64 support,
33938 prior to the introduction of Pentium 4 G1 step in December 2005,
33939 lacked the @code{LAHF} and @code{SAHF} instructions
33940 which are supported by AMD64.
33941 These are load and store instructions, respectively, for certain status flags.
33942 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
33943 @code{drem}, and @code{remainder} built-in functions;
33944 see @ref{Other Builtins} for details.
33946 @opindex mmovbe
33947 @item -mmovbe
33948 This option enables use of the @code{movbe} instruction to implement
33949 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
33951 @opindex mshstk
33952 @item -mshstk
33953 The @option{-mshstk} option enables shadow stack built-in functions
33954 from x86 Control-flow Enforcement Technology (CET).
33956 @opindex mcrc32
33957 @item -mcrc32
33958 This option enables built-in functions @code{__builtin_ia32_crc32qi},
33959 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
33960 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
33962 @opindex mmwait
33963 @item -mmwait
33964 This option enables built-in functions @code{__builtin_ia32_monitor},
33965 and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
33966 @code{mwait} machine instructions.
33968 @opindex mrecip
33969 @item -mrecip
33970 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
33971 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
33972 with an additional Newton-Raphson step
33973 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
33974 (and their vectorized
33975 variants) for single-precision floating-point arguments.  These instructions
33976 are generated only when @option{-funsafe-math-optimizations} is enabled
33977 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
33978 Note that while the throughput of the sequence is higher than the throughput
33979 of the non-reciprocal instruction, the precision of the sequence can be
33980 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
33982 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
33983 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
33984 combination), and doesn't need @option{-mrecip}.
33986 Also note that GCC emits the above sequence with additional Newton-Raphson step
33987 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
33988 already with @option{-ffast-math} (or the above option combination), and
33989 doesn't need @option{-mrecip}.
33991 @opindex mrecip=opt
33992 @item -mrecip=@var{opt}
33993 This option controls which reciprocal estimate instructions
33994 may be used.  @var{opt} is a comma-separated list of options, which may
33995 be preceded by a @samp{!} to invert the option:
33997 @table @samp
33998 @item all
33999 Enable all estimate instructions.
34001 @item default
34002 Enable the default instructions, equivalent to @option{-mrecip}.
34004 @item none
34005 Disable all estimate instructions, equivalent to @option{-mno-recip}.
34007 @item div
34008 Enable the approximation for scalar division.
34010 @item vec-div
34011 Enable the approximation for vectorized division.
34013 @item sqrt
34014 Enable the approximation for scalar square root.
34016 @item vec-sqrt
34017 Enable the approximation for vectorized square root.
34018 @end table
34020 So, for example, @option{-mrecip=all,!sqrt} enables
34021 all of the reciprocal approximations, except for square root.
34023 @opindex mveclibabi
34024 @item -mveclibabi=@var{type}
34025 Specifies the ABI type to use for vectorizing intrinsics using an
34026 external library.  Supported values for @var{type} are @samp{svml} 
34027 for the Intel short
34028 vector math library and @samp{acml} for the AMD math core library.
34029 To use this option, both @option{-ftree-vectorize} and
34030 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 
34031 ABI-compatible library must be specified at link time.
34033 GCC currently emits calls to @code{vmldExp2},
34034 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
34035 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
34036 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
34037 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
34038 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
34039 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
34040 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
34041 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
34042 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
34043 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
34044 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
34045 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
34046 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
34047 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
34048 when @option{-mveclibabi=acml} is used.  
34050 @opindex mabi
34051 @item -mabi=@var{name}
34052 Generate code for the specified calling convention.  Permissible values
34053 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
34054 @samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
34055 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
34056 You can control this behavior for specific functions by
34057 using the function attributes @code{ms_abi} and @code{sysv_abi}.
34058 @xref{Function Attributes}.
34060 @opindex mforce-indirect-call
34061 @item -mforce-indirect-call
34062 Force all calls to functions to be indirect. This is useful
34063 when using Intel Processor Trace where it generates more precise timing
34064 information for function calls.
34066 @opindex mmanual-endbr
34067 @item -mmanual-endbr
34068 Insert ENDBR instruction at function entry only via the @code{cf_check}
34069 function attribute. This is useful when used with the option
34070 @option{-fcf-protection=branch} to control ENDBR insertion at the
34071 function entry.
34073 @opindex mcet-switch
34074 @item -mcet-switch
34075 By default, CET instrumentation is turned off on switch statements that
34076 use a jump table and indirect branch track is disabled.  Since jump
34077 tables are stored in read-only memory, this does not result in a direct
34078 loss of hardening.  But if the jump table index is attacker-controlled,
34079 the indirect jump may not be constrained by CET.  This option turns on
34080 CET instrumentation to enable indirect branch track for switch statements
34081 with jump tables which leads to the jump targets reachable via any indirect
34082 jumps.
34084 @opindex mcall-ms2sysv-xlogues
34085 @opindex mno-call-ms2sysv-xlogues
34086 @item -mcall-ms2sysv-xlogues
34087 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
34088 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered.  By
34089 default, the code for saving and restoring these registers is emitted inline,
34090 resulting in fairly lengthy prologues and epilogues.  Using
34091 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
34092 use stubs in the static portion of libgcc to perform these saves and restores,
34093 thus reducing function size at the cost of a few extra instructions.
34095 @opindex mtls-dialect
34096 @item -mtls-dialect=@var{type}
34097 Generate code to access thread-local storage using the @samp{gnu} or
34098 @samp{gnu2} conventions.  @samp{gnu} is the conservative default;
34099 @samp{gnu2} is more efficient, but it may add compile- and run-time
34100 requirements that cannot be satisfied on all systems.
34102 @opindex mpush-args
34103 @opindex mno-push-args
34104 @item -mpush-args
34105 @itemx -mno-push-args
34106 Use PUSH operations to store outgoing parameters.  This method is shorter
34107 and usually equally fast as method using SUB/MOV operations and is enabled
34108 by default.  In some cases disabling it may improve performance because of
34109 improved scheduling and reduced dependencies.
34111 @opindex maccumulate-outgoing-args
34112 @item -maccumulate-outgoing-args
34113 If enabled, the maximum amount of space required for outgoing arguments is
34114 computed in the function prologue.  This is faster on most modern CPUs
34115 because of reduced dependencies, improved scheduling and reduced stack usage
34116 when the preferred stack boundary is not equal to 2.  The drawback is a notable
34117 increase in code size.  This switch implies @option{-mno-push-args}.
34119 @opindex mthreads
34120 @item -mthreads
34121 Support thread-safe exception handling on MinGW.  Programs that rely
34122 on thread-safe exception handling must compile and link all code with the
34123 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
34124 @option{-D_MT}; when linking, it links in a special thread helper library
34125 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
34127 @opindex mms-bitfields
34128 @opindex mno-ms-bitfields
34129 @item -mms-bitfields
34130 @itemx -mno-ms-bitfields
34132 Enable/disable bit-field layout compatible with the native Microsoft
34133 Windows compiler.  
34135 If @code{packed} is used on a structure, or if bit-fields are used,
34136 it may be that the Microsoft ABI lays out the structure differently
34137 than the way GCC normally does.  Particularly when moving packed
34138 data between functions compiled with GCC and the native Microsoft compiler
34139 (either via function call or as data in a file), it may be necessary to access
34140 either format.
34142 This option is enabled by default for Microsoft Windows
34143 targets.  This behavior can also be controlled locally by use of variable
34144 or type attributes.  For more information, see @ref{x86 Variable Attributes}
34145 and @ref{x86 Type Attributes}.
34147 The Microsoft structure layout algorithm is fairly simple with the exception
34148 of the bit-field packing.  
34149 The padding and alignment of members of structures and whether a bit-field 
34150 can straddle a storage-unit boundary are determine by these rules:
34152 @enumerate
34153 @item Structure members are stored sequentially in the order in which they are
34154 declared: the first member has the lowest memory address and the last member
34155 the highest.
34157 @item Every data object has an alignment requirement.  The alignment requirement
34158 for all data except structures, unions, and arrays is either the size of the
34159 object or the current packing size (specified with either the
34160 @code{aligned} attribute or the @code{pack} pragma),
34161 whichever is less.  For structures, unions, and arrays,
34162 the alignment requirement is the largest alignment requirement of its members.
34163 Every object is allocated an offset so that:
34165 @smallexample
34166 offset % alignment_requirement == 0
34167 @end smallexample
34169 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
34170 unit if the integral types are the same size and if the next bit-field fits
34171 into the current allocation unit without crossing the boundary imposed by the
34172 common alignment requirements of the bit-fields.
34173 @end enumerate
34175 MSVC interprets zero-length bit-fields in the following ways:
34177 @enumerate
34178 @item If a zero-length bit-field is inserted between two bit-fields that
34179 are normally coalesced, the bit-fields are not coalesced.
34181 For example:
34183 @smallexample
34184 struct
34185  @{
34186    unsigned long bf_1 : 12;
34187    unsigned long : 0;
34188    unsigned long bf_2 : 12;
34189  @} t1;
34190 @end smallexample
34192 @noindent
34193 The size of @code{t1} is 8 bytes with the zero-length bit-field.  If the
34194 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
34196 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
34197 alignment of the zero-length bit-field is greater than the member that follows it,
34198 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
34200 For example:
34202 @smallexample
34203 struct
34204  @{
34205    char foo : 4;
34206    short : 0;
34207    char bar;
34208  @} t2;
34210 struct
34211  @{
34212    char foo : 4;
34213    short : 0;
34214    double bar;
34215  @} t3;
34216 @end smallexample
34218 @noindent
34219 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
34220 Accordingly, the size of @code{t2} is 4.  For @code{t3}, the zero-length
34221 bit-field does not affect the alignment of @code{bar} or, as a result, the size
34222 of the structure.
34224 Taking this into account, it is important to note the following:
34226 @enumerate
34227 @item If a zero-length bit-field follows a normal bit-field, the type of the
34228 zero-length bit-field may affect the alignment of the structure as whole. For
34229 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
34230 normal bit-field, and is of type short.
34232 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
34233 still affect the alignment of the structure:
34235 @smallexample
34236 struct
34237  @{
34238    char foo : 6;
34239    long : 0;
34240  @} t4;
34241 @end smallexample
34243 @noindent
34244 Here, @code{t4} takes up 4 bytes.
34245 @end enumerate
34247 @item Zero-length bit-fields following non-bit-field members are ignored:
34249 @smallexample
34250 struct
34251  @{
34252    char foo;
34253    long : 0;
34254    char bar;
34255  @} t5;
34256 @end smallexample
34258 @noindent
34259 Here, @code{t5} takes up 2 bytes.
34260 @end enumerate
34263 @opindex mno-align-stringops
34264 @opindex malign-stringops
34265 @item -mno-align-stringops
34266 Do not align the destination of inlined string operations.  This switch reduces
34267 code size and improves performance in case the destination is already aligned,
34268 but GCC doesn't know about it.
34270 @opindex minline-all-stringops
34271 @item -minline-all-stringops
34272 By default GCC inlines string operations only when the destination is 
34273 known to be aligned to least a 4-byte boundary.  
34274 This enables more inlining and increases code
34275 size, but may improve performance of code that depends on fast
34276 @code{memcpy} and @code{memset} for short lengths.
34277 The option enables inline expansion of @code{strlen} for all
34278 pointer alignments.
34280 @opindex minline-stringops-dynamically
34281 @item -minline-stringops-dynamically
34282 For string operations of unknown size, use run-time checks with
34283 inline code for small blocks and a library call for large blocks.
34285 @opindex mstringop-strategy=@var{alg}
34286 @item -mstringop-strategy=@var{alg}
34287 Override the internal decision heuristic for the particular algorithm to use
34288 for inlining string operations.  The allowed values for @var{alg} are:
34290 @table @samp
34291 @item rep_byte
34292 @itemx rep_4byte
34293 @itemx rep_8byte
34294 Expand using i386 @code{rep} prefix of the specified size.
34296 @item byte_loop
34297 @itemx loop
34298 @itemx unrolled_loop
34299 Expand into an inline loop.
34301 @item libcall
34302 Always use a library call.
34303 @end table
34305 @opindex mmemcpy-strategy=@var{strategy}
34306 @item -mmemcpy-strategy=@var{strategy}
34307 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
34308 should be inlined and what inline algorithm to use when the expected size
34309 of the copy operation is known. @var{strategy} 
34310 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 
34311 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
34312 the max byte size with which inline algorithm @var{alg} is allowed.  For the last
34313 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
34314 in the list must be specified in increasing order.  The minimal byte size for 
34315 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 
34316 preceding range.
34318 @opindex mmemset-strategy=@var{strategy}
34319 @item -mmemset-strategy=@var{strategy}
34320 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
34321 @code{__builtin_memset} expansion.
34323 @opindex momit-leaf-frame-pointer
34324 @item -momit-leaf-frame-pointer
34325 Don't keep the frame pointer in a register for leaf functions.  This
34326 avoids the instructions to save, set up, and restore frame pointers and
34327 makes an extra register available in leaf functions.  The option
34328 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
34329 which might make debugging harder.
34331 @opindex mtls-direct-seg-refs
34332 @item -mtls-direct-seg-refs
34333 @itemx -mno-tls-direct-seg-refs
34334 Controls whether TLS variables may be accessed with offsets from the
34335 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
34336 or whether the thread base pointer must be added.  Whether or not this
34337 is valid depends on the operating system, and whether it maps the
34338 segment to cover the entire TLS area.
34340 For systems that use the GNU C Library, the default is on.
34342 @opindex msse2avx
34343 @item -msse2avx
34344 @itemx -mno-sse2avx
34345 Specify that the assembler should encode SSE instructions with VEX
34346 prefix.  The option @option{-mavx} turns this on by default.
34348 @opindex mfentry
34349 @item -mfentry
34350 @itemx -mno-fentry
34351 If profiling is active (@option{-pg}), put the profiling
34352 counter call before the prologue.
34353 Note: On x86 architectures the attribute @code{ms_hook_prologue}
34354 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
34356 @opindex mrecord-mcount
34357 @item -mrecord-mcount
34358 @itemx -mno-record-mcount
34359 If profiling is active (@option{-pg}), generate a __mcount_loc section
34360 that contains pointers to each profiling call. This is useful for
34361 automatically patching and out calls.
34363 @opindex mnop-mcount
34364 @item -mnop-mcount
34365 @itemx -mno-nop-mcount
34366 If profiling is active (@option{-pg}), generate the calls to
34367 the profiling functions as NOPs. This is useful when they
34368 should be patched in later dynamically. This is likely only
34369 useful together with @option{-mrecord-mcount}.
34371 @opindex minstrument-return
34372 @item -minstrument-return=@var{type}
34373 Instrument function exit in -pg -mfentry instrumented functions with
34374 call to specified function. This only instruments true returns ending
34375 with ret, but not sibling calls ending with jump. Valid types
34376 are @var{none} to not instrument, @var{call} to generate a call to __return__,
34377 or @var{nop5} to generate a 5 byte nop.
34379 @opindex mrecord-return
34380 @item -mrecord-return
34381 @itemx -mno-record-return
34382 Generate a __return_loc section pointing to all return instrumentation code.
34384 @opindex mfentry-name
34385 @item -mfentry-name=@var{name}
34386 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
34388 @opindex mfentry-section
34389 @item -mfentry-section=@var{name}
34390 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
34392 @opindex mskip-rax-setup
34393 @item -mskip-rax-setup
34394 @itemx -mno-skip-rax-setup
34395 When generating code for the x86-64 architecture with SSE extensions
34396 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
34397 register when there are no variable arguments passed in vector registers.
34399 @strong{Warning:} Since RAX register is used to avoid unnecessarily
34400 saving vector registers on stack when passing variable arguments, the
34401 impacts of this option are callees may waste some stack space,
34402 misbehave or jump to a random location.  GCC 4.4 or newer don't have
34403 those issues, regardless the RAX register value.
34405 @opindex m8bit-idiv
34406 @item -m8bit-idiv
34407 @itemx -mno-8bit-idiv
34408 On some processors, like Intel Atom, 8-bit unsigned integer divide is
34409 much faster than 32-bit/64-bit integer divide.  This option generates a
34410 run-time check.  If both dividend and divisor are within range of 0
34411 to 255, 8-bit unsigned integer divide is used instead of
34412 32-bit/64-bit integer divide.
34414 @opindex mavx256-split-unaligned-load
34415 @opindex mavx256-split-unaligned-store
34416 @item -mavx256-split-unaligned-load
34417 @itemx -mavx256-split-unaligned-store
34418 Split 32-byte AVX unaligned load and store.
34420 @opindex mstack-protector-guard
34421 @opindex mstack-protector-guard-reg
34422 @opindex mstack-protector-guard-offset
34423 @item -mstack-protector-guard=@var{guard}
34424 @itemx -mstack-protector-guard-reg=@var{reg}
34425 @itemx -mstack-protector-guard-offset=@var{offset}
34426 Generate stack protection code using canary at @var{guard}.  Supported
34427 locations are @samp{global} for global canary or @samp{tls} for per-thread
34428 canary in the TLS block (the default).  This option has effect only when
34429 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
34431 With the latter choice the options
34432 @option{-mstack-protector-guard-reg=@var{reg}} and
34433 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
34434 which segment register (@code{%fs} or @code{%gs}) to use as base register
34435 for reading the canary, and from what offset from that base register.
34436 The default for those is as specified in the relevant ABI.
34438 @opindex mgeneral-regs-only
34439 @item -mgeneral-regs-only
34440 Generate code that uses only the general-purpose registers.  This
34441 prevents the compiler from using floating-point, vector, mask and bound
34442 registers.
34444 @opindex mrelax-cmpxchg-loop
34445 @item -mrelax-cmpxchg-loop
34446 When emitting a compare-and-swap loop for @ref{__sync Builtins}
34447 and @ref{__atomic Builtins} lacking a native instruction, optimize
34448 for the highly contended case by issuing an atomic load before the
34449 @code{CMPXCHG} instruction, and using the @code{PAUSE} instruction
34450 to save CPU power when restarting the loop.
34452 @opindex mindirect-branch
34453 @item -mindirect-branch=@var{choice}
34454 Convert indirect call and jump with @var{choice}.  The default is
34455 @samp{keep}, which keeps indirect call and jump unmodified.
34456 @samp{thunk} converts indirect call and jump to call and return thunk.
34457 @samp{thunk-inline} converts indirect call and jump to inlined call
34458 and return thunk.  @samp{thunk-extern} converts indirect call and jump
34459 to external call and return thunk provided in a separate object file.
34460 You can control this behavior for a specific function by using the
34461 function attribute @code{indirect_branch}.  @xref{Function Attributes}.
34463 Note that @option{-mcmodel=large} is incompatible with
34464 @option{-mindirect-branch=thunk} and
34465 @option{-mindirect-branch=thunk-extern} since the thunk function may
34466 not be reachable in the large code model.
34468 Note that @option{-mindirect-branch=thunk-extern} is compatible with
34469 @option{-fcf-protection=branch} since the external thunk can be made
34470 to enable control-flow check.
34472 @opindex mfunction-return
34473 @item -mfunction-return=@var{choice}
34474 Convert function return with @var{choice}.  The default is @samp{keep},
34475 which keeps function return unmodified.  @samp{thunk} converts function
34476 return to call and return thunk.  @samp{thunk-inline} converts function
34477 return to inlined call and return thunk.  @samp{thunk-extern} converts
34478 function return to external call and return thunk provided in a separate
34479 object file.  You can control this behavior for a specific function by
34480 using the function attribute @code{function_return}.
34481 @xref{Function Attributes}.
34483 Note that @option{-mindirect-return=thunk-extern} is compatible with
34484 @option{-fcf-protection=branch} since the external thunk can be made
34485 to enable control-flow check.
34487 Note that @option{-mcmodel=large} is incompatible with
34488 @option{-mfunction-return=thunk} and
34489 @option{-mfunction-return=thunk-extern} since the thunk function may
34490 not be reachable in the large code model.
34493 @opindex mindirect-branch-register
34494 @item -mindirect-branch-register
34495 Force indirect call and jump via register.
34497 @opindex mharden-sls
34498 @item -mharden-sls=@var{choice}
34499 Generate code to mitigate against straight line speculation (SLS) with
34500 @var{choice}.  The default is @samp{none} which disables all SLS
34501 hardening.  @samp{return} enables SLS hardening for function returns.
34502 @samp{indirect-jmp} enables SLS hardening for indirect jumps.
34503 @samp{all} enables all SLS hardening.
34505 @opindex mindirect-branch-cs-prefix
34506 @item -mindirect-branch-cs-prefix
34507 Add CS prefix to call and jmp to indirect thunk with branch target in
34508 r8-r15 registers so that the call and jmp instruction length is 6 bytes
34509 to allow them to be replaced with @samp{lfence; call *%r8-r15} or
34510 @samp{lfence; jmp *%r8-r15} at run-time.
34512 @end table
34514 These @samp{-m} switches are supported in addition to the above
34515 on x86-64 processors in 64-bit environments.
34517 @table @gcctabopt
34518 @opindex m32
34519 @opindex m64
34520 @opindex mx32
34521 @opindex m16
34522 @opindex miamcu
34523 @item -m32
34524 @itemx -m64
34525 @itemx -mx32
34526 @itemx -m16
34527 @itemx -miamcu
34528 Generate code for a 16-bit, 32-bit or 64-bit environment.
34529 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
34530 to 32 bits, and
34531 generates code that runs in 32-bit mode.
34533 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
34534 types to 64 bits, and generates code for the x86-64 architecture.
34535 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
34536 and @option{-mdynamic-no-pic} options.
34538 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
34539 to 32 bits, and
34540 generates code for the x86-64 architecture.
34542 The @option{-m16} option is the same as @option{-m32}, except for that
34543 it outputs the @code{.code16gcc} assembly directive at the beginning of
34544 the assembly output so that the binary can run in 16-bit mode.
34546 The @option{-miamcu} option generates code which conforms to Intel MCU
34547 psABI.  It requires the @option{-m32} option to be turned on.
34549 @opindex mno-red-zone
34550 @opindex mred-zone
34551 @item -mno-red-zone
34552 Do not use a so-called ``red zone'' for x86-64 code.  The red zone is mandated
34553 by the x86-64 ABI; it is a 128-byte area beyond the location of the
34554 stack pointer that is not modified by signal or interrupt handlers
34555 and therefore can be used for temporary data without adjusting the stack
34556 pointer.  The flag @option{-mno-red-zone} disables this red zone.
34558 @opindex mcmodel=small
34559 @item -mcmodel=small
34560 Generate code for the small code model: the program and its symbols must
34561 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
34562 Programs can be statically or dynamically linked.  This is the default
34563 code model.
34565 @opindex mcmodel=kernel
34566 @item -mcmodel=kernel
34567 Generate code for the kernel code model.  The kernel runs in the
34568 negative 2 GB of the address space.
34569 This model has to be used for Linux kernel code.
34571 @opindex mcmodel=medium
34572 @item -mcmodel=medium
34573 Generate code for the medium model: the program is linked in the lower 2
34574 GB of the address space.  Small symbols are also placed there.  Symbols
34575 with sizes larger than @option{-mlarge-data-threshold} are put into
34576 large data or BSS sections and can be located above 2GB.  Programs can
34577 be statically or dynamically linked.
34579 @opindex mcmodel=large
34580 @item -mcmodel=large
34581 Generate code for the large model.  This model makes no assumptions
34582 about addresses and sizes of sections.
34584 @opindex maddress-mode=long
34585 @item -maddress-mode=long
34586 Generate code for long address mode.  This is only supported for 64-bit
34587 and x32 environments.  It is the default address mode for 64-bit
34588 environments.
34590 @opindex maddress-mode=short
34591 @item -maddress-mode=short
34592 Generate code for short address mode.  This is only supported for 32-bit
34593 and x32 environments.  It is the default address mode for 32-bit and
34594 x32 environments.
34596 @opindex mneeded
34597 @item -mneeded
34598 @itemx -mno-needed
34599 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
34600 indicate the micro-architecture ISA level required to execute the binary.
34602 @opindex mno-direct-extern-access
34603 @opindex mdirect-extern-access
34604 @item -mno-direct-extern-access
34605 Without @option{-fpic} nor @option{-fPIC}, always use the GOT pointer
34606 to access external symbols.  With @option{-fpic} or @option{-fPIC},
34607 treat access to protected symbols as local symbols.  The default is
34608 @option{-mdirect-extern-access}.
34610 @strong{Warning:} shared libraries compiled with
34611 @option{-mno-direct-extern-access} and executable compiled with
34612 @option{-mdirect-extern-access} may not be binary compatible if
34613 protected symbols are used in shared libraries and executable.
34615 @opindex munroll-only-small-loops
34616 @opindex mno-unroll-only-small-loops
34617 @item -munroll-only-small-loops
34618 Controls conservative small loop unrolling. It is default enabled by
34619 O2, and unrolls loop with less than 4 insns by 1 time. Explicit
34620 -f[no-]unroll-[all-]loops would disable this flag to avoid any
34621 unintended unrolling behavior that user does not want.
34623 @opindex mlam
34624 @item -mlam=@var{choice}
34625 LAM(linear-address masking) allows special bits in the pointer to be used
34626 for metadata. The default is @samp{none}. With @samp{u48}, pointer bits in
34627 positions 62:48 can be used for metadata; With @samp{u57}, pointer bits in
34628 positions 62:57 can be used for metadata.
34629 @end table
34631 @node x86 Windows Options
34632 @subsection x86 Windows Options
34633 @cindex x86 Windows Options
34634 @cindex Windows Options for x86
34636 These additional options are available for Microsoft Windows targets:
34638 @table @gcctabopt
34639 @opindex mconsole
34640 @item -mconsole
34641 This option
34642 specifies that a console application is to be generated, by
34643 instructing the linker to set the PE header subsystem type
34644 required for console applications.
34645 This option is available for Cygwin and MinGW targets and is
34646 enabled by default on those targets.
34648 @opindex mcrtdll
34649 @item -mcrtdll=@var{library}
34650 Preprocess, compile or link with specified C RunTime DLL @var{library}.
34651 This option adjust predefined macros @code{__CRTDLL__}, @code{__MSVCRT__}
34652 and @code{__MSVCRT_VERSION__} for specified CRT @var{library}, choose
34653 start file for CRT @var{library} and link with CRT @var{library}.
34654 Recognized CRT library names for proprocessor are:
34655 @code{crtdll}, @code{msvcrt10}, @code{msvcrt20}, @code{msvcrt40},
34656 @code{msvcrt-os}, @code{msvcr70}, @code{msvcr80}, @code{msvcr90},
34657 @code{msvcr100}, @code{msvcr110}, @code{msvcr120} and @code{ucrt}.
34658 If this options is not specified then the default MinGW import library
34659 @code{msvcrt} is used for linking and no other adjustment for
34660 preprocessor is done. MinGW import library @code{msvcrt} is just a
34661 symlink to (or a copy of) another MinGW CRT import library
34662 chosen during MinGW compilation. MinGW import library @code{msvcrt-os}
34663 is for Windows system CRT DLL library @code{msvcrt.dll} and
34664 in most cases is the default MinGW import library.
34665 Generally speaking, changing the CRT DLL requires recompiling
34666 the entire MinGW CRT. This option is for experimental and testing
34667 purposes only.
34668 This option is available for MinGW targets.
34670 @opindex mdll
34671 @item -mdll
34672 This option is available for Cygwin and MinGW targets.  It
34673 specifies that a DLL---a dynamic link library---is to be
34674 generated, enabling the selection of the required runtime
34675 startup object and entry point.
34677 @opindex mnop-fun-dllimport
34678 @item -mnop-fun-dllimport
34679 This option is available for Cygwin and MinGW targets.  It
34680 specifies that the @code{dllimport} attribute should be ignored.
34682 @opindex mthreads
34683 @item -mthreads
34684 This option is available for MinGW targets. It specifies
34685 that MinGW-specific thread support is to be used.
34687 @opindex municode
34688 @item -municode
34689 This option is available for MinGW-w64 targets.  It causes
34690 the @code{UNICODE} preprocessor macro to be predefined, and
34691 chooses Unicode-capable runtime startup code.
34693 @opindex mwin32
34694 @item -mwin32
34695 This option is available for Cygwin and MinGW targets.  It
34696 specifies that the typical Microsoft Windows predefined macros are to
34697 be set in the pre-processor, but does not influence the choice
34698 of runtime library/startup code.
34700 @opindex mwindows
34701 @item -mwindows
34702 This option is available for Cygwin and MinGW targets.  It
34703 specifies that a GUI application is to be generated by
34704 instructing the linker to set the PE header subsystem type
34705 appropriately.
34707 @opindex fno-set-stack-executable
34708 @opindex fset-stack-executable
34709 @item -fno-set-stack-executable
34710 This option is available for MinGW targets. It specifies that
34711 the executable flag for the stack used by nested functions isn't
34712 set. This is necessary for binaries running in kernel mode of
34713 Microsoft Windows, as there the User32 API, which is used to set executable
34714 privileges, isn't available.
34716 @opindex fno-writable-relocated-rdata
34717 @opindex fwritable-relocated-rdata
34718 @item -fwritable-relocated-rdata
34719 This option is available for MinGW and Cygwin targets.  It specifies
34720 that relocated-data in read-only section is put into the @code{.data}
34721 section.  This is a necessary for older runtimes not supporting
34722 modification of @code{.rdata} sections for pseudo-relocation.
34724 @opindex mpe-aligned-commons
34725 @item -mpe-aligned-commons
34726 This option is available for Cygwin and MinGW targets.  It
34727 specifies that the GNU extension to the PE file format that
34728 permits the correct alignment of COMMON variables should be
34729 used when generating code.  It is enabled by default if
34730 GCC detects that the target assembler found during configuration
34731 supports the feature.
34732 @end table
34734 See also under @ref{x86 Options} for standard options.
34736 @node Xstormy16 Options
34737 @subsection Xstormy16 Options
34738 @cindex Xstormy16 Options
34740 These options are defined for Xstormy16:
34742 @table @gcctabopt
34743 @opindex msim
34744 @item -msim
34745 Choose startup files and linker script suitable for the simulator.
34746 @end table
34748 @node Xtensa Options
34749 @subsection Xtensa Options
34750 @cindex Xtensa Options
34752 These options are supported for Xtensa targets:
34754 @table @gcctabopt
34755 @opindex mconst16
34756 @opindex mno-const16
34757 @item -mconst16
34758 @itemx -mno-const16
34759 Enable or disable use of @code{CONST16} instructions for loading
34760 constant values.  The @code{CONST16} instruction is currently not a
34761 standard option from Tensilica.  When enabled, @code{CONST16}
34762 instructions are always used in place of the standard @code{L32R}
34763 instructions.  The use of @code{CONST16} is enabled by default only if
34764 the @code{L32R} instruction is not available.
34766 @opindex mfused-madd
34767 @opindex mno-fused-madd
34768 @item -mfused-madd
34769 @itemx -mno-fused-madd
34770 Enable or disable use of fused multiply/add and multiply/subtract
34771 instructions in the floating-point option.  This has no effect if the
34772 floating-point option is not also enabled.  Disabling fused multiply/add
34773 and multiply/subtract instructions forces the compiler to use separate
34774 instructions for the multiply and add/subtract operations.  This may be
34775 desirable in some cases where strict IEEE 754-compliant results are
34776 required: the fused multiply add/subtract instructions do not round the
34777 intermediate result, thereby producing results with @emph{more} bits of
34778 precision than specified by the IEEE standard.  Disabling fused multiply
34779 add/subtract instructions also ensures that the program output is not
34780 sensitive to the compiler's ability to combine multiply and add/subtract
34781 operations.
34783 @opindex mserialize-volatile
34784 @opindex mno-serialize-volatile
34785 @item -mserialize-volatile
34786 @itemx -mno-serialize-volatile
34787 When this option is enabled, GCC inserts @code{MEMW} instructions before
34788 @code{volatile} memory references to guarantee sequential consistency.
34789 The default is @option{-mserialize-volatile}.  Use
34790 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
34792 @opindex mforce-no-pic
34793 @item -mforce-no-pic
34794 For targets, like GNU/Linux, where all user-mode Xtensa code must be
34795 position-independent code (PIC), this option disables PIC for compiling
34796 kernel code.
34798 @opindex mtext-section-literals
34799 @opindex mno-text-section-literals
34800 @item -mtext-section-literals
34801 @itemx -mno-text-section-literals
34802 These options control the treatment of literal pools.  The default is
34803 @option{-mno-text-section-literals}, which places literals in a separate
34804 section in the output file.  This allows the literal pool to be placed
34805 in a data RAM/ROM, and it also allows the linker to combine literal
34806 pools from separate object files to remove redundant literals and
34807 improve code size.  With @option{-mtext-section-literals}, the literals
34808 are interspersed in the text section in order to keep them as close as
34809 possible to their references.  This may be necessary for large assembly
34810 files.  Literals for each function are placed right before that function.
34812 @opindex mauto-litpools
34813 @opindex mno-auto-litpools
34814 @item -mauto-litpools
34815 @itemx -mno-auto-litpools
34816 These options control the treatment of literal pools.  The default is
34817 @option{-mno-auto-litpools}, which places literals in a separate
34818 section in the output file unless @option{-mtext-section-literals} is
34819 used.  With @option{-mauto-litpools} the literals are interspersed in
34820 the text section by the assembler.  Compiler does not produce explicit
34821 @code{.literal} directives and loads literals into registers with
34822 @code{MOVI} instructions instead of @code{L32R} to let the assembler
34823 do relaxation and place literals as necessary.  This option allows
34824 assembler to create several literal pools per function and assemble
34825 very big functions, which may not be possible with
34826 @option{-mtext-section-literals}.
34828 @opindex mtarget-align
34829 @opindex mno-target-align
34830 @item -mtarget-align
34831 @itemx -mno-target-align
34832 When this option is enabled, GCC instructs the assembler to
34833 automatically align instructions to reduce branch penalties at the
34834 expense of some code density.  The assembler attempts to widen density
34835 instructions to align branch targets and the instructions following call
34836 instructions.  If there are not enough preceding safe density
34837 instructions to align a target, no widening is performed.  The
34838 default is @option{-mtarget-align}.  These options do not affect the
34839 treatment of auto-aligned instructions like @code{LOOP}, which the
34840 assembler always aligns, either by widening density instructions or
34841 by inserting NOP instructions.
34843 @opindex mlongcalls
34844 @opindex mno-longcalls
34845 @item -mlongcalls
34846 @itemx -mno-longcalls
34847 When this option is enabled, GCC instructs the assembler to translate
34848 direct calls to indirect calls unless it can determine that the target
34849 of a direct call is in the range allowed by the call instruction.  This
34850 translation typically occurs for calls to functions in other source
34851 files.  Specifically, the assembler translates a direct @code{CALL}
34852 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
34853 The default is @option{-mno-longcalls}.  This option should be used in
34854 programs where the call target can potentially be out of range.  This
34855 option is implemented in the assembler, not the compiler, so the
34856 assembly code generated by GCC still shows direct call
34857 instructions---look at the disassembled object code to see the actual
34858 instructions.  Note that the assembler uses an indirect call for
34859 every cross-file call, not just those that really are out of range.
34861 @opindex mabi
34862 @item -mabi=@var{name}
34863 Generate code for the specified ABI@.  Permissible values are: @samp{call0},
34864 @samp{windowed}.  Default ABI is chosen by the Xtensa core configuration.
34866 @opindex mabi=call0
34867 @item -mabi=call0
34868 When this option is enabled function parameters are passed in registers
34869 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
34870 caller-saved, and register @code{a15} may be used as a frame pointer.
34871 When this version of the ABI is enabled the C preprocessor symbol
34872 @code{__XTENSA_CALL0_ABI__} is defined.
34874 @opindex mabi=windowed
34875 @item -mabi=windowed
34876 When this option is enabled function parameters are passed in registers
34877 @code{a10} through @code{a15}, and called function rotates register window
34878 by 8 registers on entry so that its arguments are found in registers
34879 @code{a2} through @code{a7}.  Register @code{a7} may be used as a frame
34880 pointer.  Register window is rotated 8 registers back upon return.
34881 When this version of the ABI is enabled the C preprocessor symbol
34882 @code{__XTENSA_WINDOWED_ABI__} is defined.
34884 @opindex mextra-l32r-costs
34885 @item -mextra-l32r-costs=@var{n}
34886 Specify an extra cost of instruction RAM/ROM access for @code{L32R}
34887 instructions, in clock cycles.  This affects, when optimizing for speed,
34888 whether loading a constant from literal pool using @code{L32R} or
34889 synthesizing the constant from a small one with a couple of arithmetic
34890 instructions.  The default value is 0.
34892 @opindex mstrict-align
34893 @opindex mno-strict-align
34894 @item -mstrict-align
34895 @itemx -mno-strict-align
34896 Avoid or allow generating memory accesses that may not be aligned on a natural
34897 object boundary as described in the architecture specification.
34898 The default is @option{-mno-strict-align} for cores that support both
34899 unaligned loads and stores in hardware and @option{-mstrict-align} for all
34900 other cores.
34902 @end table
34904 @node zSeries Options
34905 @subsection zSeries Options
34906 @cindex zSeries options
34908 These are listed under @xref{S/390 and zSeries Options}.
34911 @c man end
34913 @node Spec Files
34914 @section Specifying Subprocesses and the Switches to Pass to Them
34915 @cindex Spec Files
34917 @command{gcc} is a driver program.  It performs its job by invoking a
34918 sequence of other programs to do the work of compiling, assembling and
34919 linking.  GCC interprets its command-line parameters and uses these to
34920 deduce which programs it should invoke, and which command-line options
34921 it ought to place on their command lines.  This behavior is controlled
34922 by @dfn{spec strings}.  In most cases there is one spec string for each
34923 program that GCC can invoke, but a few programs have multiple spec
34924 strings to control their behavior.  The spec strings built into GCC can
34925 be overridden by using the @option{-specs=} command-line switch to specify
34926 a spec file.
34928 @dfn{Spec files} are plain-text files that are used to construct spec
34929 strings.  They consist of a sequence of directives separated by blank
34930 lines.  The type of directive is determined by the first non-whitespace
34931 character on the line, which can be one of the following:
34933 @table @code
34934 @item %@var{command}
34935 Issues a @var{command} to the spec file processor.  The commands that can
34936 appear here are:
34938 @table @code
34939 @cindex @code{%include}
34940 @item %include <@var{file}>
34941 Search for @var{file} and insert its text at the current point in the
34942 specs file.
34944 @cindex @code{%include_noerr}
34945 @item %include_noerr <@var{file}>
34946 Just like @samp{%include}, but do not generate an error message if the include
34947 file cannot be found.
34949 @cindex @code{%rename}
34950 @item %rename @var{old_name} @var{new_name}
34951 Rename the spec string @var{old_name} to @var{new_name}.
34953 @end table
34955 @item *[@var{spec_name}]:
34956 This tells the compiler to create, override or delete the named spec
34957 string.  All lines after this directive up to the next directive or
34958 blank line are considered to be the text for the spec string.  If this
34959 results in an empty string then the spec is deleted.  (Or, if the
34960 spec did not exist, then nothing happens.)  Otherwise, if the spec
34961 does not currently exist a new spec is created.  If the spec does
34962 exist then its contents are overridden by the text of this
34963 directive, unless the first character of that text is the @samp{+}
34964 character, in which case the text is appended to the spec.
34966 @item [@var{suffix}]:
34967 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
34968 and up to the next directive or blank line are considered to make up the
34969 spec string for the indicated suffix.  When the compiler encounters an
34970 input file with the named suffix, it processes the spec string in
34971 order to work out how to compile that file.  For example:
34973 @smallexample
34974 .ZZ:
34975 z-compile -input %i
34976 @end smallexample
34978 This says that any input file whose name ends in @samp{.ZZ} should be
34979 passed to the program @samp{z-compile}, which should be invoked with the
34980 command-line switch @option{-input} and with the result of performing the
34981 @samp{%i} substitution.  (See below.)
34983 As an alternative to providing a spec string, the text following a
34984 suffix directive can be one of the following:
34986 @table @code
34987 @item @@@var{language}
34988 This says that the suffix is an alias for a known @var{language}.  This is
34989 similar to using the @option{-x} command-line switch to GCC to specify a
34990 language explicitly.  For example:
34992 @smallexample
34993 .ZZ:
34994 @@c++
34995 @end smallexample
34997 Says that .ZZ files are, in fact, C++ source files.
34999 @item #@var{name}
35000 This causes an error messages saying:
35002 @smallexample
35003 @var{name} compiler not installed on this system.
35004 @end smallexample
35005 @end table
35007 GCC already has an extensive list of suffixes built into it.
35008 This directive adds an entry to the end of the list of suffixes, but
35009 since the list is searched from the end backwards, it is effectively
35010 possible to override earlier entries using this technique.
35012 @end table
35014 GCC has the following spec strings built into it.  Spec files can
35015 override these strings or create their own.  Note that individual
35016 targets can also add their own spec strings to this list.
35018 @smallexample
35019 asm          Options to pass to the assembler
35020 asm_final    Options to pass to the assembler post-processor
35021 cpp          Options to pass to the C preprocessor
35022 cc1          Options to pass to the C compiler
35023 cc1plus      Options to pass to the C++ compiler
35024 endfile      Object files to include at the end of the link
35025 link         Options to pass to the linker
35026 lib          Libraries to include on the command line to the linker
35027 libgcc       Decides which GCC support library to pass to the linker
35028 linker       Sets the name of the linker
35029 predefines   Defines to be passed to the C preprocessor
35030 signed_char  Defines to pass to CPP to say whether @code{char} is signed
35031              by default
35032 startfile    Object files to include at the start of the link
35033 @end smallexample
35035 Here is a small example of a spec file:
35037 @smallexample
35038 %rename lib                 old_lib
35040 *lib:
35041 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
35042 @end smallexample
35044 This example renames the spec called @samp{lib} to @samp{old_lib} and
35045 then overrides the previous definition of @samp{lib} with a new one.
35046 The new definition adds in some extra command-line options before
35047 including the text of the old definition.
35049 @dfn{Spec strings} are a list of command-line options to be passed to their
35050 corresponding program.  In addition, the spec strings can contain
35051 @samp{%}-prefixed sequences to substitute variable text or to
35052 conditionally insert text into the command line.  Using these constructs
35053 it is possible to generate quite complex command lines.
35055 Here is a table of all defined @samp{%}-sequences for spec
35056 strings.  Note that spaces are not generated automatically around the
35057 results of expanding these sequences.  Therefore you can concatenate them
35058 together or combine them with constant text in a single argument.
35060 @table @code
35061 @item %%
35062 Substitute one @samp{%} into the program name or argument.
35064 @item %"
35065 Substitute an empty argument.
35067 @item %i
35068 Substitute the name of the input file being processed.
35070 @item %b
35071 Substitute the basename for outputs related with the input file being
35072 processed.  This is often the substring up to (and not including) the
35073 last period and not including the directory but, unless %w is active, it
35074 expands to the basename for auxiliary outputs, which may be influenced
35075 by an explicit output name, and by various other options that control
35076 how auxiliary outputs are named.
35078 @item %B
35079 This is the same as @samp{%b}, but include the file suffix (text after
35080 the last period).  Without %w, it expands to the basename for dump
35081 outputs.
35083 @item %d
35084 Marks the argument containing or following the @samp{%d} as a
35085 temporary file name, so that that file is deleted if GCC exits
35086 successfully.  Unlike @samp{%g}, this contributes no text to the
35087 argument.
35089 @item %g@var{suffix}
35090 Substitute a file name that has suffix @var{suffix} and is chosen
35091 once per compilation, and mark the argument in the same way as
35092 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
35093 name is now chosen in a way that is hard to predict even when previously
35094 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
35095 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
35096 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
35097 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
35098 was simply substituted with a file name chosen once per compilation,
35099 without regard to any appended suffix (which was therefore treated
35100 just like ordinary text), making such attacks more likely to succeed.
35102 @item %u@var{suffix}
35103 Like @samp{%g}, but generates a new temporary file name
35104 each time it appears instead of once per compilation.
35106 @item %U@var{suffix}
35107 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
35108 new one if there is no such last file name.  In the absence of any
35109 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
35110 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
35111 involves the generation of two distinct file names, one
35112 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
35113 simply substituted with a file name chosen for the previous @samp{%u},
35114 without regard to any appended suffix.
35116 @item %j@var{suffix}
35117 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
35118 writable, and if @option{-save-temps} is not used; 
35119 otherwise, substitute the name
35120 of a temporary file, just like @samp{%u}.  This temporary file is not
35121 meant for communication between processes, but rather as a junk
35122 disposal mechanism.
35124 @item %|@var{suffix}
35125 @itemx %m@var{suffix}
35126 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
35127 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
35128 all.  These are the two most common ways to instruct a program that it
35129 should read from standard input or write to standard output.  If you
35130 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
35131 construct: see for example @file{gcc/fortran/lang-specs.h}.
35133 @item %.@var{SUFFIX}
35134 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
35135 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
35136 terminated by the next space or %.
35138 @item %w
35139 Marks the argument containing or following the @samp{%w} as the
35140 designated output file of this compilation.  This puts the argument
35141 into the sequence of arguments that @samp{%o} substitutes.
35143 @item %V
35144 Indicates that this compilation produces no output file.
35146 @item %o
35147 Substitutes the names of all the output files, with spaces
35148 automatically placed around them.  You should write spaces
35149 around the @samp{%o} as well or the results are undefined.
35150 @samp{%o} is for use in the specs for running the linker.
35151 Input files whose names have no recognized suffix are not compiled
35152 at all, but they are included among the output files, so they are
35153 linked.
35155 @item %O
35156 Substitutes the suffix for object files.  Note that this is
35157 handled specially when it immediately follows @samp{%g, %u, or %U},
35158 because of the need for those to form complete file names.  The
35159 handling is such that @samp{%O} is treated exactly as if it had already
35160 been substituted, except that @samp{%g, %u, and %U} do not currently
35161 support additional @var{suffix} characters following @samp{%O} as they do
35162 following, for example, @samp{.o}.
35164 @item %I
35165 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
35166 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
35167 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
35168 and @option{-imultilib} as necessary.
35170 @item %s
35171 Current argument is the name of a library or startup file of some sort.
35172 Search for that file in a standard list of directories and substitute
35173 the full name found.  The current working directory is included in the
35174 list of directories scanned.
35176 @item %T
35177 Current argument is the name of a linker script.  Search for that file
35178 in the current list of directories to scan for libraries. If the file
35179 is located insert a @option{--script} option into the command line
35180 followed by the full path name found.  If the file is not found then
35181 generate an error message.  Note: the current working directory is not
35182 searched.
35184 @item %e@var{str}
35185 Print @var{str} as an error message.  @var{str} is terminated by a newline.
35186 Use this when inconsistent options are detected.
35188 @item %n@var{str}
35189 Print @var{str} as a notice.  @var{str} is terminated by a newline.
35191 @item %(@var{name})
35192 Substitute the contents of spec string @var{name} at this point.
35194 @item %x@{@var{option}@}
35195 Accumulate an option for @samp{%X}.
35197 @item %X
35198 Output the accumulated linker options specified by a @samp{%x} spec string.
35200 @item %Y
35201 Output the accumulated assembler options specified by @option{-Wa}.
35203 @item %Z
35204 Output the accumulated preprocessor options specified by @option{-Wp}.
35206 @item %M
35207 Output @code{multilib_os_dir}.
35209 @item %R
35210 Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
35212 @item %a
35213 Process the @code{asm} spec.  This is used to compute the
35214 switches to be passed to the assembler.
35216 @item %A
35217 Process the @code{asm_final} spec.  This is a spec string for
35218 passing switches to an assembler post-processor, if such a program is
35219 needed.
35221 @item %l
35222 Process the @code{link} spec.  This is the spec for computing the
35223 command line passed to the linker.  Typically it makes use of the
35224 @samp{%L %G %S %D and %E} sequences.
35226 @item %D
35227 Dump out a @option{-L} option for each directory that GCC believes might
35228 contain startup files.  If the target supports multilibs then the
35229 current multilib directory is prepended to each of these paths.
35231 @item %L
35232 Process the @code{lib} spec.  This is a spec string for deciding which
35233 libraries are included on the command line to the linker.
35235 @item %G
35236 Process the @code{libgcc} spec.  This is a spec string for deciding
35237 which GCC support library is included on the command line to the linker.
35239 @item %S
35240 Process the @code{startfile} spec.  This is a spec for deciding which
35241 object files are the first ones passed to the linker.  Typically
35242 this might be a file named @file{crt0.o}.
35244 @item %E
35245 Process the @code{endfile} spec.  This is a spec string that specifies
35246 the last object files that are passed to the linker.
35248 @item %C
35249 Process the @code{cpp} spec.  This is used to construct the arguments
35250 to be passed to the C preprocessor.
35252 @item %1
35253 Process the @code{cc1} spec.  This is used to construct the options to be
35254 passed to the actual C compiler (@command{cc1}).
35256 @item %2
35257 Process the @code{cc1plus} spec.  This is used to construct the options to be
35258 passed to the actual C++ compiler (@command{cc1plus}).
35260 @item %*
35261 Substitute the variable part of a matched option.  See below.
35262 Note that each comma in the substituted string is replaced by
35263 a single space.
35265 @item %<S
35266 Remove all occurrences of @code{-S} from the command line.  Note---this
35267 command is position dependent.  @samp{%} commands in the spec string
35268 before this one see @code{-S}, @samp{%} commands in the spec string
35269 after this one do not.
35271 @item %<S*
35272 Similar to @samp{%<S}, but match all switches beginning with @code{-S}.
35274 @item %>S
35275 Similar to @samp{%<S}, but keep @code{-S} in the GCC command line.
35277 @item %:@var{function}(@var{args})
35278 Call the named function @var{function}, passing it @var{args}.
35279 @var{args} is first processed as a nested spec string, then split
35280 into an argument vector in the usual fashion.  The function returns
35281 a string which is processed as if it had appeared literally as part
35282 of the current spec.
35284 The following built-in spec functions are provided:
35286 @table @code
35287 @item @code{getenv}
35288 The @code{getenv} spec function takes two arguments: an environment
35289 variable name and a string.  If the environment variable is not
35290 defined, a fatal error is issued.  Otherwise, the return value is the
35291 value of the environment variable concatenated with the string.  For
35292 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
35294 @smallexample
35295 %:getenv(TOPDIR /include)
35296 @end smallexample
35298 expands to @file{/path/to/top/include}.
35300 @item @code{if-exists}
35301 The @code{if-exists} spec function takes one argument, an absolute
35302 pathname to a file.  If the file exists, @code{if-exists} returns the
35303 pathname.  Here is a small example of its usage:
35305 @smallexample
35306 *startfile:
35307 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
35308 @end smallexample
35310 @item @code{if-exists-else}
35311 The @code{if-exists-else} spec function is similar to the @code{if-exists}
35312 spec function, except that it takes two arguments.  The first argument is
35313 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
35314 returns the pathname.  If it does not exist, it returns the second argument.
35315 This way, @code{if-exists-else} can be used to select one file or another,
35316 based on the existence of the first.  Here is a small example of its usage:
35318 @smallexample
35319 *startfile:
35320 crt0%O%s %:if-exists(crti%O%s) \
35321 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
35322 @end smallexample
35324 @item @code{if-exists-then-else}
35325 The @code{if-exists-then-else} spec function takes at least two arguments
35326 and an optional third one. The first argument is an absolute pathname to a
35327 file.  If the file exists, the function returns the second argument.
35328 If the file does not exist, the function returns the third argument if there
35329 is one, or NULL otherwise. This can be used to expand one text, or optionally
35330 another, based on the existence of a file.  Here is a small example of its
35331 usage:
35333 @smallexample
35334 -l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
35335 @end smallexample
35337 @item @code{sanitize}
35338 The @code{sanitize} spec function takes no arguments.  It returns non-NULL if
35339 any address, thread or undefined behavior sanitizers are active.
35341 @smallexample
35342 %@{%:sanitize(address):-funwind-tables@}
35343 @end smallexample
35345 @item @code{replace-outfile}
35346 The @code{replace-outfile} spec function takes two arguments.  It looks for the
35347 first argument in the outfiles array and replaces it with the second argument.  Here
35348 is a small example of its usage:
35350 @smallexample
35351 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
35352 @end smallexample
35354 @item @code{remove-outfile}
35355 The @code{remove-outfile} spec function takes one argument.  It looks for the
35356 first argument in the outfiles array and removes it.  Here is a small example
35357 its usage:
35359 @smallexample
35360 %:remove-outfile(-lm)
35361 @end smallexample
35363 @item @code{version-compare}
35364 The @code{version-compare} spec function takes four or five arguments of the following
35365 form:
35367 @smallexample
35368 <comparison-op> <arg1> [<arg2>] <switch> <result>
35369 @end smallexample
35371 It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
35372 The supported @code{comparison-op} values are:
35374 @table @code
35375 @item >=
35376 True if @code{switch} is a later (or same) version than @code{arg1}
35378 @item !>
35379 Opposite of @code{>=}
35381 @item <
35382 True if @code{switch} is an earlier version than @code{arg1}
35384 @item !<
35385 Opposite of @code{<}
35387 @item ><
35388 True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
35390 @item <>
35391 True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
35392 @end table
35394 If the @code{switch} is not present at all, the condition is false unless the first character
35395 of the @code{comparison-op} is @code{!}.
35397 @smallexample
35398 %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
35399 @end smallexample
35401 The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
35402 passed.
35404 @item @code{include}
35405 The @code{include} spec function behaves much like @code{%include}, with the advantage
35406 that it can be nested inside a spec and thus be conditionalized.  It takes one argument,
35407 the filename, and looks for it in the startfile path.  It always returns NULL.
35409 @smallexample
35410 %@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
35411 @end smallexample
35413 @item @code{pass-through-libs}
35414 The @code{pass-through-libs} spec function takes any number of arguments.  It
35415 finds any @option{-l} options and any non-options ending in @file{.a} (which it
35416 assumes are the names of linker input library archive files) and returns a
35417 result containing all the found arguments each prepended by
35418 @option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
35419 intended to be passed to the LTO linker plugin.
35421 @smallexample
35422 %:pass-through-libs(%G %L %G)
35423 @end smallexample
35425 @item @code{print-asm-header}
35426 The @code{print-asm-header} function takes no arguments and simply
35427 prints a banner like:
35429 @smallexample
35430 Assembler options
35431 =================
35433 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
35434 @end smallexample
35436 It is used to separate compiler options from assembler options
35437 in the @option{--target-help} output.
35439 @item @code{gt}
35440 The @code{gt} spec function takes two or more arguments.  It returns @code{""} (the
35441 empty string) if the second-to-last argument is greater than the last argument, and NULL
35442 otherwise.  The following example inserts the @code{link_gomp} spec if the last
35443 @option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
35445 @smallexample
35446 %@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
35447 @end smallexample
35449 @item @code{debug-level-gt}
35450 The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
35451 empty string) if @code{debug_info_level} is greater than the specified number, and NULL
35452 otherwise.
35454 @smallexample
35455 %@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
35456 @end smallexample
35457 @end table
35459 @item %@{S@}
35460 Substitutes the @code{-S} switch, if that switch is given to GCC@.
35461 If that switch is not specified, this substitutes nothing.  Note that
35462 the leading dash is omitted when specifying this option, and it is
35463 automatically inserted if the substitution is performed.  Thus the spec
35464 string @samp{%@{foo@}} matches the command-line option @option{-foo}
35465 and outputs the command-line option @option{-foo}.
35467 @item %W@{S@}
35468 Like %@{@code{S}@} but mark last argument supplied within as a file to be
35469 deleted on failure.
35471 @item %@@@{S@}
35472 Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes
35473 @code{@@FILE} if an @code{@@file} argument has been supplied.
35475 @item %@{S*@}
35476 Substitutes all the switches specified to GCC whose names start
35477 with @code{-S}, but which also take an argument.  This is used for
35478 switches like @option{-o}, @option{-D}, @option{-I}, etc.
35479 GCC considers @option{-o foo} as being
35480 one switch whose name starts with @samp{o}.  %@{o*@} substitutes this
35481 text, including the space.  Thus two arguments are generated.
35483 @item %@{S*&T*@}
35484 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
35485 (the order of @code{S} and @code{T} in the spec is not significant).
35486 There can be any number of ampersand-separated variables; for each the
35487 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
35489 @item %@{S:X@}
35490 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
35492 @item %@{!S:X@}
35493 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
35495 @item %@{S*:X@}
35496 Substitutes @code{X} if one or more switches whose names start with
35497 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
35498 once, no matter how many such switches appeared.  However, if @code{%*}
35499 appears somewhere in @code{X}, then @code{X} is substituted once
35500 for each matching switch, with the @code{%*} replaced by the part of
35501 that switch matching the @code{*}.
35503 If @code{%*} appears as the last part of a spec sequence then a space
35504 is added after the end of the last substitution.  If there is more
35505 text in the sequence, however, then a space is not generated.  This
35506 allows the @code{%*} substitution to be used as part of a larger
35507 string.  For example, a spec string like this:
35509 @smallexample
35510 %@{mcu=*:--script=%*/memory.ld@}
35511 @end smallexample
35513 @noindent
35514 when matching an option like @option{-mcu=newchip} produces:
35516 @smallexample
35517 --script=newchip/memory.ld
35518 @end smallexample
35520 @item %@{.S:X@}
35521 Substitutes @code{X}, if processing a file with suffix @code{S}.
35523 @item %@{!.S:X@}
35524 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
35526 @item %@{,S:X@}
35527 Substitutes @code{X}, if processing a file for language @code{S}.
35529 @item %@{!,S:X@}
35530 Substitutes @code{X}, if not processing a file for language @code{S}.
35532 @item %@{S|P:X@}
35533 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
35534 GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
35535 @code{*} sequences as well, although they have a stronger binding than
35536 the @samp{|}.  If @code{%*} appears in @code{X}, all of the
35537 alternatives must be starred, and only the first matching alternative
35538 is substituted.
35540 For example, a spec string like this:
35542 @smallexample
35543 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
35544 @end smallexample
35546 @noindent
35547 outputs the following command-line options from the following input
35548 command-line options:
35550 @smallexample
35551 fred.c        -foo -baz
35552 jim.d         -bar -boggle
35553 -d fred.c     -foo -baz -boggle
35554 -d jim.d      -bar -baz -boggle
35555 @end smallexample
35557 @item %@{%:@var{function}(@var{args}):X@}
35559 Call function named @var{function} with args @var{args}.  If the
35560 function returns non-NULL, then @code{X} is substituted, if it returns
35561 NULL, it isn't substituted.
35563 @item %@{S:X; T:Y; :D@}
35565 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
35566 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
35567 be as many clauses as you need.  This may be combined with @code{.},
35568 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
35571 @end table
35573 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
35574 or similar construct can use a backslash to ignore the special meaning
35575 of the character following it, thus allowing literal matching of a
35576 character that is otherwise specially treated.  For example,
35577 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
35578 @option{-std=iso9899:1999} option is given.
35580 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
35581 construct may contain other nested @samp{%} constructs or spaces, or
35582 even newlines.  They are processed as usual, as described above.
35583 Trailing white space in @code{X} is ignored.  White space may also
35584 appear anywhere on the left side of the colon in these constructs,
35585 except between @code{.} or @code{*} and the corresponding word.
35587 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
35588 handled specifically in these constructs.  If another value of
35589 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
35590 @option{-W} switch is found later in the command line, the earlier
35591 switch value is ignored, except with @{@code{S}*@} where @code{S} is
35592 just one letter, which passes all matching options.
35594 The character @samp{|} at the beginning of the predicate text is used to
35595 indicate that a command should be piped to the following command, but
35596 only if @option{-pipe} is specified.
35598 It is built into GCC which switches take arguments and which do not.
35599 (You might think it would be useful to generalize this to allow each
35600 compiler's spec to say which switches take arguments.  But this cannot
35601 be done in a consistent fashion.  GCC cannot even decide which input
35602 files have been specified without knowing which switches take arguments,
35603 and it must know which input files to compile in order to tell which
35604 compilers to run).
35606 GCC also knows implicitly that arguments starting in @option{-l} are to be
35607 treated as compiler output files, and passed to the linker in their
35608 proper position among the other output files.
35610 @node Environment Variables
35611 @section Environment Variables Affecting GCC
35612 @cindex environment variables
35614 @c man begin ENVIRONMENT
35615 This section describes several environment variables that affect how GCC
35616 operates.  Some of them work by specifying directories or prefixes to use
35617 when searching for various kinds of files.  Some are used to specify other
35618 aspects of the compilation environment.
35620 Note that you can also specify places to search using options such as
35621 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
35622 take precedence over places specified using environment variables, which
35623 in turn take precedence over those specified by the configuration of GCC@.
35624 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
35625 GNU Compiler Collection (GCC) Internals}.
35627 @table @env
35628 @vindex LANG
35629 @vindex LC_CTYPE
35630 @c @vindex LC_COLLATE
35631 @vindex LC_MESSAGES
35632 @c @vindex LC_MONETARY
35633 @c @vindex LC_NUMERIC
35634 @c @vindex LC_TIME
35635 @vindex LC_ALL
35636 @cindex locale
35637 @item LANG
35638 @itemx LC_CTYPE
35639 @c @itemx LC_COLLATE
35640 @itemx LC_MESSAGES
35641 @c @itemx LC_MONETARY
35642 @c @itemx LC_NUMERIC
35643 @c @itemx LC_TIME
35644 @itemx LC_ALL
35645 These environment variables control the way that GCC uses
35646 localization information which allows GCC to work with different
35647 national conventions.  GCC inspects the locale categories
35648 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
35649 so.  These locale categories can be set to any value supported by your
35650 installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
35651 Kingdom encoded in UTF-8.
35653 The @env{LC_CTYPE} environment variable specifies character
35654 classification.  GCC uses it to determine the character boundaries in
35655 a string; this is needed for some multibyte encodings that contain quote
35656 and escape characters that are otherwise interpreted as a string
35657 end or escape.
35659 The @env{LC_MESSAGES} environment variable specifies the language to
35660 use in diagnostic messages.
35662 If the @env{LC_ALL} environment variable is set, it overrides the value
35663 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
35664 and @env{LC_MESSAGES} default to the value of the @env{LANG}
35665 environment variable.  If none of these variables are set, GCC
35666 defaults to traditional C English behavior.
35668 @vindex TMPDIR
35669 @item TMPDIR
35670 If @env{TMPDIR} is set, it specifies the directory to use for temporary
35671 files.  GCC uses temporary files to hold the output of one stage of
35672 compilation which is to be used as input to the next stage: for example,
35673 the output of the preprocessor, which is the input to the compiler
35674 proper.
35676 @vindex GCC_COMPARE_DEBUG
35677 @item GCC_COMPARE_DEBUG
35678 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
35679 @option{-fcompare-debug} to the compiler driver.  See the documentation
35680 of this option for more details.
35682 @vindex GCC_EXEC_PREFIX
35683 @item GCC_EXEC_PREFIX
35684 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
35685 names of the subprograms executed by the compiler.  No slash is added
35686 when this prefix is combined with the name of a subprogram, but you can
35687 specify a prefix that ends with a slash if you wish.
35689 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
35690 an appropriate prefix to use based on the pathname it is invoked with.
35692 If GCC cannot find the subprogram using the specified prefix, it
35693 tries looking in the usual places for the subprogram.
35695 The default value of @env{GCC_EXEC_PREFIX} is
35696 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
35697 the installed compiler. In many cases @var{prefix} is the value
35698 of @code{prefix} when you ran the @file{configure} script.
35700 Other prefixes specified with @option{-B} take precedence over this prefix.
35702 This prefix is also used for finding files such as @file{crt0.o} that are
35703 used for linking.
35705 In addition, the prefix is used in an unusual way in finding the
35706 directories to search for header files.  For each of the standard
35707 directories whose name normally begins with @samp{/usr/local/lib/gcc}
35708 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
35709 replacing that beginning with the specified prefix to produce an
35710 alternate directory name.  Thus, with @option{-Bfoo/}, GCC searches
35711 @file{foo/bar} just before it searches the standard directory 
35712 @file{/usr/local/lib/bar}.
35713 If a standard directory begins with the configured
35714 @var{prefix} then the value of @var{prefix} is replaced by
35715 @env{GCC_EXEC_PREFIX} when looking for header files.
35717 @vindex COMPILER_PATH
35718 @item COMPILER_PATH
35719 The value of @env{COMPILER_PATH} is a colon-separated list of
35720 directories, much like @env{PATH}.  GCC tries the directories thus
35721 specified when searching for subprograms, if it cannot find the
35722 subprograms using @env{GCC_EXEC_PREFIX}.
35724 @vindex LIBRARY_PATH
35725 @item LIBRARY_PATH
35726 The value of @env{LIBRARY_PATH} is a colon-separated list of
35727 directories, much like @env{PATH}.  When configured as a native compiler,
35728 GCC tries the directories thus specified when searching for special
35729 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}.  Linking
35730 using GCC also uses these directories when searching for ordinary
35731 libraries for the @option{-l} option (but directories specified with
35732 @option{-L} come first).
35734 @vindex LANG
35735 @cindex locale definition
35736 @item LANG
35737 This variable is used to pass locale information to the compiler.  One way in
35738 which this information is used is to determine the character set to be used
35739 when character literals, string literals and comments are parsed in C and C++.
35740 When the compiler is configured to allow multibyte characters,
35741 the following values for @env{LANG} are recognized:
35743 @table @samp
35744 @item C-JIS
35745 Recognize JIS characters.
35746 @item C-SJIS
35747 Recognize SJIS characters.
35748 @item C-EUCJP
35749 Recognize EUCJP characters.
35750 @end table
35752 If @env{LANG} is not defined, or if it has some other value, then the
35753 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
35754 recognize and translate multibyte characters.
35756 @vindex GCC_EXTRA_DIAGNOSTIC_OUTPUT
35757 @item GCC_EXTRA_DIAGNOSTIC_OUTPUT
35758 If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
35759 then additional text will be emitted to stderr when fix-it hints are
35760 emitted.  @option{-fdiagnostics-parseable-fixits} and
35761 @option{-fno-diagnostics-parseable-fixits} take precedence over this
35762 environment variable.
35764 @table @samp
35765 @item fixits-v1
35766 Emit parseable fix-it hints, equivalent to
35767 @option{-fdiagnostics-parseable-fixits}.  In particular, columns are
35768 expressed as a count of bytes, starting at byte 1 for the initial column.
35770 @item fixits-v2
35771 As @code{fixits-v1}, but columns are expressed as display columns,
35772 as per @option{-fdiagnostics-column-unit=display}.
35773 @end table
35775 @end table
35777 @noindent
35778 Some additional environment variables affect the behavior of the
35779 preprocessor.
35781 @include cppenv.texi
35783 @c man end
35785 @node Precompiled Headers
35786 @section Using Precompiled Headers
35787 @cindex precompiled headers
35788 @cindex speed of compilation
35790 Often large projects have many header files that are included in every
35791 source file.  The time the compiler takes to process these header files
35792 over and over again can account for nearly all of the time required to
35793 build the project.  To make builds faster, GCC allows you to
35794 @dfn{precompile} a header file.
35796 To create a precompiled header file, simply compile it as you would any
35797 other file, if necessary using the @option{-x} option to make the driver
35798 treat it as a C or C++ header file.  You may want to use a
35799 tool like @command{make} to keep the precompiled header up-to-date when
35800 the headers it contains change.
35802 A precompiled header file is searched for when @code{#include} is
35803 seen in the compilation.  As it searches for the included file
35804 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
35805 compiler looks for a precompiled header in each directory just before it
35806 looks for the include file in that directory.  The name searched for is
35807 the name specified in the @code{#include} with @samp{.gch} appended.  If
35808 the precompiled header file cannot be used, it is ignored.
35810 For instance, if you have @code{#include "all.h"}, and you have
35811 @file{all.h.gch} in the same directory as @file{all.h}, then the
35812 precompiled header file is used if possible, and the original
35813 header is used otherwise.
35815 Alternatively, you might decide to put the precompiled header file in a
35816 directory and use @option{-I} to ensure that directory is searched
35817 before (or instead of) the directory containing the original header.
35818 Then, if you want to check that the precompiled header file is always
35819 used, you can put a file of the same name as the original header in this
35820 directory containing an @code{#error} command.
35822 This also works with @option{-include}.  So yet another way to use
35823 precompiled headers, good for projects not designed with precompiled
35824 header files in mind, is to simply take most of the header files used by
35825 a project, include them from another header file, precompile that header
35826 file, and @option{-include} the precompiled header.  If the header files
35827 have guards against multiple inclusion, they are skipped because
35828 they've already been included (in the precompiled header).
35830 If you need to precompile the same header file for different
35831 languages, targets, or compiler options, you can instead make a
35832 @emph{directory} named like @file{all.h.gch}, and put each precompiled
35833 header in the directory, perhaps using @option{-o}.  It doesn't matter
35834 what you call the files in the directory; every precompiled header in
35835 the directory is considered.  The first precompiled header
35836 encountered in the directory that is valid for this compilation is
35837 used; they're searched in no particular order.
35839 There are many other possibilities, limited only by your imagination,
35840 good sense, and the constraints of your build system.
35842 A precompiled header file can be used only when these conditions apply:
35844 @itemize
35845 @item
35846 Only one precompiled header can be used in a particular compilation.
35848 @item
35849 A precompiled header cannot be used once the first C token is seen.  You
35850 can have preprocessor directives before a precompiled header; you cannot
35851 include a precompiled header from inside another header.
35853 @item
35854 The precompiled header file must be produced for the same language as
35855 the current compilation.  You cannot use a C precompiled header for a C++
35856 compilation.
35858 @item
35859 The precompiled header file must have been produced by the same compiler
35860 binary as the current compilation is using.
35862 @item
35863 Any macros defined before the precompiled header is included must
35864 either be defined in the same way as when the precompiled header was
35865 generated, or must not affect the precompiled header, which usually
35866 means that they don't appear in the precompiled header at all.
35868 The @option{-D} option is one way to define a macro before a
35869 precompiled header is included; using a @code{#define} can also do it.
35870 There are also some options that define macros implicitly, like
35871 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
35872 defined this way.
35874 @item If debugging information is output when using the precompiled
35875 header, using @option{-g} or similar, the same kind of debugging information
35876 must have been output when building the precompiled header.  However,
35877 a precompiled header built using @option{-g} can be used in a compilation
35878 when no debugging information is being output.
35880 @item The same @option{-m} options must generally be used when building
35881 and using the precompiled header.  @xref{Submodel Options},
35882 for any cases where this rule is relaxed.
35884 @item Each of the following options must be the same when building and using
35885 the precompiled header:
35887 @gccoptlist{-fexceptions}
35889 @item
35890 Some other command-line options starting with @option{-f},
35891 @option{-p}, or @option{-O} must be defined in the same way as when
35892 the precompiled header was generated.  At present, it's not clear
35893 which options are safe to change and which are not; the safest choice
35894 is to use exactly the same options when generating and using the
35895 precompiled header.  The following are known to be safe:
35897 @gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock
35898 -fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous
35899 -fsched-verbose=@var{number}  -fschedule-insns  -fvisibility=
35900 -pedantic-errors}
35902 @item Address space layout randomization (ASLR) can lead to not binary identical
35903 PCH files.  If you rely on stable PCH file contents disable ASLR when generating
35904 PCH files.
35906 @end itemize
35908 For all of these except the last, the compiler automatically
35909 ignores the precompiled header if the conditions aren't met.  If you
35910 find an option combination that doesn't work and doesn't cause the
35911 precompiled header to be ignored, please consider filing a bug report,
35912 see @ref{Bugs}.
35914 If you do use differing options when generating and using the
35915 precompiled header, the actual behavior is a mixture of the
35916 behavior for the options.  For instance, if you use @option{-g} to
35917 generate the precompiled header but not when using it, you may or may
35918 not get debugging information for routines in the precompiled header.
35920 @node C++ Modules
35921 @section C++ Modules
35922 @cindex speed of compilation
35924 Modules are a C++20 language feature.  As the name suggests, they
35925 provides a modular compilation system, intending to provide both
35926 faster builds and better library isolation.  The ``Merging Modules''
35927 paper @uref{https://wg21.link/p1103}, provides the easiest to read set
35928 of changes to the standard, although it does not capture later
35929 changes.
35931 @emph{G++'s modules support is not complete.}  Other than bugs, the
35932 known missing pieces are:
35934 @table @emph
35936 @item Private Module Fragment
35937 The Private Module Fragment is recognized, but an error is emitted.
35939 @item Partition definition visibility rules
35940 Entities may be defined in implementation partitions, and those
35941 definitions are not available outside of the module.  This is not
35942 implemented, and the definitions are available to extra-module use.
35944 @item Textual merging of reachable GM entities
35945 Entities may be multiply defined across different header-units.
35946 These must be de-duplicated, and this is implemented across imports,
35947 or when an import redefines a textually-defined entity.  However the
35948 reverse is not implemented---textually redefining an entity that has
35949 been defined in an imported header-unit.  A redefinition error is
35950 emitted.
35952 @item Translation-Unit local referencing rules
35953 Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
35954 (@uref{https://wg21.link/p2003}) add limitations on which entities an
35955 exported region may reference (for instance, the entities an exported
35956 template definition may reference).  These are not fully implemented.
35958 @item Standard Library Header Units
35959 The Standard Library is not provided as importable header units.  If
35960 you want to import such units, you must explicitly build them first.
35961 If you do not do this with care, you may have multiple declarations,
35962 which the module machinery must merge---compiler resource usage can be
35963 affected by how you partition header files into header units.
35965 @end table
35967 Modular compilation is @emph{not} enabled with just the
35968 @option{-std=c++20} option.  You must explicitly enable it with the
35969 @option{-fmodules-ts} option.  It is independent of the language
35970 version selected, although in pre-C++20 versions, it is of course an
35971 extension.
35973 No new source file suffixes are required or supported.  If you wish to
35974 use a non-standard suffix (@pxref{Overall Options}), you also need
35975 to provide a @option{-x c++} option too.@footnote{Some users like to
35976 distinguish module interface files with a new suffix, such as naming
35977 the source @code{module.cppm}, which involves
35978 teaching all tools about the new suffix.  A different scheme, such as
35979 naming @code{module-m.cpp} would be less invasive.}
35981 Compiling a module interface unit produces an additional output (to
35982 the assembly or object file), called a Compiled Module Interface
35983 (CMI).  This encodes the exported declarations of the module.
35984 Importing a module reads in the CMI.  The import graph is a Directed
35985 Acyclic Graph (DAG).  You must build imports before the importer.
35987 Header files may themselves be compiled to header units, which are a
35988 transitional ability aiming at faster compilation.  The
35989 @option{-fmodule-header} option is used to enable this, and implies
35990 the @option{-fmodules-ts} option.  These CMIs are named by the fully
35991 resolved underlying header file, and thus may be a complete pathname
35992 containing subdirectories.  If the header file is found at an absolute
35993 pathname, the CMI location is still relative to a CMI root directory.
35995 As header files often have no suffix, you commonly have to specify a
35996 @option{-x} option to tell the compiler the source is a header file.
35997 You may use @option{-x c++-header}, @option{-x c++-user-header} or
35998 @option{-x c++-system-header}.  When used in conjunction with
35999 @option{-fmodules-ts}, these all imply an appropriate
36000 @option{-fmodule-header} option.  The latter two variants use the
36001 user or system include path to search for the file specified.  This
36002 allows you to, for instance, compile standard library header files as
36003 header units, without needing to know exactly where they are
36004 installed.  Specifying the language as one of these variants also
36005 inhibits output of the object file, as header files have no associated
36006 object file.
36008 The @option{-fmodule-only} option disables generation of the
36009 associated object file for compiling a module interface.  Only the CMI
36010 is generated.  This option is implied when using the
36011 @option{-fmodule-header} option.
36013 The @option{-flang-info-include-translate} and
36014 @option{-flang-info-include-translate-not} options notes whether
36015 include translation occurs or not.  With no argument, the first will
36016 note all include translation.  The second will note all
36017 non-translations of include files not known to intentionally be
36018 textual.  With an argument, queries about include translation of a
36019 header files with that particular trailing pathname are noted.  You
36020 may repeat this form to cover several different header files.  This
36021 option may be helpful in determining whether include translation is
36022 happening---if it is working correctly, it behaves as if it isn't
36023 there at all.
36025 The @option{-flang-info-module-cmi} option can be used to determine
36026 where the compiler is reading a CMI from.  Without the option, the
36027 compiler is silent when such a read is successful.  This option has an
36028 optional argument, which will restrict the notification to just the
36029 set of named modules or header units specified.
36031 The @option{-Winvalid-imported-macros} option causes all imported macros
36032 to be resolved at the end of compilation.  Without this, imported
36033 macros are only resolved when expanded or (re)defined.  This option
36034 detects conflicting import definitions for all macros.
36036 For details of the @option{-fmodule-mapper} family of options,
36037 @pxref{C++ Module Mapper}.
36039 @menu
36040 * C++ Module Mapper::       Module Mapper
36041 * C++ Module Preprocessing::  Module Preprocessing
36042 * C++ Compiled Module Interface:: Compiled Module Interface
36043 @end menu
36045 @node C++ Module Mapper
36046 @subsection Module Mapper
36047 @cindex C++ Module Mapper
36049 A module mapper provides a server or file that the compiler queries to
36050 determine the mapping between module names and CMI files.  It is also
36051 used to build CMIs on demand.  @emph{Mapper functionality is in its
36052 infancy and is intended for experimentation with build system
36053 interactions.}
36055 You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
36056 option or @env{CXX_MODULE_MAPPER} environment variable.  The value may
36057 have one of the following forms:
36059 @table @gcctabopt
36061 @item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
36062 An optional hostname and a numeric port number to connect to.  If the
36063 hostname is omitted, the loopback address is used.  If the hostname
36064 corresponds to multiple IPV6 addresses, these are tried in turn, until
36065 one is successful.  If your host lacks IPv6, this form is
36066 non-functional.  If you must use IPv4 use
36067 @option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
36069 @item =@var{socket}@r{[}?@var{ident}@r{]}
36070 A local domain socket.  If your host lacks local domain sockets, this
36071 form is non-functional.
36073 @item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
36074 A program to spawn, and communicate with on its stdin/stdout streams.
36075 Your @var{PATH} environment variable is searched for the program.
36076 Arguments are separated by space characters, (it is not possible for
36077 one of the arguments delivered to the program to contain a space).  An
36078 exception is if @var{program} begins with @@.  In that case
36079 @var{program} (sans @@) is looked for in the compiler's internal
36080 binary directory.  Thus the sample mapper-server can be specified
36081 with @code{@@g++-mapper-server}.
36083 @item <>@r{[}?@var{ident}@r{]}
36084 @item <>@var{inout}@r{[}?@var{ident}@r{]}
36085 @item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
36086 Named pipes or file descriptors to communicate over.  The first form,
36087 @option{<>}, communicates over stdin and stdout.  The other forms
36088 allow you to specify a file descriptor or name a pipe.  A numeric value
36089 is interpreted as a file descriptor, otherwise named pipe is opened.
36090 The second form specifies a bidirectional pipe and the last form
36091 allows specifying two independent pipes.  Using file descriptors
36092 directly in this manner is fragile in general, as it can require the
36093 cooperation of intermediate processes.  In particular using stdin &
36094 stdout is fraught with danger as other compiler options might also
36095 cause the compiler to read stdin or write stdout, and it can have
36096 unfortunate interactions with signal delivery from the terminal.
36098 @item @var{file}@r{[}?@var{ident}@r{]}
36099 A mapping file consisting of space-separated module-name, filename
36100 pairs, one per line.  Only the mappings for the direct imports and any
36101 module export name need be provided.  If other mappings are provided,
36102 they override those stored in any imported CMI files.  A repository
36103 root may be specified in the mapping file by using @samp{$root} as the
36104 module name in the first active line.  Use of this option will disable
36105 any default module->CMI name mapping.
36107 @end table
36109 As shown, an optional @var{ident} may suffix the first word of the
36110 option, indicated by a @samp{?} prefix.  The value is used in the
36111 initial handshake with the module server, or to specify a prefix on
36112 mapping file lines.  In the server case, the main source file name is
36113 used if no @var{ident} is specified.  In the file case, all non-blank
36114 lines are significant, unless a value is specified, in which case only
36115 lines beginning with @var{ident} are significant.  The @var{ident}
36116 must be separated by whitespace from the module name.  Be aware that
36117 @samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
36118 significant to the shell, and therefore may need quoting.
36120 The mapper is connected to or loaded lazily, when the first module
36121 mapping is required.  The networking protocols are only supported on
36122 hosts that provide networking.  If no mapper is specified a default is
36123 provided.
36125 A project-specific mapper is expected to be provided by the build
36126 system that invokes the compiler.  It is not expected that a
36127 general-purpose server is provided for all compilations.  As such, the
36128 server will know the build configuration, the compiler it invoked, and
36129 the environment (such as working directory) in which that is
36130 operating.  As it may parallelize builds, several compilations may
36131 connect to the same socket.
36133 The default mapper generates CMI files in a @samp{gcm.cache}
36134 directory.  CMI files have a @samp{.gcm} suffix.  The module unit name
36135 is used directly to provide the basename.  Header units construct a
36136 relative path using the underlying header file name.  If the path is
36137 already relative, a @samp{,} directory is prepended.  Internal
36138 @samp{..} components are translated to @samp{,,}.  No attempt is made
36139 to canonicalize these filenames beyond that done by the preprocessor's
36140 include search algorithm, as in general it is ambiguous when symbolic
36141 links are present.
36143 The mapper protocol was published as ``A Module Mapper''
36144 @uref{https://wg21.link/p1184}.  The implementation is provided by
36145 @command{libcody}, @uref{https://github.com/urnathan/libcody},
36146 which specifies the canonical protocol definition.  A proof of concept
36147 server implementation embedded in @command{make} was described in
36148 ''Make Me A Module'', @uref{https://wg21.link/p1602}.
36150 @node C++ Module Preprocessing
36151 @subsection Module Preprocessing
36152 @cindex C++ Module Preprocessing
36154 Modules affect preprocessing because of header units and include
36155 translation.  Some uses of the preprocessor as a separate step either
36156 do not produce a correct output, or require CMIs to be available.
36158 Header units import macros.  These macros can affect later conditional
36159 inclusion, which therefore can cascade to differing import sets.  When
36160 preprocessing, it is necessary to load the CMI.  If a header unit is
36161 unavailable, the preprocessor issues a warning and continue (when
36162 not just preprocessing, an error is emitted).  Detecting such imports
36163 requires preprocessor tokenization of the input stream to phase 4
36164 (macro expansion).
36166 Include translation converts @code{#include}, @code{#include_next} and
36167 @code{#import} directives to internal @code{import} declarations.
36168 Whether a particular directive is translated is controlled by the
36169 module mapper.  Header unit names are canonicalized during
36170 preprocessing.
36172 Dependency information can be emitted for macro import, extending the
36173 functionality of @option{-MD} and @option{-MMD} options.  Detection of
36174 import declarations also requires phase 4 preprocessing, and thus
36175 requires full preprocessing (or compilation).
36177 The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
36178 preprocessing before phase 4.
36180 The @option{-save-temps} option uses @option{-fdirectives-only} for
36181 preprocessing, and preserve the macro definitions in the preprocessed
36182 output.  Usually you also want to use this option when explicitly
36183 preprocessing a header-unit, or consuming such preprocessed output:
36185 @smallexample
36186 g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
36187 g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
36188 @end smallexample
36190 @node C++ Compiled Module Interface
36191 @subsection Compiled Module Interface
36192 @cindex C++ Compiled Module Interface
36194 CMIs are an additional artifact when compiling named module
36195 interfaces, partitions or header units.  These are read when
36196 importing.  CMI contents are implementation-specific, and in GCC's
36197 case tied to the compiler version.  Consider them a rebuildable cache
36198 artifact, not a distributable object.
36200 When creating an output CMI, any missing directory components are
36201 created in a manner that is safe for concurrent builds creating
36202 multiple, different, CMIs within a common subdirectory tree.
36204 CMI contents are written to a temporary file, which is then atomically
36205 renamed.  Observers either see old contents (if there is an
36206 existing file), or complete new contents.  They do not observe the
36207 CMI during its creation.  This is unlike object file writing, which
36208 may be observed by an external process.
36210 CMIs are read in lazily, if the host OS provides @code{mmap}
36211 functionality.  Generally blocks are read when name lookup or template
36212 instantiation occurs.  To inhibit this, the @option{-fno-module-lazy}
36213 option may be used.
36215 The @option{--param lazy-modules=@var{n}} parameter controls the limit
36216 on the number of concurrently open module files during lazy loading.
36217 Should more modules be imported, an LRU algorithm is used to determine
36218 which files to close---until that file is needed again.  This limit
36219 may be exceeded with deep module dependency hierarchies.  With large
36220 code bases there may be more imports than the process limit of file
36221 descriptors.  By default, the limit is a few less than the per-process
36222 file descriptor hard limit, if that is determinable.@footnote{Where
36223 applicable the soft limit is incremented as needed towards the hard limit.}
36225 GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
36226 You may use @command{readelf} to inspect them, although section
36227 contents are largely undecipherable.  There is a section named
36228 @code{.gnu.c++.README}, which contains human-readable text.  Other
36229 than the first line, each line consists of @code{@var{tag}: @code{value}}
36230 tuples.
36232 @smallexample
36233 > @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
36235 String dump of section '.gnu.c++.README':
36236   [     0]  GNU C++ primary module interface
36237   [    21]  compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
36238   [    6f]  version: 2020/11/16-04:54
36239   [    89]  module: foo
36240   [    95]  source: c_b.ii
36241   [    a4]  dialect: C++20/coroutines
36242   [    be]  cwd: /data/users/nathans/modules/obj/x86_64/gcc
36243   [    ee]  repository: gcm.cache
36244   [   104]  buildtime: 2020/11/16 15:03:21 UTC
36245   [   127]  localtime: 2020/11/16 07:03:21 PST
36246   [   14a]  export: foo:part1 foo-part1.gcm
36247 @end smallexample
36249 Amongst other things, this lists the source that was built, C++
36250 dialect used and imports of the module.@footnote{The precise contents
36251 of this output may change.} The timestamp is the same value as that
36252 provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
36253 explicitly specified with the environment variable
36254 @code{SOURCE_DATE_EPOCH}.  For further details
36255 @pxref{Environment Variables}.
36257 A set of related CMIs may be copied, provided the relative pathnames
36258 are preserved.
36260 The @code{.gnu.c++.README} contents do not affect CMI integrity, and
36261 it may be removed or altered.  The section numbering of the sections
36262 whose names do not begin with @code{.gnu.c++.}, or are not the string
36263 section is significant and must not be altered.