tree-optimization/112450 - avoid AVX512 style masking for BImode masks
[official-gcc.git] / gcc / doc / invoke.texi
blob1bf71ce47a8abed78055f9c736bbbf9ce5729e72
1 @c Copyright (C) 1988-2023 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2023 Free Software Foundation, Inc.
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below).  A copy of the license is
19 included in the gfdl(7) man page.
21 (a) The FSF's Front-Cover Text is:
23      A GNU Manual
25 (b) The FSF's Back-Cover Text is:
27      You have freedom to copy and modify this GNU Manual, like GNU
28      software.  Copies published by the Free Software Foundation raise
29      funds for GNU development.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
35 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36     [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37     [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38     [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39     [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40     [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41     [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
43 Only the most useful options are listed here; see below for the
44 remainder.  @command{g++} accepts mostly the same options as @command{gcc}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
51 @c man end
52 @c man begin BUGS
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{https://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
60 @c man end
61 @end ignore
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
69 @c man begin DESCRIPTION
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking.  The ``overall options'' allow you to stop this
72 process at an intermediate stage.  For example, the @option{-c} option
73 says not to run the linker.  Then the output consists of object files
74 output by the assembler.
75 @xref{Overall Options,,Options Controlling the Kind of Output}.
77 Other options are passed on to one or more stages of processing.  Some options
78 control the preprocessor and others the compiler itself.  Yet other
79 options control the assembler and linker; most of these are not
80 documented here, since you rarely need to use any of them.
82 @cindex C compilation options
83 Most of the command-line options that you can use with GCC are useful
84 for C programs; when an option is only useful with another language
85 (usually C++), the explanation says so explicitly.  If the description
86 for a particular option does not mention a source language, you can use
87 that option with all supported languages.
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
94 The usual way to run GCC is to run the executable called @command{gcc}, or
95 @command{@var{machine}-gcc} when cross-compiling, or
96 @command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97 When you compile C++ programs, you should invoke GCC as @command{g++} 
98 instead.  @xref{Invoking G++,,Compiling C++ Programs}, 
99 for information about the differences in behavior between @command{gcc} 
100 and @command{g++} when compiling C++ programs.
102 @cindex grouping options
103 @cindex options, grouping
104 The @command{gcc} program accepts options and file names as operands.  Many
105 options have multi-letter names; therefore multiple single-letter options
106 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107 -v}}.
109 @cindex order of options
110 @cindex options, order
111 You can mix options and other arguments.  For the most part, the order
112 you use doesn't matter.  Order does matter when you use several
113 options of the same kind; for example, if you specify @option{-L} more
114 than once, the directories are searched in the order specified.  Also,
115 the placement of the @option{-l} option is significant.
117 Many options have long names starting with @samp{-f} or with
118 @samp{-W}---for example,
119 @option{-fmove-loop-invariants}, @option{-Wformat} and so on.  Most of
120 these have both positive and negative forms; the negative form of
121 @option{-ffoo} is @option{-fno-foo}.  This manual documents
122 only one of these two forms, whichever one is not the default.
124 Some options take one or more arguments typically separated either
125 by a space or by the equals sign (@samp{=}) from the option name.
126 Unless documented otherwise, an argument can be either numeric or
127 a string.  Numeric arguments must typically be small unsigned decimal
128 or hexadecimal integers.  Hexadecimal arguments must begin with
129 the @samp{0x} prefix.  Arguments to options that specify a size
130 threshold of some sort may be arbitrarily large decimal or hexadecimal
131 integers followed by a byte size suffix designating a multiple of bytes
132 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
133 @code{MB} and @code{MiB} for megabyte and mebibyte, @code{GB} and
134 @code{GiB} for gigabyte and gigibyte, and so on.  Such arguments are
135 designated by @var{byte-size} in the following text.  Refer to the NIST,
136 IEC, and other relevant national and international standards for the full
137 listing and explanation of the binary and decimal byte size prefixes.
139 @c man end
141 @xref{Option Index}, for an index to GCC's options.
143 @menu
144 * Option Summary::      Brief list of all options, without explanations.
145 * Overall Options::     Controlling the kind of output:
146                         an executable, object files, assembler files,
147                         or preprocessed source.
148 * Invoking G++::        Compiling C++ programs.
149 * C Dialect Options::   Controlling the variant of C language compiled.
150 * C++ Dialect Options:: Variations on C++.
151 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
152                         and Objective-C++.
153 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
154                         be formatted.
155 * Warning Options::     How picky should the compiler be?
156 * Static Analyzer Options:: More expensive warnings.
157 * Debugging Options::   Producing debuggable code.
158 * Optimize Options::    How much optimization?
159 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
160 * Preprocessor Options:: Controlling header files and macro definitions.
161                          Also, getting dependency information for Make.
162 * Assembler Options::   Passing options to the assembler.
163 * Link Options::        Specifying libraries and so on.
164 * Directory Options::   Where to find header files and libraries.
165                         Where to find the compiler executable files.
166 * Code Gen Options::    Specifying conventions for function calls, data layout
167                         and register usage.
168 * Developer Options::   Printing GCC configuration info, statistics, and
169                         debugging dumps.
170 * Submodel Options::    Target-specific options, such as compiling for a
171                         specific processor variant.
172 * Spec Files::          How to pass switches to sub-processes.
173 * Environment Variables:: Env vars that affect GCC.
174 * Precompiled Headers:: Compiling a header once, and using it many times.
175 * C++ Modules::         Experimental C++20 module system.
176 @end menu
178 @c man begin OPTIONS
180 @node Option Summary
181 @section Option Summary
183 Here is a summary of all the options, grouped by type.  Explanations are
184 in the following sections.
186 @table @emph
187 @item Overall Options
188 @xref{Overall Options,,Options Controlling the Kind of Output}.
189 @gccoptlist{-c  -S  -E  -o @var{file}
190 -dumpbase @var{dumpbase}  -dumpbase-ext @var{auxdropsuf}
191 -dumpdir @var{dumppfx}  -x @var{language}
192 -v  -###  --help@r{[}=@var{class}@r{[},@dots{}@r{]]}  --target-help  --version
193 -pass-exit-codes  -pipe  -specs=@var{file}  -wrapper
194 @@@var{file}  -ffile-prefix-map=@var{old}=@var{new}  -fcanon-prefix-map
195 -fplugin=@var{file}  -fplugin-arg-@var{name}=@var{arg}
196 -fdump-ada-spec@r{[}-slim@r{]}  -fada-spec-parent=@var{unit}  -fdump-go-spec=@var{file}}
198 @item C Language Options
199 @xref{C Dialect Options,,Options Controlling C Dialect}.
200 @gccoptlist{-ansi  -std=@var{standard}  -aux-info @var{filename}
201 -fno-asm
202 -fno-builtin  -fno-builtin-@var{function}  -fcond-mismatch
203 -ffreestanding  -fgimple  -fgnu-tm  -fgnu89-inline  -fhosted
204 -flax-vector-conversions  -fms-extensions
205 -foffload=@var{arg}  -foffload-options=@var{arg}
206 -fopenacc  -fopenacc-dim=@var{geom}
207 -fopenmp  -fopenmp-simd  -fopenmp-target-simd-clone@r{[}=@var{device-type}@r{]}
208 -fpermitted-flt-eval-methods=@var{standard}
209 -fplan9-extensions  -fsigned-bitfields  -funsigned-bitfields
210 -fsigned-char  -funsigned-char -fstrict-flex-arrays[=@var{n}]
211 -fsso-struct=@var{endianness}}
213 @item C++ Language Options
214 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
215 @gccoptlist{-fabi-version=@var{n}  -fno-access-control
216 -faligned-new=@var{n}  -fargs-in-order=@var{n}  -fchar8_t  -fcheck-new
217 -fconstexpr-depth=@var{n}  -fconstexpr-cache-depth=@var{n}
218 -fconstexpr-loop-limit=@var{n}  -fconstexpr-ops-limit=@var{n}
219 -fno-elide-constructors
220 -fno-enforce-eh-specs
221 -fno-gnu-keywords
222 -fno-implicit-templates
223 -fno-implicit-inline-templates
224 -fno-implement-inlines
225 -fmodule-header@r{[}=@var{kind}@r{]} -fmodule-only -fmodules-ts
226 -fmodule-implicit-inline
227 -fno-module-lazy
228 -fmodule-mapper=@var{specification}
229 -fmodule-version-ignore
230 -fms-extensions
231 -fnew-inheriting-ctors
232 -fnew-ttp-matching
233 -fno-nonansi-builtins  -fnothrow-opt  -fno-operator-names
234 -fno-optional-diags
235 -fno-pretty-templates
236 -fno-rtti  -fsized-deallocation
237 -ftemplate-backtrace-limit=@var{n}
238 -ftemplate-depth=@var{n}
239 -fno-threadsafe-statics  -fuse-cxa-atexit
240 -fno-weak  -nostdinc++
241 -fvisibility-inlines-hidden
242 -fvisibility-ms-compat
243 -fext-numeric-literals
244 -flang-info-include-translate@r{[}=@var{header}@r{]}
245 -flang-info-include-translate-not
246 -flang-info-module-cmi@r{[}=@var{module}@r{]}
247 -stdlib=@var{libstdc++,libc++}
248 -Wabi-tag  -Wcatch-value  -Wcatch-value=@var{n}
249 -Wno-class-conversion  -Wclass-memaccess
250 -Wcomma-subscript  -Wconditionally-supported
251 -Wno-conversion-null  -Wctad-maybe-unsupported
252 -Wctor-dtor-privacy  -Wdangling-reference
253 -Wno-delete-incomplete
254 -Wdelete-non-virtual-dtor  -Wno-deprecated-array-compare
255 -Wdeprecated-copy -Wdeprecated-copy-dtor
256 -Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion
257 -Weffc++ -Wno-elaborated-enum-base
258 -Wno-exceptions -Wextra-semi  -Wno-inaccessible-base
259 -Wno-inherited-variadic-ctor  -Wno-init-list-lifetime
260 -Winvalid-constexpr -Winvalid-imported-macros
261 -Wno-invalid-offsetof  -Wno-literal-suffix
262 -Wmismatched-new-delete -Wmismatched-tags
263 -Wmultiple-inheritance  -Wnamespaces  -Wnarrowing
264 -Wnoexcept  -Wnoexcept-type  -Wnon-virtual-dtor
265 -Wpessimizing-move  -Wno-placement-new  -Wplacement-new=@var{n}
266 -Wrange-loop-construct -Wredundant-move -Wredundant-tags
267 -Wreorder  -Wregister
268 -Wstrict-null-sentinel  -Wno-subobject-linkage  -Wtemplates
269 -Wno-non-template-friend  -Wold-style-cast
270 -Woverloaded-virtual  -Wno-pmf-conversions -Wself-move -Wsign-promo
271 -Wsized-deallocation  -Wsuggest-final-methods
272 -Wsuggest-final-types  -Wsuggest-override
273 -Wno-terminate  -Wuseless-cast  -Wno-vexing-parse
274 -Wvirtual-inheritance
275 -Wno-virtual-move-assign  -Wvolatile  -Wzero-as-null-pointer-constant}
277 @item Objective-C and Objective-C++ Language Options
278 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
279 Objective-C and Objective-C++ Dialects}.
280 @gccoptlist{-fconstant-string-class=@var{class-name}
281 -fgnu-runtime  -fnext-runtime
282 -fno-nil-receivers
283 -fobjc-abi-version=@var{n}
284 -fobjc-call-cxx-cdtors
285 -fobjc-direct-dispatch
286 -fobjc-exceptions
287 -fobjc-gc
288 -fobjc-nilcheck
289 -fobjc-std=objc1
290 -fno-local-ivars
291 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
292 -freplace-objc-classes
293 -fzero-link
294 -gen-decls
295 -Wassign-intercept  -Wno-property-assign-default
296 -Wno-protocol -Wobjc-root-class -Wselector
297 -Wstrict-selector-match
298 -Wundeclared-selector}
300 @item Diagnostic Message Formatting Options
301 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
302 @gccoptlist{-fmessage-length=@var{n}
303 -fdiagnostics-plain-output
304 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}
305 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]}
306 -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]}
307 -fdiagnostics-format=@r{[}text@r{|}sarif-stderr@r{|}sarif-file@r{|}json@r{|}json-stderr@r{|}json-file@r{]}
308 -fno-diagnostics-show-option  -fno-diagnostics-show-caret
309 -fno-diagnostics-show-labels  -fno-diagnostics-show-line-numbers
310 -fno-diagnostics-show-cwe
311 -fno-diagnostics-show-rule
312 -fdiagnostics-minimum-margin-width=@var{width}
313 -fdiagnostics-parseable-fixits  -fdiagnostics-generate-patch
314 -fdiagnostics-show-template-tree  -fno-elide-type
315 -fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]}
316 -fdiagnostics-show-path-depths
317 -fno-show-column
318 -fdiagnostics-column-unit=@r{[}display@r{|}byte@r{]}
319 -fdiagnostics-column-origin=@var{origin}
320 -fdiagnostics-escape-format=@r{[}unicode@r{|}bytes@r{]}
321 -fdiagnostics-text-art-charset=@r{[}none@r{|}ascii@r{|}unicode@r{|}emoji@r{]}}
323 @item Warning Options
324 @xref{Warning Options,,Options to Request or Suppress Warnings}.
325 @gccoptlist{-fsyntax-only  -fmax-errors=@var{n}  -Wpedantic
326 -pedantic-errors -fpermissive
327 -w  -Wextra  -Wall  -Wabi=@var{n}
328 -Waddress  -Wno-address-of-packed-member  -Waggregate-return
329 -Walloc-size-larger-than=@var{byte-size}  -Walloc-zero
330 -Walloca  -Walloca-larger-than=@var{byte-size}
331 -Wno-aggressive-loop-optimizations
332 -Warith-conversion
333 -Warray-bounds  -Warray-bounds=@var{n}  -Warray-compare
334 -Wno-attributes  -Wattribute-alias=@var{n} -Wno-attribute-alias
335 -Wno-attribute-warning
336 -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
337 -Wbool-compare  -Wbool-operation
338 -Wno-builtin-declaration-mismatch
339 -Wno-builtin-macro-redefined  -Wc90-c99-compat  -Wc99-c11-compat
340 -Wc11-c23-compat
341 -Wc++-compat  -Wc++11-compat  -Wc++14-compat  -Wc++17-compat
342 -Wc++20-compat
343 -Wno-c++11-extensions  -Wno-c++14-extensions -Wno-c++17-extensions
344 -Wno-c++20-extensions  -Wno-c++23-extensions
345 -Wcast-align  -Wcast-align=strict  -Wcast-function-type  -Wcast-qual
346 -Wchar-subscripts
347 -Wclobbered  -Wcomment
348 -Wcompare-distinct-pointer-types
349 -Wno-complain-wrong-lang
350 -Wconversion  -Wno-coverage-mismatch  -Wno-cpp
351 -Wdangling-else  -Wdangling-pointer  -Wdangling-pointer=@var{n}
352 -Wdate-time
353 -Wno-deprecated  -Wno-deprecated-declarations  -Wno-designated-init
354 -Wdisabled-optimization
355 -Wno-discarded-array-qualifiers  -Wno-discarded-qualifiers
356 -Wno-div-by-zero  -Wdouble-promotion
357 -Wduplicated-branches  -Wduplicated-cond
358 -Wempty-body  -Wno-endif-labels  -Wenum-compare  -Wenum-conversion
359 -Wenum-int-mismatch
360 -Werror  -Werror=*  -Wexpansion-to-defined  -Wfatal-errors
361 -Wflex-array-member-not-at-end
362 -Wfloat-conversion  -Wfloat-equal  -Wformat  -Wformat=2
363 -Wno-format-contains-nul  -Wno-format-extra-args
364 -Wformat-nonliteral  -Wformat-overflow=@var{n}
365 -Wformat-security  -Wformat-signedness  -Wformat-truncation=@var{n}
366 -Wformat-y2k  -Wframe-address
367 -Wframe-larger-than=@var{byte-size}  -Wno-free-nonheap-object
368 -Wno-if-not-aligned  -Wno-ignored-attributes
369 -Wignored-qualifiers  -Wno-incompatible-pointer-types
370 -Wimplicit  -Wimplicit-fallthrough  -Wimplicit-fallthrough=@var{n}
371 -Wno-implicit-function-declaration  -Wno-implicit-int
372 -Winfinite-recursion
373 -Winit-self  -Winline  -Wno-int-conversion  -Wint-in-bool-context
374 -Wno-int-to-pointer-cast  -Wno-invalid-memory-model
375 -Winvalid-pch  -Winvalid-utf8  -Wno-unicode  -Wjump-misses-init
376 -Wlarger-than=@var{byte-size}  -Wlogical-not-parentheses  -Wlogical-op
377 -Wlong-long  -Wno-lto-type-mismatch -Wmain  -Wmaybe-uninitialized
378 -Wmemset-elt-size  -Wmemset-transposed-args
379 -Wmisleading-indentation  -Wmissing-attributes  -Wmissing-braces
380 -Wmissing-field-initializers  -Wmissing-format-attribute
381 -Wmissing-include-dirs  -Wmissing-noreturn  -Wno-missing-profile
382 -Wno-multichar  -Wmultistatement-macros  -Wnonnull  -Wnonnull-compare
383 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
384 -Wnull-dereference  -Wno-odr
385 -Wopenacc-parallelism
386 -Wopenmp-simd
387 -Wno-overflow  -Woverlength-strings  -Wno-override-init-side-effects
388 -Wpacked  -Wno-packed-bitfield-compat  -Wpacked-not-aligned  -Wpadded
389 -Wparentheses  -Wno-pedantic-ms-format
390 -Wpointer-arith  -Wno-pointer-compare  -Wno-pointer-to-int-cast
391 -Wno-pragmas  -Wno-prio-ctor-dtor  -Wredundant-decls
392 -Wrestrict  -Wno-return-local-addr  -Wreturn-type
393 -Wno-scalar-storage-order  -Wsequence-point
394 -Wshadow  -Wshadow=global  -Wshadow=local  -Wshadow=compatible-local
395 -Wno-shadow-ivar
396 -Wno-shift-count-negative  -Wno-shift-count-overflow  -Wshift-negative-value
397 -Wno-shift-overflow  -Wshift-overflow=@var{n}
398 -Wsign-compare  -Wsign-conversion
399 -Wno-sizeof-array-argument
400 -Wsizeof-array-div
401 -Wsizeof-pointer-div  -Wsizeof-pointer-memaccess
402 -Wstack-protector  -Wstack-usage=@var{byte-size}  -Wstrict-aliasing
403 -Wstrict-aliasing=n  -Wstrict-overflow  -Wstrict-overflow=@var{n}
404 -Wstring-compare
405 -Wno-stringop-overflow -Wno-stringop-overread
406 -Wno-stringop-truncation -Wstrict-flex-arrays
407 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]}
408 -Wswitch  -Wno-switch-bool  -Wswitch-default  -Wswitch-enum
409 -Wno-switch-outside-range  -Wno-switch-unreachable  -Wsync-nand
410 -Wsystem-headers  -Wtautological-compare  -Wtrampolines  -Wtrigraphs
411 -Wtrivial-auto-var-init -Wtsan -Wtype-limits  -Wundef
412 -Wuninitialized  -Wunknown-pragmas
413 -Wunsuffixed-float-constants  -Wunused
414 -Wunused-but-set-parameter  -Wunused-but-set-variable
415 -Wunused-const-variable  -Wunused-const-variable=@var{n}
416 -Wunused-function  -Wunused-label  -Wunused-local-typedefs
417 -Wunused-macros
418 -Wunused-parameter  -Wno-unused-result
419 -Wunused-value  -Wunused-variable
420 -Wno-varargs  -Wvariadic-macros
421 -Wvector-operation-performance
422 -Wvla  -Wvla-larger-than=@var{byte-size}  -Wno-vla-larger-than
423 -Wvolatile-register-var  -Wwrite-strings
424 -Wxor-used-as-pow
425 -Wzero-length-bounds}
427 @item Static Analyzer Options
428 @gccoptlist{
429 -fanalyzer
430 -fanalyzer-call-summaries
431 -fanalyzer-checker=@var{name}
432 -fno-analyzer-feasibility
433 -fanalyzer-fine-grained
434 -fanalyzer-show-events-in-system-headers
435 -fno-analyzer-state-merge
436 -fno-analyzer-state-purge
437 -fno-analyzer-suppress-followups
438 -fanalyzer-transitivity
439 -fno-analyzer-undo-inlining
440 -fanalyzer-verbose-edges
441 -fanalyzer-verbose-state-changes
442 -fanalyzer-verbosity=@var{level}
443 -fdump-analyzer
444 -fdump-analyzer-callgraph
445 -fdump-analyzer-exploded-graph
446 -fdump-analyzer-exploded-nodes
447 -fdump-analyzer-exploded-nodes-2
448 -fdump-analyzer-exploded-nodes-3
449 -fdump-analyzer-exploded-paths
450 -fdump-analyzer-feasibility
451 -fdump-analyzer-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 -ffold-mem-offsets
547 -fcompare-elim  -fcprop-registers  -fcrossjumping
548 -fcse-follow-jumps  -fcse-skip-blocks  -fcx-fortran-rules
549 -fcx-limited-range
550 -fdata-sections  -fdce  -fdelayed-branch
551 -fdelete-null-pointer-checks  -fdevirtualize  -fdevirtualize-speculatively
552 -fdevirtualize-at-ltrans  -fdse
553 -fearly-inlining  -fipa-sra  -fexpensive-optimizations  -ffat-lto-objects
554 -ffast-math  -ffinite-math-only  -ffloat-store  -fexcess-precision=@var{style}
555 -ffinite-loops
556 -fforward-propagate  -ffp-contract=@var{style}  -ffunction-sections
557 -fgcse  -fgcse-after-reload  -fgcse-las  -fgcse-lm  -fgraphite-identity
558 -fgcse-sm  -fhoist-adjacent-loads  -fif-conversion
559 -fif-conversion2  -findirect-inlining
560 -finline-functions  -finline-functions-called-once  -finline-limit=@var{n}
561 -finline-small-functions -fipa-modref -fipa-cp  -fipa-cp-clone
562 -fipa-bit-cp  -fipa-vrp  -fipa-pta  -fipa-profile  -fipa-pure-const
563 -fipa-reference  -fipa-reference-addressable
564 -fipa-stack-alignment  -fipa-icf  -fira-algorithm=@var{algorithm}
565 -flive-patching=@var{level}
566 -fira-region=@var{region}  -fira-hoist-pressure
567 -fira-loop-pressure  -fno-ira-share-save-slots
568 -fno-ira-share-spill-slots
569 -fisolate-erroneous-paths-dereference  -fisolate-erroneous-paths-attribute
570 -fivopts  -fkeep-inline-functions  -fkeep-static-functions
571 -fkeep-static-consts  -flimit-function-alignment  -flive-range-shrinkage
572 -floop-block  -floop-interchange  -floop-strip-mine
573 -floop-unroll-and-jam  -floop-nest-optimize
574 -floop-parallelize-all  -flra-remat  -flto  -flto-compression-level
575 -flto-partition=@var{alg}  -fmerge-all-constants
576 -fmerge-constants  -fmodulo-sched  -fmodulo-sched-allow-regmoves
577 -fmove-loop-invariants  -fmove-loop-stores  -fno-branch-count-reg
578 -fno-defer-pop  -fno-fp-int-builtin-inexact  -fno-function-cse
579 -fno-guess-branch-probability  -fno-inline  -fno-math-errno  -fno-peephole
580 -fno-peephole2  -fno-printf-return-value  -fno-sched-interblock
581 -fno-sched-spec  -fno-signed-zeros
582 -fno-toplevel-reorder  -fno-trapping-math  -fno-zero-initialized-in-bss
583 -fomit-frame-pointer  -foptimize-sibling-calls
584 -fpartial-inlining  -fpeel-loops  -fpredictive-commoning
585 -fprefetch-loop-arrays
586 -fprofile-correction
587 -fprofile-use  -fprofile-use=@var{path} -fprofile-partial-training
588 -fprofile-values -fprofile-reorder-functions
589 -freciprocal-math  -free  -frename-registers  -freorder-blocks
590 -freorder-blocks-algorithm=@var{algorithm}
591 -freorder-blocks-and-partition  -freorder-functions
592 -frerun-cse-after-loop  -freschedule-modulo-scheduled-loops
593 -frounding-math  -fsave-optimization-record
594 -fsched2-use-superblocks  -fsched-pressure
595 -fsched-spec-load  -fsched-spec-load-dangerous
596 -fsched-stalled-insns-dep[=@var{n}]  -fsched-stalled-insns[=@var{n}]
597 -fsched-group-heuristic  -fsched-critical-path-heuristic
598 -fsched-spec-insn-heuristic  -fsched-rank-heuristic
599 -fsched-last-insn-heuristic  -fsched-dep-count-heuristic
600 -fschedule-fusion
601 -fschedule-insns  -fschedule-insns2  -fsection-anchors
602 -fselective-scheduling  -fselective-scheduling2
603 -fsel-sched-pipelining  -fsel-sched-pipelining-outer-loops
604 -fsemantic-interposition  -fshrink-wrap  -fshrink-wrap-separate
605 -fsignaling-nans
606 -fsingle-precision-constant  -fsplit-ivs-in-unroller  -fsplit-loops
607 -fsplit-paths
608 -fsplit-wide-types  -fsplit-wide-types-early  -fssa-backprop  -fssa-phiopt
609 -fstdarg-opt  -fstore-merging  -fstrict-aliasing -fipa-strict-aliasing
610 -fthread-jumps  -ftracer  -ftree-bit-ccp
611 -ftree-builtin-call-dce  -ftree-ccp  -ftree-ch
612 -ftree-coalesce-vars  -ftree-copy-prop  -ftree-dce  -ftree-dominator-opts
613 -ftree-dse  -ftree-forwprop  -ftree-fre  -fcode-hoisting
614 -ftree-loop-if-convert  -ftree-loop-im
615 -ftree-phiprop  -ftree-loop-distribution  -ftree-loop-distribute-patterns
616 -ftree-loop-ivcanon  -ftree-loop-linear  -ftree-loop-optimize
617 -ftree-loop-vectorize
618 -ftree-parallelize-loops=@var{n}  -ftree-pre  -ftree-partial-pre  -ftree-pta
619 -ftree-reassoc  -ftree-scev-cprop  -ftree-sink  -ftree-slsr  -ftree-sra
620 -ftree-switch-conversion  -ftree-tail-merge
621 -ftree-ter  -ftree-vectorize  -ftree-vrp  -ftrivial-auto-var-init
622 -funconstrained-commons -funit-at-a-time  -funroll-all-loops
623 -funroll-loops -funsafe-math-optimizations  -funswitch-loops
624 -fipa-ra  -fvariable-expansion-in-unroller  -fvect-cost-model  -fvpt
625 -fweb  -fwhole-program  -fwpa  -fuse-linker-plugin -fzero-call-used-regs
626 --param @var{name}=@var{value}
627 -O  -O0  -O1  -O2  -O3  -Os  -Ofast  -Og  -Oz}
629 @item Program Instrumentation Options
630 @xref{Instrumentation Options,,Program Instrumentation Options}.
631 @gccoptlist{-p  -pg  -fprofile-arcs  --coverage  -ftest-coverage
632 -fprofile-abs-path
633 -fprofile-dir=@var{path}  -fprofile-generate  -fprofile-generate=@var{path}
634 -fprofile-info-section  -fprofile-info-section=@var{name}
635 -fprofile-note=@var{path} -fprofile-prefix-path=@var{path}
636 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex}
637 -fprofile-exclude-files=@var{regex}
638 -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
639 -fsanitize=@var{style}  -fsanitize-recover  -fsanitize-recover=@var{style}
640 -fsanitize-trap   -fsanitize-trap=@var{style}
641 -fasan-shadow-offset=@var{number}  -fsanitize-sections=@var{s1},@var{s2},...
642 -fsanitize-undefined-trap-on-error  -fbounds-check
643 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
644 -fharden-compares -fharden-conditional-branches
645 -fharden-control-flow-redundancy  -fhardcfr-skip-leaf
646 -fhardcfr-check-exceptions  -fhardcfr-check-returning-calls
647 -fhardcfr-check-noreturn-calls=@r{[}always@r{|}no-xthrow@r{|}nothrow@r{|}never@r{]}
648 -fstack-protector  -fstack-protector-all  -fstack-protector-strong
649 -fstack-protector-explicit  -fstack-check
650 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym}
651 -fno-stack-limit  -fsplit-stack
652 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
653 -fvtv-counts  -fvtv-debug
654 -finstrument-functions  -finstrument-functions-once
655 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
656 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
657 -fprofile-prefix-map=@var{old}=@var{new}}
659 @item Preprocessor Options
660 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
661 @gccoptlist{-A@var{question}=@var{answer}
662 -A-@var{question}@r{[}=@var{answer}@r{]}
663 -C  -CC  -D@var{macro}@r{[}=@var{defn}@r{]}
664 -dD  -dI  -dM  -dN  -dU
665 -fdebug-cpp  -fdirectives-only  -fdollars-in-identifiers
666 -fexec-charset=@var{charset}  -fextended-identifiers
667 -finput-charset=@var{charset}  -flarge-source-files
668 -fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth}
669 -fno-canonical-system-headers  -fpch-deps  -fpch-preprocess
670 -fpreprocessed  -ftabstop=@var{width}  -ftrack-macro-expansion
671 -fwide-exec-charset=@var{charset}  -fworking-directory
672 -H  -imacros @var{file}  -include @var{file}
673 -M  -MD  -MF  -MG  -MM  -MMD  -MP  -MQ  -MT -Mno-modules
674 -no-integrated-cpp  -P  -pthread  -remap
675 -traditional  -traditional-cpp  -trigraphs
676 -U@var{macro}  -undef
677 -Wp,@var{option}  -Xpreprocessor @var{option}}
679 @item Assembler Options
680 @xref{Assembler Options,,Passing Options to the Assembler}.
681 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
683 @item Linker Options
684 @xref{Link Options,,Options for Linking}.
685 @gccoptlist{@var{object-file-name}  -fuse-ld=@var{linker}  -l@var{library}
686 -nostartfiles  -nodefaultlibs  -nolibc  -nostdlib  -nostdlib++
687 -e @var{entry}  --entry=@var{entry}
688 -pie  -pthread  -r  -rdynamic
689 -s  -static  -static-pie  -static-libgcc  -static-libstdc++
690 -static-libasan  -static-libtsan  -static-liblsan  -static-libubsan
691 -shared  -shared-libgcc  -symbolic
692 -T @var{script}  -Wl,@var{option}  -Xlinker @var{option}
693 -u @var{symbol}  -z @var{keyword}}
695 @item Directory Options
696 @xref{Directory Options,,Options for Directory Search}.
697 @gccoptlist{-B@var{prefix}  -I@var{dir}  -I-
698 -idirafter @var{dir}
699 -imacros @var{file}  -imultilib @var{dir}
700 -iplugindir=@var{dir}  -iprefix @var{file}
701 -iquote @var{dir}  -isysroot @var{dir}  -isystem @var{dir}
702 -iwithprefix @var{dir}  -iwithprefixbefore @var{dir}
703 -L@var{dir}  -no-canonical-prefixes  --no-sysroot-suffix
704 -nostdinc  -nostdinc++  --sysroot=@var{dir}}
706 @item Code Generation Options
707 @xref{Code Gen Options,,Options for Code Generation Conventions}.
708 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg}
709 -ffixed-@var{reg}  -fexceptions
710 -fnon-call-exceptions  -fdelete-dead-exceptions  -funwind-tables
711 -fasynchronous-unwind-tables
712 -fno-gnu-unique
713 -finhibit-size-directive  -fcommon  -fno-ident
714 -fpcc-struct-return  -fpic  -fPIC  -fpie  -fPIE  -fno-plt
715 -fno-jump-tables -fno-bit-tests
716 -frecord-gcc-switches
717 -freg-struct-return  -fshort-enums  -fshort-wchar
718 -fverbose-asm  -fpack-struct[=@var{n}]
719 -fleading-underscore  -ftls-model=@var{model}
720 -fstack-reuse=@var{reuse_level}
721 -ftrampolines -ftrampoline-impl=@r{[}stack@r{|}heap@r{]}
722 -ftrapv  -fwrapv
723 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
724 -fstrict-volatile-bitfields  -fsync-libcalls}
726 @item Developer Options
727 @xref{Developer Options,,GCC Developer Options}.
728 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion
729 -dumpfullversion  -fcallgraph-info@r{[}=su,da@r{]}
730 -fchecking  -fchecking=@var{n}
731 -fdbg-cnt-list  -fdbg-cnt=@var{counter-value-list}
732 -fdisable-ipa-@var{pass_name}
733 -fdisable-rtl-@var{pass_name}
734 -fdisable-rtl-@var{pass-name}=@var{range-list}
735 -fdisable-tree-@var{pass_name}
736 -fdisable-tree-@var{pass-name}=@var{range-list}
737 -fdump-debug  -fdump-earlydebug
738 -fdump-noaddr  -fdump-unnumbered  -fdump-unnumbered-links
739 -fdump-final-insns@r{[}=@var{file}@r{]}
740 -fdump-ipa-all  -fdump-ipa-cgraph  -fdump-ipa-inline
741 -fdump-lang-all
742 -fdump-lang-@var{switch}
743 -fdump-lang-@var{switch}-@var{options}
744 -fdump-lang-@var{switch}-@var{options}=@var{filename}
745 -fdump-passes
746 -fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename}
747 -fdump-statistics
748 -fdump-tree-all
749 -fdump-tree-@var{switch}
750 -fdump-tree-@var{switch}-@var{options}
751 -fdump-tree-@var{switch}-@var{options}=@var{filename}
752 -fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second
753 -fenable-@var{kind}-@var{pass}
754 -fenable-@var{kind}-@var{pass}=@var{range-list}
755 -fira-verbose=@var{n}
756 -flto-report  -flto-report-wpa  -fmem-report-wpa
757 -fmem-report  -fpre-ipa-mem-report  -fpost-ipa-mem-report
758 -fopt-info  -fopt-info-@var{options}@r{[}=@var{file}@r{]}
759 -fmultiflags  -fprofile-report
760 -frandom-seed=@var{string}  -fsched-verbose=@var{n}
761 -fsel-sched-verbose  -fsel-sched-dump-cfg  -fsel-sched-pipelining-verbose
762 -fstats  -fstack-usage  -ftime-report  -ftime-report-details
763 -fvar-tracking-assignments-toggle  -gtoggle
764 -print-file-name=@var{library}  -print-libgcc-file-name
765 -print-multi-directory  -print-multi-lib  -print-multi-os-directory
766 -print-prog-name=@var{program}  -print-search-dirs  -Q
767 -print-sysroot  -print-sysroot-headers-suffix
768 -save-temps  -save-temps=cwd  -save-temps=obj  -time@r{[}=@var{file}@r{]}}
770 @item Machine-Dependent Options
771 @xref{Submodel Options,,Machine-Dependent Options}.
772 @c This list is ordered alphanumerically by subsection name.
773 @c Try and put the significant identifier (CPU or system) first,
774 @c so users have a clue at guessing where the ones they want will be.
776 @emph{AArch64 Options}
777 @gccoptlist{-mabi=@var{name}  -mbig-endian  -mlittle-endian
778 -mgeneral-regs-only
779 -mcmodel=tiny  -mcmodel=small  -mcmodel=large
780 -mstrict-align  -mno-strict-align
781 -momit-leaf-frame-pointer
782 -mtls-dialect=desc  -mtls-dialect=traditional
783 -mtls-size=@var{size}
784 -mfix-cortex-a53-835769  -mfix-cortex-a53-843419
785 -mlow-precision-recip-sqrt  -mlow-precision-sqrt  -mlow-precision-div
786 -mpc-relative-literal-loads
787 -msign-return-address=@var{scope}
788 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
789 +@var{b-key}]|@var{bti}
790 -mharden-sls=@var{opts}
791 -march=@var{name}  -mcpu=@var{name}  -mtune=@var{name}
792 -moverride=@var{string}  -mverbose-cost-dump
793 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg}
794 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation
795 -moutline-atomics }
797 @emph{Adapteva Epiphany Options}
798 @gccoptlist{-mhalf-reg-file  -mprefer-short-insn-regs
799 -mbranch-cost=@var{num}  -mcmove  -mnops=@var{num}  -msoft-cmpsf
800 -msplit-lohi  -mpost-inc  -mpost-modify  -mstack-offset=@var{num}
801 -mround-nearest  -mlong-calls  -mshort-calls  -msmall16
802 -mfp-mode=@var{mode}  -mvect-double  -max-vect-align=@var{num}
803 -msplit-vecmove-early  -m1reg-@var{reg}}
805 @emph{AMD GCN Options}
806 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
808 @emph{ARC Options}
809 @gccoptlist{-mbarrel-shifter  -mjli-always
810 -mcpu=@var{cpu}  -mA6  -mARC600  -mA7  -mARC700
811 -mdpfp  -mdpfp-compact  -mdpfp-fast  -mno-dpfp-lrsr
812 -mea  -mno-mpy  -mmul32x16  -mmul64  -matomic
813 -mnorm  -mspfp  -mspfp-compact  -mspfp-fast  -msimd  -msoft-float  -mswap
814 -mcrc  -mdsp-packa  -mdvbf  -mlock  -mmac-d16  -mmac-24  -mrtsc  -mswape
815 -mtelephony  -mxy  -misize  -mannotate-align  -marclinux  -marclinux_prof
816 -mlong-calls  -mmedium-calls  -msdata  -mirq-ctrl-saved
817 -mrgf-banked-regs  -mlpc-width=@var{width}  -G @var{num}
818 -mvolatile-cache  -mtp-regno=@var{regno}
819 -malign-call  -mauto-modify-reg  -mbbit-peephole  -mno-brcc
820 -mcase-vector-pcrel  -mcompact-casesi  -mno-cond-exec  -mearly-cbranchsi
821 -mexpand-adddi  -mindexed-loads  -mlra  -mlra-priority-none
822 -mlra-priority-compact -mlra-priority-noncompact  -mmillicode
823 -mmixed-code  -mq-class  -mRcq  -mRcw  -msize-level=@var{level}
824 -mtune=@var{cpu}  -mmultcost=@var{num}  -mcode-density-frame
825 -munalign-prob-threshold=@var{probability}  -mmpy-option=@var{multo}
826 -mdiv-rem  -mcode-density  -mll64  -mfpu=@var{fpu}  -mrf16  -mbranch-index}
828 @emph{ARM Options}
829 @gccoptlist{-mapcs-frame  -mno-apcs-frame
830 -mabi=@var{name}
831 -mapcs-stack-check  -mno-apcs-stack-check
832 -mapcs-reentrant  -mno-apcs-reentrant
833 -mgeneral-regs-only
834 -msched-prolog  -mno-sched-prolog
835 -mlittle-endian  -mbig-endian
836 -mbe8  -mbe32
837 -mfloat-abi=@var{name}
838 -mfp16-format=@var{name}
839 -mthumb-interwork  -mno-thumb-interwork
840 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}
841 -mtune=@var{name}  -mprint-tune-info
842 -mstructure-size-boundary=@var{n}
843 -mabort-on-noreturn
844 -mlong-calls  -mno-long-calls
845 -msingle-pic-base  -mno-single-pic-base
846 -mpic-register=@var{reg}
847 -mnop-fun-dllimport
848 -mpoke-function-name
849 -mthumb  -marm  -mflip-thumb
850 -mtpcs-frame  -mtpcs-leaf-frame
851 -mcaller-super-interworking  -mcallee-super-interworking
852 -mtp=@var{name}  -mtls-dialect=@var{dialect}
853 -mword-relocations
854 -mfix-cortex-m3-ldrd
855 -mfix-cortex-a57-aes-1742098
856 -mfix-cortex-a72-aes-1655431
857 -munaligned-access
858 -mneon-for-64bits
859 -mslow-flash-data
860 -masm-syntax-unified
861 -mrestrict-it
862 -mverbose-cost-dump
863 -mpure-code
864 -mcmse
865 -mfix-cmse-cve-2021-35465
866 -mstack-protector-guard=@var{guard} -mstack-protector-guard-offset=@var{offset}
867 -mfdpic
868 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}]
869 [+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]]}
871 @emph{AVR Options}
872 @gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args
873 -mbranch-cost=@var{cost}
874 -mcall-prologues  -mgas-isr-prologues  -mint8
875 -mdouble=@var{bits} -mlong-double=@var{bits}
876 -mn_flash=@var{size}  -mno-interrupts
877 -mmain-is-OS_task  -mrelax  -mrmw  -mstrict-X  -mtiny-stack
878 -mfract-convert-truncate
879 -mshort-calls  -nodevicelib  -nodevicespecs
880 -Waddr-space-convert  -Wmisspelled-isr}
882 @emph{Blackfin Options}
883 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
884 -msim  -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer
885 -mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly
886 -mlow-64k  -mno-low64k  -mstack-check-l1  -mid-shared-library
887 -mno-id-shared-library  -mshared-library-id=@var{n}
888 -mleaf-id-shared-library  -mno-leaf-id-shared-library
889 -msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls
890 -mfast-fp  -minline-plt  -mmulticore  -mcorea  -mcoreb  -msdram
891 -micplb}
893 @emph{C6X Options}
894 @gccoptlist{-mbig-endian  -mlittle-endian  -march=@var{cpu}
895 -msim  -msdata=@var{sdata-type}}
897 @emph{CRIS Options}
898 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}
899 -mtune=@var{cpu} -mmax-stack-frame=@var{n}
900 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects
901 -mstack-align  -mdata-align  -mconst-align
902 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue
903 -melf  -maout  -sim  -sim2
904 -mmul-bug-workaround  -mno-mul-bug-workaround}
906 @emph{C-SKY Options}
907 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}
908 -mbig-endian  -EB  -mlittle-endian  -EL
909 -mhard-float  -msoft-float  -mfpu=@var{fpu}  -mdouble-float  -mfdivdu
910 -mfloat-abi=@var{name}
911 -melrw  -mistack  -mmp  -mcp  -mcache  -msecurity  -mtrust
912 -mdsp  -medsp  -mvdsp
913 -mdiv  -msmart  -mhigh-registers  -manchor
914 -mpushpop  -mmultiple-stld  -mconstpool  -mstack-size  -mccrt
915 -mbranch-cost=@var{n}  -mcse-cc  -msched-prolog -msim}
917 @emph{Darwin Options}
918 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal
919 -arch_only  -bind_at_load  -bundle  -bundle_loader
920 -client_name  -compatibility_version  -current_version
921 -dead_strip
922 -dependency-file  -dylib_file  -dylinker_install_name
923 -dynamic  -dynamiclib  -exported_symbols_list
924 -filelist  -flat_namespace  -force_cpusubtype_ALL
925 -force_flat_namespace  -headerpad_max_install_names
926 -iframework
927 -image_base  -init  -install_name  -keep_private_externs
928 -multi_module  -multiply_defined  -multiply_defined_unused
929 -noall_load   -no_dead_strip_inits_and_terms -nodefaultrpaths
930 -nofixprebinding  -nomultidefs  -noprebind  -noseglinkedit
931 -pagezero_size  -prebind  -prebind_all_twolevel_modules
932 -private_bundle  -read_only_relocs  -sectalign
933 -sectobjectsymbols  -whyload  -seg1addr
934 -sectcreate  -sectobjectsymbols  -sectorder
935 -segaddr  -segs_read_only_addr  -segs_read_write_addr
936 -seg_addr_table  -seg_addr_table_filename  -seglinkedit
937 -segprot  -segs_read_only_addr  -segs_read_write_addr
938 -single_module  -static  -sub_library  -sub_umbrella
939 -twolevel_namespace  -umbrella  -undefined
940 -unexported_symbols_list  -weak_reference_mismatches
941 -whatsloaded  -F  -gused  -gfull  -mmacosx-version-min=@var{version}
942 -mkernel  -mone-byte-bool}
944 @emph{DEC Alpha Options}
945 @gccoptlist{-mno-fp-regs  -msoft-float
946 -mieee  -mieee-with-inexact  -mieee-conformant
947 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode}
948 -mtrap-precision=@var{mode}  -mbuild-constants
949 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type}
950 -mbwx  -mmax  -mfix  -mcix
951 -mfloat-vax  -mfloat-ieee
952 -mexplicit-relocs  -msmall-data  -mlarge-data
953 -msmall-text  -mlarge-text
954 -mmemory-latency=@var{time}}
956 @emph{eBPF Options}
957 @gccoptlist{-mbig-endian -mlittle-endian
958 -mframe-limit=@var{bytes} -mxbpf -mco-re -mno-co-re -mjmpext
959 -mjmp32 -malu32 -mv3-atomics -mbswap -msdiv -msmov -mcpu=@var{version}
960 -masm=@var{dialect}}
962 @emph{FR30 Options}
963 @gccoptlist{-msmall-model  -mno-lsim}
965 @emph{FT32 Options}
966 @gccoptlist{-msim  -mlra  -mnodiv  -mft32b  -mcompress  -mnopm}
968 @emph{FRV Options}
969 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64
970 -mhard-float  -msoft-float
971 -malloc-cc  -mfixed-cc  -mdword  -mno-dword
972 -mdouble  -mno-double
973 -mmedia  -mno-media  -mmuladd  -mno-muladd
974 -mfdpic  -minline-plt  -mgprel-ro  -multilib-library-pic
975 -mlinked-fp  -mlong-calls  -malign-labels
976 -mlibrary-pic  -macc-4  -macc-8
977 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move
978 -moptimize-membar  -mno-optimize-membar
979 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec
980 -mvliw-branch  -mno-vliw-branch
981 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec
982 -mno-nested-cond-exec  -mtomcat-stats
983 -mTLS  -mtls
984 -mcpu=@var{cpu}}
986 @emph{GNU/Linux Options}
987 @gccoptlist{-mglibc  -muclibc  -mmusl  -mbionic  -mandroid
988 -tno-android-cc  -tno-android-ld}
990 @emph{H8/300 Options}
991 @gccoptlist{-mrelax  -mh  -ms  -mn  -mexr  -mno-exr  -mint32  -malign-300}
993 @emph{HPPA Options}
994 @gccoptlist{-march=@var{architecture-type}
995 -matomic-libcalls  -mbig-switch
996 -mcaller-copies  -mdisable-fpregs  -mdisable-indexing
997 -mordered  -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld
998 -mfixed-range=@var{register-range}
999 -mcoherent-ldcw -mjump-in-delay  -mlinker-opt  -mlong-calls
1000 -mlong-load-store  -mno-atomic-libcalls  -mno-disable-fpregs
1001 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas
1002 -mno-jump-in-delay  -mno-long-load-store
1003 -mno-portable-runtime  -mno-soft-float
1004 -mno-space-regs  -msoft-float  -mpa-risc-1-0
1005 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime
1006 -mschedule=@var{cpu-type}  -mspace-regs  -msoft-mult  -msio  -mwsio
1007 -munix=@var{unix-std}  -nolibdld  -static  -threads}
1009 @emph{IA-64 Options}
1010 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic
1011 -mvolatile-asm-stop  -mregister-names  -msdata  -mno-sdata
1012 -mconstant-gp  -mauto-pic  -mfused-madd
1013 -minline-float-divide-min-latency
1014 -minline-float-divide-max-throughput
1015 -mno-inline-float-divide
1016 -minline-int-divide-min-latency
1017 -minline-int-divide-max-throughput
1018 -mno-inline-int-divide
1019 -minline-sqrt-min-latency  -minline-sqrt-max-throughput
1020 -mno-inline-sqrt
1021 -mdwarf2-asm  -mearly-stop-bits
1022 -mfixed-range=@var{register-range}  -mtls-size=@var{tls-size}
1023 -mtune=@var{cpu-type}  -milp32  -mlp64
1024 -msched-br-data-spec  -msched-ar-data-spec  -msched-control-spec
1025 -msched-br-in-data-spec  -msched-ar-in-data-spec  -msched-in-control-spec
1026 -msched-spec-ldc  -msched-spec-control-ldc
1027 -msched-prefer-non-data-spec-insns  -msched-prefer-non-control-spec-insns
1028 -msched-stop-bits-after-every-cycle  -msched-count-spec-in-critical-path
1029 -msel-sched-dont-check-control-spec  -msched-fp-mem-deps-zero-cost
1030 -msched-max-memory-insns-hard-limit  -msched-max-memory-insns=@var{max-insns}}
1032 @emph{LM32 Options}
1033 @gccoptlist{-mbarrel-shift-enabled  -mdivide-enabled  -mmultiply-enabled
1034 -msign-extend-enabled  -muser-enabled}
1036 @emph{LoongArch Options}
1037 @gccoptlist{-march=@var{cpu-type}  -mtune=@var{cpu-type} -mabi=@var{base-abi-type}
1038 -mfpu=@var{fpu-type} -msimd=@var{simd-type}
1039 -msoft-float -msingle-float -mdouble-float -mlsx -mno-lsx -mlasx -mno-lasx
1040 -mbranch-cost=@var{n}  -mcheck-zero-division -mno-check-zero-division
1041 -mcond-move-int  -mno-cond-move-int
1042 -mcond-move-float  -mno-cond-move-float
1043 -memcpy  -mno-memcpy -mstrict-align -mno-strict-align
1044 -mmax-inline-memcpy-size=@var{n}
1045 -mexplicit-relocs=@var{style} -mexplicit-relocs -mno-explicit-relocs
1046 -mdirect-extern-access -mno-direct-extern-access
1047 -mcmodel=@var{code-model}}
1049 @emph{M32R/D Options}
1050 @gccoptlist{-m32r2  -m32rx  -m32r
1051 -mdebug
1052 -malign-loops  -mno-align-loops
1053 -missue-rate=@var{number}
1054 -mbranch-cost=@var{number}
1055 -mmodel=@var{code-size-model-type}
1056 -msdata=@var{sdata-type}
1057 -mno-flush-func  -mflush-func=@var{name}
1058 -mno-flush-trap  -mflush-trap=@var{number}
1059 -G @var{num}}
1061 @emph{M32C Options}
1062 @gccoptlist{-mcpu=@var{cpu}  -msim  -memregs=@var{number}}
1064 @emph{M680x0 Options}
1065 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune}
1066 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040
1067 -m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407
1068 -mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020
1069 -mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort
1070 -mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel
1071 -malign-int  -mstrict-align  -msep-data  -mno-sep-data
1072 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library
1073 -mxgot  -mno-xgot  -mlong-jump-table-offsets}
1075 @emph{MCore Options}
1076 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates
1077 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields
1078 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data
1079 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim
1080 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
1082 @emph{MicroBlaze Options}
1083 @gccoptlist{-msoft-float  -mhard-float  -msmall-divides  -mcpu=@var{cpu}
1084 -mmemcpy  -mxl-soft-mul  -mxl-soft-div  -mxl-barrel-shift
1085 -mxl-pattern-compare  -mxl-stack-check  -mxl-gp-opt  -mno-clearbss
1086 -mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt
1087 -mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model}
1088 -mpic-data-is-text-relative}
1090 @emph{MIPS Options}
1091 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch}
1092 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips32r3  -mips32r5
1093 -mips32r6  -mips64  -mips64r2  -mips64r3  -mips64r5  -mips64r6
1094 -mips16  -mno-mips16  -mflip-mips16
1095 -minterlink-compressed  -mno-interlink-compressed
1096 -minterlink-mips16  -mno-interlink-mips16
1097 -mabi=@var{abi}  -mabicalls  -mno-abicalls
1098 -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot
1099 -mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float
1100 -mno-float  -msingle-float  -mdouble-float
1101 -modd-spreg  -mno-odd-spreg
1102 -mabs=@var{mode}  -mnan=@var{encoding}
1103 -mdsp  -mno-dsp  -mdspr2  -mno-dspr2
1104 -mmcu  -mmno-mcu
1105 -meva  -mno-eva
1106 -mvirt  -mno-virt
1107 -mxpa  -mno-xpa
1108 -mcrc  -mno-crc
1109 -mginv  -mno-ginv
1110 -mmicromips  -mno-micromips
1111 -mmsa  -mno-msa
1112 -mloongson-mmi  -mno-loongson-mmi
1113 -mloongson-ext  -mno-loongson-ext
1114 -mloongson-ext2  -mno-loongson-ext2
1115 -mfpu=@var{fpu-type}
1116 -msmartmips  -mno-smartmips
1117 -mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx
1118 -mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc
1119 -mlong64  -mlong32  -msym32  -mno-sym32
1120 -G@var{num}  -mlocal-sdata  -mno-local-sdata
1121 -mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt
1122 -membedded-data  -mno-embedded-data
1123 -muninit-const-in-rodata  -mno-uninit-const-in-rodata
1124 -mcode-readable=@var{setting}
1125 -msplit-addresses  -mno-split-addresses
1126 -mexplicit-relocs  -mno-explicit-relocs
1127 -mcheck-zero-division  -mno-check-zero-division
1128 -mdivide-traps  -mdivide-breaks
1129 -mload-store-pairs  -mno-load-store-pairs
1130 -munaligned-access  -mno-unaligned-access
1131 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls
1132 -mmad  -mno-mad  -mimadd  -mno-imadd  -mfused-madd  -mno-fused-madd  -nocpp
1133 -mfix-24k  -mno-fix-24k
1134 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400
1135 -mfix-r5900  -mno-fix-r5900
1136 -mfix-r10000  -mno-fix-r10000  -mfix-rm7000  -mno-fix-rm7000
1137 -mfix-vr4120  -mno-fix-vr4120
1138 -mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1
1139 -mflush-func=@var{func}  -mno-flush-func
1140 -mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely
1141 -mcompact-branches=@var{policy}
1142 -mfp-exceptions  -mno-fp-exceptions
1143 -mvr4130-align  -mno-vr4130-align  -msynci  -mno-synci
1144 -mlxc1-sxc1  -mno-lxc1-sxc1  -mmadd4  -mno-madd4
1145 -mrelax-pic-calls  -mno-relax-pic-calls  -mmcount-ra-address
1146 -mframe-header-opt  -mno-frame-header-opt}
1148 @emph{MMIX Options}
1149 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu
1150 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols
1151 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses
1152 -mno-base-addresses  -msingle-exit  -mno-single-exit}
1154 @emph{MN10300 Options}
1155 @gccoptlist{-mmult-bug  -mno-mult-bug
1156 -mno-am33  -mam33  -mam33-2  -mam34
1157 -mtune=@var{cpu-type}
1158 -mreturn-pointer-on-d0
1159 -mno-crt0  -mrelax  -mliw  -msetlb}
1161 @emph{Moxie Options}
1162 @gccoptlist{-meb  -mel  -mmul.x  -mno-crt0}
1164 @emph{MSP430 Options}
1165 @gccoptlist{-msim  -masm-hex  -mmcu=  -mcpu=  -mlarge  -msmall  -mrelax
1166 -mwarn-mcu
1167 -mcode-region=  -mdata-region=
1168 -msilicon-errata=  -msilicon-errata-warn=
1169 -mhwmult=  -minrt  -mtiny-printf  -mmax-inline-shift=}
1171 @emph{NDS32 Options}
1172 @gccoptlist{-mbig-endian  -mlittle-endian
1173 -mreduced-regs  -mfull-regs
1174 -mcmov  -mno-cmov
1175 -mext-perf  -mno-ext-perf
1176 -mext-perf2  -mno-ext-perf2
1177 -mext-string  -mno-ext-string
1178 -mv3push  -mno-v3push
1179 -m16bit  -mno-16bit
1180 -misr-vector-size=@var{num}
1181 -mcache-block-size=@var{num}
1182 -march=@var{arch}
1183 -mcmodel=@var{code-model}
1184 -mctor-dtor  -mrelax}
1186 @emph{Nios II Options}
1187 @gccoptlist{-G @var{num}  -mgpopt=@var{option}  -mgpopt  -mno-gpopt
1188 -mgprel-sec=@var{regexp}  -mr0rel-sec=@var{regexp}
1189 -mel  -meb
1190 -mno-bypass-cache  -mbypass-cache
1191 -mno-cache-volatile  -mcache-volatile
1192 -mno-fast-sw-div  -mfast-sw-div
1193 -mhw-mul  -mno-hw-mul  -mhw-mulx  -mno-hw-mulx  -mno-hw-div  -mhw-div
1194 -mcustom-@var{insn}=@var{N}  -mno-custom-@var{insn}
1195 -mcustom-fpu-cfg=@var{name}
1196 -mhal  -msmallc  -msys-crt0=@var{name}  -msys-lib=@var{name}
1197 -march=@var{arch}  -mbmx  -mno-bmx  -mcdx  -mno-cdx}
1199 @emph{Nvidia PTX Options}
1200 @gccoptlist{-m64  -mmainkernel  -moptimize}
1202 @emph{OpenRISC Options}
1203 @gccoptlist{-mboard=@var{name}  -mnewlib  -mhard-mul  -mhard-div
1204 -msoft-mul  -msoft-div
1205 -msoft-float  -mhard-float  -mdouble-float -munordered-float
1206 -mcmov  -mror  -mrori  -msext  -msfimm  -mshftimm
1207 -mcmodel=@var{code-model}}
1209 @emph{PDP-11 Options}
1210 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10
1211 -mint32  -mno-int16  -mint16  -mno-int32
1212 -msplit  -munix-asm  -mdec-asm  -mgnu-asm  -mlra}
1214 @emph{PowerPC Options}
1215 See RS/6000 and PowerPC Options.
1217 @emph{PRU Options}
1218 @gccoptlist{-mmcu=@var{mcu}  -minrt  -mno-relax  -mloop
1219 -mabi=@var{variant}}
1221 @emph{RISC-V Options}
1222 @gccoptlist{-mbranch-cost=@var{N-instruction}
1223 -mplt  -mno-plt
1224 -mabi=@var{ABI-string}
1225 -mfdiv  -mno-fdiv
1226 -mdiv  -mno-div
1227 -misa-spec=@var{ISA-spec-string}
1228 -march=@var{ISA-string}
1229 -mtune=@var{processor-string}
1230 -mpreferred-stack-boundary=@var{num}
1231 -msmall-data-limit=@var{N-bytes}
1232 -msave-restore  -mno-save-restore
1233 -mshorten-memrefs  -mno-shorten-memrefs
1234 -mstrict-align  -mno-strict-align
1235 -mcmodel=medlow  -mcmodel=medany
1236 -mexplicit-relocs  -mno-explicit-relocs
1237 -mrelax  -mno-relax
1238 -mriscv-attribute  -mno-riscv-attribute
1239 -malign-data=@var{type}
1240 -mbig-endian  -mlittle-endian
1241 -mstack-protector-guard=@var{guard}  -mstack-protector-guard-reg=@var{reg}
1242 -mstack-protector-guard-offset=@var{offset}
1243 -mcsr-check -mno-csr-check
1244 -minline-atomics  -mno-inline-atomics
1245 -minline-strlen  -mno-inline-strlen
1246 -minline-strcmp  -mno-inline-strcmp
1247 -minline-strncmp  -mno-inline-strncmp}
1249 @emph{RL78 Options}
1250 @gccoptlist{-msim  -mmul=none  -mmul=g13  -mmul=g14  -mallregs
1251 -mcpu=g10  -mcpu=g13  -mcpu=g14  -mg10  -mg13  -mg14
1252 -m64bit-doubles  -m32bit-doubles  -msave-mduc-in-interrupts}
1254 @emph{RS/6000 and PowerPC Options}
1255 @gccoptlist{-mcpu=@var{cpu-type}
1256 -mtune=@var{cpu-type}
1257 -mcmodel=@var{code-model}
1258 -mpowerpc64
1259 -maltivec  -mno-altivec
1260 -mpowerpc-gpopt  -mno-powerpc-gpopt
1261 -mpowerpc-gfxopt  -mno-powerpc-gfxopt
1262 -mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mpopcntd  -mno-popcntd
1263 -mfprnd  -mno-fprnd
1264 -mcmpb  -mno-cmpb  -mhard-dfp  -mno-hard-dfp
1265 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc
1266 -m64  -m32  -mxl-compat  -mno-xl-compat  -mpe
1267 -malign-power  -malign-natural
1268 -msoft-float  -mhard-float  -mmultiple  -mno-multiple
1269 -mupdate  -mno-update
1270 -mavoid-indexed-addresses  -mno-avoid-indexed-addresses
1271 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align
1272 -mstrict-align  -mno-strict-align  -mrelocatable
1273 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib
1274 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian
1275 -mdynamic-no-pic  -mswdiv  -msingle-pic-base
1276 -mprioritize-restricted-insns=@var{priority}
1277 -msched-costly-dep=@var{dependence_type}
1278 -minsert-sched-nops=@var{scheme}
1279 -mcall-aixdesc  -mcall-eabi  -mcall-freebsd
1280 -mcall-linux  -mcall-netbsd  -mcall-openbsd
1281 -mcall-sysv  -mcall-sysv-eabi  -mcall-sysv-noeabi
1282 -mtraceback=@var{traceback_type}
1283 -maix-struct-return  -msvr4-struct-return
1284 -mabi=@var{abi-type}  -msecure-plt  -mbss-plt
1285 -mlongcall  -mno-longcall  -mpltseq  -mno-pltseq
1286 -mblock-move-inline-limit=@var{num}
1287 -mblock-compare-inline-limit=@var{num}
1288 -mblock-compare-inline-loop-limit=@var{num}
1289 -mno-block-ops-unaligned-vsx
1290 -mstring-compare-inline-limit=@var{num}
1291 -misel  -mno-isel
1292 -mvrsave  -mno-vrsave
1293 -mmulhw  -mno-mulhw
1294 -mdlmzb  -mno-dlmzb
1295 -mprototype  -mno-prototype
1296 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata
1297 -msdata=@var{opt}  -mreadonly-in-sdata  -mvxworks  -G @var{num}
1298 -mrecip  -mrecip=@var{opt}  -mno-recip  -mrecip-precision
1299 -mno-recip-precision
1300 -mveclibabi=@var{type}  -mfriz  -mno-friz
1301 -mpointers-to-nested-functions  -mno-pointers-to-nested-functions
1302 -msave-toc-indirect  -mno-save-toc-indirect
1303 -mpower8-fusion  -mno-mpower8-fusion  -mpower8-vector  -mno-power8-vector
1304 -mcrypto  -mno-crypto  -mhtm  -mno-htm
1305 -mquad-memory  -mno-quad-memory
1306 -mquad-memory-atomic  -mno-quad-memory-atomic
1307 -mcompat-align-parm  -mno-compat-align-parm
1308 -mfloat128  -mno-float128  -mfloat128-hardware  -mno-float128-hardware
1309 -mgnu-attribute  -mno-gnu-attribute
1310 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg}
1311 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed
1312 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
1313 -mprivileged -mno-privileged}
1315 @emph{RX Options}
1316 @gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu
1317 -mcpu=
1318 -mbig-endian-data  -mlittle-endian-data
1319 -msmall-data
1320 -msim  -mno-sim
1321 -mas100-syntax  -mno-as100-syntax
1322 -mrelax
1323 -mmax-constant-size=
1324 -mint-register=
1325 -mpid
1326 -mallow-string-insns  -mno-allow-string-insns
1327 -mjsr
1328 -mno-warn-multiple-fast-interrupts
1329 -msave-acc-in-interrupts}
1331 @emph{S/390 and zSeries Options}
1332 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type}
1333 -mhard-float  -msoft-float  -mhard-dfp  -mno-hard-dfp
1334 -mlong-double-64  -mlong-double-128
1335 -mbackchain  -mno-backchain  -mpacked-stack  -mno-packed-stack
1336 -msmall-exec  -mno-small-exec  -mmvcle  -mno-mvcle
1337 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch
1338 -mhtm  -mvx  -mzvector
1339 -mtpf-trace  -mno-tpf-trace  -mtpf-trace-skip  -mno-tpf-trace-skip
1340 -mfused-madd  -mno-fused-madd
1341 -mwarn-framesize  -mwarn-dynamicstack  -mstack-size  -mstack-guard
1342 -mhotpatch=@var{halfwords},@var{halfwords}}
1344 @emph{SH Options}
1345 @gccoptlist{-m1  -m2  -m2e
1346 -m2a-nofpu  -m2a-single-only  -m2a-single  -m2a
1347 -m3  -m3e
1348 -m4-nofpu  -m4-single-only  -m4-single  -m4
1349 -m4a-nofpu  -m4a-single-only  -m4a-single  -m4a  -m4al
1350 -mb  -ml  -mdalign  -mrelax
1351 -mbigtable  -mfmovd  -mrenesas  -mno-renesas  -mnomacsave
1352 -mieee  -mno-ieee  -mbitops  -misize  -minline-ic_invalidate  -mpadstruct
1353 -mprefergot  -musermode  -multcost=@var{number}  -mdiv=@var{strategy}
1354 -mdivsi3_libfunc=@var{name}  -mfixed-range=@var{register-range}
1355 -maccumulate-outgoing-args
1356 -matomic-model=@var{atomic-model}
1357 -mbranch-cost=@var{num}  -mzdcbranch  -mno-zdcbranch
1358 -mcbranch-force-delay-slot
1359 -mfused-madd  -mno-fused-madd  -mfsca  -mno-fsca  -mfsrra  -mno-fsrra
1360 -mpretend-cmove  -mtas}
1362 @emph{Solaris 2 Options}
1363 @gccoptlist{-mclear-hwcap  -mno-clear-hwcap  -mimpure-text  -mno-impure-text
1364 -pthreads}
1366 @emph{SPARC Options}
1367 @gccoptlist{-mcpu=@var{cpu-type}
1368 -mtune=@var{cpu-type}
1369 -mcmodel=@var{code-model}
1370 -mmemory-model=@var{mem-model}
1371 -m32  -m64  -mapp-regs  -mno-app-regs
1372 -mfaster-structs  -mno-faster-structs  -mflat  -mno-flat
1373 -mfpu  -mno-fpu  -mhard-float  -msoft-float
1374 -mhard-quad-float  -msoft-quad-float
1375 -mstack-bias  -mno-stack-bias
1376 -mstd-struct-return  -mno-std-struct-return
1377 -munaligned-doubles  -mno-unaligned-doubles
1378 -muser-mode  -mno-user-mode
1379 -mv8plus  -mno-v8plus  -mvis  -mno-vis
1380 -mvis2  -mno-vis2  -mvis3  -mno-vis3
1381 -mvis4  -mno-vis4  -mvis4b  -mno-vis4b
1382 -mcbcond  -mno-cbcond  -mfmaf  -mno-fmaf  -mfsmuld  -mno-fsmuld
1383 -mpopc  -mno-popc  -msubxc  -mno-subxc
1384 -mfix-at697f  -mfix-ut699  -mfix-ut700  -mfix-gr712rc
1385 -mlra  -mno-lra}
1387 @emph{System V Options}
1388 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
1390 @emph{V850 Options}
1391 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep
1392 -mprolog-function  -mno-prolog-function  -mspace
1393 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n}
1394 -mapp-regs  -mno-app-regs
1395 -mdisable-callt  -mno-disable-callt
1396 -mv850e2v3  -mv850e2  -mv850e1  -mv850es
1397 -mv850e  -mv850  -mv850e3v5
1398 -mloop
1399 -mrelax
1400 -mlong-jumps
1401 -msoft-float
1402 -mhard-float
1403 -mgcc-abi
1404 -mrh850-abi
1405 -mbig-switch}
1407 @emph{VAX Options}
1408 @gccoptlist{-mg  -mgnu  -munix  -mlra}
1410 @emph{Visium Options}
1411 @gccoptlist{-mdebug  -msim  -mfpu  -mno-fpu  -mhard-float  -msoft-float
1412 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type}  -msv-mode  -muser-mode}
1414 @emph{VMS Options}
1415 @gccoptlist{-mvms-return-codes  -mdebug-main=@var{prefix}  -mmalloc64
1416 -mpointer-size=@var{size}}
1418 @emph{VxWorks Options}
1419 @gccoptlist{-mrtp  -msmp  -non-static  -Bstatic  -Bdynamic
1420 -Xbind-lazy  -Xbind-now}
1422 @emph{x86 Options}
1423 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type}
1424 -mtune-ctrl=@var{feature-list}  -mdump-tune-features  -mno-default
1425 -mfpmath=@var{unit}
1426 -masm=@var{dialect}  -mno-fancy-math-387
1427 -mno-fp-ret-in-387  -m80387  -mhard-float  -msoft-float
1428 -mno-wide-multiply  -mrtd  -malign-double
1429 -mpreferred-stack-boundary=@var{num}
1430 -mincoming-stack-boundary=@var{num}
1431 -mcld  -mcx16  -msahf  -mmovbe  -mcrc32 -mmwait
1432 -mrecip  -mrecip=@var{opt}
1433 -mvzeroupper  -mprefer-avx128  -mprefer-vector-width=@var{opt}
1434 -mpartial-vector-fp-math
1435 -mmove-max=@var{bits} -mstore-max=@var{bits}
1436 -mmmx  -msse  -msse2  -msse3  -mssse3  -msse4.1  -msse4.2  -msse4  -mavx
1437 -mavx2  -mavx512f  -mavx512pf  -mavx512er  -mavx512cd  -mavx512vl
1438 -mavx512bw  -mavx512dq  -mavx512ifma  -mavx512vbmi  -msha  -maes
1439 -mpclmul  -mfsgsbase  -mrdrnd  -mf16c  -mfma  -mpconfig  -mwbnoinvd
1440 -mptwrite  -mprefetchwt1  -mclflushopt  -mclwb  -mxsavec  -mxsaves
1441 -msse4a  -m3dnow  -m3dnowa  -mpopcnt  -mabm  -mbmi  -mtbm  -mfma4  -mxop
1442 -madx  -mlzcnt  -mbmi2  -mfxsr  -mxsave  -mxsaveopt  -mrtm  -mhle  -mlwp
1443 -mmwaitx  -mclzero  -mpku  -mthreads  -mgfni  -mvaes  -mwaitpkg
1444 -mshstk -mmanual-endbr -mcet-switch -mforce-indirect-call
1445 -mavx512vbmi2 -mavx512bf16 -menqcmd
1446 -mvpclmulqdq  -mavx512bitalg  -mmovdiri  -mmovdir64b  -mavx512vpopcntdq
1447 -mavx5124fmaps  -mavx512vnni  -mavx5124vnniw  -mprfchw  -mrdpid
1448 -mrdseed  -msgx -mavx512vp2intersect -mserialize -mtsxldtrk
1449 -mamx-tile  -mamx-int8  -mamx-bf16 -muintr -mhreset -mavxvnni
1450 -mavx512fp16 -mavxifma -mavxvnniint8 -mavxneconvert -mcmpccxadd -mamx-fp16
1451 -mprefetchi -mraoint -mamx-complex -mavxvnniint16 -msm3 -msha512 -msm4 -mapxf
1452 -musermsr
1453 -mcldemote  -mms-bitfields  -mno-align-stringops  -minline-all-stringops
1454 -minline-stringops-dynamically  -mstringop-strategy=@var{alg}
1455 -mkl -mwidekl
1456 -mmemcpy-strategy=@var{strategy}  -mmemset-strategy=@var{strategy}
1457 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double
1458 -m96bit-long-double  -mlong-double-64  -mlong-double-80  -mlong-double-128
1459 -mregparm=@var{num}  -msseregparm
1460 -mveclibabi=@var{type}  -mvect8-ret-in-mem
1461 -mpc32  -mpc64  -mpc80  -mdaz-ftz -mstackrealign
1462 -momit-leaf-frame-pointer  -mno-red-zone  -mno-tls-direct-seg-refs
1463 -mcmodel=@var{code-model}  -mabi=@var{name}  -maddress-mode=@var{mode}
1464 -m32  -m64  -mx32  -m16  -miamcu  -mlarge-data-threshold=@var{num}
1465 -msse2avx  -mfentry  -mrecord-mcount  -mnop-mcount  -m8bit-idiv
1466 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name}
1467 -mavx256-split-unaligned-load  -mavx256-split-unaligned-store
1468 -malign-data=@var{type}  -mstack-protector-guard=@var{guard}
1469 -mstack-protector-guard-reg=@var{reg}
1470 -mstack-protector-guard-offset=@var{offset}
1471 -mstack-protector-guard-symbol=@var{symbol}
1472 -mgeneral-regs-only  -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop
1473 -mindirect-branch=@var{choice}  -mfunction-return=@var{choice}
1474 -mindirect-branch-register -mharden-sls=@var{choice}
1475 -mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access
1476 -munroll-only-small-loops -mlam=@var{choice}}
1478 @emph{x86 Windows Options}
1479 @gccoptlist{-mconsole  -mcrtdll=@var{library}  -mcygwin  -mno-cygwin  -mdll
1480 -mnop-fun-dllimport  -mthread
1481 -municode  -mwin32  -mwindows  -fno-set-stack-executable}
1483 @emph{Xstormy16 Options}
1484 @gccoptlist{-msim}
1486 @emph{Xtensa Options}
1487 @gccoptlist{-mconst16  -mno-const16
1488 -mfused-madd  -mno-fused-madd
1489 -mforce-no-pic
1490 -mserialize-volatile  -mno-serialize-volatile
1491 -mtext-section-literals  -mno-text-section-literals
1492 -mauto-litpools  -mno-auto-litpools
1493 -mtarget-align  -mno-target-align
1494 -mlongcalls  -mno-longcalls
1495 -mabi=@var{abi-type}
1496 -mextra-l32r-costs=@var{cycles}
1497 -mstrict-align  -mno-strict-align}
1499 @emph{zSeries Options}
1500 See S/390 and zSeries Options.
1501 @end table
1504 @node Overall Options
1505 @section Options Controlling the Kind of Output
1507 Compilation can involve up to four stages: preprocessing, compilation
1508 proper, assembly and linking, always in that order.  GCC is capable of
1509 preprocessing and compiling several files either into several
1510 assembler input files, or into one assembler input file; then each
1511 assembler input file produces an object file, and linking combines all
1512 the object files (those newly compiled, and those specified as input)
1513 into an executable file.
1515 @cindex file name suffix
1516 For any given input file, the file name suffix determines what kind of
1517 compilation is done:
1519 @table @gcctabopt
1520 @item @var{file}.c
1521 C source code that must be preprocessed.
1523 @item @var{file}.i
1524 C source code that should not be preprocessed.
1526 @item @var{file}.ii
1527 C++ source code that should not be preprocessed.
1529 @item @var{file}.m
1530 Objective-C source code.  Note that you must link with the @file{libobjc}
1531 library to make an Objective-C program work.
1533 @item @var{file}.mi
1534 Objective-C source code that should not be preprocessed.
1536 @item @var{file}.mm
1537 @itemx @var{file}.M
1538 Objective-C++ source code.  Note that you must link with the @file{libobjc}
1539 library to make an Objective-C++ program work.  Note that @samp{.M} refers
1540 to a literal capital M@.
1542 @item @var{file}.mii
1543 Objective-C++ source code that should not be preprocessed.
1545 @item @var{file}.h
1546 C, C++, Objective-C or Objective-C++ header file to be turned into a
1547 precompiled header (default), or C, C++ header file to be turned into an
1548 Ada spec (via the @option{-fdump-ada-spec} switch).
1550 @item @var{file}.cc
1551 @itemx @var{file}.cp
1552 @itemx @var{file}.cxx
1553 @itemx @var{file}.cpp
1554 @itemx @var{file}.CPP
1555 @itemx @var{file}.c++
1556 @itemx @var{file}.C
1557 C++ source code that must be preprocessed.  Note that in @samp{.cxx},
1558 the last two letters must both be literally @samp{x}.  Likewise,
1559 @samp{.C} refers to a literal capital C@.
1561 @item @var{file}.mm
1562 @itemx @var{file}.M
1563 Objective-C++ source code that must be preprocessed.
1565 @item @var{file}.mii
1566 Objective-C++ source code that should not be preprocessed.
1568 @item @var{file}.hh
1569 @itemx @var{file}.H
1570 @itemx @var{file}.hp
1571 @itemx @var{file}.hxx
1572 @itemx @var{file}.hpp
1573 @itemx @var{file}.HPP
1574 @itemx @var{file}.h++
1575 @itemx @var{file}.tcc
1576 C++ header file to be turned into a precompiled header or Ada spec.
1578 @item @var{file}.f
1579 @itemx @var{file}.for
1580 @itemx @var{file}.ftn
1581 Fixed form Fortran source code that should not be preprocessed.
1583 @item @var{file}.F
1584 @itemx @var{file}.FOR
1585 @itemx @var{file}.fpp
1586 @itemx @var{file}.FPP
1587 @itemx @var{file}.FTN
1588 Fixed form Fortran source code that must be preprocessed (with the traditional
1589 preprocessor).
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 should not be preprocessed.
1597 @item @var{file}.F90
1598 @itemx @var{file}.F95
1599 @itemx @var{file}.F03
1600 @itemx @var{file}.F08
1601 Free form Fortran source code that must be preprocessed (with the
1602 traditional preprocessor).
1604 @item @var{file}.go
1605 Go source code.
1607 @item @var{file}.d
1608 D source code.
1610 @item @var{file}.di
1611 D interface file.
1613 @item @var{file}.dd
1614 D documentation code (Ddoc).
1616 @item @var{file}.ads
1617 Ada source code file that contains a library unit declaration (a
1618 declaration of a package, subprogram, or generic, or a generic
1619 instantiation), or a library unit renaming declaration (a package,
1620 generic, or subprogram renaming declaration).  Such files are also
1621 called @dfn{specs}.
1623 @item @var{file}.adb
1624 Ada source code file containing a library unit body (a subprogram or
1625 package body).  Such files are also called @dfn{bodies}.
1627 @c GCC also knows about some suffixes for languages not yet included:
1628 @c Ratfor:
1629 @c @var{file}.r
1631 @item @var{file}.s
1632 Assembler code.
1634 @item @var{file}.S
1635 @itemx @var{file}.sx
1636 Assembler code that must be preprocessed.
1638 @item @var{other}
1639 An object file to be fed straight into linking.
1640 Any file name with no recognized suffix is treated this way.
1641 @end table
1643 @opindex x
1644 You can specify the input language explicitly with the @option{-x} option:
1646 @table @gcctabopt
1647 @item -x @var{language}
1648 Specify explicitly the @var{language} for the following input files
1649 (rather than letting the compiler choose a default based on the file
1650 name suffix).  This option applies to all following input files until
1651 the next @option{-x} option.  Possible values for @var{language} are:
1652 @smallexample
1653 c  c-header  cpp-output
1654 c++  c++-header  c++-system-header c++-user-header c++-cpp-output
1655 objective-c  objective-c-header  objective-c-cpp-output
1656 objective-c++ objective-c++-header objective-c++-cpp-output
1657 assembler  assembler-with-cpp
1660 f77  f77-cpp-input f95  f95-cpp-input
1662 @end smallexample
1664 @item -x none
1665 Turn off any specification of a language, so that subsequent files are
1666 handled according to their file name suffixes (as they are if @option{-x}
1667 has not been used at all).
1668 @end table
1670 If you only want some of the stages of compilation, you can use
1671 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1672 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1673 @command{gcc} is to stop.  Note that some combinations (for example,
1674 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1676 @table @gcctabopt
1677 @opindex c
1678 @item -c
1679 Compile or assemble the source files, but do not link.  The linking
1680 stage simply is not done.  The ultimate output is in the form of an
1681 object file for each source file.
1683 By default, the object file name for a source file is made by replacing
1684 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1686 Unrecognized input files, not requiring compilation or assembly, are
1687 ignored.
1689 @opindex S
1690 @item -S
1691 Stop after the stage of compilation proper; do not assemble.  The output
1692 is in the form of an assembler code file for each non-assembler input
1693 file specified.
1695 By default, the assembler file name for a source file is made by
1696 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1698 Input files that don't require compilation are ignored.
1700 @opindex E
1701 @item -E
1702 Stop after the preprocessing stage; do not run the compiler proper.  The
1703 output is in the form of preprocessed source code, which is sent to the
1704 standard output.
1706 Input files that don't require preprocessing are ignored.
1708 @cindex output file option
1709 @opindex o
1710 @item -o @var{file}
1711 Place the primary output in file @var{file}.  This applies to whatever
1712 sort of output is being produced, whether it be an executable file, an
1713 object file, an assembler file or preprocessed C code.
1715 If @option{-o} is not specified, the default is to put an executable
1716 file in @file{a.out}, the object file for
1717 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1718 assembler file in @file{@var{source}.s}, a precompiled header file in
1719 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1720 standard output.
1722 Though @option{-o} names only the primary output, it also affects the
1723 naming of auxiliary and dump outputs.  See the examples below.  Unless
1724 overridden, both auxiliary outputs and dump outputs are placed in the
1725 same directory as the primary output.  In auxiliary outputs, the suffix
1726 of the input file is replaced with that of the auxiliary output file
1727 type; in dump outputs, the suffix of the dump file is appended to the
1728 input file suffix.  In compilation commands, the base name of both
1729 auxiliary and dump outputs is that of the primary output; in compile and
1730 link commands, the primary output name, minus the executable suffix, is
1731 combined with the input file name.  If both share the same base name,
1732 disregarding the suffix, the result of the combination is that base
1733 name, otherwise, they are concatenated, separated by a dash.
1735 @smallexample
1736 gcc -c foo.c ...
1737 @end smallexample
1739 will use @file{foo.o} as the primary output, and place aux outputs and
1740 dumps next to it, e.g., aux file @file{foo.dwo} for
1741 @option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1742 @option{-fdump-rtl-final}.
1744 If a non-linker output file is explicitly specified, aux and dump files
1745 by default take the same base name:
1747 @smallexample
1748 gcc -c foo.c -o dir/foobar.o ...
1749 @end smallexample
1751 will name aux outputs @file{dir/foobar.*} and dump outputs
1752 @file{dir/foobar.c.*}.
1754 A linker output will instead prefix aux and dump outputs:
1756 @smallexample
1757 gcc foo.c bar.c -o dir/foobar ...
1758 @end smallexample
1760 will generally name aux outputs @file{dir/foobar-foo.*} and
1761 @file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1762 @file{dir/foobar-bar.c.*}.
1764 The one exception to the above is when the executable shares the base
1765 name with the single input:
1767 @smallexample
1768 gcc foo.c -o dir/foo ...
1769 @end smallexample
1771 in which case aux outputs are named @file{dir/foo.*} and dump outputs
1772 named @file{dir/foo.c.*}.
1774 The location and the names of auxiliary and dump outputs can be adjusted
1775 by the options @option{-dumpbase}, @option{-dumpbase-ext},
1776 @option{-dumpdir}, @option{-save-temps=cwd}, and
1777 @option{-save-temps=obj}.
1780 @opindex dumpbase
1781 @item -dumpbase @var{dumpbase}
1782 This option sets the base name for auxiliary and dump output files.  It
1783 does not affect the name of the primary output file.  Intermediate
1784 outputs, when preserved, are not regarded as primary outputs, but as
1785 auxiliary outputs:
1787 @smallexample
1788 gcc -save-temps -S foo.c
1789 @end smallexample
1791 saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1792 then compiles to the (implied) output file @file{foo.s}, whereas:
1794 @smallexample
1795 gcc -save-temps -dumpbase save-foo -c foo.c
1796 @end smallexample
1798 preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1799 an intermediate, thus auxiliary output), and then assembles to the
1800 (implied) output file @file{foo.o}.
1802 Absent this option, dump and aux files take their names from the input
1803 file, or from the (non-linker) output file, if one is explicitly
1804 specified: dump output files (e.g. those requested by @option{-fdump-*}
1805 options) with the input name suffix, and aux output files (those
1806 requested by other non-dump options, e.g. @code{-save-temps},
1807 @code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1809 Similar suffix differentiation of dump and aux outputs can be attained
1810 for explicitly-given @option{-dumpbase basename.suf} by also specifying
1811 @option{-dumpbase-ext .suf}.
1813 If @var{dumpbase} is explicitly specified with any directory component,
1814 any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1815 @option{-save-temps=*}) is ignored, and instead of appending to it,
1816 @var{dumpbase} fully overrides it:
1818 @smallexample
1819 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1820   -dumpdir pfx- -save-temps=cwd ...
1821 @end smallexample
1823 creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1824 @file{dir/} in @option{-o}, the @file{./} prefix implied by
1825 @option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1827 When @option{-dumpbase} is specified in a command that compiles multiple
1828 inputs, or that compiles and then links, it may be combined with
1829 @var{dumppfx}, as specified under @option{-dumpdir}.  Then, each input
1830 file is compiled using the combined @var{dumppfx}, and default values
1831 for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1832 file:
1834 @smallexample
1835 gcc foo.c bar.c -c -dumpbase main ...
1836 @end smallexample
1838 creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1839 overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1840 as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1841 and @file{main-bar.*}.
1843 An empty string specified as @var{dumpbase} avoids the influence of the
1844 output basename in the naming of auxiliary and dump outputs during
1845 compilation, computing default values :
1847 @smallexample
1848 gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1849 @end smallexample
1851 will name aux outputs @file{dir/foo.*} and dump outputs
1852 @file{dir/foo.c.*}.  Note how their basenames are taken from the input
1853 name, but the directory still defaults to that of the output.
1855 The empty-string dumpbase does not prevent the use of the output
1856 basename for outputs during linking:
1858 @smallexample
1859 gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1860 @end smallexample
1862 The compilation of the source files will name auxiliary outputs
1863 @file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1864 @file{dir/foo.c.*} and @file{dir/bar.c.*}.  LTO recompilation during
1865 linking will use @file{dir/foobar.} as the prefix for dumps and
1866 auxiliary files.
1869 @opindex dumpbase-ext
1870 @item -dumpbase-ext @var{auxdropsuf}
1871 When forming the name of an auxiliary (but not a dump) output file, drop
1872 trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1873 suffixes.  If not specified, this option defaults to the suffix of a
1874 default @var{dumpbase}, i.e., the suffix of the input file when
1875 @option{-dumpbase} is not present in the command line, or @var{dumpbase}
1876 is combined with @var{dumppfx}.
1878 @smallexample
1879 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1880 @end smallexample
1882 creates @file{dir/foo.o} as the main output, and generates auxiliary
1883 outputs in @file{dir/x-foo.*}, taking the location of the primary
1884 output, and dropping the @file{.c} suffix from the @var{dumpbase}.  Dump
1885 outputs retain the suffix: @file{dir/x-foo.c.*}.
1887 This option is disregarded if it does not match the suffix of a
1888 specified @var{dumpbase}, except as an alternative to the executable
1889 suffix when appending the linker output base name to @var{dumppfx}, as
1890 specified below:
1892 @smallexample
1893 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1894 @end smallexample
1896 creates @file{main.out} as the primary output, and avoids overwriting
1897 the auxiliary and dump outputs by using the executable name minus
1898 @var{auxdropsuf} as a prefix, creating auxiliary outputs named
1899 @file{main-foo.*} and @file{main-bar.*} and dump outputs named
1900 @file{main-foo.c.*} and @file{main-bar.c.*}.
1903 @opindex dumpdir
1904 @item -dumpdir @var{dumppfx}
1905 When forming the name of an auxiliary or dump output file, use
1906 @var{dumppfx} as a prefix:
1908 @smallexample
1909 gcc -dumpdir pfx- -c foo.c ...
1910 @end smallexample
1912 creates @file{foo.o} as the primary output, and auxiliary outputs named
1913 @file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1914 @var{dumpbase} derived from the default primary output, derived in turn
1915 from the input name.  Dump outputs also take the input name suffix:
1916 @file{pfx-foo.c.*}.
1918 If @var{dumppfx} is to be used as a directory name, it must end with a
1919 directory separator:
1921 @smallexample
1922 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1923 @end smallexample
1925 creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1926 named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1927 default @var{dumpbase} derived from the primary output name.  Dump
1928 outputs also take the input name suffix: @file{dir/bar.c.*}.
1930 It defaults to the location of the output file, unless the output
1931 file is a special file like @code{/dev/null}. Options
1932 @option{-save-temps=cwd} and @option{-save-temps=obj} override this
1933 default, just like an explicit @option{-dumpdir} option.  In case
1934 multiple such options are given, the last one prevails:
1936 @smallexample
1937 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1938 @end smallexample
1940 outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1941 @option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1942 @option{-dumpdir} option.  It does not matter that @option{=obj} is the
1943 default for @option{-save-temps}, nor that the output directory is
1944 implicitly the current directory.  Dump outputs are named
1945 @file{foo.c.*}.
1947 When compiling from multiple input files, if @option{-dumpbase} is
1948 specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1949 are appended to (or override, if containing any directory components) an
1950 explicit or defaulted @var{dumppfx}, so that each of the multiple
1951 compilations gets differently-named aux and dump outputs.
1953 @smallexample
1954 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1955 @end smallexample
1957 outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1958 @file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1959 Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1960 and @file{dir/pfx-main-bar.c.*}, respectively.  Contrast with the
1961 single-input compilation:
1963 @smallexample
1964 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1965 @end smallexample
1967 that, applying @option{-dumpbase} to a single source, does not compute
1968 and append a separate @var{dumpbase} per input file.  Its auxiliary and
1969 dump outputs go in @file{dir/pfx-main.*}.
1971 When compiling and then linking from multiple input files, a defaulted
1972 or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1973 transformation above (e.g. the compilation of @file{foo.c} and
1974 @file{bar.c} above, but without @option{-c}).  If neither
1975 @option{-dumpdir} nor @option{-dumpbase} are given, the linker output
1976 base name, minus @var{auxdropsuf}, if specified, or the executable
1977 suffix otherwise, plus a dash is appended to the default @var{dumppfx}
1978 instead.  Note, however, that unlike earlier cases of linking:
1980 @smallexample
1981 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1982 @end smallexample
1984 does not append the output name @file{main} to @var{dumppfx}, because
1985 @option{-dumpdir} is explicitly specified.  The goal is that the
1986 explicitly-specified @var{dumppfx} may contain the specified output name
1987 as part of the prefix, if desired; only an explicitly-specified
1988 @option{-dumpbase} would be combined with it, in order to avoid simply
1989 discarding a meaningful option.
1991 When compiling and then linking from a single input file, the linker
1992 output base name will only be appended to the default @var{dumppfx} as
1993 above if it does not share the base name with the single input file
1994 name.  This has been covered in single-input linking cases above, but
1995 not with an explicit @option{-dumpdir} that inhibits the combination,
1996 even if overridden by @option{-save-temps=*}:
1998 @smallexample
1999 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
2000 @end smallexample
2002 Auxiliary outputs are named @file{foo.*}, and dump outputs
2003 @file{foo.c.*}, in the current working directory as ultimately requested
2004 by @option{-save-temps=cwd}.
2006 Summing it all up for an intuitive though slightly imprecise data flow:
2007 the primary output name is broken into a directory part and a basename
2008 part; @var{dumppfx} is set to the former, unless overridden by
2009 @option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
2010 to the latter, unless overriden by @option{-dumpbase}.  If there are
2011 multiple inputs or linking, this @var{dumpbase} may be combined with
2012 @var{dumppfx} and taken from each input file.  Auxiliary output names
2013 for each input are formed by combining @var{dumppfx}, @var{dumpbase}
2014 minus suffix, and the auxiliary output suffix; dump output names are
2015 only different in that the suffix from @var{dumpbase} is retained.
2017 When it comes to auxiliary and dump outputs created during LTO
2018 recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
2019 given or as derived from the linker output name but not from inputs,
2020 even in cases in which this combination would not otherwise be used as
2021 such, is passed down with a trailing period replacing the compiler-added
2022 dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
2023 being involved in linking, this program does not normally get any
2024 @option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
2026 When running sub-compilers, @command{lto-wrapper} appends LTO stage
2027 names to the received @var{dumppfx}, ensures it contains a directory
2028 component so that it overrides any @option{-dumpdir}, and passes that as
2029 @option{-dumpbase} to sub-compilers.
2031 @opindex v
2032 @item -v
2033 Print (on standard error output) the commands executed to run the stages
2034 of compilation.  Also print the version number of the compiler driver
2035 program and of the preprocessor and the compiler proper.
2037 @opindex ###
2038 @item -###
2039 Like @option{-v} except the commands are not executed and arguments
2040 are quoted unless they contain only alphanumeric characters or @code{./-_}.
2041 This is useful for shell scripts to capture the driver-generated command lines.
2043 @opindex help
2044 @item --help
2045 Print (on the standard output) a description of the command-line options
2046 understood by @command{gcc}.  If the @option{-v} option is also specified
2047 then @option{--help} is also passed on to the various processes
2048 invoked by @command{gcc}, so that they can display the command-line options
2049 they accept.  If the @option{-Wextra} option has also been specified
2050 (prior to the @option{--help} option), then command-line options that
2051 have no documentation associated with them are also displayed.
2053 @opindex target-help
2054 @item --target-help
2055 Print (on the standard output) a description of target-specific command-line
2056 options for each tool.  For some targets extra target-specific
2057 information may also be printed.
2059 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
2060 Print (on the standard output) a description of the command-line
2061 options understood by the compiler that fit into all specified classes
2062 and qualifiers.  These are the supported classes:
2064 @table @asis
2065 @item @samp{optimizers}
2066 Display all of the optimization options supported by the
2067 compiler.
2069 @item @samp{warnings}
2070 Display all of the options controlling warning messages
2071 produced by the compiler.
2073 @item @samp{target}
2074 Display target-specific options.  Unlike the
2075 @option{--target-help} option however, target-specific options of the
2076 linker and assembler are not displayed.  This is because those
2077 tools do not currently support the extended @option{--help=} syntax.
2079 @item @samp{params}
2080 Display the values recognized by the @option{--param}
2081 option.
2083 @item @var{language}
2084 Display the options supported for @var{language}, where
2085 @var{language} is the name of one of the languages supported in this
2086 version of GCC@.  If an option is supported by all languages, one needs
2087 to select @samp{common} class.
2089 @item @samp{common}
2090 Display the options that are common to all languages.
2091 @end table
2093 These are the supported qualifiers:
2095 @table @asis
2096 @item @samp{undocumented}
2097 Display only those options that are undocumented.
2099 @item @samp{joined}
2100 Display options taking an argument that appears after an equal
2101 sign in the same continuous piece of text, such as:
2102 @samp{--help=target}.
2104 @item @samp{separate}
2105 Display options taking an argument that appears as a separate word
2106 following the original option, such as: @samp{-o output-file}.
2107 @end table
2109 Thus for example to display all the undocumented target-specific
2110 switches supported by the compiler, use:
2112 @smallexample
2113 --help=target,undocumented
2114 @end smallexample
2116 The sense of a qualifier can be inverted by prefixing it with the
2117 @samp{^} character, so for example to display all binary warning
2118 options (i.e., ones that are either on or off and that do not take an
2119 argument) that have a description, use:
2121 @smallexample
2122 --help=warnings,^joined,^undocumented
2123 @end smallexample
2125 The argument to @option{--help=} should not consist solely of inverted
2126 qualifiers.
2128 Combining several classes is possible, although this usually
2129 restricts the output so much that there is nothing to display.  One
2130 case where it does work, however, is when one of the classes is
2131 @var{target}.  For example, to display all the target-specific
2132 optimization options, use:
2134 @smallexample
2135 --help=target,optimizers
2136 @end smallexample
2138 The @option{--help=} option can be repeated on the command line.  Each
2139 successive use displays its requested class of options, skipping
2140 those that have already been displayed.  If @option{--help} is also
2141 specified anywhere on the command line then this takes precedence
2142 over any @option{--help=} option.
2144 If the @option{-Q} option appears on the command line before the
2145 @option{--help=} option, then the descriptive text displayed by
2146 @option{--help=} is changed.  Instead of describing the displayed
2147 options, an indication is given as to whether the option is enabled,
2148 disabled or set to a specific value (assuming that the compiler
2149 knows this at the point where the @option{--help=} option is used).
2151 Here is a truncated example from the ARM port of @command{gcc}:
2153 @smallexample
2154   % gcc -Q -mabi=2 --help=target -c
2155   The following options are target specific:
2156   -mabi=                                2
2157   -mabort-on-noreturn                   [disabled]
2158   -mapcs                                [disabled]
2159 @end smallexample
2161 The output is sensitive to the effects of previous command-line
2162 options, so for example it is possible to find out which optimizations
2163 are enabled at @option{-O2} by using:
2165 @smallexample
2166 -Q -O2 --help=optimizers
2167 @end smallexample
2169 Alternatively you can discover which binary optimizations are enabled
2170 by @option{-O3} by using:
2172 @smallexample
2173 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2174 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2175 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2176 @end smallexample
2178 @opindex version
2179 @item --version
2180 Display the version number and copyrights of the invoked GCC@.
2182 @opindex pass-exit-codes
2183 @item -pass-exit-codes
2184 Normally the @command{gcc} program exits with the code of 1 if any
2185 phase of the compiler returns a non-success return code.  If you specify
2186 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
2187 the numerically highest error produced by any phase returning an error
2188 indication.  The C, C++, and Fortran front ends return 4 if an internal
2189 compiler error is encountered.
2191 @opindex pipe
2192 @item -pipe
2193 Use pipes rather than temporary files for communication between the
2194 various stages of compilation.  This fails to work on some systems where
2195 the assembler is unable to read from a pipe; but the GNU assembler has
2196 no trouble.
2198 @opindex specs
2199 @item -specs=@var{file}
2200 Process @var{file} after the compiler reads in the standard @file{specs}
2201 file, in order to override the defaults which the @command{gcc} driver
2202 program uses when determining what switches to pass to @command{cc1},
2203 @command{cc1plus}, @command{as}, @command{ld}, etc.  More than one
2204 @option{-specs=@var{file}} can be specified on the command line, and they
2205 are processed in order, from left to right.  @xref{Spec Files}, for
2206 information about the format of the @var{file}.
2208 @opindex wrapper
2209 @item -wrapper
2210 Invoke all subcommands under a wrapper program.  The name of the
2211 wrapper program and its parameters are passed as a comma separated
2212 list.
2214 @smallexample
2215 gcc -c t.c -wrapper gdb,--args
2216 @end smallexample
2218 @noindent
2219 This invokes all subprograms of @command{gcc} under
2220 @samp{gdb --args}, thus the invocation of @command{cc1} is
2221 @samp{gdb --args cc1 @dots{}}.
2223 @opindex ffile-prefix-map
2224 @item -ffile-prefix-map=@var{old}=@var{new}
2225 When compiling files residing in directory @file{@var{old}}, record
2226 any references to them in the result of the compilation as if the
2227 files resided in directory @file{@var{new}} instead.  Specifying this
2228 option is equivalent to specifying all the individual
2229 @option{-f*-prefix-map} options.  This can be used to make reproducible
2230 builds that are location independent.  Directories referenced by
2231 directives are not affected by these options.  See also
2232 @option{-fmacro-prefix-map}, @option{-fdebug-prefix-map},
2233 @option{-fprofile-prefix-map} and @option{-fcanon-prefix-map}.
2235 @opindex fcanon-prefix-map
2236 @item -fcanon-prefix-map
2237 For the @option{-f*-prefix-map} options normally comparison
2238 of @file{@var{old}} prefix against the filename that would be normally
2239 referenced in the result of the compilation is done using textual
2240 comparison of the prefixes, or ignoring character case for case insensitive
2241 filesystems and considering slashes and backslashes as equal on DOS based
2242 filesystems.  The @option{-fcanon-prefix-map} causes such comparisons
2243 to be done on canonicalized paths of @file{@var{old}}
2244 and the referenced filename.
2246 @opindex fplugin
2247 @item -fplugin=@var{name}.so
2248 Load the plugin code in file @var{name}.so, assumed to be a
2249 shared object to be dlopen'd by the compiler.  The base name of
2250 the shared object file is used to identify the plugin for the
2251 purposes of argument parsing (See
2252 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2253 Each plugin should define the callback functions specified in the
2254 Plugins API.
2256 @opindex fplugin-arg
2257 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
2258 Define an argument called @var{key} with a value of @var{value}
2259 for the plugin called @var{name}.
2261 @opindex fdump-ada-spec
2262 @item -fdump-ada-spec@r{[}-slim@r{]}
2263 For C and C++ source and include files, generate corresponding Ada specs.
2264 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2265 GNAT User's Guide}, which provides detailed documentation on this feature.
2267 @opindex fada-spec-parent
2268 @item -fada-spec-parent=@var{unit}
2269 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2270 Ada specs as child units of parent @var{unit}.
2272 @opindex fdump-go-spec
2273 @item -fdump-go-spec=@var{file}
2274 For input files in any language, generate corresponding Go
2275 declarations in @var{file}.  This generates Go @code{const},
2276 @code{type}, @code{var}, and @code{func} declarations which may be a
2277 useful way to start writing a Go interface to code written in some
2278 other language.
2280 @include @value{srcdir}/../libiberty/at-file.texi
2281 @end table
2283 @node Invoking G++
2284 @section Compiling C++ Programs
2286 @cindex suffixes for C++ source
2287 @cindex C++ source file suffixes
2288 C++ source files conventionally use one of the suffixes @samp{.C},
2289 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2290 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2291 @samp{.H}, or (for shared template code) @samp{.tcc}; and
2292 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
2293 files with these names and compiles them as C++ programs even if you
2294 call the compiler the same way as for compiling C programs (usually
2295 with the name @command{gcc}).
2297 @findex g++
2298 @findex c++
2299 However, the use of @command{gcc} does not add the C++ library.
2300 @command{g++} is a program that calls GCC and automatically specifies linking
2301 against the C++ library.  It treats @samp{.c},
2302 @samp{.h} and @samp{.i} files as C++ source files instead of C source
2303 files unless @option{-x} is used.  This program is also useful when
2304 precompiling a C header file with a @samp{.h} extension for use in C++
2305 compilations.  On many systems, @command{g++} is also installed with
2306 the name @command{c++}.
2308 @cindex invoking @command{g++}
2309 When you compile C++ programs, you may specify many of the same
2310 command-line options that you use for compiling programs in any
2311 language; or command-line options meaningful for C and related
2312 languages; or options that are meaningful only for C++ programs.
2313 @xref{C Dialect Options,,Options Controlling C Dialect}, for
2314 explanations of options for languages related to C@.
2315 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2316 explanations of options that are meaningful only for C++ programs.
2318 @node C Dialect Options
2319 @section Options Controlling C Dialect
2320 @cindex dialect options
2321 @cindex language dialect options
2322 @cindex options, dialect
2324 The following options control the dialect of C (or languages derived
2325 from C, such as C++, Objective-C and Objective-C++) that the compiler
2326 accepts:
2328 @table @gcctabopt
2329 @cindex ANSI support
2330 @cindex ISO support
2331 @opindex ansi
2332 @item -ansi
2333 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2334 equivalent to @option{-std=c++98}.
2336 This turns off certain features of GCC that are incompatible with ISO
2337 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2338 such as the @code{asm} and @code{typeof} keywords, and
2339 predefined macros such as @code{unix} and @code{vax} that identify the
2340 type of system you are using.  It also enables the undesirable and
2341 rarely used ISO trigraph feature.  For the C compiler,
2342 it disables recognition of C++ style @samp{//} comments as well as
2343 the @code{inline} keyword.
2345 The alternate keywords @code{__asm__}, @code{__extension__},
2346 @code{__inline__} and @code{__typeof__} continue to work despite
2347 @option{-ansi}.  You would not want to use them in an ISO C program, of
2348 course, but it is useful to put them in header files that might be included
2349 in compilations done with @option{-ansi}.  Alternate predefined macros
2350 such as @code{__unix__} and @code{__vax__} are also available, with or
2351 without @option{-ansi}.
2353 The @option{-ansi} option does not cause non-ISO programs to be
2354 rejected gratuitously.  For that, @option{-Wpedantic} is required in
2355 addition to @option{-ansi}.  @xref{Warning Options}.
2357 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2358 option is used.  Some header files may notice this macro and refrain
2359 from declaring certain functions or defining certain macros that the
2360 ISO standard doesn't call for; this is to avoid interfering with any
2361 programs that might use these names for other things.
2363 Functions that are normally built in but do not have semantics
2364 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2365 functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
2366 built-in functions provided by GCC}, for details of the functions
2367 affected.
2369 @opindex std
2370 @item -std=
2371 Determine the language standard. @xref{Standards,,Language Standards
2372 Supported by GCC}, for details of these standard versions.  This option
2373 is currently only supported when compiling C or C++.
2375 The compiler can accept several base standards, such as @samp{c90} or
2376 @samp{c++98}, and GNU dialects of those standards, such as
2377 @samp{gnu90} or @samp{gnu++98}.  When a base standard is specified, the
2378 compiler accepts all programs following that standard plus those
2379 using GNU extensions that do not contradict it.  For example,
2380 @option{-std=c90} turns off certain features of GCC that are
2381 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2382 keywords, but not other GNU extensions that do not have a meaning in
2383 ISO C90, such as omitting the middle term of a @code{?:}
2384 expression. On the other hand, when a GNU dialect of a standard is
2385 specified, all features supported by the compiler are enabled, even when
2386 those features change the meaning of the base standard.  As a result, some
2387 strict-conforming programs may be rejected.  The particular standard
2388 is used by @option{-Wpedantic} to identify which features are GNU
2389 extensions given that version of the standard. For example
2390 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2391 comments, while @option{-std=gnu99 -Wpedantic} does not.
2393 A value for this option must be provided; possible values are
2395 @table @samp
2396 @item c90
2397 @itemx c89
2398 @itemx iso9899:1990
2399 Support all ISO C90 programs (certain GNU extensions that conflict
2400 with ISO C90 are disabled). Same as @option{-ansi} for C code.
2402 @item iso9899:199409
2403 ISO C90 as modified in amendment 1.
2405 @item c99
2406 @itemx c9x
2407 @itemx iso9899:1999
2408 @itemx iso9899:199x
2409 ISO C99.  This standard is substantially completely supported, modulo
2410 bugs and floating-point issues
2411 (mainly but not entirely relating to optional C99 features from
2412 Annexes F and G).  See
2413 @w{@uref{https://gcc.gnu.org/c99status.html}} for more information.  The
2414 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2416 @item c11
2417 @itemx c1x
2418 @itemx iso9899:2011
2419 ISO C11, the 2011 revision of the ISO C standard.  This standard is
2420 substantially completely supported, modulo bugs, floating-point issues
2421 (mainly but not entirely relating to optional C11 features from
2422 Annexes F and G) and the optional Annexes K (Bounds-checking
2423 interfaces) and L (Analyzability).  The name @samp{c1x} is deprecated.
2425 @item c17
2426 @itemx c18
2427 @itemx iso9899:2017
2428 @itemx iso9899:2018
2429 ISO C17, the 2017 revision of the ISO C standard
2430 (published in 2018).  This standard is
2431 same as C11 except for corrections of defects (all of which are also
2432 applied with @option{-std=c11}) and a new value of
2433 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2435 @item c23
2436 @itemx c2x
2437 @itemx iso9899:2024
2438 ISO C23, the 2023 revision of the ISO C standard (expected to be
2439 published in 2024).  The support for this version is experimental and
2440 incomplete.  The name @samp{c2x} is deprecated.
2442 @item gnu90
2443 @itemx gnu89
2444 GNU dialect of ISO C90 (including some C99 features).
2446 @item gnu99
2447 @itemx gnu9x
2448 GNU dialect of ISO C99.  The name @samp{gnu9x} is deprecated.
2450 @item gnu11
2451 @itemx gnu1x
2452 GNU dialect of ISO C11.
2453 The name @samp{gnu1x} is deprecated.
2455 @item gnu17
2456 @itemx gnu18
2457 GNU dialect of ISO C17.  This is the default for C code.
2459 @item gnu23
2460 @itemx gnu2x
2461 The next version of the ISO C standard, still under development, plus
2462 GNU extensions.  The support for this version is experimental and
2463 incomplete.  The name @samp{gnu2x} is deprecated.
2465 @item c++98
2466 @itemx c++03
2467 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2468 additional defect reports. Same as @option{-ansi} for C++ code.
2470 @item gnu++98
2471 @itemx gnu++03
2472 GNU dialect of @option{-std=c++98}.
2474 @item c++11
2475 @itemx c++0x
2476 The 2011 ISO C++ standard plus amendments.
2477 The name @samp{c++0x} is deprecated.
2479 @item gnu++11
2480 @itemx gnu++0x
2481 GNU dialect of @option{-std=c++11}.
2482 The name @samp{gnu++0x} is deprecated.
2484 @item c++14
2485 @itemx c++1y
2486 The 2014 ISO C++ standard plus amendments.
2487 The name @samp{c++1y} is deprecated.
2489 @item gnu++14
2490 @itemx gnu++1y
2491 GNU dialect of @option{-std=c++14}.
2492 The name @samp{gnu++1y} is deprecated.
2494 @item c++17
2495 @itemx c++1z
2496 The 2017 ISO C++ standard plus amendments.
2497 The name @samp{c++1z} is deprecated.
2499 @item gnu++17
2500 @itemx gnu++1z
2501 GNU dialect of @option{-std=c++17}.
2502 This is the default for C++ code.
2503 The name @samp{gnu++1z} is deprecated.
2505 @item c++20
2506 @itemx c++2a
2507 The 2020 ISO C++ standard plus amendments.
2508 Support is experimental, and could change in incompatible ways in
2509 future releases.
2510 The name @samp{c++2a} is deprecated.
2512 @item gnu++20
2513 @itemx gnu++2a
2514 GNU dialect of @option{-std=c++20}.
2515 Support is experimental, and could change in incompatible ways in
2516 future releases.
2517 The name @samp{gnu++2a} is deprecated.
2519 @item c++2b
2520 @itemx c++23
2521 The next revision of the ISO C++ standard, planned for
2522 2023.  Support is highly experimental, and will almost certainly
2523 change in incompatible ways in future releases.
2525 @item gnu++2b
2526 @itemx gnu++23
2527 GNU dialect of @option{-std=c++2b}.  Support is highly experimental,
2528 and will almost certainly change in incompatible ways in future
2529 releases.
2531 @item c++2c
2532 @itemx c++26
2533 The next revision of the ISO C++ standard, planned for
2534 2026.  Support is highly experimental, and will almost certainly
2535 change in incompatible ways in future releases.
2537 @item gnu++2c
2538 @itemx gnu++26
2539 GNU dialect of @option{-std=c++2c}.  Support is highly experimental,
2540 and will almost certainly change in incompatible ways in future
2541 releases.
2542 @end table
2544 @opindex aux-info
2545 @item -aux-info @var{filename}
2546 Output to the given filename prototyped declarations for all functions
2547 declared and/or defined in a translation unit, including those in header
2548 files.  This option is silently ignored in any language other than C@.
2550 Besides declarations, the file indicates, in comments, the origin of
2551 each declaration (source file and line), whether the declaration was
2552 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2553 @samp{O} for old, respectively, in the first character after the line
2554 number and the colon), and whether it came from a declaration or a
2555 definition (@samp{C} or @samp{F}, respectively, in the following
2556 character).  In the case of function definitions, a K&R-style list of
2557 arguments followed by their declarations is also provided, inside
2558 comments, after the declaration.
2560 @opindex fno-asm
2561 @opindex fasm
2562 @item -fno-asm
2563 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2564 keyword, so that code can use these words as identifiers.  You can use
2565 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2566 instead.  In C, @option{-ansi} implies @option{-fno-asm}.
2568 In C++, @code{inline} is a standard keyword and is not affected by
2569 this switch.  You may want to use the @option{-fno-gnu-keywords} flag
2570 instead, which disables @code{typeof} but not @code{asm} and
2571 @code{inline}.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}),
2572 this switch only affects the @code{asm} and @code{typeof} keywords,
2573 since @code{inline} is a standard keyword in ISO C99.  In C23 mode
2574 (@option{-std=c23} or @option{-std=gnu23}), this switch only affects
2575 the @code{asm} keyword, since @code{typeof} is a standard keyword in
2576 ISO C23.
2578 @opindex fno-builtin
2579 @opindex fbuiltin
2580 @cindex built-in functions
2581 @item -fno-builtin
2582 @itemx -fno-builtin-@var{function}
2583 Don't recognize built-in functions that do not begin with
2584 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
2585 functions provided by GCC}, for details of the functions affected,
2586 including those which are not built-in functions when @option{-ansi} or
2587 @option{-std} options for strict ISO C conformance are used because they
2588 do not have an ISO standard meaning.
2590 GCC normally generates special code to handle certain built-in functions
2591 more efficiently; for instance, calls to @code{alloca} may become single
2592 instructions which adjust the stack directly, and calls to @code{memcpy}
2593 may become inline copy loops.  The resulting code is often both smaller
2594 and faster, but since the function calls no longer appear as such, you
2595 cannot set a breakpoint on those calls, nor can you change the behavior
2596 of the functions by linking with a different library.  In addition,
2597 when a function is recognized as a built-in function, GCC may use
2598 information about that function to warn about problems with calls to
2599 that function, or to generate more efficient code, even if the
2600 resulting code still contains calls to that function.  For example,
2601 warnings are given with @option{-Wformat} for bad calls to
2602 @code{printf} when @code{printf} is built in and @code{strlen} is
2603 known not to modify global memory.
2605 With the @option{-fno-builtin-@var{function}} option
2606 only the built-in function @var{function} is
2607 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
2608 function is named that is not built-in in this version of GCC, this
2609 option is ignored.  There is no corresponding
2610 @option{-fbuiltin-@var{function}} option; if you wish to enable
2611 built-in functions selectively when using @option{-fno-builtin} or
2612 @option{-ffreestanding}, you may define macros such as:
2614 @smallexample
2615 #define abs(n)          __builtin_abs ((n))
2616 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
2617 @end smallexample
2619 @opindex fcond-mismatch
2620 @item -fcond-mismatch
2621 Allow conditional expressions with mismatched types in the second and
2622 third arguments.  The value of such an expression is void.  This option
2623 is not supported for C++.
2625 @opindex ffreestanding
2626 @cindex hosted environment
2627 @item -ffreestanding
2629 Assert that compilation targets a freestanding environment.  This
2630 implies @option{-fno-builtin}.  A freestanding environment
2631 is one in which the standard library may not exist, and program startup may
2632 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
2633 This is equivalent to @option{-fno-hosted}.
2635 @xref{Standards,,Language Standards Supported by GCC}, for details of
2636 freestanding and hosted environments.
2638 @opindex fgimple
2639 @item -fgimple
2641 Enable parsing of function definitions marked with @code{__GIMPLE}.
2642 This is an experimental feature that allows unit testing of GIMPLE
2643 passes.
2645 @opindex fgnu-tm
2646 @item -fgnu-tm
2647 When the option @option{-fgnu-tm} is specified, the compiler
2648 generates code for the Linux variant of Intel's current Transactional
2649 Memory ABI specification document (Revision 1.1, May 6 2009).  This is
2650 an experimental feature whose interface may change in future versions
2651 of GCC, as the official specification changes.  Please note that not
2652 all architectures are supported for this feature.
2654 For more information on GCC's support for transactional memory,
2655 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2656 Transactional Memory Library}.
2658 Note that the transactional memory feature is not supported with
2659 non-call exceptions (@option{-fnon-call-exceptions}).
2661 @opindex fgnu89-inline
2662 @item -fgnu89-inline
2663 The option @option{-fgnu89-inline} tells GCC to use the traditional
2664 GNU semantics for @code{inline} functions when in C99 mode.
2665 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2666 Using this option is roughly equivalent to adding the
2667 @code{gnu_inline} function attribute to all inline functions
2668 (@pxref{Function Attributes}).
2670 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2671 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2672 specifies the default behavior).
2673 This option is not supported in @option{-std=c90} or
2674 @option{-std=gnu90} mode.
2676 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2677 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2678 in effect for @code{inline} functions.  @xref{Common Predefined
2679 Macros,,,cpp,The C Preprocessor}.
2681 @opindex fhosted
2682 @cindex hosted environment
2683 @item -fhosted
2685 Assert that compilation targets a hosted environment.  This implies
2686 @option{-fbuiltin}.  A hosted environment is one in which the
2687 entire standard library is available, and in which @code{main} has a return
2688 type of @code{int}.  Examples are nearly everything except a kernel.
2689 This is equivalent to @option{-fno-freestanding}.
2691 @opindex flax-vector-conversions
2692 @item -flax-vector-conversions
2693 Allow implicit conversions between vectors with differing numbers of
2694 elements and/or incompatible element types.  This option should not be
2695 used for new code.
2697 @opindex fms-extensions
2698 @item -fms-extensions
2699 Accept some non-standard constructs used in Microsoft header files.
2701 In C++ code, this allows member names in structures to be similar
2702 to previous types declarations.
2704 @smallexample
2705 typedef int UOW;
2706 struct ABC @{
2707   UOW UOW;
2709 @end smallexample
2711 Some cases of unnamed fields in structures and unions are only
2712 accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
2713 fields within structs/unions}, for details.
2715 Note that this option is off for all targets except for x86
2716 targets using ms-abi.
2718 @opindex foffload
2719 @cindex Offloading targets
2720 @cindex OpenACC offloading targets
2721 @cindex OpenMP offloading targets
2722 @item -foffload=disable
2723 @itemx -foffload=default
2724 @itemx -foffload=@var{target-list}
2725 Specify for which OpenMP and OpenACC offload targets code should be generated.
2726 The default behavior, equivalent to @option{-foffload=default}, is to generate
2727 code for all supported offload targets.  The @option{-foffload=disable} form
2728 generates code only for the host fallback, while
2729 @option{-foffload=@var{target-list}} generates code only for the specified
2730 comma-separated list of offload targets.
2732 Offload targets are specified in GCC's internal target-triplet format. You can
2733 run the compiler with @option{-v} to show the list of configured offload targets
2734 under @code{OFFLOAD_TARGET_NAMES}.
2736 @opindex foffload-options
2737 @cindex Offloading options
2738 @cindex OpenACC offloading options
2739 @cindex OpenMP offloading options
2740 @item -foffload-options=@var{options}
2741 @itemx -foffload-options=@var{target-triplet-list}=@var{options}
2743 With @option{-foffload-options=@var{options}}, GCC passes the specified
2744 @var{options} to the compilers for all enabled offloading targets.  You can
2745 specify options that apply only to a specific target or targets by using
2746 the @option{-foffload-options=@var{target-list}=@var{options}} form.  The
2747 @var{target-list} is a comma-separated list in the same format as for the
2748 @option{-foffload=} option.
2750 Typical command lines are
2752 @smallexample
2753 -foffload-options='-fno-math-errno -ffinite-math-only' -foffload-options=nvptx-none=-latomic
2754 -foffload-options=amdgcn-amdhsa=-march=gfx906
2755 @end smallexample
2757 @opindex fopenacc
2758 @cindex OpenACC accelerator programming
2759 @item -fopenacc
2760 Enable handling of OpenACC directives @samp{#pragma acc} in C/C++ and
2761 @samp{!$acc} in free-form Fortran and @samp{!$acc}, @samp{c$acc} and
2762 @samp{*$acc} in fixed-form Fortran.  When @option{-fopenacc} is specified,
2763 the compiler generates accelerated code according to the OpenACC Application
2764 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}.  This option
2765 implies @option{-pthread}, and thus is only supported on targets that
2766 have support for @option{-pthread}.
2768 @opindex fopenacc-dim
2769 @cindex OpenACC accelerator programming
2770 @item -fopenacc-dim=@var{geom}
2771 Specify default compute dimensions for parallel offload regions that do
2772 not explicitly specify.  The @var{geom} value is a triple of
2773 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'.  A size
2774 can be omitted, to use a target-specific default value.
2776 @opindex fopenmp
2777 @cindex OpenMP parallel
2778 @item -fopenmp
2779 Enable handling of OpenMP directives @samp{#pragma omp},
2780 @samp{[[omp::directive(...)]]}, @samp{[[omp::sequence(...)]]} and
2781 @samp{[[omp::decl(...)]]} in C/C++ and @samp{!$omp} in Fortran.  It
2782 additionally enables the conditional compilation sentinel @samp{!$} in
2783 Fortran.  In fixed source form Fortran, the sentinels can also start with
2784 @samp{c} or @samp{*}.  When @option{-fopenmp} is specified, the
2785 compiler generates parallel code according to the OpenMP Application
2786 Program Interface v4.5 @w{@uref{https://www.openmp.org}}.  This option
2787 implies @option{-pthread}, and thus is only supported on targets that
2788 have support for @option{-pthread}. @option{-fopenmp} implies
2789 @option{-fopenmp-simd}.
2791 @opindex fopenmp-simd
2792 @cindex OpenMP SIMD
2793 @cindex SIMD
2794 @item -fopenmp-simd
2795 Enable handling of OpenMP's @code{simd}, @code{declare simd},
2796 @code{declare reduction}, @code{assume}, @code{ordered}, @code{scan}
2797 and @code{loop} directive, and of combined or composite directives with
2798 @code{simd} as constituent with @code{#pragma omp},
2799 @code{[[omp::directive(...)]]}, @code{[[omp::sequence(...)]]} and
2800 @code{[[omp::decl(...)]]} in C/C++ and @code{!$omp} in Fortran.  It
2801 additionally enables the conditional compilation sentinel @samp{!$} in
2802 Fortran.  In fixed source form Fortran, the sentinels can also start with
2803 @samp{c} or @samp{*}.  Other OpenMP directives are ignored.  Unless
2804 @option{-fopenmp} is additionally specified, the @code{loop} region binds
2805 to the current task region, independent of the specified @code{bind} clause.
2807 @opindex fopenmp-target-simd-clone
2808 @cindex OpenMP target SIMD clone
2809 @item -fopenmp-target-simd-clone
2810 @item -fopenmp-target-simd-clone=@var{device-type}
2811 In addition to generating SIMD clones for functions marked with the
2812 @code{declare simd} directive, GCC also generates clones
2813 for functions marked with the OpenMP @code{declare target} directive
2814 that are suitable for vectorization when this option is in effect.  The
2815 @var{device-type} may be one of @code{none}, @code{host}, @code{nohost},
2816 and @code{any}, which correspond to keywords for the @code{device_type}
2817 clause of the @code{declare target} directive; clones are generated for
2818 the intersection of devices specified.
2819 @option{-fopenmp-target-simd-clone} is equivalent to
2820 @option{-fopenmp-target-simd-clone=any} and
2821 @option{-fno-openmp-target-simd-clone} is equivalent to
2822 @option{-fopenmp-target-simd-clone=none}.
2824 At @option{-O2} and higher (but not @option{-Os} or @option{-Og}) this
2825 optimization defaults to @option{-fopenmp-target-simd-clone=nohost}; otherwise
2826 it is disabled by default.
2828 @opindex fpermitted-flt-eval-methods
2829 @opindex fpermitted-flt-eval-methods=c11
2830 @opindex fpermitted-flt-eval-methods=ts-18661-3
2831 @item -fpermitted-flt-eval-methods=@var{style}
2832 ISO/IEC TS 18661-3 defines new permissible values for
2833 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2834 a semantic type that is an interchange or extended format should be
2835 evaluated to the precision and range of that type.  These new values are
2836 a superset of those permitted under C99/C11, which does not specify the
2837 meaning of other positive values of @code{FLT_EVAL_METHOD}.  As such, code
2838 conforming to C11 may not have been written expecting the possibility of
2839 the new values.
2841 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2842 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2843 or the extended set of values specified in ISO/IEC TS 18661-3.
2845 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2847 The default when in a standards compliant mode (@option{-std=c11} or similar)
2848 is @option{-fpermitted-flt-eval-methods=c11}.  The default when in a GNU
2849 dialect (@option{-std=gnu11} or similar) is
2850 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2852 @opindex fdeps-
2853 The @samp{-fdeps-*} options are used to extract structured dependency
2854 information for a source.  This involves determining what resources provided by
2855 other source files will be required to compile the source as well as what
2856 resources are provided by the source.  This information can be used to add
2857 required dependencies between compilation rules of dependent sources based on
2858 their contents rather than requiring such information be reflected within the
2859 build tools as well.
2861 @opindex fdeps-file
2862 @item -fdeps-file=@var{file}
2863 Where to write structured dependency information.
2865 @opindex fdeps-format
2866 @item -fdeps-format=@var{format}
2867 The format to use for structured dependency information. @samp{p1689r5} is the
2868 only supported format right now.  Note that when this argument is specified, the
2869 output of @samp{-MF} is stripped of some information (namely C++ modules) so
2870 that it does not use extended makefile syntax not understood by most tools.
2872 @opindex fdeps-target
2873 @item -fdeps-target=@var{file}
2874 Analogous to @option{-MT} but for structured dependency information.  This
2875 indicates the target which will ultimately need any required resources and
2876 provide any resources extracted from the source that may be required by other
2877 sources.
2879 @opindex fplan9-extensions
2880 @item -fplan9-extensions
2881 Accept some non-standard constructs used in Plan 9 code.
2883 This enables @option{-fms-extensions}, permits passing pointers to
2884 structures with anonymous fields to functions that expect pointers to
2885 elements of the type of the field, and permits referring to anonymous
2886 fields declared using a typedef.  @xref{Unnamed Fields,,Unnamed
2887 struct/union fields within structs/unions}, for details.  This is only
2888 supported for C, not C++.
2890 @opindex fsigned-bitfields
2891 @opindex funsigned-bitfields
2892 @opindex fno-signed-bitfields
2893 @opindex fno-unsigned-bitfields
2894 @item -fsigned-bitfields
2895 @itemx -funsigned-bitfields
2896 @itemx -fno-signed-bitfields
2897 @itemx -fno-unsigned-bitfields
2898 These options control whether a bit-field is signed or unsigned, when the
2899 declaration does not use either @code{signed} or @code{unsigned}.  By
2900 default, such a bit-field is signed, because this is consistent: the
2901 basic integer types such as @code{int} are signed types.
2903 @opindex fsigned-char
2904 @item -fsigned-char
2905 Let the type @code{char} be signed, like @code{signed char}.
2907 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2908 the negative form of @option{-funsigned-char}.  Likewise, the option
2909 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2911 @opindex funsigned-char
2912 @item -funsigned-char
2913 Let the type @code{char} be unsigned, like @code{unsigned char}.
2915 Each kind of machine has a default for what @code{char} should
2916 be.  It is either like @code{unsigned char} by default or like
2917 @code{signed char} by default.
2919 Ideally, a portable program should always use @code{signed char} or
2920 @code{unsigned char} when it depends on the signedness of an object.
2921 But many programs have been written to use plain @code{char} and
2922 expect it to be signed, or expect it to be unsigned, depending on the
2923 machines they were written for.  This option, and its inverse, let you
2924 make such a program work with the opposite default.
2926 The type @code{char} is always a distinct type from each of
2927 @code{signed char} or @code{unsigned char}, even though its behavior
2928 is always just like one of those two.
2930 @opindex fstrict-flex-arrays
2931 @opindex fno-strict-flex-arrays
2932 @item -fstrict-flex-arrays
2933 Control when to treat the trailing array of a structure as a flexible array
2934 member for the purpose of accessing the elements of such an array.
2935 The positive form is equivalent to @option{-fstrict-flex-arrays=3}, which is the
2936 strictest.  A trailing array is treated as a flexible array member only when it
2937 is declared as a flexible array member per C99 standard onwards.
2938 The negative form is equivalent to @option{-fstrict-flex-arrays=0}, which is the
2939 least strict.  All trailing arrays of structures are treated as flexible array
2940 members.
2942 @opindex fstrict-flex-arrays=@var{level}
2943 @item -fstrict-flex-arrays=@var{level}
2944 Control when to treat the trailing array of a structure as a flexible array
2945 member for the purpose of accessing the elements of such an array.  The value
2946 of @var{level} controls the level of strictness.
2948 The possible values of @var{level} are the same as for the
2949 @code{strict_flex_array} attribute (@pxref{Variable Attributes}).
2951 You can control this behavior for a specific trailing array field of a
2952 structure by using the variable attribute @code{strict_flex_array} attribute
2953 (@pxref{Variable Attributes}).
2955 @opindex fsso-struct
2956 @item -fsso-struct=@var{endianness}
2957 Set the default scalar storage order of structures and unions to the
2958 specified endianness.  The accepted values are @samp{big-endian},
2959 @samp{little-endian} and @samp{native} for the native endianness of
2960 the target (the default).  This option is not supported for C++.
2962 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2963 code that is not binary compatible with code generated without it if the
2964 specified endianness is not the native endianness of the target.
2965 @end table
2967 @node C++ Dialect Options
2968 @section Options Controlling C++ Dialect
2970 @cindex compiler options, C++
2971 @cindex C++ options, command-line
2972 @cindex options, C++
2973 This section describes the command-line options that are only meaningful
2974 for C++ programs.  You can also use most of the GNU compiler options
2975 regardless of what language your program is in.  For example, you
2976 might compile a file @file{firstClass.C} like this:
2978 @smallexample
2979 g++ -g -fstrict-enums -O -c firstClass.C
2980 @end smallexample
2982 @noindent
2983 In this example, only @option{-fstrict-enums} is an option meant
2984 only for C++ programs; you can use the other options with any
2985 language supported by GCC@.
2987 Some options for compiling C programs, such as @option{-std}, are also
2988 relevant for C++ programs.
2989 @xref{C Dialect Options,,Options Controlling C Dialect}.
2991 Here is a list of options that are @emph{only} for compiling C++ programs:
2993 @table @gcctabopt
2995 @opindex fabi-version
2996 @item -fabi-version=@var{n}
2997 Use version @var{n} of the C++ ABI@.  The default is version 0.
2999 Version 0 refers to the version conforming most closely to
3000 the C++ ABI specification.  Therefore, the ABI obtained using version 0
3001 will change in different versions of G++ as ABI bugs are fixed.
3003 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
3005 Version 2 is the version of the C++ ABI that first appeared in G++
3006 3.4, and was the default through G++ 4.9.
3008 Version 3 corrects an error in mangling a constant address as a
3009 template argument.
3011 Version 4, which first appeared in G++ 4.5, implements a standard
3012 mangling for vector types.
3014 Version 5, which first appeared in G++ 4.6, corrects the mangling of
3015 attribute const/volatile on function pointer types, decltype of a
3016 plain decl, and use of a function parameter in the declaration of
3017 another parameter.
3019 Version 6, which first appeared in G++ 4.7, corrects the promotion
3020 behavior of C++11 scoped enums and the mangling of template argument
3021 packs, const/static_cast, prefix ++ and --, and a class scope function
3022 used as a template argument.
3024 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
3025 builtin type and corrects the mangling of lambdas in default argument
3026 scope.
3028 Version 8, which first appeared in G++ 4.9, corrects the substitution
3029 behavior of function types with function-cv-qualifiers.
3031 Version 9, which first appeared in G++ 5.2, corrects the alignment of
3032 @code{nullptr_t}.
3034 Version 10, which first appeared in G++ 6.1, adds mangling of
3035 attributes that affect type identity, such as ia32 calling convention
3036 attributes (e.g.@: @samp{stdcall}).
3038 Version 11, which first appeared in G++ 7, corrects the mangling of
3039 sizeof... expressions and operator names.  For multiple entities with
3040 the same name within a function, that are declared in different scopes,
3041 the mangling now changes starting with the twelfth occurrence.  It also
3042 implies @option{-fnew-inheriting-ctors}.
3044 Version 12, which first appeared in G++ 8, corrects the calling
3045 conventions for empty classes on the x86_64 target and for classes
3046 with only deleted copy/move constructors.  It accidentally changes the
3047 calling convention for classes with a deleted copy constructor and a
3048 trivial move constructor.
3050 Version 13, which first appeared in G++ 8.2, fixes the accidental
3051 change in version 12.
3053 Version 14, which first appeared in G++ 10, corrects the mangling of
3054 the nullptr expression.
3056 Version 15, which first appeared in G++ 10.3, corrects G++ 10 ABI
3057 tag regression.
3059 Version 16, which first appeared in G++ 11, changes the mangling of
3060 @code{__alignof__} to be distinct from that of @code{alignof}, and
3061 dependent operator names.
3063 Version 17, which first appeared in G++ 12, fixes layout of classes
3064 that inherit from aggregate classes with default member initializers
3065 in C++14 and up.
3067 Version 18, which first appeard in G++ 13, fixes manglings of lambdas
3068 that have additional context.
3070 Version 19, which first appeard in G++ 14, fixes manglings of structured
3071 bindings to include ABI tags.
3073 See also @option{-Wabi}.
3075 @opindex fabi-compat-version
3076 @item -fabi-compat-version=@var{n}
3077 On targets that support strong aliases, G++
3078 works around mangling changes by creating an alias with the correct
3079 mangled name when defining a symbol with an incorrect mangled name.
3080 This switch specifies which ABI version to use for the alias.
3082 With @option{-fabi-version=0} (the default), this defaults to 13 (GCC 8.2
3083 compatibility).  If another ABI version is explicitly selected, this
3084 defaults to 0.  For compatibility with GCC versions 3.2 through 4.9,
3085 use @option{-fabi-compat-version=2}.
3087 If this option is not provided but @option{-Wabi=@var{n}} is, that
3088 version is used for compatibility aliases.  If this option is provided
3089 along with @option{-Wabi} (without the version), the version from this
3090 option is used for the warning.
3092 @opindex fno-access-control
3093 @opindex faccess-control
3094 @item -fno-access-control
3095 Turn off all access checking.  This switch is mainly useful for working
3096 around bugs in the access control code.
3098 @opindex faligned-new
3099 @item -faligned-new
3100 Enable support for C++17 @code{new} of types that require more
3101 alignment than @code{void* ::operator new(std::size_t)} provides.  A
3102 numeric argument such as @code{-faligned-new=32} can be used to
3103 specify how much alignment (in bytes) is provided by that function,
3104 but few users will need to override the default of
3105 @code{alignof(std::max_align_t)}.
3107 This flag is enabled by default for @option{-std=c++17}.
3109 @opindex fchar8_t
3110 @opindex fno-char8_t
3111 @item -fchar8_t
3112 @itemx -fno-char8_t
3113 Enable support for @code{char8_t} as adopted for C++20.  This includes
3114 the addition of a new @code{char8_t} fundamental type, changes to the
3115 types of UTF-8 string and character literals, new signatures for
3116 user-defined literals, associated standard library updates, and new
3117 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
3119 This option enables functions to be overloaded for ordinary and UTF-8
3120 strings:
3122 @smallexample
3123 int f(const char *);    // #1
3124 int f(const char8_t *); // #2
3125 int v1 = f("text");     // Calls #1
3126 int v2 = f(u8"text");   // Calls #2
3127 @end smallexample
3129 @noindent
3130 and introduces new signatures for user-defined literals:
3132 @smallexample
3133 int operator""_udl1(char8_t);
3134 int v3 = u8'x'_udl1;
3135 int operator""_udl2(const char8_t*, std::size_t);
3136 int v4 = u8"text"_udl2;
3137 template<typename T, T...> int operator""_udl3();
3138 int v5 = u8"text"_udl3;
3139 @end smallexample
3141 @noindent
3142 The change to the types of UTF-8 string and character literals introduces
3143 incompatibilities with ISO C++11 and later standards.  For example, the
3144 following code is well-formed under ISO C++11, but is ill-formed when
3145 @option{-fchar8_t} is specified.
3147 @smallexample
3148 const char *cp = u8"xx";// error: invalid conversion from
3149                         //        `const char8_t*' to `const char*'
3150 int f(const char*);
3151 auto v = f(u8"xx");     // error: invalid conversion from
3152                         //        `const char8_t*' to `const char*'
3153 std::string s@{u8"xx"@};  // error: no matching function for call to
3154                         //        `std::basic_string<char>::basic_string()'
3155 using namespace std::literals;
3156 s = u8"xx"s;            // error: conversion from
3157                         //        `basic_string<char8_t>' to non-scalar
3158                         //        type `basic_string<char>' requested
3159 @end smallexample
3161 @opindex fcheck-new
3162 @item -fcheck-new
3163 Check that the pointer returned by @code{operator new} is non-null
3164 before attempting to modify the storage allocated.  This check is
3165 normally unnecessary because the C++ standard specifies that
3166 @code{operator new} only returns @code{0} if it is declared
3167 @code{throw()}, in which case the compiler always checks the
3168 return value even without this option.  In all other cases, when
3169 @code{operator new} has a non-empty exception specification, memory
3170 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
3171 @samp{new (nothrow)}.
3173 @opindex fconcepts
3174 @opindex fconcepts-ts
3175 @item -fconcepts
3176 @itemx -fconcepts-ts
3177 Enable support for the C++ Concepts feature for constraining template
3178 arguments.  With @option{-std=c++20} and above, Concepts are part of
3179 the language standard, so @option{-fconcepts} defaults to on.
3181 Some constructs that were allowed by the earlier C++ Extensions for
3182 Concepts Technical Specification, ISO 19217 (2015), but didn't make it
3183 into the standard, can additionally be enabled by
3184 @option{-fconcepts-ts}.
3186 @opindex fconstexpr-depth
3187 @item -fconstexpr-depth=@var{n}
3188 Set the maximum nested evaluation depth for C++11 constexpr functions
3189 to @var{n}.  A limit is needed to detect endless recursion during
3190 constant expression evaluation.  The minimum specified by the standard
3191 is 512.
3193 @opindex fconstexpr-cache-depth
3194 @item -fconstexpr-cache-depth=@var{n}
3195 Set the maximum level of nested evaluation depth for C++11 constexpr
3196 functions that will be cached to @var{n}.  This is a heuristic that
3197 trades off compilation speed (when the cache avoids repeated
3198 calculations) against memory consumption (when the cache grows very
3199 large from highly recursive evaluations).  The default is 8.  Very few
3200 users are likely to want to adjust it, but if your code does heavy
3201 constexpr calculations you might want to experiment to find which
3202 value works best for you.
3204 @opindex fconstexpr-fp-except
3205 @item -fconstexpr-fp-except
3206 Annex F of the C standard specifies that IEC559 floating point
3207 exceptions encountered at compile time should not stop compilation.
3208 C++ compilers have historically not followed this guidance, instead
3209 treating floating point division by zero as non-constant even though
3210 it has a well defined value.  This flag tells the compiler to give
3211 Annex F priority over other rules saying that a particular operation
3212 is undefined.
3214 @smallexample
3215 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
3216 @end smallexample
3218 @opindex fconstexpr-loop-limit
3219 @item -fconstexpr-loop-limit=@var{n}
3220 Set the maximum number of iterations for a loop in C++14 constexpr functions
3221 to @var{n}.  A limit is needed to detect infinite loops during
3222 constant expression evaluation.  The default is 262144 (1<<18).
3224 @opindex fconstexpr-ops-limit
3225 @item -fconstexpr-ops-limit=@var{n}
3226 Set the maximum number of operations during a single constexpr evaluation.
3227 Even when number of iterations of a single loop is limited with the above limit,
3228 if there are several nested loops and each of them has many iterations but still
3229 smaller than the above limit, or if in a body of some loop or even outside
3230 of a loop too many expressions need to be evaluated, the resulting constexpr
3231 evaluation might take too long.
3232 The default is 33554432 (1<<25).
3234 @opindex fcontracts
3235 @item -fcontracts
3236 Enable experimental support for the C++ Contracts feature, as briefly
3237 added to and then removed from the C++20 working paper (N4820).  The
3238 implementation also includes proposed enhancements from papers P1290,
3239 P1332, and P1429.  This functionality is intended mostly for those
3240 interested in experimentation towards refining the feature to get it
3241 into shape for a future C++ standard.
3243 On violation of a checked contract, the violation handler is called.
3244 Users can replace the violation handler by defining
3245 @smallexample
3246 void
3247 handle_contract_violation (const std::experimental::contract_violation&);
3248 @end smallexample
3250 There are different sets of additional flags that can be used together
3251 to specify which contracts will be checked and how, for N4820
3252 contracts, P1332 contracts, or P1429 contracts; these sets cannot be
3253 used together.
3255 @table @gcctabopt
3256 @opindex fcontract-mode
3257 @item -fcontract-mode=[on|off]
3258 Control whether any contracts have any semantics at all.  Defaults to on.
3260 @opindex fcontract-assumption-mode
3261 @item -fcontract-assumption-mode=[on|off]
3262 [N4820] Control whether contracts with level @samp{axiom}
3263 should have the assume semantic.  Defaults to on.
3265 @opindex fcontract-build-level
3266 @item -fcontract-build-level=[off|default|audit]
3267 [N4820] Specify which level of contracts to generate checks
3268 for.  Defaults to @samp{default}.
3270 @opindex fcontract-continuation-mode
3271 @item -fcontract-continuation-mode=[on|off]
3272 [N4820] Control whether to allow the program to continue executing
3273 after a contract violation.  That is, do checked contracts have the
3274 @samp{maybe} semantic described below rather than the @samp{never}
3275 semantic.  Defaults to off.
3277 @opindex fcontract-role
3278 @item -fcontract-role=<name>:<default>,<audit>,<axiom>
3279 [P1332] Specify the concrete semantics for each contract level
3280 of a particular contract role.
3282 @item -fcontract-semantic=[default|audit|axiom]:<semantic>
3283 [P1429] Specify the concrete semantic for a particular
3284 contract level.
3286 @opindex fcontract-strict-declarations
3287 @item -fcontract-strict-declarations=[on|off]
3288 Control whether to reject adding contracts to a function after its
3289 first declaration.  Defaults to off.
3290 @end table
3292 The possible concrete semantics for that can be specified with
3293 @samp{-fcontract-role} or @samp{-fcontract-semantic} are:
3295 @table @code
3296 @item ignore
3297 This contract has no effect.
3299 @item assume
3300 This contract is treated like C++23 @code{[[assume]]}.
3302 @item check_never_continue
3303 @itemx never
3304 @itemx abort
3305 This contract is checked.  If it fails, the violation handler is
3306 called.  If the handler returns, @code{std::terminate} is called.
3308 @item check_maybe_continue
3309 @itemx maybe
3310 This contract is checked.  If it fails, the violation handler is
3311 called.  If the handler returns, execution continues normally.
3312 @end table
3314 @opindex fcoroutines
3315 @item -fcoroutines
3316 Enable support for the C++ coroutines extension (experimental).
3318 @opindex fno-elide-constructors
3319 @opindex felide-constructors
3320 @item -fno-elide-constructors
3321 The C++ standard allows an implementation to omit creating a temporary
3322 that is only used to initialize another object of the same type.
3323 Specifying this option disables that optimization, and forces G++ to
3324 call the copy constructor in all cases.  This option also causes G++
3325 to call trivial member functions which otherwise would be expanded inline.
3327 In C++17, the compiler is required to omit these temporaries, but this
3328 option still affects trivial member functions.
3330 @opindex fno-enforce-eh-specs
3331 @opindex fenforce-eh-specs
3332 @item -fno-enforce-eh-specs
3333 Don't generate code to check for violation of exception specifications
3334 at run time.  This option violates the C++ standard, but may be useful
3335 for reducing code size in production builds, much like defining
3336 @code{NDEBUG}.  This does not give user code permission to throw
3337 exceptions in violation of the exception specifications; the compiler
3338 still optimizes based on the specifications, so throwing an
3339 unexpected exception results in undefined behavior at run time.
3341 @opindex fextern-tls-init
3342 @opindex fno-extern-tls-init
3343 @item -fextern-tls-init
3344 @itemx -fno-extern-tls-init
3345 The C++11 and OpenMP standards allow @code{thread_local} and
3346 @code{threadprivate} variables to have dynamic (runtime)
3347 initialization.  To support this, any use of such a variable goes
3348 through a wrapper function that performs any necessary initialization.
3349 When the use and definition of the variable are in the same
3350 translation unit, this overhead can be optimized away, but when the
3351 use is in a different translation unit there is significant overhead
3352 even if the variable doesn't actually need dynamic initialization.  If
3353 the programmer can be sure that no use of the variable in a
3354 non-defining TU needs to trigger dynamic initialization (either
3355 because the variable is statically initialized, or a use of the
3356 variable in the defining TU will be executed before any uses in
3357 another TU), they can avoid this overhead with the
3358 @option{-fno-extern-tls-init} option.
3360 On targets that support symbol aliases, the default is
3361 @option{-fextern-tls-init}.  On targets that do not support symbol
3362 aliases, the default is @option{-fno-extern-tls-init}.
3364 @opindex ffold-simple-inlines
3365 @opindex fno-fold-simple-inlines
3366 @item -ffold-simple-inlines
3367 @itemx -fno-fold-simple-inlines
3368 Permit the C++ frontend to fold calls to @code{std::move}, @code{std::forward},
3369 @code{std::addressof} and @code{std::as_const}.  In contrast to inlining, this
3370 means no debug information will be generated for such calls.  Since these
3371 functions are rarely interesting to debug, this flag is enabled by default
3372 unless @option{-fno-inline} is active.
3374 @opindex fno-gnu-keywords
3375 @opindex fgnu-keywords
3376 @item -fno-gnu-keywords
3377 Do not recognize @code{typeof} as a keyword, so that code can use this
3378 word as an identifier.  You can use the keyword @code{__typeof__} instead.
3379 This option is implied by the strict ISO C++ dialects: @option{-ansi},
3380 @option{-std=c++98}, @option{-std=c++11}, etc.
3382 @opindex fimplicit-constexpr
3383 @item -fimplicit-constexpr
3384 Make inline functions implicitly constexpr, if they satisfy the
3385 requirements for a constexpr function.  This option can be used in
3386 C++14 mode or later.  This can result in initialization changing from
3387 dynamic to static and other optimizations.
3389 @opindex fno-implicit-templates
3390 @opindex fimplicit-templates
3391 @item -fno-implicit-templates
3392 Never emit code for non-inline templates that are instantiated
3393 implicitly (i.e.@: by use); only emit code for explicit instantiations.
3394 If you use this option, you must take care to structure your code to
3395 include all the necessary explicit instantiations to avoid getting
3396 undefined symbols at link time.
3397 @xref{Template Instantiation}, for more information.
3399 @opindex fno-implicit-inline-templates
3400 @opindex fimplicit-inline-templates
3401 @item -fno-implicit-inline-templates
3402 Don't emit code for implicit instantiations of inline templates, either.
3403 The default is to handle inlines differently so that compiles with and
3404 without optimization need the same set of explicit instantiations.
3406 @opindex fno-implement-inlines
3407 @opindex fimplement-inlines
3408 @item -fno-implement-inlines
3409 To save space, do not emit out-of-line copies of inline functions
3410 controlled by @code{#pragma implementation}.  This causes linker
3411 errors if these functions are not inlined everywhere they are called.
3413 @opindex fmodules-ts
3414 @opindex fno-modules-ts
3415 @item -fmodules-ts
3416 @itemx -fno-modules-ts
3417 Enable support for C++20 modules (@pxref{C++ Modules}).  The
3418 @option{-fno-modules-ts} is usually not needed, as that is the
3419 default.  Even though this is a C++20 feature, it is not currently
3420 implicitly enabled by selecting that standard version.
3422 @opindex fmodule-header
3423 @item -fmodule-header
3424 @itemx -fmodule-header=user
3425 @itemx -fmodule-header=system
3426 Compile a header file to create an importable header unit.
3428 @opindex fmodule-implicit-inline
3429 @item -fmodule-implicit-inline
3430 Member functions defined in their class definitions are not implicitly
3431 inline for modular code.  This is different to traditional C++
3432 behavior, for good reasons.  However, it may result in a difficulty
3433 during code porting.  This option makes such function definitions
3434 implicitly inline.  It does however generate an ABI incompatibility,
3435 so you must use it everywhere or nowhere.  (Such definitions outside
3436 of a named module remain implicitly inline, regardless.)
3438 @opindex fno-module-lazy
3439 @opindex fmodule-lazy
3440 @item -fno-module-lazy
3441 Disable lazy module importing and module mapper creation.
3443 @vindex CXX_MODULE_MAPPER @r{environment variable}
3444 @opindex fmodule-mapper
3445 @item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
3446 @itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...}
3447 @itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]}
3448 @itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]}
3449 @itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]}
3450 @itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]}
3451 An oracle to query for module name to filename mappings.  If
3452 unspecified the @env{CXX_MODULE_MAPPER} environment variable is used,
3453 and if that is unset, an in-process default is provided.
3455 @opindex fmodule-only
3456 @item -fmodule-only
3457 Only emit the Compiled Module Interface, inhibiting any object file.
3459 @opindex fms-extensions
3460 @item -fms-extensions
3461 Disable Wpedantic warnings about constructs used in MFC, such as implicit
3462 int and getting a pointer to member function via non-standard syntax.
3464 @opindex fnew-inheriting-ctors
3465 @item -fnew-inheriting-ctors
3466 Enable the P0136 adjustment to the semantics of C++11 constructor
3467 inheritance.  This is part of C++17 but also considered to be a Defect
3468 Report against C++11 and C++14.  This flag is enabled by default
3469 unless @option{-fabi-version=10} or lower is specified.
3471 @opindex fnew-ttp-matching
3472 @item -fnew-ttp-matching
3473 Enable the P0522 resolution to Core issue 150, template template
3474 parameters and default arguments: this allows a template with default
3475 template arguments as an argument for a template template parameter
3476 with fewer template parameters.  This flag is enabled by default for
3477 @option{-std=c++17}.
3479 @opindex fno-nonansi-builtins
3480 @opindex fnonansi-builtins
3481 @item -fno-nonansi-builtins
3482 Disable built-in declarations of functions that are not mandated by
3483 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
3484 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
3486 @opindex fnothrow-opt
3487 @item -fnothrow-opt
3488 Treat a @code{throw()} exception specification as if it were a
3489 @code{noexcept} specification to reduce or eliminate the text size
3490 overhead relative to a function with no exception specification.  If
3491 the function has local variables of types with non-trivial
3492 destructors, the exception specification actually makes the
3493 function smaller because the EH cleanups for those variables can be
3494 optimized away.  The semantic effect is that an exception thrown out of
3495 a function with such an exception specification results in a call
3496 to @code{terminate} rather than @code{unexpected}.
3498 @opindex fno-operator-names
3499 @opindex foperator-names
3500 @item -fno-operator-names
3501 Do not treat the operator name keywords @code{and}, @code{bitand},
3502 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3503 synonyms as keywords.
3505 @opindex fno-optional-diags
3506 @opindex foptional-diags
3507 @item -fno-optional-diags
3508 Disable diagnostics that the standard says a compiler does not need to
3509 issue.  Currently, the only such diagnostic issued by G++ is the one for
3510 a name having multiple meanings within a class.
3512 @opindex fno-pretty-templates
3513 @opindex fpretty-templates
3514 @item -fno-pretty-templates
3515 When an error message refers to a specialization of a function
3516 template, the compiler normally prints the signature of the
3517 template followed by the template arguments and any typedefs or
3518 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3519 rather than @code{void f(int)}) so that it's clear which template is
3520 involved.  When an error message refers to a specialization of a class
3521 template, the compiler omits any template arguments that match
3522 the default template arguments for that template.  If either of these
3523 behaviors make it harder to understand the error message rather than
3524 easier, you can use @option{-fno-pretty-templates} to disable them.
3526 @opindex fno-rtti
3527 @opindex frtti
3528 @item -fno-rtti
3529 Disable generation of information about every class with virtual
3530 functions for use by the C++ run-time type identification features
3531 (@code{dynamic_cast} and @code{typeid}).  If you don't use those parts
3532 of the language, you can save some space by using this flag.  Note that
3533 exception handling uses the same information, but G++ generates it as
3534 needed. The @code{dynamic_cast} operator can still be used for casts that
3535 do not require run-time type information, i.e.@: casts to @code{void *} or to
3536 unambiguous base classes.
3538 Mixing code compiled with @option{-frtti} with that compiled with
3539 @option{-fno-rtti} may not work.  For example, programs may
3540 fail to link if a class compiled with @option{-fno-rtti} is used as a base 
3541 for a class compiled with @option{-frtti}.  
3543 @opindex fsized-deallocation
3544 @item -fsized-deallocation
3545 Enable the built-in global declarations
3546 @smallexample
3547 void operator delete (void *, std::size_t) noexcept;
3548 void operator delete[] (void *, std::size_t) noexcept;
3549 @end smallexample
3550 as introduced in C++14.  This is useful for user-defined replacement
3551 deallocation functions that, for example, use the size of the object
3552 to make deallocation faster.  Enabled by default under
3553 @option{-std=c++14} and above.  The flag @option{-Wsized-deallocation}
3554 warns about places that might want to add a definition.
3556 @opindex fstrict-enums
3557 @item -fstrict-enums
3558 Allow the compiler to optimize using the assumption that a value of
3559 enumerated type can only be one of the values of the enumeration (as
3560 defined in the C++ standard; basically, a value that can be
3561 represented in the minimum number of bits needed to represent all the
3562 enumerators).  This assumption may not be valid if the program uses a
3563 cast to convert an arbitrary integer value to the enumerated type.
3564 This option has no effect for an enumeration type with a fixed underlying
3565 type.
3567 @opindex fstrong-eval-order
3568 @item -fstrong-eval-order
3569 Evaluate member access, array subscripting, and shift expressions in
3570 left-to-right order, and evaluate assignment in right-to-left order,
3571 as adopted for C++17.  Enabled by default with @option{-std=c++17}.
3572 @option{-fstrong-eval-order=some} enables just the ordering of member
3573 access and shift expressions, and is the default without
3574 @option{-std=c++17}.
3576 @opindex ftemplate-backtrace-limit
3577 @item -ftemplate-backtrace-limit=@var{n}
3578 Set the maximum number of template instantiation notes for a single
3579 warning or error to @var{n}.  The default value is 10.
3581 @opindex ftemplate-depth
3582 @item -ftemplate-depth=@var{n}
3583 Set the maximum instantiation depth for template classes to @var{n}.
3584 A limit on the template instantiation depth is needed to detect
3585 endless recursions during template class instantiation.  ANSI/ISO C++
3586 conforming programs must not rely on a maximum depth greater than 17
3587 (changed to 1024 in C++11).  The default value is 900, as the compiler
3588 can run out of stack space before hitting 1024 in some situations.
3590 @opindex fno-threadsafe-statics
3591 @opindex fthreadsafe-statics
3592 @item -fno-threadsafe-statics
3593 Do not emit the extra code to use the routines specified in the C++
3594 ABI for thread-safe initialization of local statics.  You can use this
3595 option to reduce code size slightly in code that doesn't need to be
3596 thread-safe.
3598 @opindex fuse-cxa-atexit
3599 @item -fuse-cxa-atexit
3600 Register destructors for objects with static storage duration with the
3601 @code{__cxa_atexit} function rather than the @code{atexit} function.
3602 This option is required for fully standards-compliant handling of static
3603 destructors, but only works if your C library supports
3604 @code{__cxa_atexit}.
3606 @opindex fno-use-cxa-get-exception-ptr
3607 @opindex fuse-cxa-get-exception-ptr
3608 @item -fno-use-cxa-get-exception-ptr
3609 Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
3610 causes @code{std::uncaught_exception} to be incorrect, but is necessary
3611 if the runtime routine is not available.
3613 @opindex fvisibility-inlines-hidden
3614 @item -fvisibility-inlines-hidden
3615 This switch declares that the user does not attempt to compare
3616 pointers to inline functions or methods where the addresses of the two functions
3617 are taken in different shared objects.
3619 The effect of this is that GCC may, effectively, mark inline methods with
3620 @code{__attribute__ ((visibility ("hidden")))} so that they do not
3621 appear in the export table of a DSO and do not require a PLT indirection
3622 when used within the DSO@.  Enabling this option can have a dramatic effect
3623 on load and link times of a DSO as it massively reduces the size of the
3624 dynamic export table when the library makes heavy use of templates.
3626 The behavior of this switch is not quite the same as marking the
3627 methods as hidden directly, because it does not affect static variables
3628 local to the function or cause the compiler to deduce that
3629 the function is defined in only one shared object.
3631 You may mark a method as having a visibility explicitly to negate the
3632 effect of the switch for that method.  For example, if you do want to
3633 compare pointers to a particular inline method, you might mark it as
3634 having default visibility.  Marking the enclosing class with explicit
3635 visibility has no effect.
3637 Explicitly instantiated inline methods are unaffected by this option
3638 as their linkage might otherwise cross a shared library boundary.
3639 @xref{Template Instantiation}.
3641 @opindex fvisibility-ms-compat
3642 @item -fvisibility-ms-compat
3643 This flag attempts to use visibility settings to make GCC's C++
3644 linkage model compatible with that of Microsoft Visual Studio.
3646 The flag makes these changes to GCC's linkage model:
3648 @enumerate
3649 @item
3650 It sets the default visibility to @code{hidden}, like
3651 @option{-fvisibility=hidden}.
3653 @item
3654 Types, but not their members, are not hidden by default.
3656 @item
3657 The One Definition Rule is relaxed for types without explicit
3658 visibility specifications that are defined in more than one
3659 shared object: those declarations are permitted if they are
3660 permitted when this option is not used.
3661 @end enumerate
3663 In new code it is better to use @option{-fvisibility=hidden} and
3664 export those classes that are intended to be externally visible.
3665 Unfortunately it is possible for code to rely, perhaps accidentally,
3666 on the Visual Studio behavior.
3668 Among the consequences of these changes are that static data members
3669 of the same type with the same name but defined in different shared
3670 objects are different, so changing one does not change the other;
3671 and that pointers to function members defined in different shared
3672 objects may not compare equal.  When this flag is given, it is a
3673 violation of the ODR to define types with the same name differently.
3675 @opindex fno-weak
3676 @opindex fweak
3677 @item -fno-weak
3678 Do not use weak symbol support, even if it is provided by the linker.
3679 By default, G++ uses weak symbols if they are available.  This
3680 option exists only for testing, and should not be used by end-users;
3681 it results in inferior code and has no benefits.  This option may
3682 be removed in a future release of G++.
3684 @opindex fext-numeric-literals
3685 @opindex fno-ext-numeric-literals
3686 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3687 Accept imaginary, fixed-point, or machine-defined
3688 literal number suffixes as GNU extensions.
3689 When this option is turned off these suffixes are treated
3690 as C++11 user-defined literal numeric suffixes.
3691 This is on by default for all pre-C++11 dialects and all GNU dialects:
3692 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3693 @option{-std=gnu++14}.
3694 This option is off by default
3695 for ISO C++11 onwards (@option{-std=c++11}, ...).
3697 @opindex nostdinc++
3698 @item -nostdinc++
3699 Do not search for header files in the standard directories specific to
3700 C++, but do still search the other standard directories.  (This option
3701 is used when building the C++ library.)
3703 @opindex flang-info-include-translate
3704 @opindex flang-info-include-translate-not
3705 @item -flang-info-include-translate
3706 @itemx -flang-info-include-translate-not
3707 @itemx -flang-info-include-translate=@var{header}
3708 Inform of include translation events.  The first will note accepted
3709 include translations, the second will note declined include
3710 translations.  The @var{header} form will inform of include
3711 translations relating to that specific header.  If @var{header} is of
3712 the form @code{"user"} or @code{<system>} it will be resolved to a
3713 specific user or system header using the include path.
3715 @opindex flang-info-module-cmi
3716 @item -flang-info-module-cmi
3717 @itemx -flang-info-module-cmi=@var{module}
3718 Inform of Compiled Module Interface pathnames.  The first will note
3719 all read CMI pathnames.  The @var{module} form will not reading a
3720 specific module's CMI.  @var{module} may be a named module or a
3721 header-unit (the latter indicated by either being a pathname containing
3722 directory separators or enclosed in @code{<>} or @code{""}).
3724 @opindex stdlib
3725 @item -stdlib=@var{libstdc++,libc++}
3726 When G++ is configured to support this option, it allows specification of
3727 alternate C++ runtime libraries.  Two options are available: @var{libstdc++}
3728 (the default, native C++ runtime for G++) and @var{libc++} which is the
3729 C++ runtime installed on some operating systems (e.g. Darwin versions from
3730 Darwin11 onwards).  The option switches G++ to use the headers from the
3731 specified library and to emit @code{-lstdc++} or @code{-lc++} respectively,
3732 when a C++ runtime is required for linking.
3733 @end table
3735 In addition, these warning options have meanings only for C++ programs:
3737 @table @gcctabopt
3738 @opindex Wabi-tag
3739 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3740 Warn when a type with an ABI tag is used in a context that does not
3741 have that ABI tag.  See @ref{C++ Attributes} for more information
3742 about ABI tags.
3744 @opindex Wcomma-subscript
3745 @opindex Wno-comma-subscript
3746 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3747 Warn about uses of a comma expression within a subscripting expression.
3748 This usage was deprecated in C++20 and is going to be removed in C++23.
3749 However, a comma expression wrapped in @code{( )} is not deprecated.  Example:
3751 @smallexample
3752 @group
3753 void f(int *a, int b, int c) @{
3754     a[b,c];     // deprecated in C++20, invalid in C++23
3755     a[(b,c)];   // OK
3757 @end group
3758 @end smallexample
3760 In C++23 it is valid to have comma separated expressions in a subscript
3761 when an overloaded subscript operator is found and supports the right
3762 number and types of arguments.  G++ will accept the formerly valid syntax
3763 for code that is not valid in C++23 but used to be valid but deprecated
3764 in C++20 with a pedantic warning that can be disabled with
3765 @option{-Wno-comma-subscript}.
3767 Enabled by default with @option{-std=c++20} unless @option{-Wno-deprecated},
3768 and with @option{-std=c++23} regardless of @option{-Wno-deprecated}.
3770 This warning is upgraded to an error by @option{-pedantic-errors} in
3771 C++23 mode or later.
3773 @opindex Wctad-maybe-unsupported
3774 @opindex Wno-ctad-maybe-unsupported
3775 @item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)}
3776 Warn when performing class template argument deduction (CTAD) on a type with
3777 no explicitly written deduction guides.  This warning will point out cases
3778 where CTAD succeeded only because the compiler synthesized the implicit
3779 deduction guides, which might not be what the programmer intended.  Certain
3780 style guides allow CTAD only on types that specifically "opt-in"; i.e., on
3781 types that are designed to support CTAD.  This warning can be suppressed with
3782 the following pattern:
3784 @smallexample
3785 struct allow_ctad_t; // any name works
3786 template <typename T> struct S @{
3787   S(T) @{ @}
3789 // Guide with incomplete parameter type will never be considered.
3790 S(allow_ctad_t) -> S<void>;
3791 @end smallexample
3793 @opindex Wctor-dtor-privacy
3794 @opindex Wno-ctor-dtor-privacy
3795 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3796 Warn when a class seems unusable because all the constructors or
3797 destructors in that class are private, and it has neither friends nor
3798 public static member functions.  Also warn if there are no non-private
3799 methods, and there's at least one private member function that isn't
3800 a constructor or destructor.
3802 @opindex Wdangling-reference
3803 @opindex Wno-dangling-reference
3804 @item -Wdangling-reference @r{(C++ and Objective-C++ only)}
3805 Warn when a reference is bound to a temporary whose lifetime has ended.
3806 For example:
3808 @smallexample
3809 int n = 1;
3810 const int& r = std::max(n - 1, n + 1); // r is dangling
3811 @end smallexample
3813 In the example above, two temporaries are created, one for each
3814 argument, and a reference to one of the temporaries is returned.
3815 However, both temporaries are destroyed at the end of the full
3816 expression, so the reference @code{r} is dangling.  This warning
3817 also detects dangling references in member initializer lists:
3819 @smallexample
3820 const int& f(const int& i) @{ return i; @}
3821 struct S @{
3822   const int &r; // r is dangling
3823   S() : r(f(10)) @{ @}
3825 @end smallexample
3827 Member functions are checked as well, but only their object argument:
3829 @smallexample
3830 struct S @{
3831    const S& self () @{ return *this; @}
3833 const S& s = S().self(); // s is dangling
3834 @end smallexample
3836 Certain functions are safe in this respect, for example @code{std::use_facet}:
3837 they take and return a reference, but they don't return one of its arguments,
3838 which can fool the warning.  Such functions can be excluded from the warning
3839 by wrapping them in a @code{#pragma}:
3841 @smallexample
3842 #pragma GCC diagnostic push
3843 #pragma GCC diagnostic ignored "-Wdangling-reference"
3844 const T& foo (const T&) @{ @dots{} @}
3845 #pragma GCC diagnostic pop
3846 @end smallexample
3848 @option{-Wdangling-reference} also warns about code like
3850 @smallexample
3851 auto p = std::minmax(1, 2);
3852 @end smallexample
3854 where @code{std::minmax} returns @code{std::pair<const int&, const int&>}, and
3855 both references dangle after the end of the full expression that contains
3856 the call to @code{std::minmax}.
3858 This warning is enabled by @option{-Wall}.
3860 @opindex Wdelete-non-virtual-dtor
3861 @opindex Wno-delete-non-virtual-dtor
3862 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3863 Warn when @code{delete} is used to destroy an instance of a class that
3864 has virtual functions and non-virtual destructor. It is unsafe to delete
3865 an instance of a derived class through a pointer to a base class if the
3866 base class does not have a virtual destructor.  This warning is enabled
3867 by @option{-Wall}.
3869 @opindex Wdeprecated-copy
3870 @opindex Wno-deprecated-copy
3871 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3872 Warn that the implicit declaration of a copy constructor or copy
3873 assignment operator is deprecated if the class has a user-provided
3874 copy constructor or copy assignment operator, in C++11 and up.  This
3875 warning is enabled by @option{-Wextra}.  With
3876 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3877 user-provided destructor.
3879 @opindex Wdeprecated-enum-enum-conversion
3880 @opindex Wno-deprecated-enum-enum-conversion
3881 @item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)}
3882 Disable the warning about the case when the usual arithmetic conversions
3883 are applied on operands where one is of enumeration type and the other is
3884 of a different enumeration type.  This conversion was deprecated in C++20.
3885 For example:
3887 @smallexample
3888 enum E1 @{ e @};
3889 enum E2 @{ f @};
3890 int k = f - e;
3891 @end smallexample
3893 @option{-Wdeprecated-enum-enum-conversion} is enabled by default with
3894 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3895 by @option{-Wenum-conversion}.
3897 @opindex Wdeprecated-enum-float-conversion
3898 @opindex Wno-deprecated-enum-float-conversion
3899 @item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)}
3900 Disable the warning about the case when the usual arithmetic conversions
3901 are applied on operands where one is of enumeration type and the other is
3902 of a floating-point type.  This conversion was deprecated in C++20.  For
3903 example:
3905 @smallexample
3906 enum E1 @{ e @};
3907 enum E2 @{ f @};
3908 bool b = e <= 3.7;
3909 @end smallexample
3911 @option{-Wdeprecated-enum-float-conversion} is enabled by default with
3912 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3913 by @option{-Wenum-conversion}.
3915 @opindex Welaborated-enum-base
3916 @opindex Wno-elaborated-enum-base
3917 @item -Wno-elaborated-enum-base
3918 For C++11 and above, warn if an (invalid) additional enum-base is used
3919 in an elaborated-type-specifier.  That is, if an enum with given
3920 underlying type and no enumerator list is used in a declaration other
3921 than just a standalone declaration of the enum.  Enabled by default.  This
3922 warning is upgraded to an error with -pedantic-errors.
3924 @opindex Winit-list-lifetime
3925 @opindex Wno-init-list-lifetime
3926 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3927 Do not warn about uses of @code{std::initializer_list} that are likely
3928 to result in dangling pointers.  Since the underlying array for an
3929 @code{initializer_list} is handled like a normal C++ temporary object,
3930 it is easy to inadvertently keep a pointer to the array past the end
3931 of the array's lifetime.  For example:
3933 @itemize @bullet
3934 @item
3935 If a function returns a temporary @code{initializer_list}, or a local
3936 @code{initializer_list} variable, the array's lifetime ends at the end
3937 of the return statement, so the value returned has a dangling pointer.
3939 @item
3940 If a new-expression creates an @code{initializer_list}, the array only
3941 lives until the end of the enclosing full-expression, so the
3942 @code{initializer_list} in the heap has a dangling pointer.
3944 @item
3945 When an @code{initializer_list} variable is assigned from a
3946 brace-enclosed initializer list, the temporary array created for the
3947 right side of the assignment only lives until the end of the
3948 full-expression, so at the next statement the @code{initializer_list}
3949 variable has a dangling pointer.
3951 @smallexample
3952 // li's initial underlying array lives as long as li
3953 std::initializer_list<int> li = @{ 1,2,3 @};
3954 // assignment changes li to point to a temporary array
3955 li = @{ 4, 5 @};
3956 // now the temporary is gone and li has a dangling pointer
3957 int i = li.begin()[0] // undefined behavior
3958 @end smallexample
3960 @item
3961 When a list constructor stores the @code{begin} pointer from the
3962 @code{initializer_list} argument, this doesn't extend the lifetime of
3963 the array, so if a class variable is constructed from a temporary
3964 @code{initializer_list}, the pointer is left dangling by the end of
3965 the variable declaration statement.
3967 @end itemize
3969 @opindex Winvalid-constexpr
3970 @opindex Wno-invalid-constexpr
3971 @item -Winvalid-constexpr
3973 Warn when a function never produces a constant expression.  In C++20
3974 and earlier, for every @code{constexpr} function and function template,
3975 there must be at least one set of function arguments in at least one
3976 instantiation such that an invocation of the function or constructor
3977 could be an evaluated subexpression of a core constant expression.
3978 C++23 removed this restriction, so it's possible to have a function
3979 or a function template marked @code{constexpr} for which no invocation
3980 satisfies the requirements of a core constant expression.
3982 This warning is enabled as a pedantic warning by default in C++20 and
3983 earlier.  In C++23, @option{-Winvalid-constexpr} can be turned on, in
3984 which case it will be an ordinary warning.  For example:
3986 @smallexample
3987 void f (int& i);
3988 constexpr void
3989 g (int& i)
3991   // Warns by default in C++20, in C++23 only with -Winvalid-constexpr.
3992   f(i);
3994 @end smallexample
3996 @opindex Winvalid-imported-macros
3997 @opindex Wno-invalid-imported-macros
3998 @item -Winvalid-imported-macros
3999 Verify all imported macro definitions are valid at the end of
4000 compilation.  This is not enabled by default, as it requires
4001 additional processing to determine.  It may be useful when preparing
4002 sets of header-units to ensure consistent macros.
4004 @opindex Wliteral-suffix
4005 @opindex Wno-literal-suffix
4006 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
4007 Do not warn when a string or character literal is followed by a
4008 ud-suffix which does not begin with an underscore.  As a conforming
4009 extension, GCC treats such suffixes as separate preprocessing tokens
4010 in order to maintain backwards compatibility with code that uses
4011 formatting macros from @code{<inttypes.h>}.  For example:
4013 @smallexample
4014 #define __STDC_FORMAT_MACROS
4015 #include <inttypes.h>
4016 #include <stdio.h>
4018 int main() @{
4019   int64_t i64 = 123;
4020   printf("My int64: %" PRId64"\n", i64);
4022 @end smallexample
4024 In this case, @code{PRId64} is treated as a separate preprocessing token.
4026 This option also controls warnings when a user-defined literal
4027 operator is declared with a literal suffix identifier that doesn't
4028 begin with an underscore. Literal suffix identifiers that don't begin
4029 with an underscore are reserved for future standardization.
4031 These warnings are enabled by default.
4033 @opindex Wnarrowing
4034 @opindex Wno-narrowing
4035 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
4036 For C++11 and later standards, narrowing conversions are diagnosed by default,
4037 as required by the standard.  A narrowing conversion from a constant produces
4038 an error, and a narrowing conversion from a non-constant produces a warning,
4039 but @option{-Wno-narrowing} suppresses the diagnostic.
4040 Note that this does not affect the meaning of well-formed code;
4041 narrowing conversions are still considered ill-formed in SFINAE contexts.
4043 With @option{-Wnarrowing} in C++98, warn when a narrowing
4044 conversion prohibited by C++11 occurs within
4045 @samp{@{ @}}, e.g.
4047 @smallexample
4048 int i = @{ 2.2 @}; // error: narrowing from double to int
4049 @end smallexample
4051 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
4053 @opindex Wnoexcept
4054 @opindex Wno-noexcept
4055 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
4056 Warn when a noexcept-expression evaluates to false because of a call
4057 to a function that does not have a non-throwing exception
4058 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
4059 the compiler to never throw an exception.
4061 @opindex Wnoexcept-type
4062 @opindex Wno-noexcept-type
4063 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
4064 Warn if the C++17 feature making @code{noexcept} part of a function
4065 type changes the mangled name of a symbol relative to C++14.  Enabled
4066 by @option{-Wabi} and @option{-Wc++17-compat}.
4068 As an example:
4070 @smallexample
4071 template <class T> void f(T t) @{ t(); @};
4072 void g() noexcept;
4073 void h() @{ f(g); @} 
4074 @end smallexample
4076 @noindent
4077 In C++14, @code{f} calls @code{f<void(*)()>}, but in
4078 C++17 it calls @code{f<void(*)()noexcept>}.
4080 @opindex Wclass-memaccess
4081 @opindex Wno-class-memaccess
4082 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
4083 Warn when the destination of a call to a raw memory function such as
4084 @code{memset} or @code{memcpy} is an object of class type, and when writing
4085 into such an object might bypass the class non-trivial or deleted constructor
4086 or copy assignment, violate const-correctness or encapsulation, or corrupt
4087 virtual table pointers.  Modifying the representation of such objects may
4088 violate invariants maintained by member functions of the class.  For example,
4089 the call to @code{memset} below is undefined because it modifies a non-trivial
4090 class object and is, therefore, diagnosed.  The safe way to either initialize
4091 or clear the storage of objects of such types is by using the appropriate
4092 constructor or assignment operator, if one is available.
4093 @smallexample
4094 std::string str = "abc";
4095 memset (&str, 0, sizeof str);
4096 @end smallexample
4097 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
4098 Explicitly casting the pointer to the class object to @code{void *} or
4099 to a type that can be safely accessed by the raw memory function suppresses
4100 the warning.
4102 @opindex Wnon-virtual-dtor
4103 @opindex Wno-non-virtual-dtor
4104 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
4105 Warn when a class has virtual functions and an accessible non-virtual
4106 destructor itself or in an accessible polymorphic base class, in which
4107 case it is possible but unsafe to delete an instance of a derived
4108 class through a pointer to the class itself or base class.  This
4109 warning is automatically enabled if @option{-Weffc++} is specified.
4110 The @option{-Wdelete-non-virtual-dtor} option (enabled by @option{-Wall})
4111 should be preferred because it warns about the unsafe cases without false
4112 positives.
4114 @opindex Wregister
4115 @opindex Wno-register
4116 @item -Wregister @r{(C++ and Objective-C++ only)}
4117 Warn on uses of the @code{register} storage class specifier, except
4118 when it is part of the GNU @ref{Explicit Register Variables} extension.
4119 The use of the @code{register} keyword as storage class specifier has
4120 been deprecated in C++11 and removed in C++17.
4121 Enabled by default with @option{-std=c++17}.
4123 @opindex Wreorder
4124 @opindex Wno-reorder
4125 @cindex reordering, warning
4126 @cindex warning for reordering of member initializers
4127 @item -Wreorder @r{(C++ and Objective-C++ only)}
4128 Warn when the order of member initializers given in the code does not
4129 match the order in which they must be executed.  For instance:
4131 @smallexample
4132 struct A @{
4133   int i;
4134   int j;
4135   A(): j (0), i (1) @{ @}
4137 @end smallexample
4139 @noindent
4140 The compiler rearranges the member initializers for @code{i}
4141 and @code{j} to match the declaration order of the members, emitting
4142 a warning to that effect.  This warning is enabled by @option{-Wall}.
4144 @opindex Wpessimizing-move
4145 @opindex Wno-pessimizing-move
4146 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
4147 This warning warns when a call to @code{std::move} prevents copy
4148 elision.  A typical scenario when copy elision can occur is when returning in
4149 a function with a class return type, when the expression being returned is the
4150 name of a non-volatile automatic object, and is not a function parameter, and
4151 has the same type as the function return type.
4153 @smallexample
4154 struct T @{
4155 @dots{}
4157 T fn()
4159   T t;
4160   @dots{}
4161   return std::move (t);
4163 @end smallexample
4165 But in this example, the @code{std::move} call prevents copy elision.
4167 This warning is enabled by @option{-Wall}.
4169 @opindex Wredundant-move
4170 @opindex Wno-redundant-move
4171 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
4172 This warning warns about redundant calls to @code{std::move}; that is, when
4173 a move operation would have been performed even without the @code{std::move}
4174 call.  This happens because the compiler is forced to treat the object as if
4175 it were an rvalue in certain situations such as returning a local variable,
4176 where copy elision isn't applicable.  Consider:
4178 @smallexample
4179 struct T @{
4180 @dots{}
4182 T fn(T t)
4184   @dots{}
4185   return std::move (t);
4187 @end smallexample
4189 Here, the @code{std::move} call is redundant.  Because G++ implements Core
4190 Issue 1579, another example is:
4192 @smallexample
4193 struct T @{ // convertible to U
4194 @dots{}
4196 struct U @{
4197 @dots{}
4199 U fn()
4201   T t;
4202   @dots{}
4203   return std::move (t);
4205 @end smallexample
4206 In this example, copy elision isn't applicable because the type of the
4207 expression being returned and the function return type differ, yet G++
4208 treats the return value as if it were designated by an rvalue.
4210 This warning is enabled by @option{-Wextra}.
4212 @opindex Wrange-loop-construct
4213 @opindex Wno-range-loop-construct
4214 @item -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
4215 This warning warns when a C++ range-based for-loop is creating an unnecessary
4216 copy.  This can happen when the range declaration is not a reference, but
4217 probably should be.  For example:
4219 @smallexample
4220 struct S @{ char arr[128]; @};
4221 void fn () @{
4222   S arr[5];
4223   for (const auto x : arr) @{ @dots{} @}
4225 @end smallexample
4227 It does not warn when the type being copied is a trivially-copyable type whose
4228 size is less than 64 bytes.
4230 This warning also warns when a loop variable in a range-based for-loop is
4231 initialized with a value of a different type resulting in a copy.  For example:
4233 @smallexample
4234 void fn() @{
4235   int arr[10];
4236   for (const double &x : arr) @{ @dots{} @}
4238 @end smallexample
4240 In the example above, in every iteration of the loop a temporary value of
4241 type @code{double} is created and destroyed, to which the reference
4242 @code{const double &} is bound.
4244 This warning is enabled by @option{-Wall}.
4246 @opindex Wredundant-tags
4247 @opindex Wno-redundant-tags
4248 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
4249 Warn about redundant class-key and enum-key in references to class types
4250 and enumerated types in contexts where the key can be eliminated without
4251 causing an ambiguity.  For example:
4253 @smallexample
4254 struct foo;
4255 struct foo *p;   // warn that keyword struct can be eliminated
4256 @end smallexample
4258 @noindent
4259 On the other hand, in this example there is no warning:
4261 @smallexample
4262 struct foo;
4263 void foo ();   // "hides" struct foo
4264 void bar (struct foo&);  // no warning, keyword struct is necessary
4265 @end smallexample
4267 @opindex Wsubobject-linkage
4268 @opindex Wno-subobject-linkage
4269 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
4270 Do not warn
4271 if a class type has a base or a field whose type uses the anonymous
4272 namespace or depends on a type with no linkage.  If a type A depends on
4273 a type B with no or internal linkage, defining it in multiple
4274 translation units would be an ODR violation because the meaning of B
4275 is different in each translation unit.  If A only appears in a single
4276 translation unit, the best way to silence the warning is to give it
4277 internal linkage by putting it in an anonymous namespace as well.  The
4278 compiler doesn't give this warning for types defined in the main .C
4279 file, as those are unlikely to have multiple definitions.
4280 @option{-Wsubobject-linkage} is enabled by default.
4282 @opindex Weffc++
4283 @opindex Wno-effc++
4284 @item -Weffc++ @r{(C++ and Objective-C++ only)}
4285 Warn about violations of the following style guidelines from Scott Meyers'
4286 @cite{Effective C++} series of books:
4288 @itemize @bullet
4289 @item
4290 Define a copy constructor and an assignment operator for classes
4291 with dynamically-allocated memory.
4293 @item
4294 Prefer initialization to assignment in constructors.
4296 @item
4297 Have @code{operator=} return a reference to @code{*this}.
4299 @item
4300 Don't try to return a reference when you must return an object.
4302 @item
4303 Distinguish between prefix and postfix forms of increment and
4304 decrement operators.
4306 @item
4307 Never overload @code{&&}, @code{||}, or @code{,}.
4309 @end itemize
4311 This option also enables @option{-Wnon-virtual-dtor}, which is also
4312 one of the effective C++ recommendations.  However, the check is
4313 extended to warn about the lack of virtual destructor in accessible
4314 non-polymorphic bases classes too.
4316 When selecting this option, be aware that the standard library
4317 headers do not obey all of these guidelines; use @samp{grep -v}
4318 to filter out those warnings.
4320 @opindex Wexceptions
4321 @opindex Wno-exceptions
4322 @item -Wno-exceptions @r{(C++ and Objective-C++ only)}
4323 Disable the warning about the case when an exception handler is shadowed by
4324 another handler, which can point out a wrong ordering of exception handlers.
4326 @opindex Wstrict-null-sentinel
4327 @opindex Wno-strict-null-sentinel
4328 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
4329 Warn about the use of an uncasted @code{NULL} as sentinel.  When
4330 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
4331 to @code{__null}.  Although it is a null pointer constant rather than a
4332 null pointer, it is guaranteed to be of the same size as a pointer.
4333 But this use is not portable across different compilers.
4335 @opindex Wno-non-template-friend
4336 @opindex Wnon-template-friend
4337 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
4338 Disable warnings when non-template friend functions are declared
4339 within a template.  In very old versions of GCC that predate implementation
4340 of the ISO standard, declarations such as 
4341 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
4342 could be interpreted as a particular specialization of a template
4343 function; the warning exists to diagnose compatibility problems, 
4344 and is enabled by default.
4346 @opindex Wold-style-cast
4347 @opindex Wno-old-style-cast
4348 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
4349 Warn if an old-style (C-style) cast to a non-void type is used within
4350 a C++ program.  The new-style casts (@code{dynamic_cast},
4351 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
4352 less vulnerable to unintended effects and much easier to search for.
4354 @opindex Woverloaded-virtual
4355 @opindex Wno-overloaded-virtual
4356 @cindex overloaded virtual function, warning
4357 @cindex warning for overloaded virtual function
4358 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
4359 @itemx -Woverloaded-virtual=@var{n}
4360 Warn when a function declaration hides virtual functions from a
4361 base class.  For example, in:
4363 @smallexample
4364 struct A @{
4365   virtual void f();
4368 struct B: public A @{
4369   void f(int); // does not override
4371 @end smallexample
4373 the @code{A} class version of @code{f} is hidden in @code{B}, and code
4374 like:
4376 @smallexample
4377 B* b;
4378 b->f();
4379 @end smallexample
4381 @noindent
4382 fails to compile.
4384 In cases where the different signatures are not an accident, the
4385 simplest solution is to add a using-declaration to the derived class
4386 to un-hide the base function, e.g. add @code{using A::f;} to @code{B}.
4388 The optional level suffix controls the behavior when all the
4389 declarations in the derived class override virtual functions in the
4390 base class, even if not all of the base functions are overridden:
4392 @smallexample
4393 struct C @{
4394   virtual void f();
4395   virtual void f(int);
4398 struct D: public C @{
4399   void f(int); // does override
4401 @end smallexample
4403 This pattern is less likely to be a mistake; if D is only used
4404 virtually, the user might have decided that the base class semantics
4405 for some of the overloads are fine.
4407 At level 1, this case does not warn; at level 2, it does.
4408 @option{-Woverloaded-virtual} by itself selects level 2.  Level 1 is
4409 included in @option{-Wall}.
4411 @opindex Wno-pmf-conversions
4412 @opindex Wpmf-conversions
4413 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
4414 Disable the diagnostic for converting a bound pointer to member function
4415 to a plain pointer.
4417 @opindex Wsign-promo
4418 @opindex Wno-sign-promo
4419 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
4420 Warn when overload resolution chooses a promotion from unsigned or
4421 enumerated type to a signed type, over a conversion to an unsigned type of
4422 the same size.  Previous versions of G++ tried to preserve
4423 unsignedness, but the standard mandates the current behavior.
4425 @opindex Wtemplates
4426 @opindex Wno-templates
4427 @item -Wtemplates @r{(C++ and Objective-C++ only)}
4428 Warn when a primary template declaration is encountered.  Some coding
4429 rules disallow templates, and this may be used to enforce that rule.
4430 The warning is inactive inside a system header file, such as the STL, so
4431 one can still use the STL.  One may also instantiate or specialize
4432 templates.
4434 @opindex Wmismatched-new-delete
4435 @opindex Wno-mismatched-new-delete
4436 @item -Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
4437 Warn for mismatches between calls to @code{operator new} or @code{operator
4438 delete} and the corresponding call to the allocation or deallocation function.
4439 This includes invocations of C++ @code{operator delete} with pointers
4440 returned from either mismatched forms of @code{operator new}, or from other
4441 functions that allocate objects for which the @code{operator delete} isn't
4442 a suitable deallocator, as well as calls to other deallocation functions
4443 with pointers returned from @code{operator new} for which the deallocation
4444 function isn't suitable.
4446 For example, the @code{delete} expression in the function below is diagnosed
4447 because it doesn't match the array form of the @code{new} expression
4448 the pointer argument was returned from.  Similarly, the call to @code{free}
4449 is also diagnosed.
4451 @smallexample
4452 void f ()
4454   int *a = new int[n];
4455   delete a;   // warning: mismatch in array forms of expressions
4457   char *p = new char[n];
4458   free (p);   // warning: mismatch between new and free
4460 @end smallexample
4462 The related option @option{-Wmismatched-dealloc} diagnoses mismatches
4463 involving allocation and deallocation functions other than @code{operator
4464 new} and @code{operator delete}.
4466 @option{-Wmismatched-new-delete} is included in @option{-Wall}.
4468 @opindex Wmismatched-tags
4469 @opindex Wno-mismatched-tags
4470 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
4471 Warn for declarations of structs, classes, and class templates and their
4472 specializations with a class-key that does not match either the definition
4473 or the first declaration if no definition is provided.
4475 For example, the declaration of @code{struct Object} in the argument list
4476 of @code{draw} triggers the warning.  To avoid it, either remove the redundant
4477 class-key @code{struct} or replace it with @code{class} to match its definition.
4478 @smallexample
4479 class Object @{
4480 public:
4481   virtual ~Object () = 0;
4483 void draw (struct Object*);
4484 @end smallexample
4486 It is not wrong to declare a class with the class-key @code{struct} as
4487 the example above shows.  The @option{-Wmismatched-tags} option is intended
4488 to help achieve a consistent style of class declarations.  In code that is
4489 intended to be portable to Windows-based compilers the warning helps prevent
4490 unresolved references due to the difference in the mangling of symbols
4491 declared with different class-keys.  The option can be used either on its
4492 own or in conjunction with @option{-Wredundant-tags}.
4494 @opindex Wmultiple-inheritance
4495 @opindex Wno-multiple-inheritance
4496 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
4497 Warn when a class is defined with multiple direct base classes.  Some
4498 coding rules disallow multiple inheritance, and this may be used to
4499 enforce that rule.  The warning is inactive inside a system header file,
4500 such as the STL, so one can still use the STL.  One may also define
4501 classes that indirectly use multiple inheritance.
4503 @opindex Wvirtual-inheritance
4504 @opindex Wno-virtual-inheritance
4505 @item -Wvirtual-inheritance
4506 Warn when a class is defined with a virtual direct base class.  Some
4507 coding rules disallow multiple inheritance, and this may be used to
4508 enforce that rule.  The warning is inactive inside a system header file,
4509 such as the STL, so one can still use the STL.  One may also define
4510 classes that indirectly use virtual inheritance.
4512 @opindex Wvirtual-move-assign
4513 @opindex Wno-virtual-move-assign
4514 @item -Wno-virtual-move-assign
4515 Suppress warnings about inheriting from a virtual base with a
4516 non-trivial C++11 move assignment operator.  This is dangerous because
4517 if the virtual base is reachable along more than one path, it is
4518 moved multiple times, which can mean both objects end up in the
4519 moved-from state.  If the move assignment operator is written to avoid
4520 moving from a moved-from object, this warning can be disabled.
4522 @opindex Wnamespaces
4523 @opindex Wno-namespaces
4524 @item -Wnamespaces
4525 Warn when a namespace definition is opened.  Some coding rules disallow
4526 namespaces, and this may be used to enforce that rule.  The warning is
4527 inactive inside a system header file, such as the STL, so one can still
4528 use the STL.  One may also use using directives and qualified names.
4530 @opindex Wterminate
4531 @opindex Wno-terminate
4532 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
4533 Disable the warning about a throw-expression that will immediately
4534 result in a call to @code{terminate}.
4536 @opindex Wvexing-parse
4537 @opindex Wno-vexing-parse
4538 @item -Wno-vexing-parse @r{(C++ and Objective-C++ only)}
4539 Warn about the most vexing parse syntactic ambiguity.  This warns about
4540 the cases when a declaration looks like a variable definition, but the
4541 C++ language requires it to be interpreted as a function declaration.
4542 For instance:
4544 @smallexample
4545 void f(double a) @{
4546   int i();        // extern int i (void);
4547   int n(int(a));  // extern int n (int);
4549 @end smallexample
4551 Another example:
4553 @smallexample
4554 struct S @{ S(int); @};
4555 void f(double a) @{
4556   S x(int(a));   // extern struct S x (int);
4557   S y(int());    // extern struct S y (int (*) (void));
4558   S z();         // extern struct S z (void);
4560 @end smallexample
4562 The warning will suggest options how to deal with such an ambiguity; e.g.,
4563 it can suggest removing the parentheses or using braces instead.
4565 This warning is enabled by default.
4567 @opindex Wno-class-conversion
4568 @opindex Wclass-conversion
4569 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
4570 Do not warn when a conversion function converts an
4571 object to the same type, to a base class of that type, or to void; such
4572 a conversion function will never be called.
4574 @opindex Wvolatile
4575 @opindex Wno-volatile
4576 @item -Wvolatile @r{(C++ and Objective-C++ only)}
4577 Warn about deprecated uses of the @code{volatile} qualifier.  This includes
4578 postfix and prefix @code{++} and @code{--} expressions of
4579 @code{volatile}-qualified types, using simple assignments where the left
4580 operand is a @code{volatile}-qualified non-class type for their value,
4581 compound assignments where the left operand is a @code{volatile}-qualified
4582 non-class type, @code{volatile}-qualified function return type,
4583 @code{volatile}-qualified parameter type, and structured bindings of a
4584 @code{volatile}-qualified type.  This usage was deprecated in C++20.
4586 Enabled by default with @option{-std=c++20}.
4588 @opindex Wzero-as-null-pointer-constant
4589 @opindex Wno-zero-as-null-pointer-constant
4590 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4591 Warn when a literal @samp{0} is used as null pointer constant.  This can
4592 be useful to facilitate the conversion to @code{nullptr} in C++11.
4594 @opindex Waligned-new
4595 @opindex Wno-aligned-new
4596 @item -Waligned-new
4597 Warn about a new-expression of a type that requires greater alignment
4598 than the @code{alignof(std::max_align_t)} but uses an allocation
4599 function without an explicit alignment parameter. This option is
4600 enabled by @option{-Wall}.
4602 Normally this only warns about global allocation functions, but
4603 @option{-Waligned-new=all} also warns about class member allocation
4604 functions.
4606 @opindex Wplacement-new
4607 @opindex Wno-placement-new
4608 @item -Wno-placement-new
4609 @itemx -Wplacement-new=@var{n}
4610 Warn about placement new expressions with undefined behavior, such as
4611 constructing an object in a buffer that is smaller than the type of
4612 the object.  For example, the placement new expression below is diagnosed
4613 because it attempts to construct an array of 64 integers in a buffer only
4614 64 bytes large.
4615 @smallexample
4616 char buf [64];
4617 new (buf) int[64];
4618 @end smallexample
4619 This warning is enabled by default.
4621 @table @gcctabopt
4622 @item -Wplacement-new=1
4623 This is the default warning level of @option{-Wplacement-new}.  At this
4624 level the warning is not issued for some strictly undefined constructs that
4625 GCC allows as extensions for compatibility with legacy code.  For example,
4626 the following @code{new} expression is not diagnosed at this level even
4627 though it has undefined behavior according to the C++ standard because
4628 it writes past the end of the one-element array.
4629 @smallexample
4630 struct S @{ int n, a[1]; @};
4631 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4632 new (s->a)int [32]();
4633 @end smallexample
4635 @item -Wplacement-new=2
4636 At this level, in addition to diagnosing all the same constructs as at level
4637 1, a diagnostic is also issued for placement new expressions that construct
4638 an object in the last member of structure whose type is an array of a single
4639 element and whose size is less than the size of the object being constructed.
4640 While the previous example would be diagnosed, the following construct makes
4641 use of the flexible member array extension to avoid the warning at level 2.
4642 @smallexample
4643 struct S @{ int n, a[]; @};
4644 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4645 new (s->a)int [32]();
4646 @end smallexample
4648 @end table
4650 @opindex Wcatch-value
4651 @opindex Wno-catch-value
4652 @item -Wcatch-value
4653 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
4654 Warn about catch handlers that do not catch via reference.
4655 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
4656 warn about polymorphic class types that are caught by value.
4657 With @option{-Wcatch-value=2} warn about all class types that are caught
4658 by value. With @option{-Wcatch-value=3} warn about all types that are
4659 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
4661 @opindex Wconditionally-supported
4662 @opindex Wno-conditionally-supported
4663 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4664 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4666 @opindex Wdelete-incomplete
4667 @opindex Wno-delete-incomplete
4668 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
4669 Do not warn when deleting a pointer to incomplete type, which may cause
4670 undefined behavior at runtime.  This warning is enabled by default.
4672 @opindex Wextra-semi
4673 @opindex Wno-extra-semi
4674 @item -Wextra-semi @r{(C++, Objective-C++ only)}
4675 Warn about redundant semicolons after in-class function definitions.
4677 @opindex Winaccessible-base
4678 @opindex Wno-inaccessible-base
4679 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
4680 This option controls warnings
4681 when a base class is inaccessible in a class derived from it due to
4682 ambiguity.  The warning is enabled by default.
4683 Note that the warning for ambiguous virtual
4684 bases is enabled by the @option{-Wextra} option.
4685 @smallexample
4686 @group
4687 struct A @{ int a; @};
4689 struct B : A @{ @};
4691 struct C : B, A @{ @};
4692 @end group
4693 @end smallexample
4695 @opindex Winherited-variadic-ctor
4696 @opindex Wno-inherited-variadic-ctor
4697 @item -Wno-inherited-variadic-ctor
4698 Suppress warnings about use of C++11 inheriting constructors when the
4699 base class inherited from has a C variadic constructor; the warning is
4700 on by default because the ellipsis is not inherited.
4702 @opindex Wno-invalid-offsetof
4703 @opindex Winvalid-offsetof
4704 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4705 Suppress warnings from applying the @code{offsetof} macro to a non-POD
4706 type.  According to the 2014 ISO C++ standard, applying @code{offsetof}
4707 to a non-standard-layout type is undefined.  In existing C++ implementations,
4708 however, @code{offsetof} typically gives meaningful results.
4709 This flag is for users who are aware that they are
4710 writing nonportable code and who have deliberately chosen to ignore the
4711 warning about it.
4713 The restrictions on @code{offsetof} may be relaxed in a future version
4714 of the C++ standard.
4716 @opindex Wsized-deallocation
4717 @opindex Wno-sized-deallocation
4718 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
4719 Warn about a definition of an unsized deallocation function
4720 @smallexample
4721 void operator delete (void *) noexcept;
4722 void operator delete[] (void *) noexcept;
4723 @end smallexample
4724 without a definition of the corresponding sized deallocation function
4725 @smallexample
4726 void operator delete (void *, std::size_t) noexcept;
4727 void operator delete[] (void *, std::size_t) noexcept;
4728 @end smallexample
4729 or vice versa.  Enabled by @option{-Wextra} along with
4730 @option{-fsized-deallocation}.
4732 @opindex Wno-suggest-final-types
4733 @opindex Wsuggest-final-types
4734 @item -Wsuggest-final-types
4735 Warn about types with virtual methods where code quality would be improved
4736 if the type were declared with the C++11 @code{final} specifier,
4737 or, if possible,
4738 declared in an anonymous namespace. This allows GCC to more aggressively
4739 devirtualize the polymorphic calls. This warning is more effective with
4740 link-time optimization,
4741 where the information about the class hierarchy graph is
4742 more complete.
4744 @opindex Wno-suggest-final-methods
4745 @opindex Wsuggest-final-methods
4746 @item -Wsuggest-final-methods
4747 Warn about virtual methods where code quality would be improved if the method
4748 were declared with the C++11 @code{final} specifier,
4749 or, if possible, its type were
4750 declared in an anonymous namespace or with the @code{final} specifier.
4751 This warning is
4752 more effective with link-time optimization, where the information about the
4753 class hierarchy graph is more complete. It is recommended to first consider
4754 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4755 annotations.
4757 @opindex Wsuggest-override
4758 @opindex Wno-suggest-override
4759 @item -Wsuggest-override
4760 Warn about overriding virtual functions that are not marked with the
4761 @code{override} keyword.
4763 @opindex Wuse-after-free
4764 @opindex Wno-use-after-free
4765 @item -Wuse-after-free
4766 @itemx -Wuse-after-free=@var{n}
4767 Warn about uses of pointers to dynamically allocated objects that have
4768 been rendered indeterminate by a call to a deallocation function.
4769 The warning is enabled at all optimization levels but may yield different
4770 results with optimization than without.
4772 @table @gcctabopt
4773 @item -Wuse-after-free=1
4774 At level 1 the warning attempts to diagnose only unconditional uses
4775 of pointers made indeterminate by a deallocation call or a successful
4776 call to @code{realloc}, regardless of whether or not the call resulted
4777 in an actual reallocatio of memory.  This includes double-@code{free}
4778 calls as well as uses in arithmetic and relational expressions.  Although
4779 undefined, uses of indeterminate pointers in equality (or inequality)
4780 expressions are not diagnosed at this level.
4781 @item -Wuse-after-free=2
4782 At level 2, in addition to unconditional uses, the warning also diagnoses
4783 conditional uses of pointers made indeterminate by a deallocation call.
4784 As at level 2, uses in equality (or inequality) expressions are not
4785 diagnosed.  For example, the second call to @code{free} in the following
4786 function is diagnosed at this level:
4787 @smallexample
4788 struct A @{ int refcount; void *data; @};
4790 void release (struct A *p)
4792   int refcount = --p->refcount;
4793   free (p);
4794   if (refcount == 0)
4795     free (p->data);   // warning: p may be used after free
4797 @end smallexample
4798 @item -Wuse-after-free=3
4799 At level 3, the warning also diagnoses uses of indeterminate pointers in
4800 equality expressions.  All uses of indeterminate pointers are undefined
4801 but equality tests sometimes appear after calls to @code{realloc} as
4802 an attempt to determine whether the call resulted in relocating the object
4803 to a different address.  They are diagnosed at a separate level to aid
4804 legacy code gradually transition to safe alternatives.  For example,
4805 the equality test in the function below is diagnosed at this level:
4806 @smallexample
4807 void adjust_pointers (int**, int);
4809 void grow (int **p, int n)
4811   int **q = (int**)realloc (p, n *= 2);
4812   if (q == p)
4813     return;
4814   adjust_pointers ((int**)q, n);
4816 @end smallexample
4817 To avoid the warning at this level, store offsets into allocated memory
4818 instead of pointers.  This approach obviates needing to adjust the stored
4819 pointers after reallocation.
4820 @end table
4822 @option{-Wuse-after-free=2} is included in @option{-Wall}.
4824 @opindex Wuseless-cast
4825 @opindex Wno-useless-cast
4826 @item -Wuseless-cast @r{(C, Objective-C, C++ and Objective-C++ only)}
4827 Warn when an expression is cast to its own type.  This warning does not
4828 occur when a class object is converted to a non-reference type as that
4829 is a way to create a temporary:
4831 @smallexample
4832 struct S @{ @};
4833 void g (S&&);
4834 void f (S&& arg)
4836   g (S(arg)); // make arg prvalue so that it can bind to S&&
4838 @end smallexample
4840 @opindex Wconversion-null
4841 @opindex Wno-conversion-null
4842 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4843 Do not warn for conversions between @code{NULL} and non-pointer
4844 types. @option{-Wconversion-null} is enabled by default.
4846 @end table
4848 @node Objective-C and Objective-C++ Dialect Options
4849 @section Options Controlling Objective-C and Objective-C++ Dialects
4851 @cindex compiler options, Objective-C and Objective-C++
4852 @cindex Objective-C and Objective-C++ options, command-line
4853 @cindex options, Objective-C and Objective-C++
4854 (NOTE: This manual does not describe the Objective-C and Objective-C++
4855 languages themselves.  @xref{Standards,,Language Standards
4856 Supported by GCC}, for references.)
4858 This section describes the command-line options that are only meaningful
4859 for Objective-C and Objective-C++ programs.  You can also use most of
4860 the language-independent GNU compiler options.
4861 For example, you might compile a file @file{some_class.m} like this:
4863 @smallexample
4864 gcc -g -fgnu-runtime -O -c some_class.m
4865 @end smallexample
4867 @noindent
4868 In this example, @option{-fgnu-runtime} is an option meant only for
4869 Objective-C and Objective-C++ programs; you can use the other options with
4870 any language supported by GCC@.
4872 Note that since Objective-C is an extension of the C language, Objective-C
4873 compilations may also use options specific to the C front-end (e.g.,
4874 @option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
4875 C++-specific options (e.g., @option{-Wabi}).
4877 Here is a list of options that are @emph{only} for compiling Objective-C
4878 and Objective-C++ programs:
4880 @table @gcctabopt
4881 @opindex fconstant-string-class
4882 @item -fconstant-string-class=@var{class-name}
4883 Use @var{class-name} as the name of the class to instantiate for each
4884 literal string specified with the syntax @code{@@"@dots{}"}.  The default
4885 class name is @code{NXConstantString} if the GNU runtime is being used, and
4886 @code{NSConstantString} if the NeXT runtime is being used (see below).  On
4887 Darwin / macOS platforms, the @option{-fconstant-cfstrings} option, if
4888 also present, overrides the @option{-fconstant-string-class} setting and cause
4889 @code{@@"@dots{}"} literals to be laid out as constant CoreFoundation strings.
4890 Note that @option{-fconstant-cfstrings} is an alias for the target-specific
4891 @option{-mconstant-cfstrings} equivalent.
4893 @opindex fgnu-runtime
4894 @item -fgnu-runtime
4895 Generate object code compatible with the standard GNU Objective-C
4896 runtime.  This is the default for most types of systems.
4898 @opindex fnext-runtime
4899 @item -fnext-runtime
4900 Generate output compatible with the NeXT runtime.  This is the default
4901 for NeXT-based systems, including Darwin / macOS.  The macro
4902 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
4903 used.
4905 @opindex fno-nil-receivers
4906 @opindex fnil-receivers
4907 @item -fno-nil-receivers
4908 Assume that all Objective-C message dispatches (@code{[receiver
4909 message:arg]}) in this translation unit ensure that the receiver is
4910 not @code{nil}.  This allows for more efficient entry points in the
4911 runtime to be used.  This option is only available in conjunction with
4912 the NeXT runtime and ABI version 0 or 1.
4914 @opindex fobjc-abi-version
4915 @item -fobjc-abi-version=@var{n}
4916 Use version @var{n} of the Objective-C ABI for the selected runtime.
4917 This option is currently supported only for the NeXT runtime.  In that
4918 case, Version 0 is the traditional (32-bit) ABI without support for
4919 properties and other Objective-C 2.0 additions.  Version 1 is the
4920 traditional (32-bit) ABI with support for properties and other
4921 Objective-C 2.0 additions.  Version 2 is the modern (64-bit) ABI.  If
4922 nothing is specified, the default is Version 0 on 32-bit target
4923 machines, and Version 2 on 64-bit target machines.
4925 @opindex fobjc-call-cxx-cdtors
4926 @item -fobjc-call-cxx-cdtors
4927 For each Objective-C class, check if any of its instance variables is a
4928 C++ object with a non-trivial default constructor.  If so, synthesize a
4929 special @code{- (id) .cxx_construct} instance method which runs
4930 non-trivial default constructors on any such instance variables, in order,
4931 and then return @code{self}.  Similarly, check if any instance variable
4932 is a C++ object with a non-trivial destructor, and if so, synthesize a
4933 special @code{- (void) .cxx_destruct} method which runs
4934 all such default destructors, in reverse order.
4936 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
4937 methods thusly generated only operate on instance variables
4938 declared in the current Objective-C class, and not those inherited
4939 from superclasses.  It is the responsibility of the Objective-C
4940 runtime to invoke all such methods in an object's inheritance
4941 hierarchy.  The @code{- (id) .cxx_construct} methods are invoked
4942 by the runtime immediately after a new object instance is allocated;
4943 the @code{- (void) .cxx_destruct} methods are invoked immediately
4944 before the runtime deallocates an object instance.
4946 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
4947 support for invoking the @code{- (id) .cxx_construct} and
4948 @code{- (void) .cxx_destruct} methods.
4950 @opindex fobjc-direct-dispatch
4951 @item -fobjc-direct-dispatch
4952 Allow fast jumps to the message dispatcher.  On Darwin this is
4953 accomplished via the comm page.
4955 @opindex fobjc-exceptions
4956 @item -fobjc-exceptions
4957 Enable syntactic support for structured exception handling in
4958 Objective-C, similar to what is offered by C++.  This option
4959 is required to use the Objective-C keywords @code{@@try},
4960 @code{@@throw}, @code{@@catch}, @code{@@finally} and
4961 @code{@@synchronized}.  This option is available with both the GNU
4962 runtime and the NeXT runtime (but not available in conjunction with
4963 the NeXT runtime on Mac OS X 10.2 and earlier).
4965 @opindex fobjc-gc
4966 @item -fobjc-gc
4967 Enable garbage collection (GC) in Objective-C and Objective-C++
4968 programs.  This option is only available with the NeXT runtime; the
4969 GNU runtime has a different garbage collection implementation that
4970 does not require special compiler flags.
4972 @opindex fobjc-nilcheck
4973 @item -fobjc-nilcheck
4974 For the NeXT runtime with version 2 of the ABI, check for a nil
4975 receiver in method invocations before doing the actual method call.
4976 This is the default and can be disabled using
4977 @option{-fno-objc-nilcheck}.  Class methods and super calls are never
4978 checked for nil in this way no matter what this flag is set to.
4979 Currently this flag does nothing when the GNU runtime, or an older
4980 version of the NeXT runtime ABI, is used.
4982 @opindex fobjc-std
4983 @item -fobjc-std=objc1
4984 Conform to the language syntax of Objective-C 1.0, the language
4985 recognized by GCC 4.0.  This only affects the Objective-C additions to
4986 the C/C++ language; it does not affect conformance to C/C++ standards,
4987 which is controlled by the separate C/C++ dialect option flags.  When
4988 this option is used with the Objective-C or Objective-C++ compiler,
4989 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
4990 This is useful if you need to make sure that your Objective-C code can
4991 be compiled with older versions of GCC@.
4993 @opindex freplace-objc-classes
4994 @item -freplace-objc-classes
4995 Emit a special marker instructing @command{ld(1)} not to statically link in
4996 the resulting object file, and allow @command{dyld(1)} to load it in at
4997 run time instead.  This is used in conjunction with the Fix-and-Continue
4998 debugging mode, where the object file in question may be recompiled and
4999 dynamically reloaded in the course of program execution, without the need
5000 to restart the program itself.  Currently, Fix-and-Continue functionality
5001 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
5002 and later.
5004 @opindex fzero-link
5005 @item -fzero-link
5006 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
5007 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
5008 compile time) with static class references that get initialized at load time,
5009 which improves run-time performance.  Specifying the @option{-fzero-link} flag
5010 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
5011 to be retained.  This is useful in Zero-Link debugging mode, since it allows
5012 for individual class implementations to be modified during program execution.
5013 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
5014 regardless of command-line options.
5016 @opindex fno-local-ivars
5017 @opindex flocal-ivars
5018 @item -fno-local-ivars
5019 By default instance variables in Objective-C can be accessed as if
5020 they were local variables from within the methods of the class they're
5021 declared in.  This can lead to shadowing between instance variables
5022 and other variables declared either locally inside a class method or
5023 globally with the same name.  Specifying the @option{-fno-local-ivars}
5024 flag disables this behavior thus avoiding variable shadowing issues.
5026 @opindex fivar-visibility
5027 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
5028 Set the default instance variable visibility to the specified option
5029 so that instance variables declared outside the scope of any access
5030 modifier directives default to the specified visibility.
5032 @opindex gen-decls
5033 @item -gen-decls
5034 Dump interface declarations for all classes seen in the source file to a
5035 file named @file{@var{sourcename}.decl}.
5037 @opindex Wassign-intercept
5038 @opindex Wno-assign-intercept
5039 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
5040 Warn whenever an Objective-C assignment is being intercepted by the
5041 garbage collector.
5043 @opindex Wproperty-assign-default
5044 @opindex Wno-property-assign-default
5045 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
5046 Do not warn if a property for an Objective-C object has no assign
5047 semantics specified.
5049 @opindex Wno-protocol
5050 @opindex Wprotocol
5051 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
5052 If a class is declared to implement a protocol, a warning is issued for
5053 every method in the protocol that is not implemented by the class.  The
5054 default behavior is to issue a warning for every method not explicitly
5055 implemented in the class, even if a method implementation is inherited
5056 from the superclass.  If you use the @option{-Wno-protocol} option, then
5057 methods inherited from the superclass are considered to be implemented,
5058 and no warning is issued for them.
5060 @opindex Wobjc-root-class
5061 @item -Wobjc-root-class @r{(Objective-C and Objective-C++ only)}
5062 Warn if a class interface lacks a superclass. Most classes will inherit
5063 from @code{NSObject} (or @code{Object}) for example.  When declaring
5064 classes intended to be root classes, the warning can be suppressed by
5065 marking their interfaces with @code{__attribute__((objc_root_class))}.
5067 @opindex Wselector
5068 @opindex Wno-selector
5069 @item -Wselector @r{(Objective-C and Objective-C++ only)}
5070 Warn if multiple methods of different types for the same selector are
5071 found during compilation.  The check is performed on the list of methods
5072 in the final stage of compilation.  Additionally, a check is performed
5073 for each selector appearing in a @code{@@selector(@dots{})}
5074 expression, and a corresponding method for that selector has been found
5075 during compilation.  Because these checks scan the method table only at
5076 the end of compilation, these warnings are not produced if the final
5077 stage of compilation is not reached, for example because an error is
5078 found during compilation, or because the @option{-fsyntax-only} option is
5079 being used.
5081 @opindex Wstrict-selector-match
5082 @opindex Wno-strict-selector-match
5083 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
5084 Warn if multiple methods with differing argument and/or return types are
5085 found for a given selector when attempting to send a message using this
5086 selector to a receiver of type @code{id} or @code{Class}.  When this flag
5087 is off (which is the default behavior), the compiler omits such warnings
5088 if any differences found are confined to types that share the same size
5089 and alignment.
5091 @opindex Wundeclared-selector
5092 @opindex Wno-undeclared-selector
5093 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
5094 Warn if a @code{@@selector(@dots{})} expression referring to an
5095 undeclared selector is found.  A selector is considered undeclared if no
5096 method with that name has been declared before the
5097 @code{@@selector(@dots{})} expression, either explicitly in an
5098 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
5099 an @code{@@implementation} section.  This option always performs its
5100 checks as soon as a @code{@@selector(@dots{})} expression is found,
5101 while @option{-Wselector} only performs its checks in the final stage of
5102 compilation.  This also enforces the coding style convention
5103 that methods and selectors must be declared before being used.
5105 @opindex print-objc-runtime-info
5106 @item -print-objc-runtime-info
5107 Generate C header describing the largest structure that is passed by
5108 value, if any.
5110 @end table
5112 @node Diagnostic Message Formatting Options
5113 @section Options to Control Diagnostic Messages Formatting
5114 @cindex options to control diagnostics formatting
5115 @cindex diagnostic messages
5116 @cindex message formatting
5118 Traditionally, diagnostic messages have been formatted irrespective of
5119 the output device's aspect (e.g.@: its width, @dots{}).  You can use the
5120 options described below
5121 to control the formatting algorithm for diagnostic messages, 
5122 e.g.@: how many characters per line, how often source location
5123 information should be reported.  Note that some language front ends may not
5124 honor these options.
5126 @table @gcctabopt
5127 @opindex fmessage-length
5128 @item -fmessage-length=@var{n}
5129 Try to format error messages so that they fit on lines of about
5130 @var{n} characters.  If @var{n} is zero, then no line-wrapping is
5131 done; each error message appears on a single line.  This is the
5132 default for all front ends.
5134 Note - this option also affects the display of the @samp{#error} and
5135 @samp{#warning} pre-processor directives, and the @samp{deprecated}
5136 function/type/variable attribute.  It does not however affect the
5137 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
5139 @item -fdiagnostics-plain-output
5140 This option requests that diagnostic output look as plain as possible, which
5141 may be useful when running @command{dejagnu} or other utilities that need to
5142 parse diagnostics output and prefer that it remain more stable over time.
5143 @option{-fdiagnostics-plain-output} is currently equivalent to the following
5144 options:
5145 @gccoptlist{-fno-diagnostics-show-caret
5146 -fno-diagnostics-show-line-numbers
5147 -fdiagnostics-color=never
5148 -fdiagnostics-urls=never
5149 -fdiagnostics-path-format=separate-events
5150 -fdiagnostics-text-art-charset=none}
5151 In the future, if GCC changes the default appearance of its diagnostics, the
5152 corresponding option to disable the new behavior will be added to this list.
5154 @opindex fdiagnostics-show-location
5155 @item -fdiagnostics-show-location=once
5156 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
5157 reporter to emit source location information @emph{once}; that is, in
5158 case the message is too long to fit on a single physical line and has to
5159 be wrapped, the source location won't be emitted (as prefix) again,
5160 over and over, in subsequent continuation lines.  This is the default
5161 behavior.
5163 @item -fdiagnostics-show-location=every-line
5164 Only meaningful in line-wrapping mode.  Instructs the diagnostic
5165 messages reporter to emit the same source location information (as
5166 prefix) for physical lines that result from the process of breaking
5167 a message which is too long to fit on a single line.
5169 @opindex fdiagnostics-color
5170 @cindex highlight, color
5171 @vindex GCC_COLORS @r{environment variable}
5172 @item -fdiagnostics-color[=@var{WHEN}]
5173 @itemx -fno-diagnostics-color
5174 Use color in diagnostics.  @var{WHEN} is @samp{never}, @samp{always},
5175 or @samp{auto}.  The default depends on how the compiler has been configured,
5176 it can be any of the above @var{WHEN} options or also @samp{never}
5177 if @env{GCC_COLORS} environment variable isn't present in the environment,
5178 and @samp{auto} otherwise.
5179 @samp{auto} makes GCC use color only when the standard error is a terminal,
5180 and when not executing in an emacs shell.
5181 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
5182 aliases for @option{-fdiagnostics-color=always} and
5183 @option{-fdiagnostics-color=never}, respectively.
5185 The colors are defined by the environment variable @env{GCC_COLORS}.
5186 Its value is a colon-separated list of capabilities and Select Graphic
5187 Rendition (SGR) substrings. SGR commands are interpreted by the
5188 terminal or terminal emulator.  (See the section in the documentation
5189 of your text terminal for permitted values and their meanings as
5190 character attributes.)  These substring values are integers in decimal
5191 representation and can be concatenated with semicolons.
5192 Common values to concatenate include
5193 @samp{1} for bold,
5194 @samp{4} for underline,
5195 @samp{5} for blink,
5196 @samp{7} for inverse,
5197 @samp{39} for default foreground color,
5198 @samp{30} to @samp{37} for foreground colors,
5199 @samp{90} to @samp{97} for 16-color mode foreground colors,
5200 @samp{38;5;0} to @samp{38;5;255}
5201 for 88-color and 256-color modes foreground colors,
5202 @samp{49} for default background color,
5203 @samp{40} to @samp{47} for background colors,
5204 @samp{100} to @samp{107} for 16-color mode background colors,
5205 and @samp{48;5;0} to @samp{48;5;255}
5206 for 88-color and 256-color modes background colors.
5208 The default @env{GCC_COLORS} is
5209 @smallexample
5210 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
5211 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
5212 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
5213 type-diff=01;32:fnname=01;32:targs=35
5214 @end smallexample
5215 @noindent
5216 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
5217 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
5218 @samp{01} is bold, and @samp{31} is red.
5219 Setting @env{GCC_COLORS} to the empty string disables colors.
5220 Supported capabilities are as follows.
5222 @table @code
5223 @vindex error GCC_COLORS @r{capability}
5224 @item error=
5225 SGR substring for error: markers.
5227 @vindex warning GCC_COLORS @r{capability}
5228 @item warning=
5229 SGR substring for warning: markers.
5231 @vindex note GCC_COLORS @r{capability}
5232 @item note=
5233 SGR substring for note: markers.
5235 @vindex path GCC_COLORS @r{capability}
5236 @item path=
5237 SGR substring for colorizing paths of control-flow events as printed
5238 via @option{-fdiagnostics-path-format=}, such as the identifiers of
5239 individual events and lines indicating interprocedural calls and returns.
5241 @vindex range1 GCC_COLORS @r{capability}
5242 @item range1=
5243 SGR substring for first additional range.
5245 @vindex range2 GCC_COLORS @r{capability}
5246 @item range2=
5247 SGR substring for second additional range.
5249 @vindex locus GCC_COLORS @r{capability}
5250 @item locus=
5251 SGR substring for location information, @samp{file:line} or
5252 @samp{file:line:column} etc.
5254 @vindex quote GCC_COLORS @r{capability}
5255 @item quote=
5256 SGR substring for information printed within quotes.
5258 @vindex fnname GCC_COLORS @r{capability}
5259 @item fnname=
5260 SGR substring for names of C++ functions.
5262 @vindex targs GCC_COLORS @r{capability}
5263 @item targs=
5264 SGR substring for C++ function template parameter bindings.
5266 @vindex fixit-insert GCC_COLORS @r{capability}
5267 @item fixit-insert=
5268 SGR substring for fix-it hints suggesting text to
5269 be inserted or replaced.
5271 @vindex fixit-delete GCC_COLORS @r{capability}
5272 @item fixit-delete=
5273 SGR substring for fix-it hints suggesting text to
5274 be deleted.
5276 @vindex diff-filename GCC_COLORS @r{capability}
5277 @item diff-filename=
5278 SGR substring for filename headers within generated patches.
5280 @vindex diff-hunk GCC_COLORS @r{capability}
5281 @item diff-hunk=
5282 SGR substring for the starts of hunks within generated patches.
5284 @vindex diff-delete GCC_COLORS @r{capability}
5285 @item diff-delete=
5286 SGR substring for deleted lines within generated patches.
5288 @vindex diff-insert GCC_COLORS @r{capability}
5289 @item diff-insert=
5290 SGR substring for inserted lines within generated patches.
5292 @vindex type-diff GCC_COLORS @r{capability}
5293 @item type-diff=
5294 SGR substring for highlighting mismatching types within template
5295 arguments in the C++ frontend.
5296 @end table
5298 @opindex fdiagnostics-urls
5299 @cindex urls
5300 @vindex GCC_URLS @r{environment variable}
5301 @vindex TERM_URLS @r{environment variable}
5302 @item -fdiagnostics-urls[=@var{WHEN}]
5303 Use escape sequences to embed URLs in diagnostics.  For example, when
5304 @option{-fdiagnostics-show-option} emits text showing the command-line
5305 option controlling a diagnostic, embed a URL for documentation of that
5306 option.
5308 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
5309 @samp{auto} makes GCC use URL escape sequences only when the standard error
5310 is a terminal, and when not executing in an emacs shell or any graphical
5311 terminal which is known to be incompatible with this feature, see below.
5313 The default depends on how the compiler has been configured.
5314 It can be any of the above @var{WHEN} options.
5316 GCC can also be configured (via the
5317 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
5318 so that the default is affected by environment variables.
5319 Under such a configuration, GCC defaults to using @samp{auto}
5320 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
5321 present and non-empty in the environment of the compiler, or @samp{never}
5322 if neither are.
5324 However, even with @option{-fdiagnostics-urls=always} the behavior is
5325 dependent on those environment variables:
5326 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
5327 diagnostics.  If set to @samp{st}, URLs use ST escape sequences.
5328 If set to @samp{bel}, the default, URLs use BEL escape sequences.
5329 Any other non-empty value enables the feature.
5330 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
5331 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
5332 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
5334 At this time GCC tries to detect also a few terminals that are known to
5335 not implement the URL feature, and have bugs or at least had bugs in
5336 some versions that are still in use, where the URL escapes are likely
5337 to misbehave, i.e. print garbage on the screen.
5338 That list is currently xfce4-terminal, certain known to be buggy
5339 gnome-terminal versions, the linux console, and mingw.
5340 This check can be skipped with the @option{-fdiagnostics-urls=always}.
5342 @opindex fno-diagnostics-show-option
5343 @opindex fdiagnostics-show-option
5344 @item -fno-diagnostics-show-option
5345 By default, each diagnostic emitted includes text indicating the
5346 command-line option that directly controls the diagnostic (if such an
5347 option is known to the diagnostic machinery).  Specifying the
5348 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
5350 @opindex fno-diagnostics-show-caret
5351 @opindex fdiagnostics-show-caret
5352 @item -fno-diagnostics-show-caret
5353 By default, each diagnostic emitted includes the original source line
5354 and a caret @samp{^} indicating the column.  This option suppresses this
5355 information.  The source line is truncated to @var{n} characters, if
5356 the @option{-fmessage-length=n} option is given.  When the output is done
5357 to the terminal, the width is limited to the width given by the
5358 @env{COLUMNS} environment variable or, if not set, to the terminal width.
5360 @opindex fno-diagnostics-show-labels
5361 @opindex fdiagnostics-show-labels
5362 @item -fno-diagnostics-show-labels
5363 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5364 diagnostics can label ranges of source code with pertinent information, such
5365 as the types of expressions:
5367 @smallexample
5368     printf ("foo %s bar", long_i + long_j);
5369                  ~^       ~~~~~~~~~~~~~~~
5370                   |              |
5371                   char *         long int
5372 @end smallexample
5374 This option suppresses the printing of these labels (in the example above,
5375 the vertical bars and the ``char *'' and ``long int'' text).
5377 @opindex fno-diagnostics-show-cwe
5378 @opindex fdiagnostics-show-cwe
5379 @item -fno-diagnostics-show-cwe
5380 Diagnostic messages can optionally have an associated
5381 @uref{https://cwe.mitre.org/index.html, CWE} identifier.
5382 GCC itself only provides such metadata for some of the @option{-fanalyzer}
5383 diagnostics.  GCC plugins may also provide diagnostics with such metadata.
5384 By default, if this information is present, it will be printed with
5385 the diagnostic.  This option suppresses the printing of this metadata.
5387 @opindex fno-diagnostics-show-rules
5388 @opindex fdiagnostics-show-rules
5389 @item -fno-diagnostics-show-rules
5390 Diagnostic messages can optionally have rules associated with them, such
5391 as from a coding standard, or a specification.
5392 GCC itself does not do this for any of its diagnostics, but plugins may do so.
5393 By default, if this information is present, it will be printed with
5394 the diagnostic.  This option suppresses the printing of this metadata.
5396 @opindex fno-diagnostics-show-line-numbers
5397 @opindex fdiagnostics-show-line-numbers
5398 @item -fno-diagnostics-show-line-numbers
5399 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5400 a left margin is printed, showing line numbers.  This option suppresses this
5401 left margin.
5403 @opindex fdiagnostics-minimum-margin-width
5404 @item -fdiagnostics-minimum-margin-width=@var{width}
5405 This option controls the minimum width of the left margin printed by
5406 @option{-fdiagnostics-show-line-numbers}.  It defaults to 6.
5408 @opindex fdiagnostics-parseable-fixits
5409 @item -fdiagnostics-parseable-fixits
5410 Emit fix-it hints in a machine-parseable format, suitable for consumption
5411 by IDEs.  For each fix-it, a line will be printed after the relevant
5412 diagnostic, starting with the string ``fix-it:''.  For example:
5414 @smallexample
5415 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
5416 @end smallexample
5418 The location is expressed as a half-open range, expressed as a count of
5419 bytes, starting at byte 1 for the initial column.  In the above example,
5420 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
5421 given string:
5423 @smallexample
5424 00000000011111111112222222222
5425 12345678901234567890123456789
5426   gtk_widget_showall (dlg);
5427   ^^^^^^^^^^^^^^^^^^
5428   gtk_widget_show_all
5429 @end smallexample
5431 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
5432 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
5433 (e.g. vertical tab as ``\013'').
5435 An empty replacement string indicates that the given range is to be removed.
5436 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
5437 be inserted at the given position.
5439 @opindex fdiagnostics-generate-patch
5440 @item -fdiagnostics-generate-patch
5441 Print fix-it hints to stderr in unified diff format, after any diagnostics
5442 are printed.  For example:
5444 @smallexample
5445 --- test.c
5446 +++ test.c
5447 @@ -42,5 +42,5 @@
5449  void show_cb(GtkDialog *dlg)
5450  @{
5451 -  gtk_widget_showall(dlg);
5452 +  gtk_widget_show_all(dlg);
5453  @}
5455 @end smallexample
5457 The diff may or may not be colorized, following the same rules
5458 as for diagnostics (see @option{-fdiagnostics-color}).
5460 @opindex fdiagnostics-show-template-tree
5461 @item -fdiagnostics-show-template-tree
5463 In the C++ frontend, when printing diagnostics showing mismatching
5464 template types, such as:
5466 @smallexample
5467   could not convert 'std::map<int, std::vector<double> >()'
5468     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5469 @end smallexample
5471 the @option{-fdiagnostics-show-template-tree} flag enables printing a
5472 tree-like structure showing the common and differing parts of the types,
5473 such as:
5475 @smallexample
5476   map<
5477     [...],
5478     vector<
5479       [double != float]>>
5480 @end smallexample
5482 The parts that differ are highlighted with color (``double'' and
5483 ``float'' in this case).
5485 @opindex fno-elide-type
5486 @opindex felide-type
5487 @item -fno-elide-type
5488 By default when the C++ frontend prints diagnostics showing mismatching
5489 template types, common parts of the types are printed as ``[...]'' to
5490 simplify the error message.  For example:
5492 @smallexample
5493   could not convert 'std::map<int, std::vector<double> >()'
5494     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5495 @end smallexample
5497 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
5498 This flag also affects the output of the
5499 @option{-fdiagnostics-show-template-tree} flag.
5501 @opindex fdiagnostics-path-format
5502 @item -fdiagnostics-path-format=@var{KIND}
5503 Specify how to print paths of control-flow events for diagnostics that
5504 have such a path associated with them.
5506 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
5507 the default.
5509 @samp{none} means to not print diagnostic paths.
5511 @samp{separate-events} means to print a separate ``note'' diagnostic for
5512 each event within the diagnostic.  For example:
5514 @smallexample
5515 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
5516 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
5517 test.c:27:3: note: (2) when 'i < count'
5518 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5519 @end smallexample
5521 @samp{inline-events} means to print the events ``inline'' within the source
5522 code.  This view attempts to consolidate the events into runs of
5523 sufficiently-close events, printing them as labelled ranges within the source.
5525 For example, the same events as above might be printed as:
5527 @smallexample
5528   'test': events 1-3
5529     |
5530     |   25 |   list = PyList_New(0);
5531     |      |          ^~~~~~~~~~~~~
5532     |      |          |
5533     |      |          (1) when 'PyList_New' fails, returning NULL
5534     |   26 |
5535     |   27 |   for (i = 0; i < count; i++) @{
5536     |      |   ~~~
5537     |      |   |
5538     |      |   (2) when 'i < count'
5539     |   28 |     item = PyLong_FromLong(random());
5540     |   29 |     PyList_Append(list, item);
5541     |      |     ~~~~~~~~~~~~~~~~~~~~~~~~~
5542     |      |     |
5543     |      |     (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5544     |
5545 @end smallexample
5547 Interprocedural control flow is shown by grouping the events by stack frame,
5548 and using indentation to show how stack frames are nested, pushed, and popped.
5550 For example:
5552 @smallexample
5553   'test': events 1-2
5554     |
5555     |  133 | @{
5556     |      | ^
5557     |      | |
5558     |      | (1) entering 'test'
5559     |  134 |   boxed_int *obj = make_boxed_int (i);
5560     |      |                    ~~~~~~~~~~~~~~~~~~
5561     |      |                    |
5562     |      |                    (2) calling 'make_boxed_int'
5563     |
5564     +--> 'make_boxed_int': events 3-4
5565            |
5566            |  120 | @{
5567            |      | ^
5568            |      | |
5569            |      | (3) entering 'make_boxed_int'
5570            |  121 |   boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
5571            |      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5572            |      |                                    |
5573            |      |                                    (4) calling 'wrapped_malloc'
5574            |
5575            +--> 'wrapped_malloc': events 5-6
5576                   |
5577                   |    7 | @{
5578                   |      | ^
5579                   |      | |
5580                   |      | (5) entering 'wrapped_malloc'
5581                   |    8 |   return malloc (size);
5582                   |      |          ~~~~~~~~~~~~~
5583                   |      |          |
5584                   |      |          (6) calling 'malloc'
5585                   |
5586     <-------------+
5587     |
5588  'test': event 7
5589     |
5590     |  138 |   free_boxed_int (obj);
5591     |      |   ^~~~~~~~~~~~~~~~~~~~
5592     |      |   |
5593     |      |   (7) calling 'free_boxed_int'
5594     |
5595 (etc)
5596 @end smallexample
5598 @opindex fdiagnostics-show-path-depths
5599 @item -fdiagnostics-show-path-depths
5600 This option provides additional information when printing control-flow paths
5601 associated with a diagnostic.
5603 If this is option is provided then the stack depth will be printed for
5604 each run of events within @option{-fdiagnostics-path-format=inline-events}.
5605 If provided with @option{-fdiagnostics-path-format=separate-events}, then
5606 the stack depth and function declaration will be appended when printing
5607 each event.
5609 This is intended for use by GCC developers and plugin developers when
5610 debugging diagnostics that report interprocedural control flow.
5612 @opindex fno-show-column
5613 @opindex fshow-column
5614 @item -fno-show-column
5615 Do not print column numbers in diagnostics.  This may be necessary if
5616 diagnostics are being scanned by a program that does not understand the
5617 column numbers, such as @command{dejagnu}.
5619 @opindex fdiagnostics-column-unit
5620 @item -fdiagnostics-column-unit=@var{UNIT}
5621 Select the units for the column number.  This affects traditional diagnostics
5622 (in the absence of @option{-fno-show-column}), as well as JSON format
5623 diagnostics if requested.
5625 The default @var{UNIT}, @samp{display}, considers the number of display
5626 columns occupied by each character.  This may be larger than the number
5627 of bytes required to encode the character, in the case of tab
5628 characters, or it may be smaller, in the case of multibyte characters.
5629 For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one
5630 display column, and its UTF-8 encoding requires two bytes; the character
5631 ``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and
5632 its UTF-8 encoding requires four bytes.
5634 Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte
5635 count in all cases, as was traditionally output by GCC prior to version 11.1.0.
5637 @opindex fdiagnostics-column-origin
5638 @item -fdiagnostics-column-origin=@var{ORIGIN}
5639 Select the origin for column numbers, i.e. the column number assigned to the
5640 first column.  The default value of 1 corresponds to traditional GCC
5641 behavior and to the GNU style guide.  Some utilities may perform better with an
5642 origin of 0; any non-negative value may be specified.
5644 @opindex fdiagnostics-escape-format
5645 @item -fdiagnostics-escape-format=@var{FORMAT}
5646 When GCC prints pertinent source lines for a diagnostic it normally attempts
5647 to print the source bytes directly.  However, some diagnostics relate to encoding
5648 issues in the source file, such as malformed UTF-8, or issues with Unicode
5649 normalization.  These diagnostics are flagged so that GCC will escape bytes
5650 that are not printable ASCII when printing their pertinent source lines.
5652 This option controls how such bytes should be escaped.
5654 The default @var{FORMAT}, @samp{unicode} displays Unicode characters that
5655 are not printable ASCII in the form @samp{<U+XXXX>}, and bytes that do not
5656 correspond to a Unicode character validly-encoded in UTF-8-encoded will be
5657 displayed as hexadecimal in the form @samp{<XX>}.
5659 For example, a source line containing the string @samp{before} followed by the
5660 Unicode character U+03C0 (``GREEK SMALL LETTER PI'', with UTF-8 encoding
5661 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by
5662 the string @samp{after} will be printed for such a diagnostic as:
5664 @smallexample
5665  before<U+03C0><BF>after
5666 @end smallexample
5668 Setting @var{FORMAT} to @samp{bytes} will display all non-printable-ASCII bytes
5669 in the form @samp{<XX>}, thus showing the underlying encoding of non-ASCII
5670 Unicode characters.  For the example above, the following will be printed:
5672 @smallexample
5673  before<CF><80><BF>after
5674 @end smallexample
5676 @opindex fdiagnostics-text-art-charset
5677 @item -fdiagnostics-text-art-charset=@var{CHARSET}
5678 Some diagnostics can contain ``text art'' diagrams: visualizations created
5679 from text, intended to be viewed in a monospaced font.
5681 This option selects which characters should be used for printing such
5682 diagrams, if any.  @var{CHARSET} is @samp{none}, @samp{ascii}, @samp{unicode},
5683 or @samp{emoji}.
5685 The @samp{none} value suppresses the printing of such diagrams.
5686 The @samp{ascii} value will ensure that such diagrams are pure ASCII
5687 (``ASCII art'').  The @samp{unicode} value will allow for conservative use of
5688 unicode drawing characters (such as box-drawing characters).  The @samp{emoji}
5689 value further adds the possibility of emoji in the output (such as emitting
5690 U+26A0 WARNING SIGN followed by U+FE0F VARIATION SELECTOR-16 to select the
5691 emoji variant of the character).
5693 The default is @samp{emoji}, except when the environment variable @env{LANG}
5694 is set to @samp{C}, in which case the default is @samp{ascii}.
5696 @opindex fdiagnostics-format
5697 @item -fdiagnostics-format=@var{FORMAT}
5698 Select a different format for printing diagnostics.
5699 @var{FORMAT} is @samp{text}, @samp{sarif-stderr}, @samp{sarif-file},
5700 @samp{json}, @samp{json-stderr}, or @samp{json-file}.
5702 The default is @samp{text}.
5704 The @samp{sarif-stderr} and @samp{sarif-file} formats both emit
5705 diagnostics in SARIF Version 2.1.0 format, either to stderr, or to a file
5706 named @file{@var{source}.sarif}, respectively.
5708 The @samp{json} format is a synonym for @samp{json-stderr}.
5709 The @samp{json-stderr} and @samp{json-file} formats are identical, apart from
5710 where the JSON is emitted to - with the former, the JSON is emitted to stderr,
5711 whereas with @samp{json-file} it is written to @file{@var{source}.gcc.json}.
5713 The emitted JSON consists of a top-level JSON array containing JSON objects
5714 representing the diagnostics.  The JSON is emitted as one line, without
5715 formatting; the examples below have been formatted for clarity.
5717 Diagnostics can have child diagnostics.  For example, this error and note:
5719 @smallexample
5720 misleading-indentation.c:15:3: warning: this 'if' clause does not
5721   guard... [-Wmisleading-indentation]
5722    15 |   if (flag)
5723       |   ^~
5724 misleading-indentation.c:17:5: note: ...this statement, but the latter
5725   is misleadingly indented as if it were guarded by the 'if'
5726    17 |     y = 2;
5727       |     ^
5728 @end smallexample
5730 @noindent
5731 might be printed in JSON form (after formatting) like this:
5733 @smallexample
5735     @{
5736         "kind": "warning",
5737         "locations": [
5738             @{
5739                 "caret": @{
5740                     "display-column": 3,
5741                     "byte-column": 3,
5742                     "column": 3,
5743                     "file": "misleading-indentation.c",
5744                     "line": 15
5745                 @},
5746                 "finish": @{
5747                     "display-column": 4,
5748                     "byte-column": 4,
5749                     "column": 4,
5750                     "file": "misleading-indentation.c",
5751                     "line": 15
5752                 @}
5753             @}
5754         ],
5755         "message": "this \u2018if\u2019 clause does not guard...",
5756         "option": "-Wmisleading-indentation",
5757         "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
5758         "children": [
5759             @{
5760                 "kind": "note",
5761                 "locations": [
5762                     @{
5763                         "caret": @{
5764                             "display-column": 5,
5765                             "byte-column": 5,
5766                             "column": 5,
5767                             "file": "misleading-indentation.c",
5768                             "line": 17
5769                         @}
5770                     @}
5771                 ],
5772                 "escape-source": false,
5773                 "message": "...this statement, but the latter is @dots{}"
5774             @}
5775         ]
5776         "escape-source": false,
5777         "column-origin": 1,
5778     @}
5780 @end smallexample
5782 @noindent
5783 where the @code{note} is a child of the @code{warning}.
5785 A diagnostic has a @code{kind}.  If this is @code{warning}, then there is
5786 an @code{option} key describing the command-line option controlling the
5787 warning.
5789 A diagnostic can contain zero or more locations.  Each location has an
5790 optional @code{label} string and up to three positions within it: a
5791 @code{caret} position and optional @code{start} and @code{finish} positions.
5792 A position is described by a @code{file} name, a @code{line} number, and
5793 three numbers indicating a column position:
5794 @itemize @bullet
5796 @item
5797 @code{display-column} counts display columns, accounting for tabs and
5798 multibyte characters.
5800 @item
5801 @code{byte-column} counts raw bytes.
5803 @item
5804 @code{column} is equal to one of
5805 the previous two, as dictated by the @option{-fdiagnostics-column-unit}
5806 option.
5808 @end itemize
5809 All three columns are relative to the origin specified by
5810 @option{-fdiagnostics-column-origin}, which is typically equal to 1 but may
5811 be set, for instance, to 0 for compatibility with other utilities that
5812 number columns from 0.  The column origin is recorded in the JSON output in
5813 the @code{column-origin} tag.  In the remaining examples below, the extra
5814 column number outputs have been omitted for brevity.
5816 For example, this error:
5818 @smallexample
5819 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
5820    'struct s'@} and 'T' @{aka 'struct t'@})
5821    64 |   return callee_4a () + callee_4b ();
5822       |          ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
5823       |          |              |
5824       |          |              T @{aka struct t@}
5825       |          S @{aka struct s@}
5826 @end smallexample
5828 @noindent
5829 has three locations.  Its primary location is at the ``+'' token at column
5830 23.  It has two secondary locations, describing the left and right-hand sides
5831 of the expression, which have labels.  It might be printed in JSON form as:
5833 @smallexample
5834     @{
5835         "children": [],
5836         "kind": "error",
5837         "locations": [
5838             @{
5839                 "caret": @{
5840                     "column": 23, "file": "bad-binary-ops.c", "line": 64
5841                 @}
5842             @},
5843             @{
5844                 "caret": @{
5845                     "column": 10, "file": "bad-binary-ops.c", "line": 64
5846                 @},
5847                 "finish": @{
5848                     "column": 21, "file": "bad-binary-ops.c", "line": 64
5849                 @},
5850                 "label": "S @{aka struct s@}"
5851             @},
5852             @{
5853                 "caret": @{
5854                     "column": 25, "file": "bad-binary-ops.c", "line": 64
5855                 @},
5856                 "finish": @{
5857                     "column": 36, "file": "bad-binary-ops.c", "line": 64
5858                 @},
5859                 "label": "T @{aka struct t@}"
5860             @}
5861         ],
5862         "escape-source": false,
5863         "message": "invalid operands to binary + @dots{}"
5864     @}
5865 @end smallexample
5867 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
5868 consisting of half-open intervals, similar to the output of
5869 @option{-fdiagnostics-parseable-fixits}.  For example, this diagnostic
5870 with a replacement fix-it hint:
5872 @smallexample
5873 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
5874   mean 'color'?
5875     8 |   return ptr->colour;
5876       |               ^~~~~~
5877       |               color
5878 @end smallexample
5880 @noindent
5881 might be printed in JSON form as:
5883 @smallexample
5884     @{
5885         "children": [],
5886         "fixits": [
5887             @{
5888                 "next": @{
5889                     "column": 21,
5890                     "file": "demo.c",
5891                     "line": 8
5892                 @},
5893                 "start": @{
5894                     "column": 15,
5895                     "file": "demo.c",
5896                     "line": 8
5897                 @},
5898                 "string": "color"
5899             @}
5900         ],
5901         "kind": "error",
5902         "locations": [
5903             @{
5904                 "caret": @{
5905                     "column": 15,
5906                     "file": "demo.c",
5907                     "line": 8
5908                 @},
5909                 "finish": @{
5910                     "column": 20,
5911                     "file": "demo.c",
5912                     "line": 8
5913                 @}
5914             @}
5915         ],
5916         "escape-source": false,
5917         "message": "\u2018struct s\u2019 has no member named @dots{}"
5918     @}
5919 @end smallexample
5921 @noindent
5922 where the fix-it hint suggests replacing the text from @code{start} up
5923 to but not including @code{next} with @code{string}'s value.  Deletions
5924 are expressed via an empty value for @code{string}, insertions by
5925 having @code{start} equal @code{next}.
5927 If the diagnostic has a path of control-flow events associated with it,
5928 it has a @code{path} array of objects representing the events.  Each
5929 event object has a @code{description} string, a @code{location} object,
5930 along with a @code{function} string and a @code{depth} number for
5931 representing interprocedural paths.  The @code{function} represents the
5932 current function at that event, and the @code{depth} represents the
5933 stack depth relative to some baseline: the higher, the more frames are
5934 within the stack.
5936 For example, the intraprocedural example shown for
5937 @option{-fdiagnostics-path-format=} might have this JSON for its path:
5939 @smallexample
5940     "path": [
5941         @{
5942             "depth": 0,
5943             "description": "when 'PyList_New' fails, returning NULL",
5944             "function": "test",
5945             "location": @{
5946                 "column": 10,
5947                 "file": "test.c",
5948                 "line": 25
5949             @}
5950         @},
5951         @{
5952             "depth": 0,
5953             "description": "when 'i < count'",
5954             "function": "test",
5955             "location": @{
5956                 "column": 3,
5957                 "file": "test.c",
5958                 "line": 27
5959             @}
5960         @},
5961         @{
5962             "depth": 0,
5963             "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
5964             "function": "test",
5965             "location": @{
5966                 "column": 5,
5967                 "file": "test.c",
5968                 "line": 29
5969             @}
5970         @}
5971     ]
5972 @end smallexample
5974 Diagnostics have a boolean attribute @code{escape-source}, hinting whether
5975 non-ASCII bytes should be escaped when printing the pertinent lines of
5976 source code (@code{true} for diagnostics involving source encoding issues).
5978 @end table
5980 @node Warning Options
5981 @section Options to Request or Suppress Warnings
5982 @cindex options to control warnings
5983 @cindex warning messages
5984 @cindex messages, warning
5985 @cindex suppressing warnings
5987 Warnings are diagnostic messages that report constructions that
5988 are not inherently erroneous but that are risky or suggest there
5989 may have been an error.
5991 The following language-independent options do not enable specific
5992 warnings but control the kinds of diagnostics produced by GCC@.
5994 @table @gcctabopt
5995 @cindex syntax checking
5996 @opindex fsyntax-only
5997 @item -fsyntax-only
5998 Check the code for syntax errors, but don't do anything beyond that.
6000 @opindex fmax-errors
6001 @item -fmax-errors=@var{n}
6002 Limits the maximum number of error messages to @var{n}, at which point
6003 GCC bails out rather than attempting to continue processing the source
6004 code.  If @var{n} is 0 (the default), there is no limit on the number
6005 of error messages produced.  If @option{-Wfatal-errors} is also
6006 specified, then @option{-Wfatal-errors} takes precedence over this
6007 option.
6009 @opindex w
6010 @item -w
6011 Inhibit all warning messages.
6013 @opindex Werror
6014 @opindex Wno-error
6015 @item -Werror
6016 Make all warnings into errors.
6018 @opindex Werror=
6019 @opindex Wno-error=
6020 @item -Werror=
6021 Make the specified warning into an error.  The specifier for a warning
6022 is appended; for example @option{-Werror=switch} turns the warnings
6023 controlled by @option{-Wswitch} into errors.  This switch takes a
6024 negative form, to be used to negate @option{-Werror} for specific
6025 warnings; for example @option{-Wno-error=switch} makes
6026 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
6027 is in effect.
6029 The warning message for each controllable warning includes the
6030 option that controls the warning.  That option can then be used with
6031 @option{-Werror=} and @option{-Wno-error=} as described above.
6032 (Printing of the option in the warning message can be disabled using the
6033 @option{-fno-diagnostics-show-option} flag.)
6035 Note that specifying @option{-Werror=}@var{foo} automatically implies
6036 @option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
6037 imply anything.
6039 @opindex Wfatal-errors
6040 @opindex Wno-fatal-errors
6041 @item -Wfatal-errors
6042 This option causes the compiler to abort compilation on the first error
6043 occurred rather than trying to keep going and printing further error
6044 messages.
6046 @end table
6048 You can request many specific warnings with options beginning with
6049 @samp{-W}, for example @option{-Wimplicit} to request warnings on
6050 implicit declarations.  Each of these specific warning options also
6051 has a negative form beginning @samp{-Wno-} to turn off warnings; for
6052 example, @option{-Wno-implicit}.  This manual lists only one of the
6053 two forms, whichever is not the default.  For further
6054 language-specific options also refer to @ref{C++ Dialect Options} and
6055 @ref{Objective-C and Objective-C++ Dialect Options}.
6056 Additional warnings can be produced by enabling the static analyzer;
6057 @xref{Static Analyzer Options}.
6059 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
6060 options, such as @option{-Wunused}, which may turn on further options,
6061 such as @option{-Wunused-value}. The combined effect of positive and
6062 negative forms is that more specific options have priority over less
6063 specific ones, independently of their position in the command-line. For
6064 options of the same specificity, the last one takes effect. Options
6065 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
6066 as if they appeared at the end of the command-line.
6068 When an unrecognized warning option is requested (e.g.,
6069 @option{-Wunknown-warning}), GCC emits a diagnostic stating
6070 that the option is not recognized.  However, if the @option{-Wno-} form
6071 is used, the behavior is slightly different: no diagnostic is
6072 produced for @option{-Wno-unknown-warning} unless other diagnostics
6073 are being produced.  This allows the use of new @option{-Wno-} options
6074 with old compilers, but if something goes wrong, the compiler
6075 warns that an unrecognized option is present.
6077 The effectiveness of some warnings depends on optimizations also being
6078 enabled. For example @option{-Wsuggest-final-types} is more effective
6079 with link-time optimization and some instances of other warnings may
6080 not be issued at all unless optimization is enabled.  While optimization
6081 in general improves the efficacy of control and data flow sensitive
6082 warnings, in some cases it may also cause false positives.
6084 @table @gcctabopt
6085 @opindex pedantic
6086 @opindex Wpedantic
6087 @opindex Wno-pedantic
6088 @item -Wpedantic
6089 @itemx -pedantic
6090 Issue all the warnings demanded by strict ISO C and ISO C++;
6091 diagnose all programs that use forbidden extensions, and some other
6092 programs that do not follow ISO C and ISO C++.  This follows the version
6093 of the ISO C or C++ standard specified by any @option{-std} option used.
6095 Valid ISO C and ISO C++ programs should compile properly with or without
6096 this option (though a rare few require @option{-ansi} or a
6097 @option{-std} option specifying the version of the standard)@.  However,
6098 without this option, certain GNU extensions and traditional C and C++
6099 features are supported as well.  With this option, they are diagnosed
6100 (or rejected with @option{-pedantic-errors}).
6102 @option{-Wpedantic} does not cause warning messages for use of the
6103 alternate keywords whose names begin and end with @samp{__}.  This alternate
6104 format can also be used to disable warnings for non-ISO @samp{__intN} types,
6105 i.e. @samp{__intN__}.
6106 Pedantic warnings are also disabled in the expression that follows
6107 @code{__extension__}.  However, only system header files should use
6108 these escape routes; application programs should avoid them.
6109 @xref{Alternate Keywords}.
6111 Some warnings about non-conforming programs are controlled by options
6112 other than @option{-Wpedantic}; in many cases they are implied by
6113 @option{-Wpedantic} but can be disabled separately by their specific
6114 option, e.g. @option{-Wpedantic -Wno-pointer-sign}.
6116 Where the standard specified with @option{-std} represents a GNU
6117 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
6118 corresponding @dfn{base standard}, the version of ISO C on which the GNU
6119 extended dialect is based.  Warnings from @option{-Wpedantic} are given
6120 where they are required by the base standard.  (It does not make sense
6121 for such warnings to be given only for features not in the specified GNU
6122 C dialect, since by definition the GNU dialects of C include all
6123 features the compiler supports with the given option, and there would be
6124 nothing to warn about.)
6126 @opindex pedantic-errors
6127 @item -pedantic-errors
6128 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
6129 requires a diagnostic, in some cases where there is undefined behavior
6130 at compile-time and in some other cases that do not prevent compilation
6131 of programs that are valid according to the standard. This is not
6132 equivalent to @option{-Werror=pedantic}: the latter option is unlikely to be
6133 useful, as it only makes errors of the diagnostics that are controlled by
6134 @option{-Wpedantic}, whereas this option also affects required diagnostics that
6135 are always enabled or controlled by options other than @option{-Wpedantic}.
6137 If you want the required diagnostics that are warnings by default to
6138 be errors instead, but don't also want to enable the @option{-Wpedantic}
6139 diagnostics, you can specify @option{-pedantic-errors -Wno-pedantic}
6140 (or @option{-pedantic-errors -Wno-error=pedantic} to enable them but
6141 only as warnings).
6143 Some required diagnostics are errors by default, but can be reduced to
6144 warnings using @option{-fpermissive} or their specific warning option,
6145 e.g. @option{-Wno-error=narrowing}.
6147 Some diagnostics for non-ISO practices are controlled by specific
6148 warning options other than @option{-Wpedantic}, but are also made
6149 errors by @option{-pedantic-errors}.  For instance:
6151 @gccoptlist{
6152 -Wattributes @r{(for standard attributes)}
6153 -Wchanges-meaning @r{(C++)}
6154 -Wcomma-subscript @r{(C++23 or later)}
6155 -Wdeclaration-after-statement @r{(C90 or earlier)}
6156 -Welaborated-enum-base @r{(C++11 or later)}
6157 -Wimplicit-int @r{(C99 or later)}
6158 -Wimplicit-function-declaration @r{(C99 or later)}
6159 -Wincompatible-pointer-types
6160 -Wint-conversion
6161 -Wlong-long @r{(C90 or earlier)}
6162 -Wmain
6163 -Wnarrowing @r{(C++11 or later)}
6164 -Wpointer-arith
6165 -Wpointer-sign
6166 -Wincompatible-pointer-types
6167 -Wregister @r{(C++17 or later)}
6168 -Wvla @r{(C90 or earlier)}
6169 -Wwrite-strings @r{(C++11 or later)}
6172 @opindex fpermissive
6173 @item -fpermissive
6174 Downgrade some required diagnostics about nonconformant code from
6175 errors to warnings.  Thus, using @option{-fpermissive} allows some
6176 nonconforming code to compile.  Some C++ diagnostics are controlled
6177 only by this flag, but it also downgrades some C and C++ diagnostics
6178 that have their own flag:
6180 @gccoptlist{
6181 -Wnarrowing @r{(C++)}
6184 The @option{-fpermissive} option is the default for historic C language
6185 modes (@option{-std=c89}, @option{-std=gnu89}, @option{-std=c90},
6186 @option{-std=gnu90}).
6188 @opindex Wall
6189 @opindex Wno-all
6190 @item -Wall
6191 This enables all the warnings about constructions that some users
6192 consider questionable, and that are easy to avoid (or modify to
6193 prevent the warning), even in conjunction with macros.  This also
6194 enables some language-specific warnings described in @ref{C++ Dialect
6195 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
6197 @option{-Wall} turns on the following warning flags:
6199 @gccoptlist{-Waddress
6200 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)}
6201 -Warray-compare
6202 -Warray-parameter=2 @r{(C and Objective-C only)}
6203 -Wbool-compare
6204 -Wbool-operation
6205 -Wc++11-compat  -Wc++14-compat
6206 -Wcatch-value @r{(C++ and Objective-C++ only)}
6207 -Wchar-subscripts
6208 -Wcomment
6209 -Wdangling-pointer=2
6210 -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6211 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)}
6212 -Wenum-int-mismatch @r{(C and Objective-C only)}
6213 -Wformat
6214 -Wformat-overflow
6215 -Wformat-truncation
6216 -Wint-in-bool-context
6217 -Wimplicit @r{(C and Objective-C only)}
6218 -Wimplicit-int @r{(C and Objective-C only)}
6219 -Wimplicit-function-declaration @r{(C and Objective-C only)}
6220 -Winit-self @r{(only for C++)}
6221 -Wlogical-not-parentheses
6222 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}
6223 -Wmaybe-uninitialized
6224 -Wmemset-elt-size
6225 -Wmemset-transposed-args
6226 -Wmisleading-indentation @r{(only for C/C++)}
6227 -Wmismatched-dealloc
6228 -Wmismatched-new-delete @r{(only for C/C++)}
6229 -Wmissing-attributes
6230 -Wmissing-braces @r{(only for C/ObjC)}
6231 -Wmultistatement-macros
6232 -Wnarrowing @r{(only for C++)}
6233 -Wnonnull
6234 -Wnonnull-compare
6235 -Wopenmp-simd
6236 -Wparentheses
6237 -Wpessimizing-move @r{(only for C++)}
6238 -Wpointer-sign
6239 -Wrange-loop-construct @r{(only for C++)}
6240 -Wreorder
6241 -Wrestrict
6242 -Wreturn-type
6243 -Wself-move @r{(only for C++)}
6244 -Wsequence-point
6245 -Wsign-compare @r{(only in C++)}
6246 -Wsizeof-array-div
6247 -Wsizeof-pointer-div
6248 -Wsizeof-pointer-memaccess
6249 -Wstrict-aliasing
6250 -Wstrict-overflow=1
6251 -Wswitch
6252 -Wtautological-compare
6253 -Wtrigraphs
6254 -Wuninitialized
6255 -Wunknown-pragmas
6256 -Wunused-function
6257 -Wunused-label
6258 -Wunused-value
6259 -Wunused-variable
6260 -Wuse-after-free=2
6261 -Wvla-parameter @r{(C and Objective-C only)}
6262 -Wvolatile-register-var
6263 -Wzero-length-bounds}
6265 Note that some warning flags are not implied by @option{-Wall}.  Some of
6266 them warn about constructions that users generally do not consider
6267 questionable, but which occasionally you might wish to check for;
6268 others warn about constructions that are necessary or hard to avoid in
6269 some cases, and there is no simple way to modify the code to suppress
6270 the warning. Some of them are enabled by @option{-Wextra} but many of
6271 them must be enabled individually.
6273 @opindex W
6274 @opindex Wextra
6275 @opindex Wno-extra
6276 @item -Wextra
6277 This enables some extra warning flags that are not enabled by
6278 @option{-Wall}. (This option used to be called @option{-W}.  The older
6279 name is still supported, but the newer name is more descriptive.)
6281 @gccoptlist{-Wclobbered
6282 -Wcast-function-type
6283 -Wdeprecated-copy @r{(C++ only)}
6284 -Wempty-body
6285 -Wenum-conversion @r{(C only)}
6286 -Wignored-qualifiers
6287 -Wimplicit-fallthrough=3
6288 -Wmissing-field-initializers
6289 -Wmissing-parameter-type @r{(C only)}
6290 -Wold-style-declaration @r{(C only)}
6291 -Woverride-init
6292 -Wsign-compare @r{(C only)}
6293 -Wstring-compare
6294 -Wredundant-move @r{(only for C++)}
6295 -Wtype-limits
6296 -Wuninitialized
6297 -Wshift-negative-value @r{(in C++11 to C++17 and in C99 and newer)}
6298 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}
6299 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
6302 The option @option{-Wextra} also prints warning messages for the
6303 following cases:
6305 @itemize @bullet
6307 @item
6308 A pointer is compared against integer zero with @code{<}, @code{<=},
6309 @code{>}, or @code{>=}.
6311 @item
6312 (C++ only) An enumerator and a non-enumerator both appear in a
6313 conditional expression.
6315 @item
6316 (C++ only) Ambiguous virtual bases.
6318 @item
6319 (C++ only) Subscripting an array that has been declared @code{register}.
6321 @item
6322 (C++ only) Taking the address of a variable that has been declared
6323 @code{register}.
6325 @item
6326 (C++ only) A base class is not initialized in the copy constructor
6327 of a derived class.
6329 @end itemize
6331 @opindex Wabi
6332 @opindex Wno-abi
6333 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
6335 Warn about code affected by ABI changes.  This includes code that may
6336 not be compatible with the vendor-neutral C++ ABI as well as the psABI
6337 for the particular target.
6339 Since G++ now defaults to updating the ABI with each major release,
6340 normally @option{-Wabi} warns only about C++ ABI compatibility
6341 problems if there is a check added later in a release series for an
6342 ABI issue discovered since the initial release.  @option{-Wabi} warns
6343 about more things if an older ABI version is selected (with
6344 @option{-fabi-version=@var{n}}).
6346 @option{-Wabi} can also be used with an explicit version number to
6347 warn about C++ ABI compatibility with a particular @option{-fabi-version}
6348 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
6349 @option{-fabi-version=2}.
6351 If an explicit version number is provided and
6352 @option{-fabi-compat-version} is not specified, the version number
6353 from this option is used for compatibility aliases.  If no explicit
6354 version number is provided with this option, but
6355 @option{-fabi-compat-version} is specified, that version number is
6356 used for C++ ABI warnings.
6358 Although an effort has been made to warn about
6359 all such cases, there are probably some cases that are not warned about,
6360 even though G++ is generating incompatible code.  There may also be
6361 cases where warnings are emitted even though the code that is generated
6362 is compatible.
6364 You should rewrite your code to avoid these warnings if you are
6365 concerned about the fact that code generated by G++ may not be binary
6366 compatible with code generated by other compilers.
6368 Known incompatibilities in @option{-fabi-version=2} (which was the
6369 default from GCC 3.4 to 4.9) include:
6371 @itemize @bullet
6373 @item
6374 A template with a non-type template parameter of reference type was
6375 mangled incorrectly:
6376 @smallexample
6377 extern int N;
6378 template <int &> struct S @{@};
6379 void n (S<N>) @{2@}
6380 @end smallexample
6382 This was fixed in @option{-fabi-version=3}.
6384 @item
6385 SIMD vector types declared using @code{__attribute ((vector_size))} were
6386 mangled in a non-standard way that does not allow for overloading of
6387 functions taking vectors of different sizes.
6389 The mangling was changed in @option{-fabi-version=4}.
6391 @item
6392 @code{__attribute ((const))} and @code{noreturn} were mangled as type
6393 qualifiers, and @code{decltype} of a plain declaration was folded away.
6395 These mangling issues were fixed in @option{-fabi-version=5}.
6397 @item
6398 Scoped enumerators passed as arguments to a variadic function are
6399 promoted like unscoped enumerators, causing @code{va_arg} to complain.
6400 On most targets this does not actually affect the parameter passing
6401 ABI, as there is no way to pass an argument smaller than @code{int}.
6403 Also, the ABI changed the mangling of template argument packs,
6404 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
6405 a class scope function used as a template argument.
6407 These issues were corrected in @option{-fabi-version=6}.
6409 @item
6410 Lambdas in default argument scope were mangled incorrectly, and the
6411 ABI changed the mangling of @code{nullptr_t}.
6413 These issues were corrected in @option{-fabi-version=7}.
6415 @item
6416 When mangling a function type with function-cv-qualifiers, the
6417 un-qualified function type was incorrectly treated as a substitution
6418 candidate.
6420 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
6422 @item
6423 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
6424 unaligned accesses.  Note that this did not affect the ABI of a
6425 function with a @code{nullptr_t} parameter, as parameters have a
6426 minimum alignment.
6428 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
6430 @item
6431 Target-specific attributes that affect the identity of a type, such as
6432 ia32 calling conventions on a function type (stdcall, regparm, etc.),
6433 did not affect the mangled name, leading to name collisions when
6434 function pointers were used as template arguments.
6436 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
6438 @end itemize
6440 This option also enables warnings about psABI-related changes.
6441 The known psABI changes at this point include:
6443 @itemize @bullet
6445 @item
6446 For SysV/x86-64, unions with @code{long double} members are
6447 passed in memory as specified in psABI.  Prior to GCC 4.4, this was not
6448 the case.  For example:
6450 @smallexample
6451 union U @{
6452   long double ld;
6453   int i;
6455 @end smallexample
6457 @noindent
6458 @code{union U} is now always passed in memory.
6460 @end itemize
6462 @item -Wno-changes-meaning @r{(C++ and Objective-C++ only)}
6463 C++ requires that unqualified uses of a name within a class have the
6464 same meaning in the complete scope of the class, so declaring the name
6465 after using it is ill-formed:
6466 @smallexample
6467 struct A;
6468 struct B1 @{ A a; typedef A A; @}; // warning, 'A' changes meaning
6469 struct B2 @{ A a; struct A @{ @}; @}; // error, 'A' changes meaning
6470 @end smallexample
6471 By default, the B1 case is only a warning because the two declarations
6472 have the same type, while the B2 case is an error.  Both diagnostics
6473 can be disabled with @option{-Wno-changes-meaning}.  Alternately, the
6474 error case can be reduced to a warning with
6475 @option{-Wno-error=changes-meaning} or @option{-fpermissive}.
6477 Both diagnostics are also suppressed by @option{-fms-extensions}.
6479 @opindex Wchar-subscripts
6480 @opindex Wno-char-subscripts
6481 @item -Wchar-subscripts
6482 Warn if an array subscript has type @code{char}.  This is a common cause
6483 of error, as programmers often forget that this type is signed on some
6484 machines.
6485 This warning is enabled by @option{-Wall}.
6487 @opindex Wno-coverage-mismatch
6488 @opindex Wcoverage-mismatch
6489 @item -Wno-coverage-mismatch
6490 Warn if feedback profiles do not match when using the
6491 @option{-fprofile-use} option.
6492 If a source file is changed between compiling with @option{-fprofile-generate}
6493 and with @option{-fprofile-use}, the files with the profile feedback can fail
6494 to match the source file and GCC cannot use the profile feedback
6495 information.  By default, this warning is enabled and is treated as an
6496 error.  @option{-Wno-coverage-mismatch} can be used to disable the
6497 warning or @option{-Wno-error=coverage-mismatch} can be used to
6498 disable the error.  Disabling the error for this warning can result in
6499 poorly optimized code and is useful only in the
6500 case of very minor changes such as bug fixes to an existing code-base.
6501 Completely disabling the warning is not recommended.
6503 @opindex Wno-coverage-invalid-line-number
6504 @opindex Wcoverage-invalid-line-number
6505 @item -Wno-coverage-invalid-line-number
6506 Warn in case a function ends earlier than it begins due
6507 to an invalid linenum macros.  The warning is emitted only
6508 with @option{--coverage} enabled.
6510 By default, this warning is enabled and is treated as an
6511 error.  @option{-Wno-coverage-invalid-line-number} can be used to disable the
6512 warning or @option{-Wno-error=coverage-invalid-line-number} can be used to
6513 disable the error.
6515 @opindex Wno-cpp
6516 @opindex Wcpp
6517 @item -Wno-cpp @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
6518 Suppress warning messages emitted by @code{#warning} directives.
6520 @opindex Wdouble-promotion
6521 @opindex Wno-double-promotion
6522 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
6523 Give a warning when a value of type @code{float} is implicitly
6524 promoted to @code{double}.  CPUs with a 32-bit ``single-precision''
6525 floating-point unit implement @code{float} in hardware, but emulate
6526 @code{double} in software.  On such a machine, doing computations
6527 using @code{double} values is much more expensive because of the
6528 overhead required for software emulation.
6530 It is easy to accidentally do computations with @code{double} because
6531 floating-point literals are implicitly of type @code{double}.  For
6532 example, in:
6533 @smallexample
6534 @group
6535 float area(float radius)
6537    return 3.14159 * radius * radius;
6539 @end group
6540 @end smallexample
6541 the compiler performs the entire computation with @code{double}
6542 because the floating-point literal is a @code{double}.
6544 @opindex Wduplicate-decl-specifier
6545 @opindex Wno-duplicate-decl-specifier
6546 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6547 Warn if a declaration has duplicate @code{const}, @code{volatile},
6548 @code{restrict} or @code{_Atomic} specifier.  This warning is enabled by
6549 @option{-Wall}.
6551 @opindex Wformat
6552 @opindex Wno-format
6553 @opindex ffreestanding
6554 @opindex fno-builtin
6555 @opindex Wformat=
6556 @item -Wformat
6557 @itemx -Wformat=@var{n}
6558 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
6559 the arguments supplied have types appropriate to the format string
6560 specified, and that the conversions specified in the format string make
6561 sense.  This includes standard functions, and others specified by format
6562 attributes (@pxref{Function Attributes}), in the @code{printf},
6563 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
6564 not in the C standard) families (or other target-specific families).
6565 Which functions are checked without format attributes having been
6566 specified depends on the standard version selected, and such checks of
6567 functions without the attribute specified are disabled by
6568 @option{-ffreestanding} or @option{-fno-builtin}.
6570 The formats are checked against the format features supported by GNU
6571 libc version 2.2.  These include all ISO C90 and C99 features, as well
6572 as features from the Single Unix Specification and some BSD and GNU
6573 extensions.  Other library implementations may not support all these
6574 features; GCC does not support warning about features that go beyond a
6575 particular library's limitations.  However, if @option{-Wpedantic} is used
6576 with @option{-Wformat}, warnings are given about format features not
6577 in the selected standard version (but not for @code{strfmon} formats,
6578 since those are not in any version of the C standard).  @xref{C Dialect
6579 Options,,Options Controlling C Dialect}.
6581 @table @gcctabopt
6582 @opindex Wformat
6583 @opindex Wformat=1
6584 @item -Wformat=1
6585 @itemx -Wformat
6586 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
6587 @option{-Wno-format} is equivalent to @option{-Wformat=0}.  Since
6588 @option{-Wformat} also checks for null format arguments for several
6589 functions, @option{-Wformat} also implies @option{-Wnonnull}.  Some
6590 aspects of this level of format checking can be disabled by the
6591 options: @option{-Wno-format-contains-nul},
6592 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
6593 @option{-Wformat} is enabled by @option{-Wall}.
6595 @opindex Wformat=2
6596 @item -Wformat=2
6597 Enable @option{-Wformat} plus additional format checks.  Currently
6598 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
6599 -Wformat-y2k}.
6600 @end table
6602 @opindex Wno-format-contains-nul
6603 @opindex Wformat-contains-nul
6604 @item -Wno-format-contains-nul
6605 If @option{-Wformat} is specified, do not warn about format strings that
6606 contain NUL bytes.
6608 @opindex Wno-format-extra-args
6609 @opindex Wformat-extra-args
6610 @item -Wno-format-extra-args
6611 If @option{-Wformat} is specified, do not warn about excess arguments to a
6612 @code{printf} or @code{scanf} format function.  The C standard specifies
6613 that such arguments are ignored.
6615 Where the unused arguments lie between used arguments that are
6616 specified with @samp{$} operand number specifications, normally
6617 warnings are still given, since the implementation could not know what
6618 type to pass to @code{va_arg} to skip the unused arguments.  However,
6619 in the case of @code{scanf} formats, this option suppresses the
6620 warning if the unused arguments are all pointers, since the Single
6621 Unix Specification says that such unused arguments are allowed.
6623 @opindex Wformat-overflow
6624 @opindex Wno-format-overflow
6625 @item -Wformat-overflow
6626 @itemx -Wformat-overflow=@var{level}
6627 Warn about calls to formatted input/output functions such as @code{sprintf}
6628 and @code{vsprintf} that might overflow the destination buffer.  When the
6629 exact number of bytes written by a format directive cannot be determined
6630 at compile-time it is estimated based on heuristics that depend on the
6631 @var{level} argument and on optimization.  While enabling optimization
6632 will in most cases improve the accuracy of the warning, it may also
6633 result in false positives.
6635 @table @gcctabopt
6636 @opindex Wformat-overflow
6637 @opindex Wno-format-overflow
6638 @item -Wformat-overflow
6639 @itemx -Wformat-overflow=1
6640 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
6641 employs a conservative approach that warns only about calls that most
6642 likely overflow the buffer.  At this level, numeric arguments to format
6643 directives with unknown values are assumed to have the value of one, and
6644 strings of unknown length to be empty.  Numeric arguments that are known
6645 to be bounded to a subrange of their type, or string arguments whose output
6646 is bounded either by their directive's precision or by a finite set of
6647 string literals, are assumed to take on the value within the range that
6648 results in the most bytes on output.  For example, the call to @code{sprintf}
6649 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
6650 the terminating NUL character (@code{'\0'}) appended by the function
6651 to the destination buffer will be written past its end.  Increasing
6652 the size of the buffer by a single byte is sufficient to avoid the
6653 warning, though it may not be sufficient to avoid the overflow.
6655 @smallexample
6656 void f (int a, int b)
6658   char buf [13];
6659   sprintf (buf, "a = %i, b = %i\n", a, b);
6661 @end smallexample
6663 @item -Wformat-overflow=2
6664 Level @var{2} warns also about calls that might overflow the destination
6665 buffer given an argument of sufficient length or magnitude.  At level
6666 @var{2}, unknown numeric arguments are assumed to have the minimum
6667 representable value for signed types with a precision greater than 1, and
6668 the maximum representable value otherwise.  Unknown string arguments whose
6669 length cannot be assumed to be bounded either by the directive's precision,
6670 or by a finite set of string literals they may evaluate to, or the character
6671 array they may point to, are assumed to be 1 character long.
6673 At level @var{2}, the call in the example above is again diagnosed, but
6674 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
6675 @code{%i} directive will write some of its digits beyond the end of
6676 the destination buffer.  To make the call safe regardless of the values
6677 of the two variables, the size of the destination buffer must be increased
6678 to at least 34 bytes.  GCC includes the minimum size of the buffer in
6679 an informational note following the warning.
6681 An alternative to increasing the size of the destination buffer is to
6682 constrain the range of formatted values.  The maximum length of string
6683 arguments can be bounded by specifying the precision in the format
6684 directive.  When numeric arguments of format directives can be assumed
6685 to be bounded by less than the precision of their type, choosing
6686 an appropriate length modifier to the format specifier will reduce
6687 the required buffer size.  For example, if @var{a} and @var{b} in the
6688 example above can be assumed to be within the precision of
6689 the @code{short int} type then using either the @code{%hi} format
6690 directive or casting the argument to @code{short} reduces the maximum
6691 required size of the buffer to 24 bytes.
6693 @smallexample
6694 void f (int a, int b)
6696   char buf [23];
6697   sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
6699 @end smallexample
6700 @end table
6702 @opindex Wno-format-zero-length
6703 @opindex Wformat-zero-length
6704 @item -Wno-format-zero-length
6705 If @option{-Wformat} is specified, do not warn about zero-length formats.
6706 The C standard specifies that zero-length formats are allowed.
6708 @opindex Wformat-nonliteral
6709 @opindex Wno-format-nonliteral
6710 @item -Wformat-nonliteral
6711 If @option{-Wformat} is specified, also warn if the format string is not a
6712 string literal and so cannot be checked, unless the format function
6713 takes its format arguments as a @code{va_list}.
6715 @opindex Wformat-security
6716 @opindex Wno-format-security
6717 @item -Wformat-security
6718 If @option{-Wformat} is specified, also warn about uses of format
6719 functions that represent possible security problems.  At present, this
6720 warns about calls to @code{printf} and @code{scanf} functions where the
6721 format string is not a string literal and there are no format arguments,
6722 as in @code{printf (foo);}.  This may be a security hole if the format
6723 string came from untrusted input and contains @samp{%n}.  (This is
6724 currently a subset of what @option{-Wformat-nonliteral} warns about, but
6725 in future warnings may be added to @option{-Wformat-security} that are not
6726 included in @option{-Wformat-nonliteral}.)
6728 @opindex Wformat-signedness
6729 @opindex Wno-format-signedness
6730 @item -Wformat-signedness
6731 If @option{-Wformat} is specified, also warn if the format string
6732 requires an unsigned argument and the argument is signed and vice versa.
6734 @opindex Wformat-truncation
6735 @opindex Wno-format-truncation
6736 @item -Wformat-truncation
6737 @itemx -Wformat-truncation=@var{level}
6738 Warn about calls to formatted input/output functions such as @code{snprintf}
6739 and @code{vsnprintf} that might result in output truncation.  When the exact
6740 number of bytes written by a format directive cannot be determined at
6741 compile-time it is estimated based on heuristics that depend on
6742 the @var{level} argument and on optimization.  While enabling optimization
6743 will in most cases improve the accuracy of the warning, it may also result
6744 in false positives.  Except as noted otherwise, the option uses the same
6745 logic @option{-Wformat-overflow}.
6747 @table @gcctabopt
6748 @opindex Wformat-truncation
6749 @opindex Wno-format-truncation
6750 @item -Wformat-truncation
6751 @itemx -Wformat-truncation=1
6752 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
6753 employs a conservative approach that warns only about calls to bounded
6754 functions whose return value is unused and that will most likely result
6755 in output truncation.
6757 @item -Wformat-truncation=2
6758 Level @var{2} warns also about calls to bounded functions whose return
6759 value is used and that might result in truncation given an argument of
6760 sufficient length or magnitude.
6761 @end table
6763 @opindex Wformat-y2k
6764 @opindex Wno-format-y2k
6765 @item -Wformat-y2k
6766 If @option{-Wformat} is specified, also warn about @code{strftime}
6767 formats that may yield only a two-digit year.
6769 @opindex Wnonnull
6770 @opindex Wno-nonnull
6771 @item -Wnonnull
6772 Warn about passing a null pointer for arguments marked as
6773 requiring a non-null value by the @code{nonnull} function attribute.
6775 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
6776 can be disabled with the @option{-Wno-nonnull} option.
6778 @opindex Wnonnull-compare
6779 @opindex Wno-nonnull-compare
6780 @item -Wnonnull-compare
6781 Warn when comparing an argument marked with the @code{nonnull}
6782 function attribute against null inside the function.
6784 @option{-Wnonnull-compare} is included in @option{-Wall}.  It
6785 can be disabled with the @option{-Wno-nonnull-compare} option.
6787 @opindex Wnull-dereference
6788 @opindex Wno-null-dereference
6789 @item -Wnull-dereference
6790 Warn if the compiler detects paths that trigger erroneous or
6791 undefined behavior due to dereferencing a null pointer.  This option
6792 is only active when @option{-fdelete-null-pointer-checks} is active,
6793 which is enabled by optimizations in most targets.  The precision of
6794 the warnings depends on the optimization options used.
6796 @opindex Wnrvo
6797 @opindex Wno-nrvo
6798 @item -Wnrvo @r{(C++ and Objective-C++ only)}
6799 Warn if the compiler does not elide the copy from a local variable to
6800 the return value of a function in a context where it is allowed by
6801 [class.copy.elision].  This elision is commonly known as the Named
6802 Return Value Optimization.  For instance, in the example below the
6803 compiler cannot elide copies from both v1 and v2, so it elides neither.
6805 @smallexample
6806 std::vector<int> f()
6808   std::vector<int> v1, v2;
6809   // ...
6810   if (cond) return v1;
6811   else return v2; // warning: not eliding copy
6813 @end smallexample
6815 @opindex Winfinite-recursion
6816 @opindex Wno-infinite-recursion
6817 @item -Winfinite-recursion
6818 Warn about infinitely recursive calls.  The warning is effective at all
6819 optimization levels but requires optimization in order to detect infinite
6820 recursion in calls between two or more functions.
6821 @option{-Winfinite-recursion} is included in @option{-Wall}.
6823 Compare with @option{-Wanalyzer-infinite-recursion} which provides a
6824 similar diagnostic, but is implemented in a different way (as part of
6825 @option{-fanalyzer}).
6827 @opindex Winit-self
6828 @opindex Wno-init-self
6829 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
6830 Warn about uninitialized variables that are initialized with themselves.
6831 Note this option can only be used with the @option{-Wuninitialized} option.
6833 For example, GCC warns about @code{i} being uninitialized in the
6834 following snippet only when @option{-Winit-self} has been specified:
6835 @smallexample
6836 @group
6837 int f()
6839   int i = i;
6840   return i;
6842 @end group
6843 @end smallexample
6845 This warning is enabled by @option{-Wall} in C++.
6847 @opindex Wimplicit-int
6848 @opindex Wno-implicit-int
6849 @item -Wno-implicit-int @r{(C and Objective-C only)}
6850 This option controls warnings when a declaration does not specify a type.
6851 This warning is enabled by default in C99 and later dialects of C,
6852 and also by @option{-Wall}.
6854 This warning is upgraded to an error by @option{-pedantic-errors}.
6856 @opindex Wimplicit-function-declaration
6857 @opindex Wno-implicit-function-declaration
6858 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
6859 This option controls warnings when a function is used before being declared.
6860 This warning is enabled by default in C99 and later dialects of C,
6861 and also by @option{-Wall}.
6863 This warning is upgraded to an error by @option{-pedantic-errors}.
6865 @opindex Wimplicit
6866 @opindex Wno-implicit
6867 @item -Wimplicit @r{(C and Objective-C only)}
6868 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
6869 This warning is enabled by @option{-Wall}.
6871 @opindex Wimplicit-fallthrough
6872 @opindex Wno-implicit-fallthrough
6873 @item -Wimplicit-fallthrough
6874 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
6875 and @option{-Wno-implicit-fallthrough} is the same as
6876 @option{-Wimplicit-fallthrough=0}.
6878 @opindex Wimplicit-fallthrough=
6879 @item -Wimplicit-fallthrough=@var{n}
6880 Warn when a switch case falls through.  For example:
6882 @smallexample
6883 @group
6884 switch (cond)
6885   @{
6886   case 1:
6887     a = 1;
6888     break;
6889   case 2:
6890     a = 2;
6891   case 3:
6892     a = 3;
6893     break;
6894   @}
6895 @end group
6896 @end smallexample
6898 This warning does not warn when the last statement of a case cannot
6899 fall through, e.g. when there is a return statement or a call to function
6900 declared with the noreturn attribute.  @option{-Wimplicit-fallthrough=}
6901 also takes into account control flow statements, such as ifs, and only
6902 warns when appropriate.  E.g.@:
6904 @smallexample
6905 @group
6906 switch (cond)
6907   @{
6908   case 1:
6909     if (i > 3) @{
6910       bar (5);
6911       break;
6912     @} else if (i < 1) @{
6913       bar (0);
6914     @} else
6915       return;
6916   default:
6917     @dots{}
6918   @}
6919 @end group
6920 @end smallexample
6922 Since there are occasions where a switch case fall through is desirable,
6923 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
6924 to be used along with a null statement to suppress this warning that
6925 would normally occur:
6927 @smallexample
6928 @group
6929 switch (cond)
6930   @{
6931   case 1:
6932     bar (0);
6933     __attribute__ ((fallthrough));
6934   default:
6935     @dots{}
6936   @}
6937 @end group
6938 @end smallexample
6940 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
6941 warning using @code{[[fallthrough]];} instead of the GNU attribute.  In C++11
6942 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
6943 Instead of these attributes, it is also possible to add a fallthrough comment
6944 to silence the warning.  The whole body of the C or C++ style comment should
6945 match the given regular expressions listed below.  The option argument @var{n}
6946 specifies what kind of comments are accepted:
6948 @itemize @bullet
6950 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
6952 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
6953 expression, any comment is used as fallthrough comment.
6955 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
6956 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
6958 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
6959 following regular expressions:
6961 @itemize @bullet
6963 @item @code{-fallthrough}
6965 @item @code{@@fallthrough@@}
6967 @item @code{lint -fallthrough[ \t]*}
6969 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
6971 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6973 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6975 @end itemize
6977 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
6978 following regular expressions:
6980 @itemize @bullet
6982 @item @code{-fallthrough}
6984 @item @code{@@fallthrough@@}
6986 @item @code{lint -fallthrough[ \t]*}
6988 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
6990 @end itemize
6992 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
6993 fallthrough comments, only attributes disable the warning.
6995 @end itemize
6997 The comment needs to be followed after optional whitespace and other comments
6998 by @code{case} or @code{default} keywords or by a user label that precedes some
6999 @code{case} or @code{default} label.
7001 @smallexample
7002 @group
7003 switch (cond)
7004   @{
7005   case 1:
7006     bar (0);
7007     /* FALLTHRU */
7008   default:
7009     @dots{}
7010   @}
7011 @end group
7012 @end smallexample
7014 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
7016 @opindex Wif-not-aligned
7017 @opindex Wno-if-not-aligned
7018 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7019 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
7020 should be issued.  These warnings are enabled by default.
7022 @opindex Wignored-qualifiers
7023 @opindex Wno-ignored-qualifiers
7024 @item -Wignored-qualifiers @r{(C and C++ only)}
7025 Warn if the return type of a function has a type qualifier
7026 such as @code{const}.  For ISO C such a type qualifier has no effect,
7027 since the value returned by a function is not an lvalue.
7028 For C++, the warning is only emitted for scalar types or @code{void}.
7029 ISO C prohibits qualified @code{void} return types on function
7030 definitions, so such return types always receive a warning
7031 even without this option.
7033 This warning is also enabled by @option{-Wextra}.
7035 @opindex Wignored-attributes
7036 @opindex Wno-ignored-attributes
7037 @item -Wno-ignored-attributes @r{(C and C++ only)}
7038 This option controls warnings when an attribute is ignored.
7039 This is different from the
7040 @option{-Wattributes} option in that it warns whenever the compiler decides
7041 to drop an attribute, not that the attribute is either unknown, used in a
7042 wrong place, etc.  This warning is enabled by default.
7044 @opindex Wmain
7045 @opindex Wno-main
7046 @item -Wmain
7047 Warn if the type of @code{main} is suspicious.  @code{main} should be
7048 a function with external linkage, returning int, taking either zero
7049 arguments, two, or three arguments of appropriate types.  This warning
7050 is enabled by default in C++ and is enabled by either @option{-Wall}
7051 or @option{-Wpedantic}.
7053 This warning is upgraded to an error by @option{-pedantic-errors}.
7055 @opindex Wmisleading-indentation
7056 @opindex Wno-misleading-indentation
7057 @item -Wmisleading-indentation @r{(C and C++ only)}
7058 Warn when the indentation of the code does not reflect the block structure.
7059 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
7060 @code{for} clauses with a guarded statement that does not use braces,
7061 followed by an unguarded statement with the same indentation.
7063 In the following example, the call to ``bar'' is misleadingly indented as
7064 if it were guarded by the ``if'' conditional.
7066 @smallexample
7067   if (some_condition ())
7068     foo ();
7069     bar ();  /* Gotcha: this is not guarded by the "if".  */
7070 @end smallexample
7072 In the case of mixed tabs and spaces, the warning uses the
7073 @option{-ftabstop=} option to determine if the statements line up
7074 (defaulting to 8).
7076 The warning is not issued for code involving multiline preprocessor logic
7077 such as the following example.
7079 @smallexample
7080   if (flagA)
7081     foo (0);
7082 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
7083   if (flagB)
7084 #endif
7085     foo (1);
7086 @end smallexample
7088 The warning is not issued after a @code{#line} directive, since this
7089 typically indicates autogenerated code, and no assumptions can be made
7090 about the layout of the file that the directive references.
7092 This warning is enabled by @option{-Wall} in C and C++.
7094 @opindex Wmissing-attributes
7095 @opindex Wno-missing-attributes
7096 @item -Wmissing-attributes
7097 Warn when a declaration of a function is missing one or more attributes
7098 that a related function is declared with and whose absence may adversely
7099 affect the correctness or efficiency of generated code.  For example,
7100 the warning is issued for declarations of aliases that use attributes
7101 to specify less restrictive requirements than those of their targets.
7102 This typically represents a potential optimization opportunity.
7103 By contrast, the @option{-Wattribute-alias=2} option controls warnings
7104 issued when the alias is more restrictive than the target, which could
7105 lead to incorrect code generation.
7106 Attributes considered include @code{alloc_align}, @code{alloc_size},
7107 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
7108 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
7109 @code{returns_nonnull}, and @code{returns_twice}.
7111 In C++, the warning is issued when an explicit specialization of a primary
7112 template declared with attribute @code{alloc_align}, @code{alloc_size},
7113 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
7114 or @code{nonnull} is declared without it.  Attributes @code{deprecated},
7115 @code{error}, and @code{warning} suppress the warning.
7116 (@pxref{Function Attributes}).
7118 You can use the @code{copy} attribute to apply the same
7119 set of attributes to a declaration as that on another declaration without
7120 explicitly enumerating the attributes. This attribute can be applied
7121 to declarations of functions (@pxref{Common Function Attributes}),
7122 variables (@pxref{Common Variable Attributes}), or types
7123 (@pxref{Common Type Attributes}).
7125 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
7127 For example, since the declaration of the primary function template
7128 below makes use of both attribute @code{malloc} and @code{alloc_size}
7129 the declaration of the explicit specialization of the template is
7130 diagnosed because it is missing one of the attributes.
7132 @smallexample
7133 template <class T>
7134 T* __attribute__ ((malloc, alloc_size (1)))
7135 allocate (size_t);
7137 template <>
7138 void* __attribute__ ((malloc))   // missing alloc_size
7139 allocate<void> (size_t);
7140 @end smallexample
7142 @opindex Wmissing-braces
7143 @opindex Wno-missing-braces
7144 @item -Wmissing-braces
7145 Warn if an aggregate or union initializer is not fully bracketed.  In
7146 the following example, the initializer for @code{a} is not fully
7147 bracketed, but that for @code{b} is fully bracketed.
7149 @smallexample
7150 int a[2][2] = @{ 0, 1, 2, 3 @};
7151 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
7152 @end smallexample
7154 This warning is enabled by @option{-Wall}.
7156 @opindex Wmissing-include-dirs
7157 @opindex Wno-missing-include-dirs
7158 @item -Wmissing-include-dirs @r{(C, C++, Objective-C, Objective-C++ and Fortran only)}
7159 Warn if a user-supplied include directory does not exist. This option is disabled
7160 by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially
7161 enabled by default by warning for -I and -J, only.
7163 @opindex Wmissing-profile
7164 @opindex Wno-missing-profile
7165 @item -Wno-missing-profile
7166 This option controls warnings if feedback profiles are missing when using the
7167 @option{-fprofile-use} option.
7168 This option diagnoses those cases where a new function or a new file is added
7169 between compiling with @option{-fprofile-generate} and with
7170 @option{-fprofile-use}, without regenerating the profiles.
7171 In these cases, the profile feedback data files do not contain any
7172 profile feedback information for
7173 the newly added function or file respectively.  Also, in the case when profile
7174 count data (.gcda) files are removed, GCC cannot use any profile feedback
7175 information.  In all these cases, warnings are issued to inform you that a
7176 profile generation step is due.
7177 Ignoring the warning can result in poorly optimized code.
7178 @option{-Wno-missing-profile} can be used to
7179 disable the warning, but this is not recommended and should be done only
7180 when non-existent profile data is justified.
7182 @opindex Wmismatched-dealloc
7183 @opindex Wno-mismatched-dealloc
7184 @item -Wmismatched-dealloc
7186 Warn for calls to deallocation functions with pointer arguments returned
7187 from from allocations functions for which the former isn't a suitable
7188 deallocator.  A pair of functions can be associated as matching allocators
7189 and deallocators by use of attribute @code{malloc}.  Unless disabled by
7190 the @option{-fno-builtin} option the standard functions @code{calloc},
7191 @code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding
7192 forms of C++ @code{operator new} and @code{operator delete} are implicitly
7193 associated as matching allocators and deallocators.  In the following
7194 example @code{mydealloc} is the deallocator for pointers returned from
7195 @code{myalloc}.
7197 @smallexample
7198 void mydealloc (void*);
7200 __attribute__ ((malloc (mydealloc, 1))) void*
7201 myalloc (size_t);
7203 void f (void)
7205   void *p = myalloc (32);
7206   // @dots{}use p@dots{}
7207   free (p);   // warning: not a matching deallocator for myalloc
7208   mydealloc (p);   // ok
7210 @end smallexample
7212 In C++, the related option @option{-Wmismatched-new-delete} diagnoses
7213 mismatches involving either @code{operator new} or @code{operator delete}.
7215 Option @option{-Wmismatched-dealloc} is included in @option{-Wall}.
7217 @opindex Wmultistatement-macros
7218 @opindex Wno-multistatement-macros
7219 @item -Wmultistatement-macros
7220 Warn about unsafe multiple statement macros that appear to be guarded
7221 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
7222 @code{while}, in which only the first statement is actually guarded after
7223 the macro is expanded.
7225 For example:
7227 @smallexample
7228 #define DOIT x++; y++
7229 if (c)
7230   DOIT;
7231 @end smallexample
7233 will increment @code{y} unconditionally, not just when @code{c} holds.
7234 The can usually be fixed by wrapping the macro in a do-while loop:
7235 @smallexample
7236 #define DOIT do @{ x++; y++; @} while (0)
7237 if (c)
7238   DOIT;
7239 @end smallexample
7241 This warning is enabled by @option{-Wall} in C and C++.
7243 @opindex Wparentheses
7244 @opindex Wno-parentheses
7245 @item -Wparentheses
7246 Warn if parentheses are omitted in certain contexts, such
7247 as when there is an assignment in a context where a truth value
7248 is expected, or when operators are nested whose precedence people
7249 often get confused about.
7251 Also warn if a comparison like @code{x<=y<=z} appears; this is
7252 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
7253 interpretation from that of ordinary mathematical notation.
7255 Also warn for dangerous uses of the GNU extension to
7256 @code{?:} with omitted middle operand. When the condition
7257 in the @code{?}: operator is a boolean expression, the omitted value is
7258 always 1.  Often programmers expect it to be a value computed
7259 inside the conditional expression instead.
7261 For C++ this also warns for some cases of unnecessary parentheses in
7262 declarations, which can indicate an attempt at a function call instead
7263 of a declaration:
7264 @smallexample
7266   // Declares a local variable called mymutex.
7267   std::unique_lock<std::mutex> (mymutex);
7268   // User meant std::unique_lock<std::mutex> lock (mymutex);
7270 @end smallexample
7272 This warning is enabled by @option{-Wall}.
7274 @opindex Wself-move
7275 @opindex Wno-self-move
7276 @item -Wno-self-move @r{(C++ and Objective-C++ only)}
7277 This warning warns when a value is moved to itself with @code{std::move}.
7278 Such a @code{std::move} typically has no effect.
7280 @smallexample
7281 struct T @{
7282 @dots{}
7284 void fn()
7286   T t;
7287   @dots{}
7288   t = std::move (t);
7290 @end smallexample
7292 This warning is enabled by @option{-Wall}.
7294 @opindex Wsequence-point
7295 @opindex Wno-sequence-point
7296 @item -Wsequence-point
7297 Warn about code that may have undefined semantics because of violations
7298 of sequence point rules in the C and C++ standards.
7300 The C and C++ standards define the order in which expressions in a C/C++
7301 program are evaluated in terms of @dfn{sequence points}, which represent
7302 a partial ordering between the execution of parts of the program: those
7303 executed before the sequence point, and those executed after it.  These
7304 occur after the evaluation of a full expression (one which is not part
7305 of a larger expression), after the evaluation of the first operand of a
7306 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
7307 function is called (but after the evaluation of its arguments and the
7308 expression denoting the called function), and in certain other places.
7309 Other than as expressed by the sequence point rules, the order of
7310 evaluation of subexpressions of an expression is not specified.  All
7311 these rules describe only a partial order rather than a total order,
7312 since, for example, if two functions are called within one expression
7313 with no sequence point between them, the order in which the functions
7314 are called is not specified.  However, the standards committee have
7315 ruled that function calls do not overlap.
7317 It is not specified when between sequence points modifications to the
7318 values of objects take effect.  Programs whose behavior depends on this
7319 have undefined behavior; the C and C++ standards specify that ``Between
7320 the previous and next sequence point an object shall have its stored
7321 value modified at most once by the evaluation of an expression.
7322 Furthermore, the prior value shall be read only to determine the value
7323 to be stored.''.  If a program breaks these rules, the results on any
7324 particular implementation are entirely unpredictable.
7326 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
7327 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
7328 diagnosed by this option, and it may give an occasional false positive
7329 result, but in general it has been found fairly effective at detecting
7330 this sort of problem in programs.
7332 The C++17 standard will define the order of evaluation of operands in
7333 more cases: in particular it requires that the right-hand side of an
7334 assignment be evaluated before the left-hand side, so the above
7335 examples are no longer undefined.  But this option will still warn
7336 about them, to help people avoid writing code that is undefined in C
7337 and earlier revisions of C++.
7339 The standard is worded confusingly, therefore there is some debate
7340 over the precise meaning of the sequence point rules in subtle cases.
7341 Links to discussions of the problem, including proposed formal
7342 definitions, may be found on the GCC readings page, at
7343 @uref{https://gcc.gnu.org/@/readings.html}.
7345 This warning is enabled by @option{-Wall} for C and C++.
7347 @opindex Wno-return-local-addr
7348 @opindex Wreturn-local-addr
7349 @item -Wno-return-local-addr
7350 Do not warn about returning a pointer (or in C++, a reference) to a
7351 variable that goes out of scope after the function returns.
7353 @opindex Wreturn-mismatch
7354 @opindex Wno-return-mismatch
7355 @item -Wreturn-mismatch
7356 Warn about return statements without an expressions in functions which
7357 do not return @code{void}.  Also warn about a @code{return} statement
7358 with an expression in a function whose return type is @code{void},
7359 unless the expression type is also @code{void}.  As a GNU extension, the
7360 latter case is accepted without a warning unless @option{-Wpedantic} is
7361 used.
7363 Attempting to use the return value of a non-@code{void} function other
7364 than @code{main} that flows off the end by reaching the closing curly
7365 brace that terminates the function is undefined.
7367 This warning is specific to C and enabled by default.
7369 @opindex Wreturn-type
7370 @opindex Wno-return-type
7371 @item -Wreturn-type
7372 Warn whenever a function is defined with a return type that defaults to
7373 @code{int} (unless @option{-Wimplicit-int} is active, which takes
7374 precedence).  Also warn if execution may reach the end of the function
7375 body, or if the function does not contain any return statement at all.
7377 Attempting to use the return value of a non-@code{void} function other
7378 than @code{main} that flows off the end by reaching the closing curly
7379 brace that terminates the function is undefined.
7381 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
7382 than @code{main} results in undefined behavior even when the value of
7383 the function is not used.
7385 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
7387 @opindex Wshift-count-negative
7388 @opindex Wno-shift-count-negative
7389 @item -Wno-shift-count-negative
7390 Controls warnings if a shift count is negative.
7391 This warning is enabled by default.
7393 @opindex Wshift-count-overflow
7394 @opindex Wno-shift-count-overflow
7395 @item -Wno-shift-count-overflow
7396 Controls warnings if a shift count is greater than or equal to the bit width
7397 of the type.  This warning is enabled by default.
7399 @opindex Wshift-negative-value
7400 @opindex Wno-shift-negative-value
7401 @item -Wshift-negative-value
7402 Warn if left shifting a negative value.  This warning is enabled by
7403 @option{-Wextra} in C99 (and newer) and C++11 to C++17 modes.
7405 @opindex Wshift-overflow
7406 @opindex Wno-shift-overflow
7407 @item -Wno-shift-overflow
7408 @itemx -Wshift-overflow=@var{n}
7409 These options control warnings about left shift overflows.
7411 @table @gcctabopt
7412 @item -Wshift-overflow=1
7413 This is the warning level of @option{-Wshift-overflow} and is enabled
7414 by default in C99 and C++11 modes (and newer).  This warning level does
7415 not warn about left-shifting 1 into the sign bit.  (However, in C, such
7416 an overflow is still rejected in contexts where an integer constant expression
7417 is required.)  No warning is emitted in C++20 mode (and newer), as signed left
7418 shifts always wrap.
7420 @item -Wshift-overflow=2
7421 This warning level also warns about left-shifting 1 into the sign bit,
7422 unless C++14 mode (or newer) is active.
7423 @end table
7425 @opindex Wswitch
7426 @opindex Wno-switch
7427 @item -Wswitch
7428 Warn whenever a @code{switch} statement has an index of enumerated type
7429 and lacks a @code{case} for one or more of the named codes of that
7430 enumeration.  (The presence of a @code{default} label prevents this
7431 warning.)  @code{case} labels outside the enumeration range also
7432 provoke warnings when this option is used (even if there is a
7433 @code{default} label).
7434 This warning is enabled by @option{-Wall}.
7436 @opindex Wswitch-default
7437 @opindex Wno-switch-default
7438 @item -Wswitch-default
7439 Warn whenever a @code{switch} statement does not have a @code{default}
7440 case.
7442 @opindex Wswitch-enum
7443 @opindex Wno-switch-enum
7444 @item -Wswitch-enum
7445 Warn whenever a @code{switch} statement has an index of enumerated type
7446 and lacks a @code{case} for one or more of the named codes of that
7447 enumeration.  @code{case} labels outside the enumeration range also
7448 provoke warnings when this option is used.  The only difference
7449 between @option{-Wswitch} and this option is that this option gives a
7450 warning about an omitted enumeration code even if there is a
7451 @code{default} label.
7453 @opindex Wswitch-bool
7454 @opindex Wno-switch-bool
7455 @item -Wno-switch-bool
7456 Do not warn when a @code{switch} statement has an index of boolean type
7457 and the case values are outside the range of a boolean type.
7458 It is possible to suppress this warning by casting the controlling
7459 expression to a type other than @code{bool}.  For example:
7460 @smallexample
7461 @group
7462 switch ((int) (a == 4))
7463   @{
7464   @dots{}
7465   @}
7466 @end group
7467 @end smallexample
7468 This warning is enabled by default for C and C++ programs.
7470 @opindex Wswitch-outside-range
7471 @opindex Wno-switch-outside-range
7472 @item -Wno-switch-outside-range
7473 This option controls warnings when a @code{switch} case has a value
7474 that is outside of its
7475 respective type range.  This warning is enabled by default for
7476 C and C++ programs.
7478 @opindex Wswitch-unreachable
7479 @opindex Wno-switch-unreachable
7480 @item -Wno-switch-unreachable
7481 Do not warn when a @code{switch} statement contains statements between the
7482 controlling expression and the first case label, which will never be
7483 executed.  For example:
7484 @smallexample
7485 @group
7486 switch (cond)
7487   @{
7488    i = 15;
7489   @dots{}
7490    case 5:
7491   @dots{}
7492   @}
7493 @end group
7494 @end smallexample
7495 @option{-Wswitch-unreachable} does not warn if the statement between the
7496 controlling expression and the first case label is just a declaration:
7497 @smallexample
7498 @group
7499 switch (cond)
7500   @{
7501    int i;
7502   @dots{}
7503    case 5:
7504    i = 5;
7505   @dots{}
7506   @}
7507 @end group
7508 @end smallexample
7509 This warning is enabled by default for C and C++ programs.
7511 @opindex Wsync-nand
7512 @opindex Wno-sync-nand
7513 @item -Wsync-nand @r{(C and C++ only)}
7514 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
7515 built-in functions are used.  These functions changed semantics in GCC 4.4.
7517 @opindex Wtrivial-auto-var-init
7518 @opindex Wno-trivial-auto-var-init
7519 @item -Wtrivial-auto-var-init
7520 Warn when @code{-ftrivial-auto-var-init} cannot initialize the automatic
7521 variable.  A common situation is an automatic variable that is declared
7522 between the controlling expression and the first case label of a @code{switch}
7523 statement.
7525 @opindex Wunused-but-set-parameter
7526 @opindex Wno-unused-but-set-parameter
7527 @item -Wunused-but-set-parameter
7528 Warn whenever a function parameter is assigned to, but otherwise unused
7529 (aside from its declaration).
7531 To suppress this warning use the @code{unused} attribute
7532 (@pxref{Variable Attributes}).
7534 This warning is also enabled by @option{-Wunused} together with
7535 @option{-Wextra}.
7537 @opindex Wunused-but-set-variable
7538 @opindex Wno-unused-but-set-variable
7539 @item -Wunused-but-set-variable
7540 Warn whenever a local variable is assigned to, but otherwise unused
7541 (aside from its declaration).
7542 This warning is enabled by @option{-Wall}.
7544 To suppress this warning use the @code{unused} attribute
7545 (@pxref{Variable Attributes}).
7547 This warning is also enabled by @option{-Wunused}, which is enabled
7548 by @option{-Wall}.
7550 @opindex Wunused-function
7551 @opindex Wno-unused-function
7552 @item -Wunused-function
7553 Warn whenever a static function is declared but not defined or a
7554 non-inline static function is unused.
7555 This warning is enabled by @option{-Wall}.
7557 @opindex Wunused-label
7558 @opindex Wno-unused-label
7559 @item -Wunused-label
7560 Warn whenever a label is declared but not used.
7561 This warning is enabled by @option{-Wall}.
7563 To suppress this warning use the @code{unused} attribute
7564 (@pxref{Variable Attributes}).
7566 @opindex Wunused-local-typedefs
7567 @opindex Wno-unused-local-typedefs
7568 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
7569 Warn when a typedef locally defined in a function is not used.
7570 This warning is enabled by @option{-Wall}.
7572 @opindex Wunused-parameter
7573 @opindex Wno-unused-parameter
7574 @item -Wunused-parameter
7575 Warn whenever a function parameter is unused aside from its declaration.
7577 To suppress this warning use the @code{unused} attribute
7578 (@pxref{Variable Attributes}).
7580 @opindex Wunused-result
7581 @opindex Wno-unused-result
7582 @item -Wno-unused-result
7583 Do not warn if a caller of a function marked with attribute
7584 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
7585 its return value. The default is @option{-Wunused-result}.
7587 @opindex Wunused-variable
7588 @opindex Wno-unused-variable
7589 @item -Wunused-variable
7590 Warn whenever a local or static variable is unused aside from its
7591 declaration. This option implies @option{-Wunused-const-variable=1} for C,
7592 but not for C++. This warning is enabled by @option{-Wall}.
7594 To suppress this warning use the @code{unused} attribute
7595 (@pxref{Variable Attributes}).
7597 @opindex Wunused-const-variable
7598 @opindex Wno-unused-const-variable
7599 @item -Wunused-const-variable
7600 @itemx -Wunused-const-variable=@var{n}
7601 Warn whenever a constant static variable is unused aside from its declaration.
7602 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
7603 for C, but not for C++. In C this declares variable storage, but in C++ this
7604 is not an error since const variables take the place of @code{#define}s.
7606 To suppress this warning use the @code{unused} attribute
7607 (@pxref{Variable Attributes}).
7609 @table @gcctabopt
7610 @item -Wunused-const-variable=1
7611 This is the warning level that is enabled by @option{-Wunused-variable} for
7612 C.  It warns only about unused static const variables defined in the main
7613 compilation unit, but not about static const variables declared in any
7614 header included.
7616 @item -Wunused-const-variable=2
7617 This warning level also warns for unused constant static variables in
7618 headers (excluding system headers).  This is the warning level of
7619 @option{-Wunused-const-variable} and must be explicitly requested since
7620 in C++ this isn't an error and in C it might be harder to clean up all
7621 headers included.
7622 @end table
7624 @opindex Wunused-value
7625 @opindex Wno-unused-value
7626 @item -Wunused-value
7627 Warn whenever a statement computes a result that is explicitly not
7628 used. To suppress this warning cast the unused expression to
7629 @code{void}. This includes an expression-statement or the left-hand
7630 side of a comma expression that contains no side effects. For example,
7631 an expression such as @code{x[i,j]} causes a warning, while
7632 @code{x[(void)i,j]} does not.
7634 This warning is enabled by @option{-Wall}.
7636 @opindex Wunused
7637 @opindex Wno-unused
7638 @item -Wunused
7639 All the above @option{-Wunused} options combined.
7641 In order to get a warning about an unused function parameter, you must
7642 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
7643 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
7645 @opindex Wuninitialized
7646 @opindex Wno-uninitialized
7647 @item -Wuninitialized
7648 Warn if an object with automatic or allocated storage duration is used
7649 without having been initialized.  In C++, also warn if a non-static
7650 reference or non-static @code{const} member appears in a class without
7651 constructors.
7653 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7654 object to a @code{const}-qualified argument of a built-in function known to
7655 read the object is also diagnosed by this warning.
7656 (@option{-Wmaybe-uninitialized} is issued for ordinary functions.)
7658 If you want to warn about code that uses the uninitialized value of the
7659 variable in its own initializer, use the @option{-Winit-self} option.
7661 These warnings occur for individual uninitialized elements of
7662 structure, union or array variables as well as for variables that are
7663 uninitialized as a whole.  They do not occur for variables or elements
7664 declared @code{volatile}.  Because these warnings depend on
7665 optimization, the exact variables or elements for which there are
7666 warnings depend on the precise optimization options and version of GCC
7667 used.
7669 Note that there may be no warning about a variable that is used only
7670 to compute a value that itself is never used, because such
7671 computations may be deleted by data flow analysis before the warnings
7672 are printed.
7674 In C++, this warning also warns about using uninitialized objects in
7675 member-initializer-lists.  For example, GCC warns about @code{b} being
7676 uninitialized in the following snippet:
7678 @smallexample
7679 struct A @{
7680   int a;
7681   int b;
7682   A() : a(b) @{ @}
7684 @end smallexample
7686 @opindex Winvalid-memory-model
7687 @opindex Wno-invalid-memory-model
7688 @item -Wno-invalid-memory-model
7689 This option controls warnings
7690 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
7691 and the C11 atomic generic functions with a memory consistency argument
7692 that is either invalid for the operation or outside the range of values
7693 of the @code{memory_order} enumeration.  For example, since the
7694 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
7695 defined for the relaxed, release, and sequentially consistent memory
7696 orders the following code is diagnosed:
7698 @smallexample
7699 void store (int *i)
7701   __atomic_store_n (i, 0, memory_order_consume);
7703 @end smallexample
7705 @option{-Winvalid-memory-model} is enabled by default.
7707 @opindex Wmaybe-uninitialized
7708 @opindex Wno-maybe-uninitialized
7709 @item -Wmaybe-uninitialized
7710 For an object with automatic or allocated storage duration, if there exists
7711 a path from the function entry to a use of the object that is initialized,
7712 but there exist some other paths for which the object is not initialized,
7713 the compiler emits a warning if it cannot prove the uninitialized paths
7714 are not executed at run time.
7716 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7717 object to a @code{const}-qualified function argument is also diagnosed by
7718 this warning.  (@option{-Wuninitialized} is issued for built-in functions
7719 known to read the object.)  Annotating the function with attribute
7720 @code{access (none)} indicates that the argument isn't used to access
7721 the object and avoids the warning (@pxref{Common Function Attributes}).
7723 These warnings are only possible in optimizing compilation, because otherwise
7724 GCC does not keep track of the state of variables.
7726 These warnings are made optional because GCC may not be able to determine when
7727 the code is correct in spite of appearing to have an error.  Here is one
7728 example of how this can happen:
7730 @smallexample
7731 @group
7733   int x;
7734   switch (y)
7735     @{
7736     case 1: x = 1;
7737       break;
7738     case 2: x = 4;
7739       break;
7740     case 3: x = 5;
7741     @}
7742   foo (x);
7744 @end group
7745 @end smallexample
7747 @noindent
7748 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
7749 always initialized, but GCC doesn't know this. To suppress the
7750 warning, you need to provide a default case with assert(0) or
7751 similar code.
7753 @cindex @code{longjmp} warnings
7754 This option also warns when a non-volatile automatic variable might be
7755 changed by a call to @code{longjmp}.
7756 The compiler sees only the calls to @code{setjmp}.  It cannot know
7757 where @code{longjmp} will be called; in fact, a signal handler could
7758 call it at any point in the code.  As a result, you may get a warning
7759 even when there is in fact no problem because @code{longjmp} cannot
7760 in fact be called at the place that would cause a problem.
7762 Some spurious warnings can be avoided if you declare all the functions
7763 you use that never return as @code{noreturn}.  @xref{Function
7764 Attributes}.
7766 This warning is enabled by @option{-Wall} or @option{-Wextra}.
7768 @opindex Wunknown-pragmas
7769 @opindex Wno-unknown-pragmas
7770 @cindex warning for unknown pragmas
7771 @cindex unknown pragmas, warning
7772 @cindex pragmas, warning of unknown
7773 @item -Wunknown-pragmas
7774 Warn when a @code{#pragma} directive is encountered that is not understood by 
7775 GCC@.  If this command-line option is used, warnings are even issued
7776 for unknown pragmas in system header files.  This is not the case if
7777 the warnings are only enabled by the @option{-Wall} command-line option.
7779 @opindex Wno-pragmas
7780 @opindex Wpragmas
7781 @item -Wno-pragmas
7782 Do not warn about misuses of pragmas, such as incorrect parameters,
7783 invalid syntax, or conflicts between pragmas.  See also
7784 @option{-Wunknown-pragmas}.
7786 @opindex Wno-prio-ctor-dtor
7787 @opindex Wprio-ctor-dtor
7788 @item -Wno-prio-ctor-dtor
7789 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
7790 The use of constructor and destructor attributes allow you to assign a
7791 priority to the constructor/destructor to control its order of execution
7792 before @code{main} is called or after it returns.  The priority values must be
7793 greater than 100 as the compiler reserves priority values between 0--100 for
7794 the implementation.
7796 @opindex Wstrict-aliasing
7797 @opindex Wno-strict-aliasing
7798 @item -Wstrict-aliasing
7799 This option is only active when @option{-fstrict-aliasing} is active.
7800 It warns about code that might break the strict aliasing rules that the
7801 compiler is using for optimization.  The warning does not catch all
7802 cases, but does attempt to catch the more common pitfalls.  It is
7803 included in @option{-Wall}.
7804 It is equivalent to @option{-Wstrict-aliasing=3}
7806 @opindex Wstrict-aliasing=n
7807 @item -Wstrict-aliasing=n
7808 This option is only active when @option{-fstrict-aliasing} is active.
7809 It warns about code that might break the strict aliasing rules that the
7810 compiler is using for optimization.
7811 Higher levels correspond to higher accuracy (fewer false positives).
7812 Higher levels also correspond to more effort, similar to the way @option{-O} 
7813 works.
7814 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
7816 Level 1: Most aggressive, quick, least accurate.
7817 Possibly useful when higher levels
7818 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
7819 false negatives.  However, it has many false positives.
7820 Warns for all pointer conversions between possibly incompatible types,
7821 even if never dereferenced.  Runs in the front end only.
7823 Level 2: Aggressive, quick, not too precise.
7824 May still have many false positives (not as many as level 1 though),
7825 and few false negatives (but possibly more than level 1).
7826 Unlike level 1, it only warns when an address is taken.  Warns about
7827 incomplete types.  Runs in the front end only.
7829 Level 3 (default for @option{-Wstrict-aliasing}):
7830 Should have very few false positives and few false
7831 negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
7832 Takes care of the common pun+dereference pattern in the front end:
7833 @code{*(int*)&some_float}.
7834 If optimization is enabled, it also runs in the back end, where it deals
7835 with multiple statement cases using flow-sensitive points-to information.
7836 Only warns when the converted pointer is dereferenced.
7837 Does not warn about incomplete types.
7839 @opindex Wstrict-overflow
7840 @opindex Wno-strict-overflow
7841 @item -Wstrict-overflow
7842 @itemx -Wstrict-overflow=@var{n}
7843 This option is only active when signed overflow is undefined.
7844 It warns about cases where the compiler optimizes based on the
7845 assumption that signed overflow does not occur.  Note that it does not
7846 warn about all cases where the code might overflow: it only warns
7847 about cases where the compiler implements some optimization.  Thus
7848 this warning depends on the optimization level.
7850 An optimization that assumes that signed overflow does not occur is
7851 perfectly safe if the values of the variables involved are such that
7852 overflow never does, in fact, occur.  Therefore this warning can
7853 easily give a false positive: a warning about code that is not
7854 actually a problem.  To help focus on important issues, several
7855 warning levels are defined.  No warnings are issued for the use of
7856 undefined signed overflow when estimating how many iterations a loop
7857 requires, in particular when determining whether a loop will be
7858 executed at all.
7860 @table @gcctabopt
7861 @item -Wstrict-overflow=1
7862 Warn about cases that are both questionable and easy to avoid.  For
7863 example the compiler simplifies
7864 @code{x + 1 > x} to @code{1}.  This level of
7865 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
7866 are not, and must be explicitly requested.
7868 @item -Wstrict-overflow=2
7869 Also warn about other cases where a comparison is simplified to a
7870 constant.  For example: @code{abs (x) >= 0}.  This can only be
7871 simplified when signed integer overflow is undefined, because
7872 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
7873 zero.  @option{-Wstrict-overflow} (with no level) is the same as
7874 @option{-Wstrict-overflow=2}.
7876 @item -Wstrict-overflow=3
7877 Also warn about other cases where a comparison is simplified.  For
7878 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
7880 @item -Wstrict-overflow=4
7881 Also warn about other simplifications not covered by the above cases.
7882 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
7884 @item -Wstrict-overflow=5
7885 Also warn about cases where the compiler reduces the magnitude of a
7886 constant involved in a comparison.  For example: @code{x + 2 > y} is
7887 simplified to @code{x + 1 >= y}.  This is reported only at the
7888 highest warning level because this simplification applies to many
7889 comparisons, so this warning level gives a very large number of
7890 false positives.
7891 @end table
7893 @opindex Wstring-compare
7894 @opindex Wno-string-compare
7895 @item -Wstring-compare
7896 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
7897 determined to be either zero or non-zero in tests for such equality
7898 owing to the length of one argument being greater than the size of
7899 the array the other argument is stored in (or the bound in the case
7900 of @code{strncmp}).  Such calls could be mistakes.  For example,
7901 the call to @code{strcmp} below is diagnosed because its result is
7902 necessarily non-zero irrespective of the contents of the array @code{a}.
7904 @smallexample
7905 extern char a[4];
7906 void f (char *d)
7908   strcpy (d, "string");
7909   @dots{}
7910   if (0 == strcmp (a, d))   // cannot be true
7911     puts ("a and d are the same");
7913 @end smallexample
7915 @option{-Wstring-compare} is enabled by @option{-Wextra}.
7917 @opindex Wstringop-overflow
7918 @opindex Wno-stringop-overflow
7919 @item -Wno-stringop-overflow
7920 @item -Wstringop-overflow
7921 @itemx -Wstringop-overflow=@var{type}
7922 Warn for calls to string manipulation functions such as @code{memcpy} and
7923 @code{strcpy} that are determined to overflow the destination buffer.  The
7924 optional argument is one greater than the type of Object Size Checking to
7925 perform to determine the size of the destination.  @xref{Object Size Checking}.
7926 The argument is meaningful only for functions that operate on character arrays
7927 but not for raw memory functions like @code{memcpy} which always make use
7928 of Object Size type-0.  The option also warns for calls that specify a size
7929 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
7930 The option produces the best results with optimization enabled but can detect
7931 a small subset of simple buffer overflows even without optimization in
7932 calls to the GCC built-in functions like @code{__builtin_memcpy} that
7933 correspond to the standard functions.  In any case, the option warns about
7934 just a subset of buffer overflows detected by the corresponding overflow
7935 checking built-ins.  For example, the option issues a warning for
7936 the @code{strcpy} call below because it copies at least 5 characters
7937 (the string @code{"blue"} including the terminating NUL) into the buffer
7938 of size 4.
7940 @smallexample
7941 enum Color @{ blue, purple, yellow @};
7942 const char* f (enum Color clr)
7944   static char buf [4];
7945   const char *str;
7946   switch (clr)
7947     @{
7948       case blue: str = "blue"; break;
7949       case purple: str = "purple"; break;
7950       case yellow: str = "yellow"; break;
7951     @}
7953   return strcpy (buf, str);   // warning here
7955 @end smallexample
7957 Option @option{-Wstringop-overflow=2} is enabled by default.
7959 @table @gcctabopt
7960 @opindex Wstringop-overflow
7961 @opindex Wno-stringop-overflow
7962 @item -Wstringop-overflow
7963 @itemx -Wstringop-overflow=1
7964 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
7965 to determine the sizes of destination objects.  At this setting the option
7966 does not warn for writes past the end of subobjects of larger objects accessed
7967 by pointers unless the size of the largest surrounding object is known.  When
7968 the destination may be one of several objects it is assumed to be the largest
7969 one of them.  On Linux systems, when optimization is enabled at this setting
7970 the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
7971 is defined to a non-zero value.
7973 @item -Wstringop-overflow=2
7974 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
7975 to determine the sizes of destination objects.  At this setting the option
7976 warns about overflows when writing to members of the largest complete
7977 objects whose exact size is known.  However, it does not warn for excessive
7978 writes to the same members of unknown objects referenced by pointers since
7979 they may point to arrays containing unknown numbers of elements.  This is
7980 the default setting of the option.
7982 @item -Wstringop-overflow=3
7983 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
7984 to determine the sizes of destination objects.  At this setting the option
7985 warns about overflowing the smallest object or data member.  This is the
7986 most restrictive setting of the option that may result in warnings for safe
7987 code.
7989 @item -Wstringop-overflow=4
7990 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
7991 to determine the sizes of destination objects.  At this setting the option
7992 warns about overflowing any data members, and when the destination is
7993 one of several objects it uses the size of the largest of them to decide
7994 whether to issue a warning.  Similarly to @option{-Wstringop-overflow=3} this
7995 setting of the option may result in warnings for benign code.
7996 @end table
7998 @opindex Wstringop-overread
7999 @opindex Wno-stringop-overread
8000 @item -Wno-stringop-overread
8001 Warn for calls to string manipulation functions such as @code{memchr}, or
8002 @code{strcpy} that are determined to read past the end of the source
8003 sequence.
8005 Option @option{-Wstringop-overread} is enabled by default.
8007 @opindex Wstringop-truncation
8008 @opindex Wno-stringop-truncation
8009 @item -Wno-stringop-truncation
8010 Do not warn for calls to bounded string manipulation functions
8011 such as @code{strncat},
8012 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
8013 or leave the destination unchanged.
8015 In the following example, the call to @code{strncat} specifies a bound that
8016 is less than the length of the source string.  As a result, the copy of
8017 the source will be truncated and so the call is diagnosed.  To avoid the
8018 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
8020 @smallexample
8021 void append (char *buf, size_t bufsize)
8023   strncat (buf, ".txt", 3);
8025 @end smallexample
8027 As another example, the following call to @code{strncpy} results in copying
8028 to @code{d} just the characters preceding the terminating NUL, without
8029 appending the NUL to the end.  Assuming the result of @code{strncpy} is
8030 necessarily a NUL-terminated string is a common mistake, and so the call
8031 is diagnosed.  To avoid the warning when the result is not expected to be
8032 NUL-terminated, call @code{memcpy} instead.
8034 @smallexample
8035 void copy (char *d, const char *s)
8037   strncpy (d, s, strlen (s));
8039 @end smallexample
8041 In the following example, the call to @code{strncpy} specifies the size
8042 of the destination buffer as the bound.  If the length of the source
8043 string is equal to or greater than this size the result of the copy will
8044 not be NUL-terminated.  Therefore, the call is also diagnosed.  To avoid
8045 the warning, specify @code{sizeof buf - 1} as the bound and set the last
8046 element of the buffer to @code{NUL}.
8048 @smallexample
8049 void copy (const char *s)
8051   char buf[80];
8052   strncpy (buf, s, sizeof buf);
8053   @dots{}
8055 @end smallexample
8057 In situations where a character array is intended to store a sequence
8058 of bytes with no terminating @code{NUL} such an array may be annotated
8059 with attribute @code{nonstring} to avoid this warning.  Such arrays,
8060 however, are not suitable arguments to functions that expect
8061 @code{NUL}-terminated strings.  To help detect accidental misuses of
8062 such arrays GCC issues warnings unless it can prove that the use is
8063 safe.  @xref{Common Variable Attributes}.
8065 @opindex Wstrict-flex-arrays
8066 @opindex Wno-strict-flex-arrays
8067 @item -Wstrict-flex-arrays
8068 Warn about inproper usages of flexible array members
8069 according to the @var{level} of the @code{strict_flex_array (@var{level})}
8070 attribute attached to the trailing array field of a structure if it's
8071 available, otherwise according to the @var{level} of the option
8072 @option{-fstrict-flex-arrays=@var{level}}.
8074 This option is effective only when @var{level} is bigger than 0.  Otherwise,
8075 it will be ignored with a warning.
8077 when @var{level}=1, warnings will be issued for a trailing array reference
8078 of a structure that have 2 or more elements if the trailing array is referenced
8079 as a flexible array member.
8081 when @var{level}=2, in addition to @var{level}=1, additional warnings will be
8082 issued for a trailing one-element array reference of a structure
8083 if the array is referenced as a flexible array member.
8085 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
8086 issued for a trailing zero-length array reference of a structure
8087 if the array is referenced as a flexible array member.
8090 @opindex Wsuggest-attribute=
8091 @opindex Wno-suggest-attribute=
8092 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
8093 Warn for cases where adding an attribute may be beneficial. The
8094 attributes currently supported are listed below.
8096 @table @gcctabopt
8097 @opindex Wsuggest-attribute=pure
8098 @opindex Wno-suggest-attribute=pure
8099 @opindex Wsuggest-attribute=const
8100 @opindex Wno-suggest-attribute=const
8101 @opindex Wsuggest-attribute=noreturn
8102 @opindex Wno-suggest-attribute=noreturn
8103 @opindex Wmissing-noreturn
8104 @opindex Wno-missing-noreturn
8105 @opindex Wsuggest-attribute=malloc
8106 @opindex Wno-suggest-attribute=malloc
8107 @item -Wsuggest-attribute=pure
8108 @itemx -Wsuggest-attribute=const
8109 @itemx -Wsuggest-attribute=noreturn
8110 @itemx -Wmissing-noreturn
8111 @itemx -Wsuggest-attribute=malloc
8113 Warn about functions that might be candidates for attributes
8114 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
8115 only warns for functions visible in other compilation units or (in the case of
8116 @code{pure} and @code{const}) if it cannot prove that the function returns
8117 normally. A function returns normally if it doesn't contain an infinite loop or
8118 return abnormally by throwing, calling @code{abort} or trapping.  This analysis
8119 requires option @option{-fipa-pure-const}, which is enabled by default at
8120 @option{-O} and higher.  Higher optimization levels improve the accuracy
8121 of the analysis.
8123 @opindex Wsuggest-attribute=format
8124 @opindex Wmissing-format-attribute
8125 @opindex Wno-suggest-attribute=format
8126 @opindex Wno-missing-format-attribute
8127 @opindex Wformat
8128 @opindex Wno-format
8129 @item -Wsuggest-attribute=format
8130 @itemx -Wmissing-format-attribute
8132 Warn about function pointers that might be candidates for @code{format}
8133 attributes.  Note these are only possible candidates, not absolute ones.
8134 GCC guesses that function pointers with @code{format} attributes that
8135 are used in assignment, initialization, parameter passing or return
8136 statements should have a corresponding @code{format} attribute in the
8137 resulting type.  I.e.@: the left-hand side of the assignment or
8138 initialization, the type of the parameter variable, or the return type
8139 of the containing function respectively should also have a @code{format}
8140 attribute to avoid the warning.
8142 GCC also warns about function definitions that might be
8143 candidates for @code{format} attributes.  Again, these are only
8144 possible candidates.  GCC guesses that @code{format} attributes
8145 might be appropriate for any function that calls a function like
8146 @code{vprintf} or @code{vscanf}, but this might not always be the
8147 case, and some functions for which @code{format} attributes are
8148 appropriate may not be detected.
8150 @opindex Wsuggest-attribute=cold
8151 @opindex Wno-suggest-attribute=cold
8152 @item -Wsuggest-attribute=cold
8154 Warn about functions that might be candidates for @code{cold} attribute.  This
8155 is based on static detection and generally only warns about functions which
8156 always leads to a call to another @code{cold} function such as wrappers of
8157 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
8158 @end table
8160 @opindex Wno-alloc-size
8161 @opindex Walloc-size
8162 @item -Walloc-size
8163 Warn about calls to allocation functions decorated with attribute
8164 @code{alloc_size} that specify insufficient size for the target type of
8165 the pointer the result is assigned to, including those to the built-in
8166 forms of the functions @code{aligned_alloc}, @code{alloca},
8167 @code{calloc},
8168 @code{malloc}, and @code{realloc}.
8170 @opindex Wno-alloc-zero
8171 @opindex Walloc-zero
8172 @item -Walloc-zero
8173 Warn about calls to allocation functions decorated with attribute
8174 @code{alloc_size} that specify zero bytes, including those to the built-in
8175 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
8176 @code{malloc}, and @code{realloc}.  Because the behavior of these functions
8177 when called with a zero size differs among implementations (and in the case
8178 of @code{realloc} has been deprecated) relying on it may result in subtle
8179 portability bugs and should be avoided.
8181 @opindex Walloc-size-larger-than=
8182 @opindex Wno-alloc-size-larger-than
8183 @item -Walloc-size-larger-than=@var{byte-size}
8184 Warn about calls to functions decorated with attribute @code{alloc_size}
8185 that attempt to allocate objects larger than the specified number of bytes,
8186 or where the result of the size computation in an integer type with infinite
8187 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
8188 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8189 Warnings controlled by the option can be disabled either by specifying
8190 @var{byte-size} of @samp{SIZE_MAX} or more or by
8191 @option{-Wno-alloc-size-larger-than}.
8192 @xref{Function Attributes}.
8194 @opindex Wno-alloc-size-larger-than
8195 @item -Wno-alloc-size-larger-than
8196 Disable @option{-Walloc-size-larger-than=} warnings.  The option is
8197 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
8198 larger.
8200 @opindex Wno-alloca
8201 @opindex Walloca
8202 @item -Walloca
8203 This option warns on all uses of @code{alloca} in the source.
8205 @opindex Walloca-larger-than=
8206 @opindex Wno-alloca-larger-than
8207 @item -Walloca-larger-than=@var{byte-size}
8208 This option warns on calls to @code{alloca} with an integer argument whose
8209 value is either zero, or that is not bounded by a controlling predicate
8210 that limits its value to at most @var{byte-size}.  It also warns for calls
8211 to @code{alloca} where the bound value is unknown.  Arguments of non-integer
8212 types are considered unbounded even if they appear to be constrained to
8213 the expected range.
8215 For example, a bounded case of @code{alloca} could be:
8217 @smallexample
8218 void func (size_t n)
8220   void *p;
8221   if (n <= 1000)
8222     p = alloca (n);
8223   else
8224     p = malloc (n);
8225   f (p);
8227 @end smallexample
8229 In the above example, passing @code{-Walloca-larger-than=1000} would not
8230 issue a warning because the call to @code{alloca} is known to be at most
8231 1000 bytes.  However, if @code{-Walloca-larger-than=500} were passed,
8232 the compiler would emit a warning.
8234 Unbounded uses, on the other hand, are uses of @code{alloca} with no
8235 controlling predicate constraining its integer argument.  For example:
8237 @smallexample
8238 void func ()
8240   void *p = alloca (n);
8241   f (p);
8243 @end smallexample
8245 If @code{-Walloca-larger-than=500} were passed, the above would trigger
8246 a warning, but this time because of the lack of bounds checking.
8248 Note, that even seemingly correct code involving signed integers could
8249 cause a warning:
8251 @smallexample
8252 void func (signed int n)
8254   if (n < 500)
8255     @{
8256       p = alloca (n);
8257       f (p);
8258     @}
8260 @end smallexample
8262 In the above example, @var{n} could be negative, causing a larger than
8263 expected argument to be implicitly cast into the @code{alloca} call.
8265 This option also warns when @code{alloca} is used in a loop.
8267 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
8268 but is usually only effective  when @option{-ftree-vrp} is active (default
8269 for @option{-O2} and above).
8271 See also @option{-Wvla-larger-than=}@samp{byte-size}.
8273 @opindex Wno-alloca-larger-than
8274 @item -Wno-alloca-larger-than
8275 Disable @option{-Walloca-larger-than=} warnings.  The option is
8276 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
8278 @opindex Warith-conversion
8279 @opindex Wno-arith-conversion
8280 @item -Warith-conversion
8281 Do warn about implicit conversions from arithmetic operations even
8282 when conversion of the operands to the same type cannot change their
8283 values.  This affects warnings from @option{-Wconversion},
8284 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
8286 @smallexample
8287 @group
8288 void f (char c, int i)
8290   c = c + i; // warns with @option{-Wconversion}
8291   c = c + 1; // only warns with @option{-Warith-conversion}
8293 @end group
8294 @end smallexample
8296 @opindex Wno-array-bounds
8297 @opindex Warray-bounds
8298 @item -Warray-bounds
8299 @itemx -Warray-bounds=@var{n}
8300 Warn about out of bounds subscripts or offsets into arrays.  This warning
8301 is enabled by @option{-Wall}.  It is more effective when @option{-ftree-vrp}
8302 is active (the default for @option{-O2} and above) but a subset of instances
8303 are issued even without optimization.
8305 By default, the trailing array of a structure will be treated as a flexible
8306 array member by @option{-Warray-bounds} or @option{-Warray-bounds=@var{n}}
8307 if it is declared as either a flexible array member per C99 standard onwards
8308 (@samp{[]}), a GCC zero-length array extension (@samp{[0]}), or an one-element
8309 array (@samp{[1]}). As a result, out of bounds subscripts or offsets into
8310 zero-length arrays or one-element arrays are not warned by default.
8312 You can add the option @option{-fstrict-flex-arrays} or
8313 @option{-fstrict-flex-arrays=@var{level}} to control how this
8314 option treat trailing array of a structure as a flexible array member:
8316 when @var{level}<=1, no change to the default behavior.
8318 when @var{level}=2, additional warnings will be issued for out of bounds
8319 subscripts or offsets into one-element arrays;
8321 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
8322 issued for out of bounds subscripts or offsets into zero-length arrays.
8324 @table @gcctabopt
8325 @item -Warray-bounds=1
8326 This is the default warning level of @option{-Warray-bounds} and is enabled
8327 by @option{-Wall}; higher levels are not, and must be explicitly requested.
8329 @item -Warray-bounds=2
8330 This warning level also warns about the intermediate results of pointer
8331 arithmetic that may yield out of bounds values. This warning level may
8332 give a larger number of false positives and is deactivated by default.
8333 @end table
8335 @opindex Warray-compare
8336 @opindex Wno-array-compare
8337 @item -Warray-compare
8338 Warn about equality and relational comparisons between two operands of array
8339 type.  This comparison was deprecated in C++20.  For example:
8341 @smallexample
8342 int arr1[5];
8343 int arr2[5];
8344 bool same = arr1 == arr2;
8345 @end smallexample
8347 @option{-Warray-compare} is enabled by @option{-Wall}.
8349 @opindex Wno-array-parameter
8350 @item -Warray-parameter
8351 @itemx -Warray-parameter=@var{n}
8352 Warn about redeclarations of functions involving arguments of array or
8353 pointer types of inconsistent kinds or forms, and enable the detection
8354 of out-of-bounds accesses to such parameters by warnings such as
8355 @option{-Warray-bounds}.
8357 If the first function declaration uses the array form the bound specified
8358 in the array is assumed to be the minimum number of elements expected to
8359 be provided in calls to the function and the maximum number of elements
8360 accessed by it.  Failing to provide arguments of sufficient size or accessing
8361 more than the maximum number of elements may be diagnosed by warnings such
8362 as @option{-Warray-bounds}.  At level 1 the warning diagnoses inconsistencies
8363 involving array parameters declared using the @code{T[static N]} form.
8365 For example, the warning triggers for the following redeclarations because
8366 the first one allows an array of any size to be passed to @code{f} while
8367 the second one with the keyword @code{static} specifies that the array
8368 argument must have at least four elements.
8370 @smallexample
8371 void f (int[static 4]);
8372 void f (int[]);           // warning (inconsistent array form)
8374 void g (void)
8376   int *p = (int *)malloc (4);
8377   f (p);                  // warning (array too small)
8378   @dots{}
8380 @end smallexample
8382 At level 2 the warning also triggers for redeclarations involving any other
8383 inconsistency in array or pointer argument forms denoting array sizes.
8384 Pointers and arrays of unspecified bound are considered equivalent and do
8385 not trigger a warning.
8387 @smallexample
8388 void g (int*);
8389 void g (int[]);     // no warning
8390 void g (int[8]);    // warning (inconsistent array bound)
8391 @end smallexample
8393 @option{-Warray-parameter=2} is included in @option{-Wall}.  The
8394 @option{-Wvla-parameter} option triggers warnings for similar inconsistencies
8395 involving Variable Length Array arguments.
8397 @opindex Wattribute-alias
8398 @opindex Wno-attribute-alias
8399 @item -Wattribute-alias=@var{n}
8400 @itemx -Wno-attribute-alias
8401 Warn about declarations using the @code{alias} and similar attributes whose
8402 target is incompatible with the type of the alias.
8403 @xref{Function Attributes,,Declaring Attributes of Functions}.
8405 @table @gcctabopt
8406 @item -Wattribute-alias=1
8407 The default warning level of the @option{-Wattribute-alias} option diagnoses
8408 incompatibilities between the type of the alias declaration and that of its
8409 target.  Such incompatibilities are typically indicative of bugs.
8411 @item -Wattribute-alias=2
8413 At this level @option{-Wattribute-alias} also diagnoses cases where
8414 the attributes of the alias declaration are more restrictive than the
8415 attributes applied to its target.  These mismatches can potentially
8416 result in incorrect code generation.  In other cases they may be
8417 benign and could be resolved simply by adding the missing attribute to
8418 the target.  For comparison, see the @option{-Wmissing-attributes}
8419 option, which controls diagnostics when the alias declaration is less
8420 restrictive than the target, rather than more restrictive.
8422 Attributes considered include @code{alloc_align}, @code{alloc_size},
8423 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
8424 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
8425 @code{returns_nonnull}, and @code{returns_twice}.
8426 @end table
8428 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
8429 This is the default.  You can disable these warnings with either
8430 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
8432 @opindex Wbidi-chars=
8433 @opindex Wbidi-chars
8434 @opindex Wno-bidi-chars
8435 @item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
8436 Warn about possibly misleading UTF-8 bidirectional control characters in
8437 comments, string literals, character constants, and identifiers.  Such
8438 characters can change left-to-right writing direction into right-to-left
8439 (and vice versa), which can cause confusion between the logical order and
8440 visual order.  This may be dangerous; for instance, it may seem that a piece
8441 of code is not commented out, whereas it in fact is.
8443 There are three levels of warning supported by GCC@.  The default is
8444 @option{-Wbidi-chars=unpaired}, which warns about improperly terminated
8445 bidi contexts.  @option{-Wbidi-chars=none} turns the warning off.
8446 @option{-Wbidi-chars=any} warns about any use of bidirectional control
8447 characters.
8449 By default, this warning does not warn about UCNs.  It is, however, possible
8450 to turn on such checking by using @option{-Wbidi-chars=unpaired,ucn} or
8451 @option{-Wbidi-chars=any,ucn}.  Using @option{-Wbidi-chars=ucn} is valid,
8452 and is equivalent to @option{-Wbidi-chars=unpaired,ucn}, if no previous
8453 @option{-Wbidi-chars=any} was specified.
8455 @opindex Wno-bool-compare
8456 @opindex Wbool-compare
8457 @item -Wbool-compare
8458 Warn about boolean expression compared with an integer value different from
8459 @code{true}/@code{false}.  For instance, the following comparison is
8460 always false:
8461 @smallexample
8462 int n = 5;
8463 @dots{}
8464 if ((n > 1) == 2) @{ @dots{} @}
8465 @end smallexample
8466 This warning is enabled by @option{-Wall}.
8468 @opindex Wno-bool-operation
8469 @opindex Wbool-operation
8470 @item -Wbool-operation
8471 Warn about suspicious operations on expressions of a boolean type.  For
8472 instance, bitwise negation of a boolean is very likely a bug in the program.
8473 For C, this warning also warns about incrementing or decrementing a boolean,
8474 which rarely makes sense.  (In C++, decrementing a boolean is always invalid.
8475 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
8477 This warning is enabled by @option{-Wall}.
8479 @opindex Wno-duplicated-branches
8480 @opindex Wduplicated-branches
8481 @item -Wduplicated-branches
8482 Warn when an if-else has identical branches.  This warning detects cases like
8483 @smallexample
8484 if (p != NULL)
8485   return 0;
8486 else
8487   return 0;
8488 @end smallexample
8489 It doesn't warn when both branches contain just a null statement.  This warning
8490 also warn for conditional operators:
8491 @smallexample
8492   int i = x ? *p : *p;
8493 @end smallexample
8495 @opindex Wno-duplicated-cond
8496 @opindex Wduplicated-cond
8497 @item -Wduplicated-cond
8498 Warn about duplicated conditions in an if-else-if chain.  For instance,
8499 warn for the following code:
8500 @smallexample
8501 if (p->q != NULL) @{ @dots{} @}
8502 else if (p->q != NULL) @{ @dots{} @}
8503 @end smallexample
8505 @opindex Wno-frame-address
8506 @opindex Wframe-address
8507 @item -Wframe-address
8508 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
8509 is called with an argument greater than 0.  Such calls may return indeterminate
8510 values or crash the program.  The warning is included in @option{-Wall}.
8512 @opindex Wno-discarded-qualifiers
8513 @opindex Wdiscarded-qualifiers
8514 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
8515 Do not warn if type qualifiers on pointers are being discarded.
8516 Typically, the compiler warns if a @code{const char *} variable is
8517 passed to a function that takes a @code{char *} parameter.  This option
8518 can be used to suppress such a warning.
8520 @opindex Wno-discarded-array-qualifiers
8521 @opindex Wdiscarded-array-qualifiers
8522 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
8523 Do not warn if type qualifiers on arrays which are pointer targets
8524 are being discarded.  Typically, the compiler warns if a
8525 @code{const int (*)[]} variable is passed to a function that
8526 takes a @code{int (*)[]} parameter.  This option can be used to
8527 suppress such a warning.
8529 @opindex Wno-incompatible-pointer-types
8530 @opindex Wincompatible-pointer-types
8531 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
8532 Do not warn when there is a conversion between pointers that have incompatible
8533 types.  This warning is for cases not covered by @option{-Wno-pointer-sign},
8534 which warns for pointer argument passing or assignment with different
8535 signedness.
8537 This warning is upgraded to an error by @option{-pedantic-errors}.
8539 @opindex Wno-int-conversion
8540 @opindex Wint-conversion
8541 @item -Wno-int-conversion @r{(C and Objective-C only)}
8542 Do not warn about incompatible integer to pointer and pointer to integer
8543 conversions.  This warning is about implicit conversions; for explicit
8544 conversions the warnings @option{-Wno-int-to-pointer-cast} and
8545 @option{-Wno-pointer-to-int-cast} may be used.
8547 This warning is upgraded to an error by @option{-pedantic-errors}.
8549 @opindex Wzero-length-bounds
8550 @opindex Wzero-length-bounds
8551 @item -Wzero-length-bounds
8552 Warn about accesses to elements of zero-length array members that might
8553 overlap other members of the same object.  Declaring interior zero-length
8554 arrays is discouraged because accesses to them are undefined.
8555 @xref{Zero Length}.
8557 For example, the first two stores in function @code{bad} are diagnosed
8558 because the array elements overlap the subsequent members @code{b} and
8559 @code{c}.  The third store is diagnosed by @option{-Warray-bounds}
8560 because it is beyond the bounds of the enclosing object.
8562 @smallexample
8563 struct X @{ int a[0]; int b, c; @};
8564 struct X x;
8566 void bad (void)
8568   x.a[0] = 0;   // -Wzero-length-bounds
8569   x.a[1] = 1;   // -Wzero-length-bounds
8570   x.a[2] = 2;   // -Warray-bounds
8572 @end smallexample
8574 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
8576 @opindex Wno-div-by-zero
8577 @opindex Wdiv-by-zero
8578 @item -Wno-div-by-zero
8579 Do not warn about compile-time integer division by zero.  Floating-point
8580 division by zero is not warned about, as it can be a legitimate way of
8581 obtaining infinities and NaNs.
8583 @opindex Wsystem-headers
8584 @opindex Wno-system-headers
8585 @cindex warnings from system headers
8586 @cindex system headers, warnings from
8587 @item -Wsystem-headers
8588 Print warning messages for constructs found in system header files.
8589 Warnings from system headers are normally suppressed, on the assumption
8590 that they usually do not indicate real problems and would only make the
8591 compiler output harder to read.  Using this command-line option tells
8592 GCC to emit warnings from system headers as if they occurred in user
8593 code.  However, note that using @option{-Wall} in conjunction with this
8594 option does @emph{not} warn about unknown pragmas in system
8595 headers---for that, @option{-Wunknown-pragmas} must also be used.
8597 @opindex Wtautological-compare
8598 @opindex Wno-tautological-compare
8599 @item -Wtautological-compare
8600 Warn if a self-comparison always evaluates to true or false.  This
8601 warning detects various mistakes such as:
8602 @smallexample
8603 int i = 1;
8604 @dots{}
8605 if (i > i) @{ @dots{} @}
8606 @end smallexample
8608 This warning also warns about bitwise comparisons that always evaluate
8609 to true or false, for instance:
8610 @smallexample
8611 if ((a & 16) == 10) @{ @dots{} @}
8612 @end smallexample
8613 will always be false.
8615 This warning is enabled by @option{-Wall}.
8617 @opindex Wtrampolines
8618 @opindex Wno-trampolines
8619 @item -Wtrampolines
8620 Warn about trampolines generated for pointers to nested functions.
8621 A trampoline is a small piece of data or code that is created at run
8622 time on the stack when the address of a nested function is taken, and is
8623 used to call the nested function indirectly.  For some targets, it is
8624 made up of data only and thus requires no special treatment.  But, for
8625 most targets, it is made up of code and thus requires the stack to be
8626 made executable in order for the program to work properly.
8628 @opindex Wfloat-equal
8629 @opindex Wno-float-equal
8630 @item -Wfloat-equal
8631 Warn if floating-point values are used in equality comparisons.
8633 The idea behind this is that sometimes it is convenient (for the
8634 programmer) to consider floating-point values as approximations to
8635 infinitely precise real numbers.  If you are doing this, then you need
8636 to compute (by analyzing the code, or in some other way) the maximum or
8637 likely maximum error that the computation introduces, and allow for it
8638 when performing comparisons (and when producing output, but that's a
8639 different problem).  In particular, instead of testing for equality, you
8640 should check to see whether the two values have ranges that overlap; and
8641 this is done with the relational operators, so equality comparisons are
8642 probably mistaken.
8644 @opindex Wtraditional
8645 @opindex Wno-traditional
8646 @item -Wtraditional @r{(C and Objective-C only)}
8647 Warn about certain constructs that behave differently in traditional and
8648 ISO C@.  Also warn about ISO C constructs that have no traditional C
8649 equivalent, and/or problematic constructs that should be avoided.
8651 @itemize @bullet
8652 @item
8653 Macro parameters that appear within string literals in the macro body.
8654 In traditional C macro replacement takes place within string literals,
8655 but in ISO C it does not.
8657 @item
8658 In traditional C, some preprocessor directives did not exist.
8659 Traditional preprocessors only considered a line to be a directive
8660 if the @samp{#} appeared in column 1 on the line.  Therefore
8661 @option{-Wtraditional} warns about directives that traditional C
8662 understands but ignores because the @samp{#} does not appear as the
8663 first character on the line.  It also suggests you hide directives like
8664 @code{#pragma} not understood by traditional C by indenting them.  Some
8665 traditional implementations do not recognize @code{#elif}, so this option
8666 suggests avoiding it altogether.
8668 @item
8669 A function-like macro that appears without arguments.
8671 @item
8672 The unary plus operator.
8674 @item
8675 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
8676 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
8677 constants.)  Note, these suffixes appear in macros defined in the system
8678 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
8679 Use of these macros in user code might normally lead to spurious
8680 warnings, however GCC's integrated preprocessor has enough context to
8681 avoid warning in these cases.
8683 @item
8684 A function declared external in one block and then used after the end of
8685 the block.
8687 @item
8688 A @code{switch} statement has an operand of type @code{long}.
8690 @item
8691 A non-@code{static} function declaration follows a @code{static} one.
8692 This construct is not accepted by some traditional C compilers.
8694 @item
8695 The ISO type of an integer constant has a different width or
8696 signedness from its traditional type.  This warning is only issued if
8697 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
8698 typically represent bit patterns, are not warned about.
8700 @item
8701 Usage of ISO string concatenation is detected.
8703 @item
8704 Initialization of automatic aggregates.
8706 @item
8707 Identifier conflicts with labels.  Traditional C lacks a separate
8708 namespace for labels.
8710 @item
8711 Initialization of unions.  If the initializer is zero, the warning is
8712 omitted.  This is done under the assumption that the zero initializer in
8713 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
8714 initializer warnings and relies on default initialization to zero in the
8715 traditional C case.
8717 @item
8718 Conversions by prototypes between fixed/floating-point values and vice
8719 versa.  The absence of these prototypes when compiling with traditional
8720 C causes serious problems.  This is a subset of the possible
8721 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
8723 @item
8724 Use of ISO C style function definitions.  This warning intentionally is
8725 @emph{not} issued for prototype declarations or variadic functions
8726 because these ISO C features appear in your code when using
8727 libiberty's traditional C compatibility macros, @code{PARAMS} and
8728 @code{VPARAMS}.  This warning is also bypassed for nested functions
8729 because that feature is already a GCC extension and thus not relevant to
8730 traditional C compatibility.
8731 @end itemize
8733 @opindex Wtraditional-conversion
8734 @opindex Wno-traditional-conversion
8735 @item -Wtraditional-conversion @r{(C and Objective-C only)}
8736 Warn if a prototype causes a type conversion that is different from what
8737 would happen to the same argument in the absence of a prototype.  This
8738 includes conversions of fixed point to floating and vice versa, and
8739 conversions changing the width or signedness of a fixed-point argument
8740 except when the same as the default promotion.
8742 @opindex Wdeclaration-after-statement
8743 @opindex Wno-declaration-after-statement
8744 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
8745 Warn when a declaration is found after a statement in a block.  This
8746 construct, known from C++, was introduced with ISO C99 and is by default
8747 allowed in GCC@.  It is not supported by ISO C90.  @xref{Mixed Labels and Declarations}.
8749 This warning is upgraded to an error by @option{-pedantic-errors}.
8751 @opindex Wshadow
8752 @opindex Wno-shadow
8753 @item -Wshadow
8754 Warn whenever a local variable or type declaration shadows another
8755 variable, parameter, type, class member (in C++), or instance variable
8756 (in Objective-C) or whenever a built-in function is shadowed.  Note
8757 that in C++, the compiler warns if a local variable shadows an
8758 explicit typedef, but not if it shadows a struct/class/enum.
8759 If this warning is enabled, it includes also all instances of
8760 local shadowing.  This means that @option{-Wno-shadow=local}
8761 and @option{-Wno-shadow=compatible-local} are ignored when
8762 @option{-Wshadow} is used.
8763 Same as @option{-Wshadow=global}.
8765 @opindex Wno-shadow-ivar
8766 @opindex Wshadow-ivar
8767 @item -Wno-shadow-ivar @r{(Objective-C only)}
8768 Do not warn whenever a local variable shadows an instance variable in an
8769 Objective-C method.
8771 @opindex Wshadow=global
8772 @item -Wshadow=global
8773 Warn for any shadowing.
8774 Same as @option{-Wshadow}.
8776 @opindex Wshadow=local
8777 @item -Wshadow=local
8778 Warn when a local variable shadows another local variable or parameter.
8780 @opindex Wshadow=compatible-local
8781 @item -Wshadow=compatible-local
8782 Warn when a local variable shadows another local variable or parameter
8783 whose type is compatible with that of the shadowing variable.  In C++,
8784 type compatibility here means the type of the shadowing variable can be
8785 converted to that of the shadowed variable.  The creation of this flag
8786 (in addition to @option{-Wshadow=local}) is based on the idea that when
8787 a local variable shadows another one of incompatible type, it is most
8788 likely intentional, not a bug or typo, as shown in the following example:
8790 @smallexample
8791 @group
8792 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
8794   for (int i = 0; i < N; ++i)
8795   @{
8796     ...
8797   @}
8798   ...
8800 @end group
8801 @end smallexample
8803 Since the two variable @code{i} in the example above have incompatible types,
8804 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
8805 Because their types are incompatible, if a programmer accidentally uses one
8806 in place of the other, type checking is expected to catch that and emit an
8807 error or warning.  Use of this flag instead of @option{-Wshadow=local} can
8808 possibly reduce the number of warnings triggered by intentional shadowing.
8809 Note that this also means that shadowing @code{const char *i} by
8810 @code{char *i} does not emit a warning.
8812 This warning is also enabled by @option{-Wshadow=local}.
8814 @opindex Wlarger-than=
8815 @opindex Wlarger-than-@var{byte-size}
8816 @item -Wlarger-than=@var{byte-size}
8817 Warn whenever an object is defined whose size exceeds @var{byte-size}.
8818 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8819 Warnings controlled by the option can be disabled either by specifying
8820 @var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
8822 Also warn for calls to bounded functions such as @code{memchr} or
8823 @code{strnlen} that specify a bound greater than the largest possible
8824 object, which is @samp{PTRDIFF_MAX} bytes by default.  These warnings
8825 can only be disabled by @option{-Wno-larger-than}.
8827 @opindex Wno-larger-than
8828 @item -Wno-larger-than
8829 Disable @option{-Wlarger-than=} warnings.  The option is equivalent
8830 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
8832 @opindex Wframe-larger-than=
8833 @opindex Wno-frame-larger-than
8834 @item -Wframe-larger-than=@var{byte-size}
8835 Warn if the size of a function frame exceeds @var{byte-size}.
8836 The computation done to determine the stack frame size is approximate
8837 and not conservative.
8838 The actual requirements may be somewhat greater than @var{byte-size}
8839 even if you do not get a warning.  In addition, any space allocated
8840 via @code{alloca}, variable-length arrays, or related constructs
8841 is not included by the compiler when determining
8842 whether or not to issue a warning.
8843 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8844 Warnings controlled by the option can be disabled either by specifying
8845 @var{byte-size} of @samp{SIZE_MAX} or more or by
8846 @option{-Wno-frame-larger-than}.
8848 @opindex Wno-frame-larger-than
8849 @item -Wno-frame-larger-than
8850 Disable @option{-Wframe-larger-than=} warnings.  The option is equivalent
8851 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
8853 @opindex Wfree-nonheap-object
8854 @opindex Wno-free-nonheap-object
8855 @item -Wfree-nonheap-object
8856 Warn when attempting to deallocate an object that was either not allocated
8857 on the heap, or by using a pointer that was not returned from a prior call
8858 to the corresponding allocation function.  For example, because the call
8859 to @code{stpcpy} returns a pointer to the terminating nul character and
8860 not to the beginning of the object, the call to @code{free} below is
8861 diagnosed.
8863 @smallexample
8864 void f (char *p)
8866   p = stpcpy (p, "abc");
8867   // ...
8868   free (p);   // warning
8870 @end smallexample
8872 @option{-Wfree-nonheap-object} is included in @option{-Wall}.
8874 @opindex Wstack-usage
8875 @opindex Wno-stack-usage
8876 @item -Wstack-usage=@var{byte-size}
8877 Warn if the stack usage of a function might exceed @var{byte-size}.
8878 The computation done to determine the stack usage is conservative.
8879 Any space allocated via @code{alloca}, variable-length arrays, or related
8880 constructs is included by the compiler when determining whether or not to
8881 issue a warning.
8883 The message is in keeping with the output of @option{-fstack-usage}.
8885 @itemize
8886 @item
8887 If the stack usage is fully static but exceeds the specified amount, it's:
8889 @smallexample
8890   warning: stack usage is 1120 bytes
8891 @end smallexample
8892 @item
8893 If the stack usage is (partly) dynamic but bounded, it's:
8895 @smallexample
8896   warning: stack usage might be 1648 bytes
8897 @end smallexample
8898 @item
8899 If the stack usage is (partly) dynamic and not bounded, it's:
8901 @smallexample
8902   warning: stack usage might be unbounded
8903 @end smallexample
8904 @end itemize
8906 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
8907 Warnings controlled by the option can be disabled either by specifying
8908 @var{byte-size} of @samp{SIZE_MAX} or more or by
8909 @option{-Wno-stack-usage}.
8911 @opindex Wno-stack-usage
8912 @item -Wno-stack-usage
8913 Disable @option{-Wstack-usage=} warnings.  The option is equivalent
8914 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
8916 @opindex Wunsafe-loop-optimizations
8917 @opindex Wno-unsafe-loop-optimizations
8918 @item -Wunsafe-loop-optimizations
8919 Warn if the loop cannot be optimized because the compiler cannot
8920 assume anything on the bounds of the loop indices.  With
8921 @option{-funsafe-loop-optimizations} warn if the compiler makes
8922 such assumptions.
8924 @opindex Wno-pedantic-ms-format
8925 @opindex Wpedantic-ms-format
8926 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
8927 When used in combination with @option{-Wformat}
8928 and @option{-pedantic} without GNU extensions, this option
8929 disables the warnings about non-ISO @code{printf} / @code{scanf} format
8930 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
8931 which depend on the MS runtime.
8933 @opindex Wpointer-arith
8934 @opindex Wno-pointer-arith
8935 @item -Wpointer-arith
8936 Warn about anything that depends on the ``size of'' a function type or
8937 of @code{void}.  GNU C assigns these types a size of 1, for
8938 convenience in calculations with @code{void *} pointers and pointers
8939 to functions.  In C++, warn also when an arithmetic operation involves
8940 @code{NULL}.  This warning is also enabled by @option{-Wpedantic}.
8942 This warning is upgraded to an error by @option{-pedantic-errors}.
8944 @opindex Wpointer-compare
8945 @opindex Wno-pointer-compare
8946 @item -Wno-pointer-compare
8947 Do not warn if a pointer is compared with a zero character constant.
8948 This usually
8949 means that the pointer was meant to be dereferenced.  For example:
8951 @smallexample
8952 const char *p = foo ();
8953 if (p == '\0')
8954   return 42;
8955 @end smallexample
8957 Note that the code above is invalid in C++11.
8959 This warning is enabled by default.
8961 @opindex Wtsan
8962 @opindex Wno-tsan
8963 @item -Wtsan
8964 Warn about unsupported features in ThreadSanitizer.
8966 ThreadSanitizer does not support @code{std::atomic_thread_fence} and
8967 can report false positives.
8969 This warning is enabled by default.
8971 @opindex Wtype-limits
8972 @opindex Wno-type-limits
8973 @item -Wtype-limits
8974 Warn if a comparison is always true or always false due to the limited
8975 range of the data type, but do not warn for constant expressions.  For
8976 example, warn if an unsigned variable is compared against zero with
8977 @code{<} or @code{>=}.  This warning is also enabled by
8978 @option{-Wextra}.
8980 @opindex Wabsolute-value
8981 @opindex Wno-absolute-value
8982 @item -Wabsolute-value @r{(C and Objective-C only)}
8983 Warn for calls to standard functions that compute the absolute value
8984 of an argument when a more appropriate standard function is available.
8985 For example, calling @code{abs(3.14)} triggers the warning because the
8986 appropriate function to call to compute the absolute value of a double
8987 argument is @code{fabs}.  The option also triggers warnings when the
8988 argument in a call to such a function has an unsigned type.  This
8989 warning can be suppressed with an explicit type cast and it is also
8990 enabled by @option{-Wextra}.
8992 @include cppwarnopts.texi
8994 @opindex Wbad-function-cast
8995 @opindex Wno-bad-function-cast
8996 @item -Wbad-function-cast @r{(C and Objective-C only)}
8997 Warn when a function call is cast to a non-matching type.
8998 For example, warn if a call to a function returning an integer type 
8999 is cast to a pointer type.
9001 @opindex Wc90-c99-compat
9002 @opindex Wno-c90-c99-compat
9003 @item -Wc90-c99-compat @r{(C and Objective-C only)}
9004 Warn about features not present in ISO C90, but present in ISO C99.
9005 For instance, warn about use of variable length arrays, @code{long long}
9006 type, @code{bool} type, compound literals, designated initializers, and so
9007 on.  This option is independent of the standards mode.  Warnings are disabled
9008 in the expression that follows @code{__extension__}.
9010 @opindex Wc99-c11-compat
9011 @opindex Wno-c99-c11-compat
9012 @item -Wc99-c11-compat @r{(C and Objective-C only)}
9013 Warn about features not present in ISO C99, but present in ISO C11.
9014 For instance, warn about use of anonymous structures and unions,
9015 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
9016 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
9017 and so on.  This option is independent of the standards mode.  Warnings are
9018 disabled in the expression that follows @code{__extension__}.
9020 @opindex Wc11-c23-compat
9021 @opindex Wno-c11-c23-compat
9022 @item -Wc11-c23-compat @r{(C and Objective-C only)}
9023 @itemx -Wc11-c2x-compat @r{(C and Objective-C only)}
9024 Warn about features not present in ISO C11, but present in ISO C23.
9025 For instance, warn about omitting the string in @code{_Static_assert},
9026 use of @samp{[[]]} syntax for attributes, use of decimal
9027 floating-point types, and so on.  This option is independent of the
9028 standards mode.  Warnings are disabled in the expression that follows
9029 @code{__extension__}.  The name @option{-Wc11-c2x-compat} is
9030 deprecated.
9032 When not compiling in C23 mode, these warnings are upgraded to errors
9033 by @option{-pedantic-errors}.
9035 @opindex Wc++-compat
9036 @opindex Wno-c++-compat
9037 @item -Wc++-compat @r{(C and Objective-C only)}
9038 Warn about ISO C constructs that are outside of the common subset of
9039 ISO C and ISO C++, e.g.@: request for implicit conversion from
9040 @code{void *} to a pointer to non-@code{void} type.
9042 @opindex Wc++11-compat
9043 @opindex Wno-c++11-compat
9044 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
9045 Warn about C++ constructs whose meaning differs between ISO C++ 1998
9046 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
9047 in ISO C++ 2011.  This warning turns on @option{-Wnarrowing} and is
9048 enabled by @option{-Wall}.
9050 @opindex Wc++14-compat
9051 @opindex Wno-c++14-compat
9052 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
9053 Warn about C++ constructs whose meaning differs between ISO C++ 2011
9054 and ISO C++ 2014.  This warning is enabled by @option{-Wall}.
9056 @opindex Wc++17-compat
9057 @opindex Wno-c++17-compat
9058 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
9059 Warn about C++ constructs whose meaning differs between ISO C++ 2014
9060 and ISO C++ 2017.  This warning is enabled by @option{-Wall}.
9062 @opindex Wc++20-compat
9063 @opindex Wno-c++20-compat
9064 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
9065 Warn about C++ constructs whose meaning differs between ISO C++ 2017
9066 and ISO C++ 2020.  This warning is enabled by @option{-Wall}.
9068 @opindex Wc++11-extensions
9069 @opindex Wno-c++11-extensions
9070 @item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)}
9071 Do not warn about C++11 constructs in code being compiled using
9072 an older C++ standard.  Even without this option, some C++11 constructs
9073 will only be diagnosed if @option{-Wpedantic} is used.
9075 @opindex Wc++14-extensions
9076 @opindex Wno-c++14-extensions
9077 @item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)}
9078 Do not warn about C++14 constructs in code being compiled using
9079 an older C++ standard.  Even without this option, some C++14 constructs
9080 will only be diagnosed if @option{-Wpedantic} is used.
9082 @opindex Wc++17-extensions
9083 @opindex Wno-c++17-extensions
9084 @item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)}
9085 Do not warn about C++17 constructs in code being compiled using
9086 an older C++ standard.  Even without this option, some C++17 constructs
9087 will only be diagnosed if @option{-Wpedantic} is used.
9089 @opindex Wc++20-extensions
9090 @opindex Wno-c++20-extensions
9091 @item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)}
9092 Do not warn about C++20 constructs in code being compiled using
9093 an older C++ standard.  Even without this option, some C++20 constructs
9094 will only be diagnosed if @option{-Wpedantic} is used.
9096 @opindex Wc++23-extensions
9097 @opindex Wno-c++23-extensions
9098 @item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)}
9099 Do not warn about C++23 constructs in code being compiled using
9100 an older C++ standard.  Even without this option, some C++23 constructs
9101 will only be diagnosed if @option{-Wpedantic} is used.
9103 @opindex Wcast-qual
9104 @opindex Wno-cast-qual
9105 @item -Wcast-qual
9106 Warn whenever a pointer is cast so as to remove a type qualifier from
9107 the target type.  For example, warn if a @code{const char *} is cast
9108 to an ordinary @code{char *}.
9110 Also warn when making a cast that introduces a type qualifier in an
9111 unsafe way.  For example, casting @code{char **} to @code{const char **}
9112 is unsafe, as in this example:
9114 @smallexample
9115   /* p is char ** value.  */
9116   const char **q = (const char **) p;
9117   /* Assignment of readonly string to const char * is OK.  */
9118   *q = "string";
9119   /* Now char** pointer points to read-only memory.  */
9120   **p = 'b';
9121 @end smallexample
9123 @opindex Wcast-align
9124 @opindex Wno-cast-align
9125 @item -Wcast-align
9126 Warn whenever a pointer is cast such that the required alignment of the
9127 target is increased.  For example, warn if a @code{char *} is cast to
9128 an @code{int *} on machines where integers can only be accessed at
9129 two- or four-byte boundaries.
9131 @opindex Wcast-align=strict
9132 @item -Wcast-align=strict
9133 Warn whenever a pointer is cast such that the required alignment of the
9134 target is increased.  For example, warn if a @code{char *} is cast to
9135 an @code{int *} regardless of the target machine.
9137 @opindex Wcast-function-type
9138 @opindex Wno-cast-function-type
9139 @item -Wcast-function-type
9140 Warn when a function pointer is cast to an incompatible function pointer.
9141 In a cast involving function types with a variable argument list only
9142 the types of initial arguments that are provided are considered.
9143 Any parameter of pointer-type matches any other pointer-type.  Any benign
9144 differences in integral types are ignored, like @code{int} vs.@: @code{long}
9145 on ILP32 targets.  Likewise type qualifiers are ignored.  The function
9146 type @code{void (*) (void)} is special and matches everything, which can
9147 be used to suppress this warning.
9148 In a cast involving pointer to member types this warning warns whenever
9149 the type cast is changing the pointer to member type.
9150 This warning is enabled by @option{-Wextra}.
9152 @opindex Wwrite-strings
9153 @opindex Wno-write-strings
9154 @item -Wwrite-strings
9155 When compiling C, give string constants the type @code{const
9156 char[@var{length}]} so that copying the address of one into a
9157 non-@code{const} @code{char *} pointer produces a warning.  These
9158 warnings help you find at compile time code that can try to write
9159 into a string constant, but only if you have been very careful about
9160 using @code{const} in declarations and prototypes.  Otherwise, it is
9161 just a nuisance. This is why we did not make @option{-Wall} request
9162 these warnings.
9164 When compiling C++, warn about the deprecated conversion from string
9165 literals to @code{char *}.  This warning is enabled by default for C++
9166 programs.
9168 This warning is upgraded to an error by @option{-pedantic-errors} in
9169 C++11 mode or later.
9171 @opindex Wclobbered
9172 @opindex Wno-clobbered
9173 @item -Wclobbered
9174 Warn for variables that might be changed by @code{longjmp} or
9175 @code{vfork}.  This warning is also enabled by @option{-Wextra}.
9177 @opindex Wcomplain-wrong-lang
9178 @opindex Wno-complain-wrong-lang
9179 @item -Wno-complain-wrong-lang
9180 By default, language front ends complain when a command-line option is
9181 valid, but not applicable to that front end.
9182 This may be disabled with @option{-Wno-complain-wrong-lang},
9183 which is mostly useful when invoking a single compiler driver for
9184 multiple source files written in different languages, for example:
9186 @smallexample
9187 $ g++ -fno-rtti a.cc b.f90
9188 @end smallexample
9190 The driver @file{g++} invokes the C++ front end to compile @file{a.cc}
9191 and the Fortran front end to compile @file{b.f90}.
9192 The latter front end diagnoses
9193 @samp{f951: Warning: command-line option '-fno-rtti' is valid for C++/D/ObjC++ but not for Fortran},
9194 which may be disabled with @option{-Wno-complain-wrong-lang}.
9196 @opindex Wcompare-distinct-pointer-types
9197 @item -Wcompare-distinct-pointer-types @r{(C and Objective-C only)}
9198 Warn if pointers of distinct types are compared without a cast.  This
9199 warning is enabled by default.
9201 @opindex Wconversion
9202 @opindex Wno-conversion
9203 @item -Wconversion
9204 Warn for implicit conversions that may alter a value. This includes
9205 conversions between real and integer, like @code{abs (x)} when
9206 @code{x} is @code{double}; conversions between signed and unsigned,
9207 like @code{unsigned ui = -1}; and conversions to smaller types, like
9208 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
9209 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
9210 changed by the conversion like in @code{abs (2.0)}.  Warnings about
9211 conversions between signed and unsigned integers can be disabled by
9212 using @option{-Wno-sign-conversion}.
9214 For C++, also warn for confusing overload resolution for user-defined
9215 conversions; and conversions that never use a type conversion
9216 operator: conversions to @code{void}, the same type, a base class or a
9217 reference to them. Warnings about conversions between signed and
9218 unsigned integers are disabled by default in C++ unless
9219 @option{-Wsign-conversion} is explicitly enabled.
9221 Warnings about conversion from arithmetic on a small type back to that
9222 type are only given with @option{-Warith-conversion}.
9224 @opindex Wdangling-else
9225 @opindex Wno-dangling-else
9226 @item -Wdangling-else
9227 Warn about constructions where there may be confusion to which
9228 @code{if} statement an @code{else} branch belongs.  Here is an example of
9229 such a case:
9231 @smallexample
9232 @group
9234   if (a)
9235     if (b)
9236       foo ();
9237   else
9238     bar ();
9240 @end group
9241 @end smallexample
9243 In C/C++, every @code{else} branch belongs to the innermost possible
9244 @code{if} statement, which in this example is @code{if (b)}.  This is
9245 often not what the programmer expected, as illustrated in the above
9246 example by indentation the programmer chose.  When there is the
9247 potential for this confusion, GCC issues a warning when this flag
9248 is specified.  To eliminate the warning, add explicit braces around
9249 the innermost @code{if} statement so there is no way the @code{else}
9250 can belong to the enclosing @code{if}.  The resulting code
9251 looks like this:
9253 @smallexample
9254 @group
9256   if (a)
9257     @{
9258       if (b)
9259         foo ();
9260       else
9261         bar ();
9262     @}
9264 @end group
9265 @end smallexample
9267 This warning is enabled by @option{-Wparentheses}.
9269 @opindex Wdangling-pointer
9270 @opindex Wno-dangling-pointer
9271 @item -Wdangling-pointer
9272 @itemx -Wdangling-pointer=@var{n}
9273 Warn about uses of pointers (or C++ references) to objects with automatic
9274 storage duration after their lifetime has ended.  This includes local
9275 variables declared in nested blocks, compound literals and other unnamed
9276 temporary objects.  In addition, warn about storing the address of such
9277 objects in escaped pointers.  The warning is enabled at all optimization
9278 levels but may yield different results with optimization than without.
9280 @table @gcctabopt
9281 @item -Wdangling-pointer=1
9282 At level 1 the warning diagnoses only unconditional uses of dangling pointers.
9283 For example
9284 @smallexample
9285 int f (int c1, int c2, x)
9287   char *p = strchr ((char[])@{ c1, c2 @}, c3);
9288   // warning: dangling pointer to a compound literal
9289   return p ? *p : 'x';
9291 @end smallexample
9292 In the following function the store of the address of the local variable
9293 @code{x} in the escaped pointer @code{*p} also triggers the warning.
9294 @smallexample
9295 void g (int **p)
9297   int x = 7;
9298   // warning: storing the address of a local variable in *p
9299   *p = &x;
9301 @end smallexample
9303 @item -Wdangling-pointer=2
9304 At level 2, in addition to unconditional uses the warning also diagnoses
9305 conditional uses of dangling pointers.
9307 For example, because the array @var{a} in the following function is out of
9308 scope when the pointer @var{s} that was set to point is used, the warning
9309 triggers at this level.
9311 @smallexample
9312 void f (char *s)
9314   if (!s)
9315     @{
9316       char a[12] = "tmpname";
9317       s = a;
9318     @}
9319   // warning: dangling pointer to a may be used
9320   strcat (s, ".tmp");
9321   ...
9323 @end smallexample
9324 @end table
9326 @option{-Wdangling-pointer=2} is included in @option{-Wall}.
9328 @opindex Wdate-time
9329 @opindex Wno-date-time
9330 @item -Wdate-time
9331 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
9332 are encountered as they might prevent bit-wise-identical reproducible
9333 compilations.
9335 @opindex Wempty-body
9336 @opindex Wno-empty-body
9337 @item -Wempty-body
9338 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
9339 while} statement.  This warning is also enabled by @option{-Wextra}.
9341 @opindex Wendif-labels
9342 @opindex Wno-endif-labels
9343 @item -Wno-endif-labels
9344 Do not warn about stray tokens after @code{#else} and @code{#endif}.
9346 @opindex Wenum-compare
9347 @opindex Wno-enum-compare
9348 @item -Wenum-compare
9349 Warn about a comparison between values of different enumerated types.
9350 In C++ enumerated type mismatches in conditional expressions are also
9351 diagnosed and the warning is enabled by default.  In C this warning is 
9352 enabled by @option{-Wall}.
9354 @opindex Wenum-conversion
9355 @opindex Wno-enum-conversion
9356 @item -Wenum-conversion
9357 Warn when a value of enumerated type is implicitly converted to a 
9358 different enumerated type.  This warning is enabled by @option{-Wextra}
9359 in C@.
9361 @opindex Wenum-int-mismatch
9362 @opindex Wno-enum-int-mismatch
9363 @item -Wenum-int-mismatch @r{(C and Objective-C only)}
9364 Warn about mismatches between an enumerated type and an integer type in
9365 declarations.  For example:
9367 @smallexample
9368 enum E @{ l = -1, z = 0, g = 1 @};
9369 int foo(void);
9370 enum E foo(void);
9371 @end smallexample
9373 In C, an enumerated type is compatible with @code{char}, a signed
9374 integer type, or an unsigned integer type.  However, since the choice
9375 of the underlying type of an enumerated type is implementation-defined,
9376 such mismatches may cause portability issues.  In C++, such mismatches
9377 are an error.  In C, this warning is enabled by @option{-Wall} and
9378 @option{-Wc++-compat}.
9380 @opindex Wjump-misses-init
9381 @opindex Wno-jump-misses-init
9382 @item -Wjump-misses-init @r{(C, Objective-C only)}
9383 Warn if a @code{goto} statement or a @code{switch} statement jumps
9384 forward across the initialization of a variable, or jumps backward to a
9385 label after the variable has been initialized.  This only warns about
9386 variables that are initialized when they are declared.  This warning is
9387 only supported for C and Objective-C; in C++ this sort of branch is an
9388 error in any case.
9390 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
9391 can be disabled with the @option{-Wno-jump-misses-init} option.
9393 @opindex Wsign-compare
9394 @opindex Wno-sign-compare
9395 @cindex warning for comparison of signed and unsigned values
9396 @cindex comparison of signed and unsigned values, warning
9397 @cindex signed and unsigned values, comparison warning
9398 @item -Wsign-compare
9399 Warn when a comparison between signed and unsigned values could produce
9400 an incorrect result when the signed value is converted to unsigned.
9401 In C++, this warning is also enabled by @option{-Wall}.  In C, it is
9402 also enabled by @option{-Wextra}.
9404 @opindex Wsign-conversion
9405 @opindex Wno-sign-conversion
9406 @item -Wsign-conversion
9407 Warn for implicit conversions that may change the sign of an integer
9408 value, like assigning a signed integer expression to an unsigned
9409 integer variable. An explicit cast silences the warning. In C, this
9410 option is enabled also by @option{-Wconversion}.
9412 @opindex Wflex-array-member-not-at-end
9413 @opindex Wno-flex-array-member-not-at-end
9414 @item -Wflex-array-member-not-at-end @r{(C and C++ only)}
9415 Warn when a structure containing a C99 flexible array member as the last
9416 field is not at the end of another structure.
9417 This warning warns e.g. about
9419 @smallexample
9420 struct flex  @{ int length; char data[]; @};
9421 struct mid_flex @{ int m; struct flex flex_data; int n; @};
9422 @end smallexample
9424 @opindex Wfloat-conversion
9425 @opindex Wno-float-conversion
9426 @item -Wfloat-conversion
9427 Warn for implicit conversions that reduce the precision of a real value.
9428 This includes conversions from real to integer, and from higher precision
9429 real to lower precision real values.  This option is also enabled by
9430 @option{-Wconversion}.
9432 @opindex Wno-scalar-storage-order
9433 @opindex Wscalar-storage-order
9434 @item -Wno-scalar-storage-order
9435 Do not warn on suspicious constructs involving reverse scalar storage order.
9437 @opindex Wsizeof-array-div
9438 @opindex Wno-sizeof-array-div
9439 @item -Wsizeof-array-div
9440 Warn about divisions of two sizeof operators when the first one is applied
9441 to an array and the divisor does not equal the size of the array element.
9442 In such a case, the computation will not yield the number of elements in the
9443 array, which is likely what the user intended.  This warning warns e.g. about
9444 @smallexample
9445 int fn ()
9447   int arr[10];
9448   return sizeof (arr) / sizeof (short);
9450 @end smallexample
9452 This warning is enabled by @option{-Wall}.
9454 @opindex Wsizeof-pointer-div
9455 @opindex Wno-sizeof-pointer-div
9456 @item -Wsizeof-pointer-div
9457 Warn for suspicious divisions of two sizeof expressions that divide
9458 the pointer size by the element size, which is the usual way to compute
9459 the array size but won't work out correctly with pointers.  This warning
9460 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
9461 not an array, but a pointer.  This warning is enabled by @option{-Wall}.
9463 @opindex Wsizeof-pointer-memaccess
9464 @opindex Wno-sizeof-pointer-memaccess
9465 @item -Wsizeof-pointer-memaccess
9466 Warn for suspicious length parameters to certain string and memory built-in
9467 functions if the argument uses @code{sizeof}.  This warning triggers for
9468 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
9469 an array, but a pointer, and suggests a possible fix, or about
9470 @code{memcpy (&foo, ptr, sizeof (&foo));}.  @option{-Wsizeof-pointer-memaccess}
9471 also warns about calls to bounded string copy functions like @code{strncat}
9472 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
9473 the source array.  For example, in the following function the call to
9474 @code{strncat} specifies the size of the source string as the bound.  That
9475 is almost certainly a mistake and so the call is diagnosed.
9476 @smallexample
9477 void make_file (const char *name)
9479   char path[PATH_MAX];
9480   strncpy (path, name, sizeof path - 1);
9481   strncat (path, ".text", sizeof ".text");
9482   @dots{}
9484 @end smallexample
9486 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
9488 @opindex Wsizeof-array-argument
9489 @opindex Wno-sizeof-array-argument
9490 @item -Wno-sizeof-array-argument
9491 Do not warn when the @code{sizeof} operator is applied to a parameter that is
9492 declared as an array in a function definition.  This warning is enabled by
9493 default for C and C++ programs.
9495 @opindex Wmemset-elt-size
9496 @opindex Wno-memset-elt-size
9497 @item -Wmemset-elt-size
9498 Warn for suspicious calls to the @code{memset} built-in function, if the
9499 first argument references an array, and the third argument is a number
9500 equal to the number of elements, but not equal to the size of the array
9501 in memory.  This indicates that the user has omitted a multiplication by
9502 the element size.  This warning is enabled by @option{-Wall}.
9504 @opindex Wmemset-transposed-args
9505 @opindex Wno-memset-transposed-args
9506 @item -Wmemset-transposed-args
9507 Warn for suspicious calls to the @code{memset} built-in function where
9508 the second argument is not zero and the third argument is zero.  For
9509 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
9510 @code{memset (buf, 0, sizeof buf)} was meant instead.  The diagnostic
9511 is only emitted if the third argument is a literal zero.  Otherwise, if
9512 it is an expression that is folded to zero, or a cast of zero to some
9513 type, it is far less likely that the arguments have been mistakenly
9514 transposed and no warning is emitted.  This warning is enabled
9515 by @option{-Wall}.
9517 @opindex Waddress
9518 @opindex Wno-address
9519 @item -Waddress
9520 Warn about suspicious uses of address expressions. These include comparing
9521 the address of a function or a declared object to the null pointer constant
9522 such as in
9523 @smallexample
9524 void f (void);
9525 void g (void)
9527   if (!f)   // warning: expression evaluates to false
9528     abort ();
9530 @end smallexample
9531 comparisons of a pointer to a string literal, such as in
9532 @smallexample
9533 void f (const char *x)
9535   if (x == "abc")   // warning: expression evaluates to false
9536     puts ("equal");
9538 @end smallexample
9539 and tests of the results of pointer addition or subtraction for equality
9540 to null, such as in
9541 @smallexample
9542 void f (const int *p, int i)
9544   return p + i == NULL;
9546 @end smallexample
9547 Such uses typically indicate a programmer error: the address of most
9548 functions and objects necessarily evaluates to true (the exception are
9549 weak symbols), so their use in a conditional might indicate missing
9550 parentheses in a function call or a missing dereference in an array
9551 expression.  The subset of the warning for object pointers can be
9552 suppressed by casting the pointer operand to an integer type such
9553 as @code{intptr_t} or @code{uintptr_t}.
9554 Comparisons against string literals result in unspecified behavior
9555 and are not portable, and suggest the intent was to call @code{strcmp}.
9556 The warning is suppressed if the suspicious expression is the result
9557 of macro expansion.
9558 @option{-Waddress} warning is enabled by @option{-Wall}.
9560 @opindex Waddress-of-packed-member
9561 @opindex Wno-address-of-packed-member
9562 @item -Wno-address-of-packed-member
9563 Do not warn when the address of packed member of struct or union is taken,
9564 which usually results in an unaligned pointer value.  This is
9565 enabled by default.
9567 @opindex Wlogical-op
9568 @opindex Wno-logical-op
9569 @item -Wlogical-op
9570 Warn about suspicious uses of logical operators in expressions.
9571 This includes using logical operators in contexts where a
9572 bit-wise operator is likely to be expected.  Also warns when
9573 the operands of a logical operator are the same:
9574 @smallexample
9575 extern int a;
9576 if (a < 0 && a < 0) @{ @dots{} @}
9577 @end smallexample
9579 @opindex Wlogical-not-parentheses
9580 @opindex Wno-logical-not-parentheses
9581 @item -Wlogical-not-parentheses
9582 Warn about logical not used on the left hand side operand of a comparison.
9583 This option does not warn if the right operand is considered to be a boolean
9584 expression.  Its purpose is to detect suspicious code like the following:
9585 @smallexample
9586 int a;
9587 @dots{}
9588 if (!a > 1) @{ @dots{} @}
9589 @end smallexample
9591 It is possible to suppress the warning by wrapping the LHS into
9592 parentheses:
9593 @smallexample
9594 if ((!a) > 1) @{ @dots{} @}
9595 @end smallexample
9597 This warning is enabled by @option{-Wall}.
9599 @opindex Waggregate-return
9600 @opindex Wno-aggregate-return
9601 @item -Waggregate-return
9602 Warn if any functions that return structures or unions are defined or
9603 called.  (In languages where you can return an array, this also elicits
9604 a warning.)
9606 @opindex Wno-aggressive-loop-optimizations
9607 @opindex Waggressive-loop-optimizations
9608 @item -Wno-aggressive-loop-optimizations
9609 Warn if in a loop with constant number of iterations the compiler detects
9610 undefined behavior in some statement during one or more of the iterations.
9612 @opindex Wno-attributes
9613 @opindex Wattributes
9614 @item -Wno-attributes
9615 Do not warn if an unexpected @code{__attribute__} is used, such as
9616 unrecognized attributes, function attributes applied to variables,
9617 etc.  This does not stop errors for incorrect use of supported
9618 attributes.
9620 Warnings about ill-formed uses of standard attributes are upgraded to
9621 errors by @option{-pedantic-errors}.
9623 Additionally, using @option{-Wno-attributes=}, it is possible to suppress
9624 warnings about unknown scoped attributes (in C++11 and C23).  For example,
9625 @option{-Wno-attributes=vendor::attr} disables warning about the following
9626 declaration:
9628 @smallexample
9629 [[vendor::attr]] void f();
9630 @end smallexample
9632 It is also possible to disable warning about all attributes in a namespace
9633 using @option{-Wno-attributes=vendor::} which prevents warning about both
9634 of these declarations:
9636 @smallexample
9637 [[vendor::safe]] void f();
9638 [[vendor::unsafe]] void f2();
9639 @end smallexample
9641 Note that @option{-Wno-attributes=} does not imply @option{-Wno-attributes}.
9643 @opindex Wno-builtin-declaration-mismatch
9644 @opindex Wbuiltin-declaration-mismatch
9645 @item -Wno-builtin-declaration-mismatch
9646 Warn if a built-in function is declared with an incompatible signature
9647 or as a non-function, or when a built-in function declared with a type
9648 that does not include a prototype is called with arguments whose promoted
9649 types do not match those expected by the function.  When @option{-Wextra}
9650 is specified, also warn when a built-in function that takes arguments is
9651 declared without a prototype.  The @option{-Wbuiltin-declaration-mismatch}
9652 warning is enabled by default.  To avoid the warning include the appropriate
9653 header to bring the prototypes of built-in functions into scope.
9655 For example, the call to @code{memset} below is diagnosed by the warning
9656 because the function expects a value of type @code{size_t} as its argument
9657 but the type of @code{32} is @code{int}.  With @option{-Wextra},
9658 the declaration of the function is diagnosed as well.
9659 @smallexample
9660 extern void* memset ();
9661 void f (void *d)
9663   memset (d, '\0', 32);
9665 @end smallexample
9667 @opindex Wno-builtin-macro-redefined
9668 @opindex Wbuiltin-macro-redefined
9669 @item -Wno-builtin-macro-redefined
9670 Do not warn if certain built-in macros are redefined.  This suppresses
9671 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
9672 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
9674 @opindex Wstrict-prototypes
9675 @opindex Wno-strict-prototypes
9676 @item -Wstrict-prototypes @r{(C and Objective-C only)}
9677 Warn if a function is declared or defined without specifying the
9678 argument types.  (An old-style function definition is permitted without
9679 a warning if preceded by a declaration that specifies the argument
9680 types.)
9682 @opindex Wold-style-declaration
9683 @opindex Wno-old-style-declaration
9684 @item -Wold-style-declaration @r{(C and Objective-C only)}
9685 Warn for obsolescent usages, according to the C Standard, in a
9686 declaration. For example, warn if storage-class specifiers like
9687 @code{static} are not the first things in a declaration.  This warning
9688 is also enabled by @option{-Wextra}.
9690 @opindex Wold-style-definition
9691 @opindex Wno-old-style-definition
9692 @item -Wold-style-definition @r{(C and Objective-C only)}
9693 Warn if an old-style function definition is used.  A warning is given
9694 even if there is a previous prototype.  A definition using @samp{()}
9695 is not considered an old-style definition in C23 mode, because it is
9696 equivalent to @samp{(void)} in that case, but is considered an
9697 old-style definition for older standards.
9699 @opindex Wmissing-parameter-type
9700 @opindex Wno-missing-parameter-type
9701 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
9702 A function parameter is declared without a type specifier in K&R-style
9703 functions:
9705 @smallexample
9706 void foo(bar) @{ @}
9707 @end smallexample
9709 This warning is also enabled by @option{-Wextra}.
9711 @opindex Wmissing-prototypes
9712 @opindex Wno-missing-prototypes
9713 @item -Wmissing-prototypes @r{(C and Objective-C only)}
9714 Warn if a global function is defined without a previous prototype
9715 declaration.  This warning is issued even if the definition itself
9716 provides a prototype.  Use this option to detect global functions
9717 that do not have a matching prototype declaration in a header file.
9718 This option is not valid for C++ because all function declarations
9719 provide prototypes and a non-matching declaration declares an
9720 overload rather than conflict with an earlier declaration.
9721 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
9723 @opindex Wmissing-variable-declarations
9724 @opindex Wno-missing-variable-declarations
9725 @item -Wmissing-variable-declarations @r{(C and Objective-C only)}
9726 Warn if a global variable is defined without a previous declaration.
9727 Use this option to detect global variables that do not have a matching
9728 extern declaration in a header file.
9730 @opindex Wmissing-declarations
9731 @opindex Wno-missing-declarations
9732 @item -Wmissing-declarations
9733 Warn if a global function is defined without a previous declaration.
9734 Do so even if the definition itself provides a prototype.
9735 Use this option to detect global functions that are not declared in
9736 header files.  In C, no warnings are issued for functions with previous
9737 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
9738 missing prototypes.  In C++, no warnings are issued for function templates,
9739 or for inline functions, or for functions in anonymous namespaces.
9741 @opindex Wmissing-field-initializers
9742 @opindex Wno-missing-field-initializers
9743 @opindex W
9744 @opindex Wextra
9745 @opindex Wno-extra
9746 @item -Wmissing-field-initializers
9747 Warn if a structure's initializer has some fields missing.  For
9748 example, the following code causes such a warning, because
9749 @code{x.h} is implicitly zero:
9751 @smallexample
9752 struct s @{ int f, g, h; @};
9753 struct s x = @{ 3, 4 @};
9754 @end smallexample
9756 @c It's unclear if this behavior is desirable.  See PR39589 and PR96868.
9757 In C this option does not warn about designated initializers, so the
9758 following modification does not trigger a warning:
9760 @smallexample
9761 struct s @{ int f, g, h; @};
9762 struct s x = @{ .f = 3, .g = 4 @};
9763 @end smallexample
9765 In C this option does not warn about the universal zero initializer
9766 @samp{@{ 0 @}}:
9768 @smallexample
9769 struct s @{ int f, g, h; @};
9770 struct s x = @{ 0 @};
9771 @end smallexample
9773 Likewise, in C++ this option does not warn about the empty @{ @}
9774 initializer, for example:
9776 @smallexample
9777 struct s @{ int f, g, h; @};
9778 s x = @{ @};
9779 @end smallexample
9781 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
9782 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
9784 @opindex Wmissing-requires
9785 @opindex Wno-missing-requires
9786 @item -Wno-missing-requires
9788 By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement:
9790 @smallexample
9791 bool satisfied = requires @{ C<T> @};
9792 @end smallexample
9794 Here @samp{satisfied} will be true if @samp{C<T>} is a valid
9795 expression, which it is for all T.  Presumably the user meant to write
9797 @smallexample
9798 bool satisfied = requires @{ requires C<T> @};
9799 @end smallexample
9801 so @samp{satisfied} is only true if concept @samp{C} is satisfied for
9802 type @samp{T}.
9804 This warning can be disabled with @option{-Wno-missing-requires}.
9806 @opindex Wmissing-template-keyword
9807 @opindex Wno-missing-template-keyword
9808 @item -Wno-missing-template-keyword
9810 The member access tokens ., -> and :: must be followed by the @code{template}
9811 keyword if the parent object is dependent and the member being named is a
9812 template.
9814 @smallexample
9815 template <class X>
9816 void DoStuff (X x)
9818   x.template DoSomeOtherStuff<X>(); // Good.
9819   x.DoMoreStuff<X>(); // Warning, x is dependent.
9821 @end smallexample
9823 In rare cases it is possible to get false positives. To silence this, wrap
9824 the expression in parentheses. For example, the following is treated as a
9825 template, even where m and N are integers:
9827 @smallexample
9828 void NotATemplate (my_class t)
9830   int N = 5;
9832   bool test = t.m < N > (0); // Treated as a template.
9833   test = (t.m < N) > (0); // Same meaning, but not treated as a template.
9835 @end smallexample
9837 This warning can be disabled with @option{-Wno-missing-template-keyword}.
9839 @opindex Wno-multichar
9840 @opindex Wmultichar
9841 @item -Wno-multichar
9842 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
9843 Usually they indicate a typo in the user's code, as they have
9844 implementation-defined values, and should not be used in portable code.
9846 @opindex Wnormalized=
9847 @opindex Wnormalized
9848 @opindex Wno-normalized
9849 @cindex NFC
9850 @cindex NFKC
9851 @cindex character set, input normalization
9852 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
9853 In ISO C and ISO C++, two identifiers are different if they are
9854 different sequences of characters.  However, sometimes when characters
9855 outside the basic ASCII character set are used, you can have two
9856 different character sequences that look the same.  To avoid confusion,
9857 the ISO 10646 standard sets out some @dfn{normalization rules} which
9858 when applied ensure that two sequences that look the same are turned into
9859 the same sequence.  GCC can warn you if you are using identifiers that
9860 have not been normalized; this option controls that warning.
9862 There are four levels of warning supported by GCC@.  The default is
9863 @option{-Wnormalized=nfc}, which warns about any identifier that is
9864 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
9865 recommended form for most uses.  It is equivalent to
9866 @option{-Wnormalized}.
9868 Unfortunately, there are some characters allowed in identifiers by
9869 ISO C and ISO C++ that, when turned into NFC, are not allowed in 
9870 identifiers.  That is, there's no way to use these symbols in portable
9871 ISO C or C++ and have all your identifiers in NFC@.
9872 @option{-Wnormalized=id} suppresses the warning for these characters.
9873 It is hoped that future versions of the standards involved will correct
9874 this, which is why this option is not the default.
9876 You can switch the warning off for all characters by writing
9877 @option{-Wnormalized=none} or @option{-Wno-normalized}.  You should
9878 only do this if you are using some other normalization scheme (like
9879 ``D''), because otherwise you can easily create bugs that are
9880 literally impossible to see.
9882 Some characters in ISO 10646 have distinct meanings but look identical
9883 in some fonts or display methodologies, especially once formatting has
9884 been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
9885 LETTER N'', displays just like a regular @code{n} that has been
9886 placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
9887 normalization scheme to convert all these into a standard form as
9888 well, and GCC warns if your code is not in NFKC if you use
9889 @option{-Wnormalized=nfkc}.  This warning is comparable to warning
9890 about every identifier that contains the letter O because it might be
9891 confused with the digit 0, and so is not the default, but may be
9892 useful as a local coding convention if the programming environment 
9893 cannot be fixed to display these characters distinctly.
9895 @opindex Wno-attribute-warning
9896 @opindex Wattribute-warning
9897 @item -Wno-attribute-warning
9898 Do not warn about usage of functions (@pxref{Function Attributes})
9899 declared with @code{warning} attribute.  By default, this warning is
9900 enabled.  @option{-Wno-attribute-warning} can be used to disable the
9901 warning or @option{-Wno-error=attribute-warning} can be used to
9902 disable the error when compiled with @option{-Werror} flag.
9904 @opindex Wno-deprecated
9905 @opindex Wdeprecated
9906 @item -Wno-deprecated
9907 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
9909 @opindex Wno-deprecated-declarations
9910 @opindex Wdeprecated-declarations
9911 @item -Wno-deprecated-declarations
9912 Do not warn about uses of functions (@pxref{Function Attributes}),
9913 variables (@pxref{Variable Attributes}), and types (@pxref{Type
9914 Attributes}) marked as deprecated by using the @code{deprecated}
9915 attribute.
9917 @opindex Wno-overflow
9918 @opindex Woverflow
9919 @item -Wno-overflow
9920 Do not warn about compile-time overflow in constant expressions.
9922 @opindex Wno-odr
9923 @opindex Wodr
9924 @item -Wno-odr
9925 Warn about One Definition Rule violations during link-time optimization.
9926 Enabled by default.
9928 @opindex Wopenacc-parallelism
9929 @opindex Wno-openacc-parallelism
9930 @cindex OpenACC accelerator programming
9931 @item -Wopenacc-parallelism
9932 Warn about potentially suboptimal choices related to OpenACC parallelism.
9934 @opindex Wopenmp-simd
9935 @opindex Wno-openmp-simd
9936 @item -Wopenmp-simd
9937 Warn if the vectorizer cost model overrides the OpenMP
9938 simd directive set by user.  The @option{-fsimd-cost-model=unlimited}
9939 option can be used to relax the cost model.
9941 @opindex Woverride-init
9942 @opindex Wno-override-init
9943 @opindex W
9944 @opindex Wextra
9945 @opindex Wno-extra
9946 @item -Woverride-init @r{(C and Objective-C only)}
9947 Warn if an initialized field without side effects is overridden when
9948 using designated initializers (@pxref{Designated Inits, , Designated
9949 Initializers}).
9951 This warning is included in @option{-Wextra}.  To get other
9952 @option{-Wextra} warnings without this one, use @option{-Wextra
9953 -Wno-override-init}.
9955 @opindex Woverride-init-side-effects
9956 @opindex Wno-override-init-side-effects
9957 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
9958 Do not warn if an initialized field with side effects is overridden when
9959 using designated initializers (@pxref{Designated Inits, , Designated
9960 Initializers}).  This warning is enabled by default.
9962 @opindex Wpacked
9963 @opindex Wno-packed
9964 @item -Wpacked
9965 Warn if a structure is given the packed attribute, but the packed
9966 attribute has no effect on the layout or size of the structure.
9967 Such structures may be mis-aligned for little benefit.  For
9968 instance, in this code, the variable @code{f.x} in @code{struct bar}
9969 is misaligned even though @code{struct bar} does not itself
9970 have the packed attribute:
9972 @smallexample
9973 @group
9974 struct foo @{
9975   int x;
9976   char a, b, c, d;
9977 @} __attribute__((packed));
9978 struct bar @{
9979   char z;
9980   struct foo f;
9982 @end group
9983 @end smallexample
9985 @opindex Wpacked-bitfield-compat
9986 @opindex Wno-packed-bitfield-compat
9987 @item -Wnopacked-bitfield-compat
9988 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
9989 on bit-fields of type @code{char}.  This was fixed in GCC 4.4 but
9990 the change can lead to differences in the structure layout.  GCC
9991 informs you when the offset of such a field has changed in GCC 4.4.
9992 For example there is no longer a 4-bit padding between field @code{a}
9993 and @code{b} in this structure:
9995 @smallexample
9996 struct foo
9998   char a:4;
9999   char b:8;
10000 @} __attribute__ ((packed));
10001 @end smallexample
10003 This warning is enabled by default.  Use
10004 @option{-Wno-packed-bitfield-compat} to disable this warning.
10006 @opindex Wpacked-not-aligned
10007 @opindex Wno-packed-not-aligned
10008 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
10009 Warn if a structure field with explicitly specified alignment in a
10010 packed struct or union is misaligned.  For example, a warning will
10011 be issued on @code{struct S}, like, @code{warning: alignment 1 of
10012 'struct S' is less than 8}, in this code:
10014 @smallexample
10015 @group
10016 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
10017 struct __attribute__ ((packed)) S @{
10018   struct S8 s8;
10020 @end group
10021 @end smallexample
10023 This warning is enabled by @option{-Wall}.
10025 @opindex Wpadded
10026 @opindex Wno-padded
10027 @item -Wpadded
10028 Warn if padding is included in a structure, either to align an element
10029 of the structure or to align the whole structure.  Sometimes when this
10030 happens it is possible to rearrange the fields of the structure to
10031 reduce the padding and so make the structure smaller.
10033 @opindex Wredundant-decls
10034 @opindex Wno-redundant-decls
10035 @item -Wredundant-decls
10036 Warn if anything is declared more than once in the same scope, even in
10037 cases where multiple declaration is valid and changes nothing.
10039 @opindex Wrestrict
10040 @opindex Wno-restrict
10041 @item -Wrestrict
10042 Warn when an object referenced by a @code{restrict}-qualified parameter
10043 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
10044 argument, or when copies between such objects overlap.  For example,
10045 the call to the @code{strcpy} function below attempts to truncate the string
10046 by replacing its initial characters with the last four.  However, because
10047 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
10048 the call is diagnosed.
10050 @smallexample
10051 void foo (void)
10053   char a[] = "abcd1234";
10054   strcpy (a, a + 4);
10055   @dots{}
10057 @end smallexample
10058 The @option{-Wrestrict} option detects some instances of simple overlap
10059 even without optimization but works best at @option{-O2} and above.  It
10060 is included in @option{-Wall}.
10062 @opindex Wnested-externs
10063 @opindex Wno-nested-externs
10064 @item -Wnested-externs @r{(C and Objective-C only)}
10065 Warn if an @code{extern} declaration is encountered within a function.
10067 @opindex Winline
10068 @opindex Wno-inline
10069 @item -Winline
10070 Warn if a function that is declared as inline cannot be inlined.
10071 Even with this option, the compiler does not warn about failures to
10072 inline functions declared in system headers.
10074 The compiler uses a variety of heuristics to determine whether or not
10075 to inline a function.  For example, the compiler takes into account
10076 the size of the function being inlined and the amount of inlining
10077 that has already been done in the current function.  Therefore,
10078 seemingly insignificant changes in the source program can cause the
10079 warnings produced by @option{-Winline} to appear or disappear.
10081 @opindex Winterference-size
10082 @item -Winterference-size
10083 Warn about use of C++17 @code{std::hardware_destructive_interference_size}
10084 without specifying its value with @option{--param destructive-interference-size}.
10085 Also warn about questionable values for that option.
10087 This variable is intended to be used for controlling class layout, to
10088 avoid false sharing in concurrent code:
10090 @smallexample
10091 struct independent_fields @{
10092   alignas(std::hardware_destructive_interference_size)
10093     std::atomic<int> one;
10094   alignas(std::hardware_destructive_interference_size)
10095     std::atomic<int> two;
10097 @end smallexample
10099 Here @samp{one} and @samp{two} are intended to be far enough apart
10100 that stores to one won't require accesses to the other to reload the
10101 cache line.
10103 By default, @option{--param destructive-interference-size} and
10104 @option{--param constructive-interference-size} are set based on the
10105 current @option{-mtune} option, typically to the L1 cache line size
10106 for the particular target CPU, sometimes to a range if tuning for a
10107 generic target.  So all translation units that depend on ABI
10108 compatibility for the use of these variables must be compiled with
10109 the same @option{-mtune} (or @option{-mcpu}).
10111 If ABI stability is important, such as if the use is in a header for a
10112 library, you should probably not use the hardware interference size
10113 variables at all.  Alternatively, you can force a particular value
10114 with @option{--param}.
10116 If you are confident that your use of the variable does not affect ABI
10117 outside a single build of your project, you can turn off the warning
10118 with @option{-Wno-interference-size}.
10120 @opindex Wint-in-bool-context
10121 @opindex Wno-int-in-bool-context
10122 @item -Wint-in-bool-context
10123 Warn for suspicious use of integer values where boolean values are expected,
10124 such as conditional expressions (?:) using non-boolean integer constants in
10125 boolean context, like @code{if (a <= b ? 2 : 3)}.  Or left shifting of signed
10126 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}.  Likewise
10127 for all kinds of multiplications regardless of the data type.
10128 This warning is enabled by @option{-Wall}.
10130 @opindex Wno-int-to-pointer-cast
10131 @opindex Wint-to-pointer-cast
10132 @item -Wno-int-to-pointer-cast
10133 Suppress warnings from casts to pointer type of an integer of a
10134 different size. In C++, casting to a pointer type of smaller size is
10135 an error. @option{Wint-to-pointer-cast} is enabled by default.
10138 @opindex Wno-pointer-to-int-cast
10139 @opindex Wpointer-to-int-cast
10140 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
10141 Suppress warnings from casts from a pointer to an integer type of a
10142 different size.
10144 @opindex Winvalid-pch
10145 @opindex Wno-invalid-pch
10146 @item -Winvalid-pch
10147 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
10148 the search path but cannot be used.
10150 @opindex Winvalid-utf8
10151 @opindex Wno-invalid-utf8
10152 @item -Winvalid-utf8
10153 Warn if an invalid UTF-8 character is found.
10154 This warning is on by default for C++23 if @option{-finput-charset=UTF-8}
10155 is used and turned into error with @option{-pedantic-errors}.
10157 @opindex Wunicode
10158 @opindex Wno-unicode
10159 @item -Wno-unicode
10160 Don't diagnose invalid forms of delimited or named escape sequences which are
10161 treated as separate tokens.  @option{Wunicode} is enabled by default.
10163 @opindex Wlong-long
10164 @opindex Wno-long-long
10165 @item -Wlong-long
10166 Warn if @code{long long} type is used.  This is enabled by either
10167 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
10168 modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
10170 This warning is upgraded to an error by @option{-pedantic-errors}.
10172 @opindex Wvariadic-macros
10173 @opindex Wno-variadic-macros
10174 @item -Wvariadic-macros
10175 Warn if variadic macros are used in ISO C90 mode, or if the GNU
10176 alternate syntax is used in ISO C99 mode.  This is enabled by either
10177 @option{-Wpedantic} or @option{-Wtraditional}.  To inhibit the warning
10178 messages, use @option{-Wno-variadic-macros}.
10180 @opindex Wvarargs
10181 @opindex Wno-varargs
10182 @item -Wno-varargs
10183 Do not warn upon questionable usage of the macros used to handle variable
10184 arguments like @code{va_start}.  These warnings are enabled by default.
10186 @opindex Wvector-operation-performance
10187 @opindex Wno-vector-operation-performance
10188 @item -Wvector-operation-performance
10189 Warn if vector operation is not implemented via SIMD capabilities of the
10190 architecture.  Mainly useful for the performance tuning.
10191 Vector operation can be implemented @code{piecewise}, which means that the
10192 scalar operation is performed on every vector element; 
10193 @code{in parallel}, which means that the vector operation is implemented
10194 using scalars of wider type, which normally is more performance efficient;
10195 and @code{as a single scalar}, which means that vector fits into a
10196 scalar type.
10198 @opindex Wvla
10199 @opindex Wno-vla
10200 @item -Wvla
10201 Warn if a variable-length array is used in the code.
10202 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
10203 the variable-length array.
10205 This warning is upgraded to an error by @option{-pedantic-errors}.
10207 @opindex Wvla-larger-than=
10208 @opindex Wno-vla-larger-than
10209 @item -Wvla-larger-than=@var{byte-size}
10210 If this option is used, the compiler warns for declarations of
10211 variable-length arrays whose size is either unbounded, or bounded
10212 by an argument that allows the array size to exceed @var{byte-size}
10213 bytes.  This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
10214 works, but with variable-length arrays.
10216 Note that GCC may optimize small variable-length arrays of a known
10217 value into plain arrays, so this warning may not get triggered for
10218 such arrays.
10220 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
10221 is typically only effective when @option{-ftree-vrp} is active (default
10222 for @option{-O2} and above).
10224 See also @option{-Walloca-larger-than=@var{byte-size}}.
10226 @opindex Wno-vla-larger-than
10227 @item -Wno-vla-larger-than
10228 Disable @option{-Wvla-larger-than=} warnings.  The option is equivalent
10229 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
10231 @opindex Wno-vla-parameter
10232 @item -Wvla-parameter
10233 Warn about redeclarations of functions involving arguments of Variable
10234 Length Array types of inconsistent kinds or forms, and enable the detection
10235 of out-of-bounds accesses to such parameters by warnings such as
10236 @option{-Warray-bounds}.
10238 If the first function declaration uses the VLA form the bound specified
10239 in the array is assumed to be the minimum number of elements expected to
10240 be provided in calls to the function and the maximum number of elements
10241 accessed by it.  Failing to provide arguments of sufficient size or
10242 accessing more than the maximum number of elements may be diagnosed.
10244 For example, the warning triggers for the following redeclarations because
10245 the first one allows an array of any size to be passed to @code{f} while
10246 the second one specifies that the array argument must have at least @code{n}
10247 elements.  In addition, calling @code{f} with the associated VLA bound
10248 parameter in excess of the actual VLA bound triggers a warning as well.
10250 @smallexample
10251 void f (int n, int[n]);
10252 // warning: argument 2 previously declared as a VLA
10253 void f (int, int[]);
10255 void g (int n)
10257     if (n > 4)
10258       return;
10259     int a[n];
10260     // warning: access to a by f may be out of bounds
10261     f (sizeof a, a);
10262   @dots{}
10265 @end smallexample
10267 @option{-Wvla-parameter} is included in @option{-Wall}.  The
10268 @option{-Warray-parameter} option triggers warnings for similar problems
10269 involving ordinary array arguments.
10271 @opindex Wvolatile-register-var
10272 @opindex Wno-volatile-register-var
10273 @item -Wvolatile-register-var
10274 Warn if a register variable is declared volatile.  The volatile
10275 modifier does not inhibit all optimizations that may eliminate reads
10276 and/or writes to register variables.  This warning is enabled by
10277 @option{-Wall}.
10279 @opindex Wxor-used-as-pow
10280 @opindex Wno-xor-used-as-pow
10281 @item -Wxor-used-as-pow @r{(C, C++, Objective-C and Objective-C++ only)}
10282 Warn about uses of @code{^}, the exclusive or operator, where it appears
10283 the user meant exponentiation.  Specifically, the warning occurs when the
10284 left-hand side is the decimal constant 2 or 10 and the right-hand side
10285 is also a decimal constant.
10287 In C and C++, @code{^} means exclusive or, whereas in some other languages
10288 (e.g. TeX and some versions of BASIC) it means exponentiation.
10290 This warning is enabled by default.  It can be silenced by converting one
10291 of the operands to hexadecimal.
10293 @opindex Wdisabled-optimization
10294 @opindex Wno-disabled-optimization
10295 @item -Wdisabled-optimization
10296 Warn if a requested optimization pass is disabled.  This warning does
10297 not generally indicate that there is anything wrong with your code; it
10298 merely indicates that GCC's optimizers are unable to handle the code
10299 effectively.  Often, the problem is that your code is too big or too
10300 complex; GCC refuses to optimize programs when the optimization
10301 itself is likely to take inordinate amounts of time.
10303 @opindex Wpointer-sign
10304 @opindex Wno-pointer-sign
10305 @item -Wpointer-sign @r{(C and Objective-C only)}
10306 Warn for pointer argument passing or assignment with different signedness.
10307 This option is only supported for C and Objective-C@.  It is implied by
10308 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
10309 @option{-Wno-pointer-sign}.
10311 This warning is upgraded to an error by @option{-pedantic-errors}.
10313 @opindex Wstack-protector
10314 @opindex Wno-stack-protector
10315 @item -Wstack-protector
10316 This option is only active when @option{-fstack-protector} is active.  It
10317 warns about functions that are not protected against stack smashing.
10319 @opindex Woverlength-strings
10320 @opindex Wno-overlength-strings
10321 @item -Woverlength-strings
10322 Warn about string constants that are longer than the ``minimum
10323 maximum'' length specified in the C standard.  Modern compilers
10324 generally allow string constants that are much longer than the
10325 standard's minimum limit, but very portable programs should avoid
10326 using longer strings.
10328 The limit applies @emph{after} string constant concatenation, and does
10329 not count the trailing NUL@.  In C90, the limit was 509 characters; in
10330 C99, it was raised to 4095.  C++98 does not specify a normative
10331 minimum maximum, so we do not diagnose overlength strings in C++@.
10333 This option is implied by @option{-Wpedantic}, and can be disabled with
10334 @option{-Wno-overlength-strings}.
10336 @opindex Wunsuffixed-float-constants
10337 @opindex Wno-unsuffixed-float-constants
10338 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
10340 Issue a warning for any floating constant that does not have
10341 a suffix.  When used together with @option{-Wsystem-headers} it
10342 warns about such constants in system header files.  This can be useful
10343 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
10344 from the decimal floating-point extension to C99.
10346 @opindex Wlto-type-mismatch
10347 @opindex Wno-lto-type-mismatch
10348 @item -Wno-lto-type-mismatch
10350 During the link-time optimization, do not warn about type mismatches in
10351 global declarations from different compilation units.
10352 Requires @option{-flto} to be enabled.  Enabled by default.
10354 @opindex Wdesignated-init
10355 @opindex Wno-designated-init
10356 @item -Wno-designated-init @r{(C and Objective-C only)}
10357 Suppress warnings when a positional initializer is used to initialize
10358 a structure that has been marked with the @code{designated_init}
10359 attribute.
10361 @end table
10363 @node Static Analyzer Options
10364 @section Options That Control Static Analysis
10366 @table @gcctabopt
10367 @opindex analyzer
10368 @opindex fanalyzer
10369 @opindex fno-analyzer
10370 @item -fanalyzer
10371 This option enables an static analysis of program flow which looks
10372 for ``interesting'' interprocedural paths through the
10373 code, and issues warnings for problems found on them.
10375 This analysis is much more expensive than other GCC warnings.
10377 In technical terms, it performs coverage-guided symbolic execution of
10378 the code being compiled.  It is neither sound nor complete: it can
10379 have false positives and false negatives.  It is a bug-finding tool,
10380 rather than a tool for proving program correctness.
10382 The analyzer is only suitable for use on C code in this release.
10384 Enabling this option effectively enables the following warnings:
10386 @gccoptlist{
10387 -Wanalyzer-allocation-size
10388 -Wanalyzer-deref-before-check
10389 -Wanalyzer-double-fclose
10390 -Wanalyzer-double-free
10391 -Wanalyzer-exposure-through-output-file
10392 -Wanalyzer-exposure-through-uninit-copy
10393 -Wanalyzer-fd-access-mode-mismatch
10394 -Wanalyzer-fd-double-close
10395 -Wanalyzer-fd-leak
10396 -Wanalyzer-fd-phase-mismatch
10397 -Wanalyzer-fd-type-mismatch
10398 -Wanalyzer-fd-use-after-close
10399 -Wanalyzer-fd-use-without-check
10400 -Wanalyzer-file-leak
10401 -Wanalyzer-free-of-non-heap
10402 -Wanalyzer-imprecise-fp-arithmetic
10403 -Wanalyzer-infinite-recursion
10404 -Wanalyzer-jump-through-null
10405 -Wanalyzer-malloc-leak
10406 -Wanalyzer-mismatching-deallocation
10407 -Wanalyzer-null-argument
10408 -Wanalyzer-null-dereference
10409 -Wanalyzer-out-of-bounds
10410 -Wanalyzer-overlapping-buffers
10411 -Wanalyzer-possible-null-argument
10412 -Wanalyzer-possible-null-dereference
10413 -Wanalyzer-putenv-of-auto-var
10414 -Wanalyzer-shift-count-negative
10415 -Wanalyzer-shift-count-overflow
10416 -Wanalyzer-stale-setjmp-buffer
10417 -Wanalyzer-unsafe-call-within-signal-handler
10418 -Wanalyzer-use-after-free
10419 -Wanalyzer-use-of-pointer-in-stale-stack-frame
10420 -Wanalyzer-use-of-uninitialized-value
10421 -Wanalyzer-va-arg-type-mismatch
10422 -Wanalyzer-va-list-exhausted
10423 -Wanalyzer-va-list-leak
10424 -Wanalyzer-va-list-use-after-va-end
10425 -Wanalyzer-write-to-const
10426 -Wanalyzer-write-to-string-literal
10428 @ignore
10429 -Wanalyzer-tainted-allocation-size
10430 -Wanalyzer-tainted-array-index
10431 -Wanalyzer-tainted-divisor
10432 -Wanalyzer-tainted-offset
10433 -Wanalyzer-tainted-size
10434 @end ignore
10436 This option is only available if GCC was configured with analyzer
10437 support enabled.
10439 @opindex Wanalyzer-too-complex
10440 @opindex Wno-analyzer-too-complex
10441 @item -Wanalyzer-too-complex
10442 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
10443 to attempt to explore the control flow and data flow in the program,
10444 but these can be defeated by sufficiently complicated code.
10446 By default, the analysis silently stops if the code is too
10447 complicated for the analyzer to fully explore and it reaches an internal
10448 limit.  The @option{-Wanalyzer-too-complex} option warns if this occurs.
10450 @opindex Wanalyzer-allocation-size
10451 @opindex Wno-analyzer-allocation-size
10452 @item -Wno-analyzer-allocation-size
10453 This warning requires @option{-fanalyzer}, which enables it;
10454 to disable it, use @option{-Wno-analyzer-allocation-size}.
10456 This diagnostic warns for paths through the code in which a pointer to
10457 a buffer is assigned to point at a buffer with a size that is not a
10458 multiple of @code{sizeof (*pointer)}.
10460 See @uref{https://cwe.mitre.org/data/definitions/131.html, CWE-131: Incorrect Calculation of Buffer Size}.
10462 @opindex Wanalyzer-deref-before-check
10463 @opindex Wno-analyzer-deref-before-check
10464 @item -Wno-analyzer-deref-before-check
10465 This warning requires @option{-fanalyzer}, which enables it; use
10466 @option{-Wno-analyzer-deref-before-check}
10467 to disable it.
10469 This diagnostic warns for paths through the code in which a pointer
10470 is checked for @code{NULL} *after* it has already been
10471 dereferenced, suggesting that the pointer could have been NULL.
10472 Such cases suggest that the check for NULL is either redundant,
10473 or that it needs to be moved to before the pointer is dereferenced.
10475 This diagnostic also considers values passed to a function argument
10476 marked with @code{__attribute__((nonnull))} as requiring a non-NULL
10477 value, and thus will complain if such values are checked for @code{NULL}
10478 after returning from such a function call.
10480 This diagnostic is unlikely to be reported when any level of optimization
10481 is enabled, as GCC's optimization logic will typically consider such
10482 checks for NULL as being redundant, and optimize them away before the
10483 analyzer "sees" them.  Hence optimization should be disabled when
10484 attempting to trigger this diagnostic.
10486 @opindex Wanalyzer-double-fclose
10487 @opindex Wno-analyzer-double-fclose
10488 @item -Wno-analyzer-double-fclose
10489 This warning requires @option{-fanalyzer}, which enables it; use
10490 @option{-Wno-analyzer-double-fclose} to disable it.
10492 This diagnostic warns for paths through the code in which a @code{FILE *}
10493 can have @code{fclose} called on it more than once.
10495 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10497 @opindex Wanalyzer-double-free
10498 @opindex Wno-analyzer-double-free
10499 @item -Wno-analyzer-double-free
10500 This warning requires @option{-fanalyzer}, which enables it; use
10501 @option{-Wno-analyzer-double-free} to disable it.
10503 This diagnostic warns for paths through the code in which a pointer
10504 can have a deallocator called on it more than once, either @code{free},
10505 or a deallocator referenced by attribute @code{malloc}.
10507 See @uref{https://cwe.mitre.org/data/definitions/415.html, CWE-415: Double Free}.
10509 @opindex Wanalyzer-exposure-through-output-file
10510 @opindex Wno-analyzer-exposure-through-output-file
10511 @item -Wno-analyzer-exposure-through-output-file
10512 This warning requires @option{-fanalyzer}, which enables it; use
10513 @option{-Wno-analyzer-exposure-through-output-file}
10514 to disable it.
10516 This diagnostic warns for paths through the code in which a
10517 security-sensitive value is written to an output file
10518 (such as writing a password to a log file).
10520 See @uref{https://cwe.mitre.org/data/definitions/532.html, CWE-532: Information Exposure Through Log Files}.
10522 @opindex Wanalyzer-exposure-through-uninit-copy
10523 @opindex Wno-analyzer-exposure-through-uninit-copy
10524 @item -Wanalyzer-exposure-through-uninit-copy
10525 This warning requires both @option{-fanalyzer} and the use of a plugin
10526 to specify a function that copies across a ``trust boundary''.  Use
10527 @option{-Wno-analyzer-exposure-through-uninit-copy} to disable it.
10529 This diagnostic warns for ``infoleaks'' - paths through the code in which
10530 uninitialized values are copied across a security boundary
10531 (such as code within an OS kernel that copies a partially-initialized
10532 struct on the stack to user space).
10534 See @uref{https://cwe.mitre.org/data/definitions/200.html, CWE-200: Exposure of Sensitive Information to an Unauthorized Actor}.
10536 @opindex Wanalyzer-fd-access-mode-mismatch
10537 @opindex Wno-analyzer-fd-access-mode-mismatch
10538 @item -Wno-analyzer-fd-access-mode-mismatch
10539 This warning requires @option{-fanalyzer}, which enables it; use
10540 @option{-Wno-analyzer-fd-access-mode-mismatch}
10541 to disable it.
10543 This diagnostic warns for paths through code in which a
10544 @code{read} on a write-only file descriptor is attempted, or vice versa.
10546 This diagnostic also warns for code paths in a which a function with attribute
10547 @code{fd_arg_read (N)} is called with a file descriptor opened with
10548 @code{O_WRONLY} at referenced argument @code{N} or a function with attribute
10549 @code{fd_arg_write (N)} is called with a file descriptor opened with
10550 @code{O_RDONLY} at referenced argument @var{N}.
10552 @opindex Wanalyzer-fd-double-close
10553 @opindex Wno-analyzer-fd-double-close
10554 @item -Wno-analyzer-fd-double-close
10555 This warning requires @option{-fanalyzer}, which enables it; use
10556 @option{-Wno-analyzer-fd-double-close}
10557 to disable it.
10559 This diagnostic warns for paths through code in which a
10560 file descriptor can be closed more than once.
10562 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10564 @opindex Wanalyzer-fd-leak
10565 @opindex Wno-analyzer-fd-leak
10566 @item -Wno-analyzer-fd-leak
10567 This warning requires @option{-fanalyzer}, which enables it; use
10568 @option{-Wno-analyzer-fd-leak}
10569 to disable it.
10571 This diagnostic warns for paths through code in which an
10572 open file descriptor is leaked.
10574 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10576 @opindex Wanalyzer-fd-phase-mismatch
10577 @opindex Wno-analyzer-fd-phase-mismatch
10578 @item -Wno-analyzer-fd-phase-mismatch
10579 This warning requires @option{-fanalyzer}, which enables it; use
10580 @option{-Wno-analyzer-fd-phase-mismatch}
10581 to disable it.
10583 This diagnostic warns for paths through code in which an operation is
10584 attempted in the wrong phase of a file descriptor's lifetime.
10585 For example, it will warn on attempts to call @code{accept} on a stream
10586 socket that has not yet had @code{listen} successfully called on it.
10588 See @uref{https://cwe.mitre.org/data/definitions/666.html, CWE-666: Operation on Resource in Wrong Phase of Lifetime}.
10590 @opindex Wanalyzer-fd-type-mismatch
10591 @opindex Wno-analyzer-fd-type-mismatch
10592 @item -Wno-analyzer-fd-type-mismatch
10593 This warning requires @option{-fanalyzer}, which enables it; use
10594 @option{-Wno-analyzer-fd-type-mismatch}
10595 to disable it.
10597 This diagnostic warns for paths through code in which an
10598 operation is attempted on the wrong type of file descriptor.
10599 For example, it will warn on attempts to use socket operations
10600 on a file descriptor obtained via @code{open}, or when attempting
10601 to use a stream socket operation on a datagram socket.
10603 @opindex Wanalyzer-fd-use-after-close
10604 @opindex Wno-analyzer-fd-use-after-close
10605 @item -Wno-analyzer-fd-use-after-close
10606 This warning requires @option{-fanalyzer}, which enables it; use
10607 @option{-Wno-analyzer-fd-use-after-close}
10608 to disable it.
10610 This diagnostic warns for paths through code in which a
10611 read or write is called on a closed file descriptor.
10613 This diagnostic also warns for paths through code in which
10614 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10615 or @code{fd_arg_write (N)} is called with a closed file descriptor at
10616 referenced argument @code{N}.
10618 @opindex Wanalyzer-fd-use-without-check
10619 @opindex Wno-analyzer-fd-use-without-check
10620 @item -Wno-analyzer-fd-use-without-check
10621 This warning requires @option{-fanalyzer}, which enables it; use
10622 @option{-Wno-analyzer-fd-use-without-check}
10623 to disable it.
10625 This diagnostic warns for paths through code in which a
10626 file descriptor is used without being checked for validity.
10628 This diagnostic also warns for paths through code in which
10629 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10630 or @code{fd_arg_write (N)} is called with a file descriptor, at referenced
10631 argument @code{N}, without being checked for validity.
10633 @opindex Wanalyzer-file-leak
10634 @opindex Wno-analyzer-file-leak
10635 @item -Wno-analyzer-file-leak
10636 This warning requires @option{-fanalyzer}, which enables it; use
10637 @option{-Wno-analyzer-file-leak}
10638 to disable it.
10640 This diagnostic warns for paths through the code in which a
10641 @code{<stdio.h>} @code{FILE *} stream object is leaked.
10643 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10645 @opindex Wanalyzer-free-of-non-heap
10646 @opindex Wno-analyzer-free-of-non-heap
10647 @item -Wno-analyzer-free-of-non-heap
10648 This warning requires @option{-fanalyzer}, which enables it; use
10649 @option{-Wno-analyzer-free-of-non-heap}
10650 to disable it.
10652 This diagnostic warns for paths through the code in which @code{free}
10653 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
10655 See @uref{https://cwe.mitre.org/data/definitions/590.html, CWE-590: Free of Memory not on the Heap}.
10657 @opindex Wanalyzer-imprecise-fp-arithmetic
10658 @opindex Wno-analyzer-imprecise-fp-arithmetic
10659 @item -Wno-analyzer-imprecise-fp-arithmetic
10660 This warning requires @option{-fanalyzer}, which enables it; use
10661 @option{-Wno-analyzer-imprecise-fp-arithmetic}
10662 to disable it.
10664 This diagnostic warns for paths through the code in which floating-point
10665 arithmetic is used in locations where precise computation is needed.  This
10666 diagnostic only warns on use of floating-point operands inside the
10667 calculation of an allocation size at the moment.
10669 @opindex Wanalyzer-infinite-recursion
10670 @opindex Wno-analyzer-infinite-recursion
10671 @item -Wno-analyzer-infinite-recursion
10672 This warning requires @option{-fanalyzer}, which enables it; use
10673 @option{-Wno-analyzer-infinite-recursion} to disable it.
10675 This diagnostics warns for paths through the code which appear to
10676 lead to infinite recursion.
10678 Specifically, when the analyzer "sees" a recursive call, it will compare
10679 the state of memory at the entry to the new frame with that at the entry
10680 to the previous frame of that function on the stack.  The warning is
10681 issued if nothing in memory appears to be changing; any changes observed
10682 to parameters or globals are assumed to lead to termination of the
10683 recursion and thus suppress the warning.
10685 This diagnostic is likely to miss cases of infinite recursion that
10686 are convered to iteration by the optimizer before the analyzer "sees"
10687 them.  Hence optimization should be disabled when attempting to trigger
10688 this diagnostic.
10690 Compare with @option{-Winfinite-recursion}, which provides a similar
10691 diagnostic, but is implemented in a different way.
10693 @opindex Wanalyzer-jump-through-null
10694 @opindex Wno-analyzer-jump-through-null
10695 @item -Wno-analyzer-jump-through-null
10696 This warning requires @option{-fanalyzer}, which enables it; use
10697 @option{-Wno-analyzer-jump-through-null}
10698 to disable it.
10700 This diagnostic warns for paths through the code in which a @code{NULL}
10701 function pointer is called.
10703 @opindex Wanalyzer-malloc-leak
10704 @opindex Wno-analyzer-malloc-leak
10705 @item -Wno-analyzer-malloc-leak
10706 This warning requires @option{-fanalyzer}, which enables it; use
10707 @option{-Wno-analyzer-malloc-leak}
10708 to disable it.
10710 This diagnostic warns for paths through the code in which a
10711 pointer allocated via an allocator is leaked: either @code{malloc},
10712 or a function marked with attribute @code{malloc}.
10714 See @uref{https://cwe.mitre.org/data/definitions/401.html, CWE-401: Missing Release of Memory after Effective Lifetime}.
10716 @opindex Wanalyzer-mismatching-deallocation
10717 @opindex Wno-analyzer-mismatching-deallocation
10718 @item -Wno-analyzer-mismatching-deallocation
10719 This warning requires @option{-fanalyzer}, which enables it; use
10720 @option{-Wno-analyzer-mismatching-deallocation}
10721 to disable it.
10723 This diagnostic warns for paths through the code in which the
10724 wrong deallocation function is called on a pointer value, based on
10725 which function was used to allocate the pointer value.  The diagnostic
10726 will warn about mismatches between @code{free}, scalar @code{delete}
10727 and vector @code{delete[]}, and those marked as allocator/deallocator
10728 pairs using attribute @code{malloc}.
10730 See @uref{https://cwe.mitre.org/data/definitions/762.html, CWE-762: Mismatched Memory Management Routines}.
10732 @opindex Wanalyzer-out-of-bounds
10733 @opindex Wno-analyzer-out-of-bounds
10734 @item -Wno-analyzer-out-of-bounds
10735 This warning requires @option{-fanalyzer}, which enables it; use
10736 @option{-Wno-analyzer-out-of-bounds} to disable it.
10738 This diagnostic warns for paths through the code in which a buffer is
10739 definitely read or written out-of-bounds.  The diagnostic applies for
10740 cases where the analyzer is able to determine a constant offset and for
10741 accesses past the end of a buffer, also a constant capacity.  Further,
10742 the diagnostic does limited checking for accesses past the end when the
10743 offset as well as the capacity is symbolic.
10745 See @uref{https://cwe.mitre.org/data/definitions/119.html, CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer}.
10747 For cases where the analyzer is able, it will emit a text art diagram
10748 visualizing the spatial relationship between the memory region that the
10749 analyzer predicts would be accessed, versus the range of memory that is
10750 valid to access: whether they overlap, are touching, are close or far
10751 apart; which one is before or after in memory, the relative sizes
10752 involved, the direction of the access (read vs write), and, in some
10753 cases, the values of data involved.  This diagram can be suppressed
10754 using @option{-fdiagnostics-text-art-charset=none}.
10756 @opindex Wanalyzer-overlapping-buffers
10757 @opindex Wno-analyzer-overlapping-buffers
10758 @item -Wno-analyzer-overlapping-buffers
10759 This warning requires @option{-fanalyzer}, which enables it; use
10760 @option{-Wno-analyzer-overlapping-buffers} to disable it.
10762 This diagnostic warns for paths through the code in which overlapping
10763 buffers are passed to an API for which the behavior on such buffers
10764 is undefined.
10766 Specifically, the diagnostic occurs on calls to the following functions
10767 @itemize @bullet
10768 @item @code{memcpy}
10769 @item @code{strcat}
10770 @item @code{strcpy}
10771 @end itemize
10772 for cases where the buffers are known to overlap.
10774 @opindex Wanalyzer-possible-null-argument
10775 @opindex Wno-analyzer-possible-null-argument
10776 @item -Wno-analyzer-possible-null-argument
10777 This warning requires @option{-fanalyzer}, which enables it; use
10778 @option{-Wno-analyzer-possible-null-argument} to disable it.
10780 This diagnostic warns for paths through the code in which a
10781 possibly-NULL value is passed to a function argument marked
10782 with @code{__attribute__((nonnull))} as requiring a non-NULL
10783 value.
10785 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10787 @opindex Wanalyzer-possible-null-dereference
10788 @opindex Wno-analyzer-possible-null-dereference
10789 @item -Wno-analyzer-possible-null-dereference
10790 This warning requires @option{-fanalyzer}, which enables it; use
10791 @option{-Wno-analyzer-possible-null-dereference} to disable it.
10793 This diagnostic warns for paths through the code in which a
10794 possibly-NULL value is dereferenced.
10796 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10798 @opindex Wanalyzer-null-argument
10799 @opindex Wno-analyzer-null-argument
10800 @item -Wno-analyzer-null-argument
10801 This warning requires @option{-fanalyzer}, which enables it; use
10802 @option{-Wno-analyzer-null-argument} to disable it.
10804 This diagnostic warns for paths through the code in which a
10805 value known to be NULL is passed to a function argument marked
10806 with @code{__attribute__((nonnull))} as requiring a non-NULL
10807 value.
10809 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10811 @opindex Wanalyzer-null-dereference
10812 @opindex Wno-analyzer-null-dereference
10813 @item -Wno-analyzer-null-dereference
10814 This warning requires @option{-fanalyzer}, which enables it; use
10815 @option{-Wno-analyzer-null-dereference} to disable it.
10817 This diagnostic warns for paths through the code in which a
10818 value known to be NULL is dereferenced.
10820 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10822 @opindex Wanalyzer-putenv-of-auto-var
10823 @opindex Wno-analyzer-putenv-of-auto-var
10824 @item -Wno-analyzer-putenv-of-auto-var
10825 This warning requires @option{-fanalyzer}, which enables it; use
10826 @option{-Wno-analyzer-putenv-of-auto-var} to disable it.
10828 This diagnostic warns for paths through the code in which a
10829 call to @code{putenv} is passed a pointer to an automatic variable
10830 or an on-stack buffer.
10832 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}.
10834 @opindex Wanalyzer-shift-count-negative
10835 @opindex Wno-analyzer-shift-count-negative
10836 @item -Wno-analyzer-shift-count-negative
10837 This warning requires @option{-fanalyzer}, which enables it; use
10838 @option{-Wno-analyzer-shift-count-negative} to disable it.
10840 This diagnostic warns for paths through the code in which a
10841 shift is attempted with a negative count.  It is analogous to
10842 the @option{-Wshift-count-negative} diagnostic implemented in
10843 the C/C++ front ends, but is implemented based on analyzing
10844 interprocedural paths, rather than merely parsing the syntax tree.
10845 However, the analyzer does not prioritize detection of such paths, so
10846 false negatives are more likely relative to other warnings.
10848 @opindex Wanalyzer-shift-count-overflow
10849 @opindex Wno-analyzer-shift-count-overflow
10850 @item -Wno-analyzer-shift-count-overflow
10851 This warning requires @option{-fanalyzer}, which enables it; use
10852 @option{-Wno-analyzer-shift-count-overflow} to disable it.
10854 This diagnostic warns for paths through the code in which a
10855 shift is attempted with a count greater than or equal to the
10856 precision of the operand's type.  It is analogous to
10857 the @option{-Wshift-count-overflow} diagnostic implemented in
10858 the C/C++ front ends, but is implemented based on analyzing
10859 interprocedural paths, rather than merely parsing the syntax tree.
10860 However, the analyzer does not prioritize detection of such paths, so
10861 false negatives are more likely relative to other warnings.
10863 @opindex Wanalyzer-stale-setjmp-buffer
10864 @opindex Wno-analyzer-stale-setjmp-buffer
10865 @item -Wno-analyzer-stale-setjmp-buffer
10866 This warning requires @option{-fanalyzer}, which enables it; use
10867 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
10869 This diagnostic warns for paths through the code in which
10870 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
10871 to a @code{setjmp} call in a function that has returned.
10873 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
10874 location, it records the stack frame.  The stack frame becomes invalid
10875 when the function containing the @code{setjmp} call returns.  Attempting
10876 to rewind to it via @code{longjmp} would reference a stack frame that
10877 no longer exists, and likely lead to a crash (or worse).
10879 @opindex Wanalyzer-tainted-allocation-size
10880 @opindex Wno-analyzer-tainted-allocation-size
10881 @item -Wno-analyzer-tainted-allocation-size
10882 This warning requires both @option{-fanalyzer} and
10883 @option{-fanalyzer-checker=taint} to enable it;
10884 use @option{-Wno-analyzer-tainted-allocation-size} to disable it.
10886 This diagnostic warns for paths through the code in which a value
10887 that could be under an attacker's control is used as the size
10888 of an allocation without being sanitized, so that an attacker could
10889 inject an excessively large allocation and potentially cause a denial
10890 of service attack.
10892 See @uref{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}.
10894 @opindex Wanalyzer-tainted-assertion
10895 @opindex Wno-analyzer-tainted-assertion
10896 @item -Wno-analyzer-tainted-assertion
10898 This warning requires both @option{-fanalyzer} and
10899 @option{-fanalyzer-checker=taint} to enable it;
10900 use @option{-Wno-analyzer-tainted-assertion} to disable it.
10902 This diagnostic warns for paths through the code in which a value
10903 that could be under an attacker's control is used as part of a
10904 condition without being first sanitized, and that condition guards a
10905 call to a function marked with attribute @code{noreturn}
10906 (such as the function @code{__builtin_unreachable}).  Such functions
10907 typically indicate abnormal termination of the program, such as for
10908 assertion failure handlers.  For example:
10910 @smallexample
10911 assert (some_tainted_value < SOME_LIMIT);
10912 @end smallexample
10914 In such cases:
10916 @itemize
10917 @item
10918 when assertion-checking is enabled: an attacker could trigger
10919 a denial of service by injecting an assertion failure
10921 @item
10922 when assertion-checking is disabled, such as by defining @code{NDEBUG},
10923 an attacker could inject data that subverts the process, since it
10924 presumably violates a precondition that is being assumed by the code.
10926 @end itemize
10928 Note that when assertion-checking is disabled, the assertions are
10929 typically removed by the preprocessor before the analyzer has a chance
10930 to "see" them, so this diagnostic can only generate warnings on builds
10931 in which assertion-checking is enabled.
10933 For the purpose of this warning, any function marked with attribute
10934 @code{noreturn} is considered as a possible assertion failure
10935 handler, including @code{__builtin_unreachable}.  Note that these functions
10936 are sometimes removed by the optimizer before the analyzer "sees" them.
10937 Hence optimization should be disabled when attempting to trigger this
10938 diagnostic.
10940 See @uref{https://cwe.mitre.org/data/definitions/617.html, CWE-617: Reachable Assertion}.
10942 The warning can also report problematic constructions such as
10944 @smallexample
10945 switch (some_tainted_value) @{
10946 case 0:
10947   /* [...etc; various valid cases omitted...] */
10948   break;
10950 default:
10951   __builtin_unreachable (); /* BUG: attacker can trigger this  */
10953 @end smallexample
10955 despite the above not being an assertion failure, strictly speaking.
10957 @opindex Wanalyzer-tainted-array-index
10958 @opindex Wno-analyzer-tainted-array-index
10959 @item -Wno-analyzer-tainted-array-index
10960 This warning requires both @option{-fanalyzer} and
10961 @option{-fanalyzer-checker=taint} to enable it;
10962 use @option{-Wno-analyzer-tainted-array-index} to disable it.
10964 This diagnostic warns for paths through the code in which a value
10965 that could be under an attacker's control is used as the index
10966 of an array access without being sanitized, so that an attacker
10967 could inject an out-of-bounds access.
10969 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
10971 @opindex Wanalyzer-tainted-divisor
10972 @opindex Wno-analyzer-tainted-divisor
10973 @item -Wno-analyzer-tainted-divisor
10974 This warning requires both @option{-fanalyzer} and
10975 @option{-fanalyzer-checker=taint} to enable it;
10976 use @option{-Wno-analyzer-tainted-divisor} to disable it.
10978 This diagnostic warns for paths through the code in which a value
10979 that could be under an attacker's control is used as the divisor
10980 in a division or modulus operation without being sanitized, so that
10981 an attacker could inject a division-by-zero.
10983 See @uref{https://cwe.mitre.org/data/definitions/369.html, CWE-369: Divide By Zero}.
10985 @opindex Wanalyzer-tainted-offset
10986 @opindex Wno-analyzer-tainted-offset
10987 @item -Wno-analyzer-tainted-offset
10988 This warning requires both @option{-fanalyzer} and
10989 @option{-fanalyzer-checker=taint} to enable it;
10990 use @option{-Wno-analyzer-tainted-offset} to disable it.
10992 This diagnostic warns for paths through the code in which a value
10993 that could be under an attacker's control is used as a pointer offset
10994 without being sanitized, so that an attacker could inject an out-of-bounds
10995 access.
10997 See @uref{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}.
10999 @opindex Wanalyzer-tainted-size
11000 @opindex Wno-analyzer-tainted-size
11001 @item -Wno-analyzer-tainted-size
11002 This warning requires both @option{-fanalyzer} and
11003 @option{-fanalyzer-checker=taint} to enable it;
11004 use @option{-Wno-analyzer-tainted-size} to disable it.
11006 This diagnostic warns for paths through the code in which a value
11007 that could be under an attacker's control is used as the size of
11008 an operation such as @code{memset} without being sanitized, so that an
11009 attacker could inject an out-of-bounds access.
11011 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
11013 @opindex Wanalyzer-unsafe-call-within-signal-handler
11014 @opindex Wno-analyzer-unsafe-call-within-signal-handler
11015 @item -Wno-analyzer-unsafe-call-within-signal-handler
11016 This warning requires @option{-fanalyzer}, which enables it; use
11017 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
11019 This diagnostic warns for paths through the code in which a
11020 function known to be async-signal-unsafe (such as @code{fprintf}) is
11021 called from a signal handler.
11023 See @uref{https://cwe.mitre.org/data/definitions/479.html, CWE-479: Signal Handler Use of a Non-reentrant Function}.
11025 @opindex Wanalyzer-use-after-free
11026 @opindex Wno-analyzer-use-after-free
11027 @item -Wno-analyzer-use-after-free
11028 This warning requires @option{-fanalyzer}, which enables it; use
11029 @option{-Wno-analyzer-use-after-free} to disable it.
11031 This diagnostic warns for paths through the code in which a
11032 pointer is used after a deallocator is called on it: either @code{free},
11033 or a deallocator referenced by attribute @code{malloc}.
11035 See @uref{https://cwe.mitre.org/data/definitions/416.html, CWE-416: Use After Free}.
11037 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
11038 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
11039 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
11040 This warning requires @option{-fanalyzer}, which enables it; use
11041 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
11042 to disable it.
11044 This diagnostic warns for paths through the code in which a pointer
11045 is dereferenced that points to a variable in a stale stack frame.
11047 @opindex Wanalyzer-va-arg-type-mismatch
11048 @opindex Wno-analyzer-va-arg-type-mismatch
11049 @item -Wno-analyzer-va-arg-type-mismatch
11050 This warning requires @option{-fanalyzer}, which enables it; use
11051 @option{-Wno-analyzer-va-arg-type-mismatch}
11052 to disable it.
11054 This diagnostic warns for interprocedural paths through the code for which
11055 the analyzer detects an attempt to use @code{va_arg} to extract a value
11056 passed to a variadic call, but uses a type that does not match that of
11057 the expression passed to the call.
11059 See @uref{https://cwe.mitre.org/data/definitions/686.html, CWE-686: Function Call With Incorrect Argument Type}.
11061 @opindex Wanalyzer-va-list-exhausted
11062 @opindex Wno-analyzer-va-list-exhausted
11063 @item -Wno-analyzer-va-list-exhausted
11064 This warning requires @option{-fanalyzer}, which enables it; use
11065 @option{-Wno-analyzer-va-list-exhausted}
11066 to disable it.
11068 This diagnostic warns for interprocedural paths through the code for which
11069 the analyzer detects an attempt to use @code{va_arg} to access the next
11070 value passed to a variadic call, but all of the values in the
11071 @code{va_list} have already been consumed.
11073 See @uref{https://cwe.mitre.org/data/definitions/685.html, CWE-685: Function Call With Incorrect Number of Arguments}.
11075 @opindex Wanalyzer-va-list-leak
11076 @opindex Wno-analyzer-va-list-leak
11077 @item -Wno-analyzer-va-list-leak
11078 This warning requires @option{-fanalyzer}, which enables it; use
11079 @option{-Wno-analyzer-va-list-leak}
11080 to disable it.
11082 This diagnostic warns for interprocedural paths through the code for which
11083 the analyzer detects that @code{va_start} or @code{va_copy} has been called
11084 on a @code{va_list} without a corresponding call to @code{va_end}.
11086 @opindex Wanalyzer-va-list-use-after-va-end
11087 @opindex Wno-analyzer-va-list-use-after-va-end
11088 @item -Wno-analyzer-va-list-use-after-va-end
11089 This warning requires @option{-fanalyzer}, which enables it; use
11090 @option{-Wno-analyzer-va-list-use-after-va-end}
11091 to disable it.
11093 This diagnostic warns for interprocedural paths through the code for which
11094 the analyzer detects an attempt to use a @code{va_list}  after
11095 @code{va_end} has been called on it.
11096 @code{va_list}.
11098 @opindex Wanalyzer-write-to-const
11099 @opindex Wno-analyzer-write-to-const
11100 @item -Wno-analyzer-write-to-const
11101 This warning requires @option{-fanalyzer}, which enables it; use
11102 @option{-Wno-analyzer-write-to-const}
11103 to disable it.
11105 This diagnostic warns for paths through the code in which the analyzer
11106 detects an attempt to write through a pointer to a @code{const} object.
11107 However, the analyzer does not prioritize detection of such paths, so
11108 false negatives are more likely relative to other warnings.
11110 @opindex Wanalyzer-write-to-string-literal
11111 @opindex Wno-analyzer-write-to-string-literal
11112 @item -Wno-analyzer-write-to-string-literal
11113 This warning requires @option{-fanalyzer}, which enables it; use
11114 @option{-Wno-analyzer-write-to-string-literal}
11115 to disable it.
11117 This diagnostic warns for paths through the code in which the analyzer
11118 detects an attempt to write through a pointer to a string literal.
11119 However, the analyzer does not prioritize detection of such paths, so
11120 false negatives are more likely relative to other warnings.
11122 @opindex Wanalyzer-use-of-uninitialized-value
11123 @opindex Wno-analyzer-use-of-uninitialized-value
11124 @item -Wno-analyzer-use-of-uninitialized-value
11125 This warning requires @option{-fanalyzer}, which enables it; use
11126 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
11128 This diagnostic warns for paths through the code in which an uninitialized
11129 value is used.
11131 See @uref{https://cwe.mitre.org/data/definitions/457.html, CWE-457: Use of Uninitialized Variable}.
11133 @end table
11135 The analyzer has hardcoded knowledge about the behavior of the following
11136 memory-management functions:
11138 @itemize @bullet
11139 @item @code{alloca}
11140 @item The built-in functions @code{__builtin_alloc},
11141 @code{__builtin_alloc_with_align}, @item @code{__builtin_calloc},
11142 @code{__builtin_free}, @code{__builtin_malloc}, @code{__builtin_memcpy},
11143 @code{__builtin_memcpy_chk}, @code{__builtin_memset},
11144 @code{__builtin_memset_chk}, @code{__builtin_realloc},
11145 @code{__builtin_stack_restore}, and @code{__builtin_stack_save}
11146 @item @code{calloc}
11147 @item @code{free}
11148 @item @code{malloc}
11149 @item @code{memset}
11150 @item @code{operator delete}
11151 @item @code{operator delete []}
11152 @item @code{operator new}
11153 @item @code{operator new []}
11154 @item @code{realloc}
11155 @item @code{strdup}
11156 @item @code{strndup}
11157 @end itemize
11159 @noindent
11160 of the following functions for working with file descriptors:
11162 @itemize @bullet
11163 @item @code{open}
11164 @item @code{close}
11165 @item @code{creat}
11166 @item @code{dup}, @code{dup2} and @code{dup3}
11167 @item @code{isatty}
11168 @item @code{pipe}, and @code{pipe2}
11169 @item @code{read}
11170 @item @code{write}
11171 @item @code{socket}, @code{bind}, @code{listen}, @code{accept}, and @code{connect}
11172 @end itemize
11174 @noindent
11175 of the following functions for working with @code{<stdio.h>} streams:
11176 @itemize @bullet
11177 @item The built-in functions @code{__builtin_fprintf},
11178 @code{__builtin_fprintf_unlocked}, @code{__builtin_fputc},
11179 @code{__builtin_fputc_unlocked}, @code{__builtin_fputs},
11180 @code{__builtin_fputs_unlocked}, @code{__builtin_fwrite},
11181 @code{__builtin_fwrite_unlocked}, @code{__builtin_printf},
11182 @code{__builtin_printf_unlocked}, @code{__builtin_putc},
11183 @code{__builtin_putchar}, @code{__builtin_putchar_unlocked},
11184 @code{__builtin_putc_unlocked}, @code{__builtin_puts},
11185 @code{__builtin_puts_unlocked}, @code{__builtin_vfprintf}, and
11186 @code{__builtin_vprintf}
11187 @item @code{fopen}
11188 @item @code{fclose}
11189 @item @code{ferror}
11190 @item @code{fgets}
11191 @item @code{fgets_unlocked}
11192 @item @code{fileno}
11193 @item @code{fread}
11194 @item @code{getc}
11195 @item @code{getchar}
11196 @item @code{fprintf}
11197 @item @code{printf}
11198 @item @code{fwrite}
11199 @end itemize
11201 @noindent
11202 and of the following functions:
11204 @itemize @bullet
11205 @item The built-in functions @code{__builtin_expect},
11206 @code{__builtin_expect_with_probability}, @code{__builtin_strchr},
11207 @code{__builtin_strcpy}, @code{__builtin_strcpy_chk},
11208 @code{__builtin_strlen}, @code{__builtin_va_copy}, and
11209 @code{__builtin_va_start}
11210 @item The GNU extensions @code{error} and @code{error_at_line}
11211 @item @code{getpass}
11212 @item @code{longjmp}
11213 @item @code{putenv}
11214 @item @code{setjmp}
11215 @item @code{siglongjmp}
11216 @item @code{signal}
11217 @item @code{sigsetjmp}
11218 @item @code{strcat}
11219 @item @code{strchr}
11220 @item @code{strlen}
11221 @end itemize
11223 In addition, various functions with an @code{__analyzer_} prefix have
11224 special meaning to the analyzer, described in the GCC Internals manual.
11226 Pertinent parameters for controlling the exploration are:
11227 @itemize @bullet
11228 @item @option{--param analyzer-bb-explosion-factor=@var{value}}
11229 @item @option{--param analyzer-max-enodes-per-program-point=@var{value}}
11230 @item @option{--param analyzer-max-recursion-depth=@var{value}}
11231 @item @option{--param analyzer-min-snodes-for-call-summary=@var{value}}
11232 @end itemize
11234 The following options control the analyzer.
11236 @table @gcctabopt
11238 @opindex fanalyzer-call-summaries
11239 @opindex fno-analyzer-call-summaries
11240 @item -fanalyzer-call-summaries
11241 Simplify interprocedural analysis by computing the effect of certain calls,
11242 rather than exploring all paths through the function from callsite to each
11243 possible return.
11245 If enabled, call summaries are only used for functions with more than one
11246 call site, and that are sufficiently complicated (as per
11247 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
11249 @opindex fanalyzer-checker
11250 @item -fanalyzer-checker=@var{name}
11251 Restrict the analyzer to run just the named checker, and enable it.
11253 Some checkers are disabled by default (even with @option{-fanalyzer}),
11254 such as the @code{taint} checker that implements
11255 @option{-Wanalyzer-tainted-array-index}, and this option is required
11256 to enable them.
11258 @emph{Note:} currently, @option{-fanalyzer-checker=taint} disables the
11259 following warnings from @option{-fanalyzer}:
11261 @gccoptlist{
11262 -Wanalyzer-deref-before-check
11263 -Wanalyzer-double-fclose
11264 -Wanalyzer-double-free
11265 -Wanalyzer-exposure-through-output-file
11266 -Wanalyzer-fd-access-mode-mismatch
11267 -Wanalyzer-fd-double-close
11268 -Wanalyzer-fd-leak
11269 -Wanalyzer-fd-use-after-close
11270 -Wanalyzer-fd-use-without-check
11271 -Wanalyzer-file-leak
11272 -Wanalyzer-free-of-non-heap
11273 -Wanalyzer-malloc-leak
11274 -Wanalyzer-mismatching-deallocation
11275 -Wanalyzer-null-argument
11276 -Wanalyzer-null-dereference
11277 -Wanalyzer-possible-null-argument
11278 -Wanalyzer-possible-null-dereference
11279 -Wanalyzer-unsafe-call-within-signal-handler
11280 -Wanalyzer-use-after-free
11281 -Wanalyzer-va-list-leak
11282 -Wanalyzer-va-list-use-after-va-end
11285 @opindex fanalyzer-debug-text-art
11286 @opindex fno-analyzer-debug-text-art
11287 @item -fanalyzer-debug-text-art-headings
11288 This option is intended for analyzer developers.  If enabled,
11289 the analyzer will add extra annotations to any diagrams it generates.
11291 @opindex fanalyzer-feasibility
11292 @opindex fno-analyzer-feasibility
11293 @item -fno-analyzer-feasibility
11294 This option is intended for analyzer developers.
11296 By default the analyzer verifies that there is a feasible control flow path
11297 for each diagnostic it emits: that the conditions that hold are not mutually
11298 exclusive.  Diagnostics for which no feasible path can be found are rejected.
11299 This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
11300 debugging issues in this code.
11302 @opindex fanalyzer-fine-grained
11303 @opindex fno-analyzer-fine-grained
11304 @item -fanalyzer-fine-grained
11305 This option is intended for analyzer developers.
11307 Internally the analyzer builds an ``exploded graph'' that combines
11308 control flow graphs with data flow information.
11310 By default, an edge in this graph can contain the effects of a run
11311 of multiple statements within a basic block.  With
11312 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
11314 @opindex fanalyzer-show-duplicate-count
11315 @opindex fno-analyzer-show-duplicate-count
11316 @item -fanalyzer-show-duplicate-count
11317 This option is intended for analyzer developers: if multiple diagnostics
11318 have been detected as being duplicates of each other, it emits a note when
11319 reporting the best diagnostic, giving the number of additional diagnostics
11320 that were suppressed by the deduplication logic.
11322 @opindex fanalyzer-show-events-in-system-headers
11323 @opindex fno-analyzer-show-events-in-system-headers
11324 @item -fanalyzer-show-events-in-system-headers
11325 By default the analyzer emits simplified diagnostics paths by hiding
11326 events fully located within a system header.
11327 With @option{-fanalyzer-show-events-in-system-headers} such
11328 events are no longer suppressed.
11330 @opindex fanalyzer-state-merge
11331 @opindex fno-analyzer-state-merge
11332 @item -fno-analyzer-state-merge
11333 This option is intended for analyzer developers.
11335 By default the analyzer attempts to simplify analysis by merging
11336 sufficiently similar states at each program point as it builds its
11337 ``exploded graph''.  With @option{-fno-analyzer-state-merge} this
11338 merging can be suppressed, for debugging state-handling issues.
11340 @opindex fanalyzer-state-purge
11341 @opindex fno-analyzer-state-purge
11342 @item -fno-analyzer-state-purge
11343 This option is intended for analyzer developers.
11345 By default the analyzer attempts to simplify analysis by purging
11346 aspects of state at a program point that appear to no longer be relevant
11347 e.g. the values of locals that aren't accessed later in the function
11348 and which aren't relevant to leak analysis.
11350 With @option{-fno-analyzer-state-purge} this purging of state can
11351 be suppressed, for debugging state-handling issues.
11353 @opindex fanalyzer-suppress-followups
11354 @opindex fno-analyzer-suppress-followups
11355 @item -fno-analyzer-suppress-followups
11356 This option is intended for analyzer developers.
11358 By default the analyzer will stop exploring an execution path after
11359 encountering certain diagnostics, in order to avoid potentially issuing a
11360 cascade of follow-up diagnostics.
11362 The diagnostics that terminate analysis along a path are:
11364 @itemize
11365 @item @option{-Wanalyzer-null-argument}
11366 @item @option{-Wanalyzer-null-dereference}
11367 @item @option{-Wanalyzer-use-after-free}
11368 @item @option{-Wanalyzer-use-of-pointer-in-stale-stack-frame}
11369 @item @option{-Wanalyzer-use-of-uninitialized-value}
11370 @end itemize
11372 With @option{-fno-analyzer-suppress-followups} the analyzer will
11373 continue to explore such paths even after such diagnostics, which may
11374 be helpful for debugging issues in the analyzer, or for microbenchmarks
11375 for detecting undefined behavior.
11377 @opindex fanalyzer-transitivity
11378 @opindex fno-analyzer-transitivity
11379 @item -fanalyzer-transitivity
11380 This option enables transitivity of constraints within the analyzer.
11382 @opindex fanalyzer-undo-inlining
11383 @opindex fno-analyzer-undo-inlining
11384 @item -fno-analyzer-undo-inlining
11385 This option is intended for analyzer developers.
11387 @option{-fanalyzer} runs relatively late compared to other code analysis
11388 tools, and some optimizations have already been applied to the code.  In
11389 particular function inlining may have occurred, leading to the
11390 interprocedural execution paths emitted by the analyzer containing
11391 function frames that don't correspond to those in the original source
11392 code.
11394 By default the analyzer attempts to reconstruct the original function
11395 frames, and to emit events showing the inlined calls.
11397 With @option{-fno-analyzer-undo-inlining} this attempt to reconstruct
11398 the original frame information can be be disabled, which may be of help
11399 when debugging issues in the analyzer.
11401 @item -fanalyzer-verbose-edges
11402 This option is intended for analyzer developers.  It enables more
11403 verbose, lower-level detail in the descriptions of control flow
11404 within diagnostic paths.
11406 @item -fanalyzer-verbose-state-changes
11407 This option is intended for analyzer developers.  It enables more
11408 verbose, lower-level detail in the descriptions of events relating
11409 to state machines within diagnostic paths.
11411 @item -fanalyzer-verbosity=@var{level}
11412 This option controls the complexity of the control flow paths that are
11413 emitted for analyzer diagnostics.
11415 The @var{level} can be one of:
11417 @table @samp
11418 @item 0
11419 At this level, interprocedural call and return events are displayed,
11420 along with the most pertinent state-change events relating to
11421 a diagnostic.  For example, for a double-@code{free} diagnostic,
11422 both calls to @code{free} will be shown.
11424 @item 1
11425 As per the previous level, but also show events for the entry
11426 to each function.
11428 @item 2
11429 As per the previous level, but also show events relating to
11430 control flow that are significant to triggering the issue
11431 (e.g. ``true path taken'' at a conditional).
11433 This level is the default.
11435 @item 3
11436 As per the previous level, but show all control flow events, not
11437 just significant ones.
11439 @item 4
11440 This level is intended for analyzer developers; it adds various
11441 other events intended for debugging the analyzer.
11443 @end table
11445 @opindex fdump-analyzer
11446 @item -fdump-analyzer
11447 Dump internal details about what the analyzer is doing to
11448 @file{@var{file}.analyzer.txt}.
11449 @option{-fdump-analyzer-stderr} overrides this option.
11451 @opindex fdump-analyzer-stderr
11452 @item -fdump-analyzer-stderr
11453 Dump internal details about what the analyzer is doing to stderr.
11454 This option overrides @option{-fdump-analyzer}.
11456 @opindex fdump-analyzer-callgraph
11457 @item -fdump-analyzer-callgraph
11458 Dump a representation of the call graph suitable for viewing with
11459 GraphViz to @file{@var{file}.callgraph.dot}.
11461 @opindex fdump-analyzer-exploded-graph
11462 @item -fdump-analyzer-exploded-graph
11463 Dump a representation of the ``exploded graph'' suitable for viewing with
11464 GraphViz to @file{@var{file}.eg.dot}.
11465 Nodes are color-coded based on state-machine states to emphasize
11466 state changes.
11468 @opindex dump-analyzer-exploded-nodes
11469 @item -fdump-analyzer-exploded-nodes
11470 Emit diagnostics showing where nodes in the ``exploded graph'' are
11471 in relation to the program source.
11473 @opindex dump-analyzer-exploded-nodes-2
11474 @item -fdump-analyzer-exploded-nodes-2
11475 Dump a textual representation of the ``exploded graph'' to
11476 @file{@var{file}.eg.txt}.
11478 @opindex dump-analyzer-exploded-nodes-3
11479 @item -fdump-analyzer-exploded-nodes-3
11480 Dump a textual representation of the ``exploded graph'' to
11481 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
11482 This is typically a large number of dump files.
11484 @opindex fdump-analyzer-exploded-paths
11485 @item -fdump-analyzer-exploded-paths
11486 Dump a textual representation of the ``exploded path'' for each
11487 diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}.
11489 @opindex dump-analyzer-feasibility
11490 @item -fdump-analyzer-feasibility
11491 Dump internal details about the analyzer's search for feasible paths.
11492 The details are written in a form suitable for viewing with GraphViz
11493 to filenames of the form @file{@var{file}.*.fg.dot},
11494 @file{@var{file}.*.tg.dot}, and @file{@var{file}.*.fpath.txt}.
11496 @opindex fdump-analyzer-json
11497 @item -fdump-analyzer-json
11498 Dump a compressed JSON representation of analyzer internals to
11499 @file{@var{file}.analyzer.json.gz}.  The precise format is subject
11500 to change.
11502 @opindex fdump-analyzer-state-purge
11503 @item -fdump-analyzer-state-purge
11504 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
11505 ``supergraph'' suitable for viewing with GraphViz, but annotate the
11506 graph with information on what state will be purged at each node.
11507 The graph is written to @file{@var{file}.state-purge.dot}.
11509 @opindex fdump-analyzer-supergraph
11510 @item -fdump-analyzer-supergraph
11511 Dump representations of the ``supergraph'' suitable for viewing with
11512 GraphViz to @file{@var{file}.supergraph.dot} and to
11513 @file{@var{file}.supergraph-eg.dot}.  These show all of the
11514 control flow graphs in the program, with interprocedural edges for
11515 calls and returns.  The second dump contains annotations showing nodes
11516 in the ``exploded graph'' and diagnostics associated with them.
11518 @opindex fdump-analyzer-untracked
11519 @item -fdump-analyzer-untracked
11520 Emit custom warnings with internal details intended for analyzer developers.
11522 @end table
11524 @node Debugging Options
11525 @section Options for Debugging Your Program
11526 @cindex options, debugging
11527 @cindex debugging information options
11529 To tell GCC to emit extra information for use by a debugger, in almost 
11530 all cases you need only to add @option{-g} to your other options.  Some debug
11531 formats can co-exist (like DWARF with CTF) when each of them is enabled
11532 explicitly by adding the respective command line option to your other options.
11534 GCC allows you to use @option{-g} with
11535 @option{-O}.  The shortcuts taken by optimized code may occasionally
11536 be surprising: some variables you declared may not exist
11537 at all; flow of control may briefly move where you did not expect it;
11538 some statements may not be executed because they compute constant
11539 results or their values are already at hand; some statements may
11540 execute in different places because they have been moved out of loops.
11541 Nevertheless it is possible to debug optimized output.  This makes
11542 it reasonable to use the optimizer for programs that might have bugs.
11544 If you are not using some other optimization option, consider
11545 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.  
11546 With no @option{-O} option at all, some compiler passes that collect
11547 information useful for debugging do not run at all, so that
11548 @option{-Og} may result in a better debugging experience.
11550 @table @gcctabopt
11551 @opindex g
11552 @item -g
11553 Produce debugging information in the operating system's native format
11554 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
11555 information.
11557 On most systems that use stabs format, @option{-g} enables use of extra
11558 debugging information that only GDB can use; this extra information
11559 makes debugging work better in GDB but probably makes other debuggers
11560 crash or refuse to read the program.  If you want to control for certain whether
11561 to generate the extra information, use @option{-gvms} (see below).
11563 @opindex ggdb
11564 @item -ggdb
11565 Produce debugging information for use by GDB@.  This means to use the
11566 most expressive format available (DWARF, stabs, or the native format
11567 if neither of those are supported), including GDB extensions if at all
11568 possible.
11570 @opindex gdwarf
11571 @item -gdwarf
11572 @itemx -gdwarf-@var{version}
11573 Produce debugging information in DWARF format (if that is supported).
11574 The value of @var{version} may be either 2, 3, 4 or 5; the default
11575 version for most targets is 5 (with the exception of VxWorks, TPF and
11576 Darwin / macOS, which default to version 2, and AIX, which defaults
11577 to version 4).
11579 Note that with DWARF Version 2, some ports require and always
11580 use some non-conflicting DWARF 3 extensions in the unwind tables.
11582 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
11583 for maximum benefit. Version 5 requires GDB 8.0 or higher.
11585 GCC no longer supports DWARF Version 1, which is substantially
11586 different than Version 2 and later.  For historical reasons, some
11587 other DWARF-related options such as
11588 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
11589 in their names, but apply to all currently-supported versions of DWARF.
11591 @opindex gbtf
11592 @item -gbtf
11593 Request BTF debug information.  BTF is the default debugging format for the
11594 eBPF target.  On other targets, like x86, BTF debug information can be
11595 generated along with DWARF debug information when both of the debug formats are
11596 enabled explicitly via their respective command line options.
11598 @opindex gctf
11599 @item -gctf
11600 @itemx -gctf@var{level}
11601 Request CTF debug information and use level to specify how much CTF debug
11602 information should be produced.  If @option{-gctf} is specified
11603 without a value for level, the default level of CTF debug information is 2.
11605 CTF debug information can be generated along with DWARF debug information when
11606 both of the debug formats are enabled explicitly via their respective command
11607 line options.
11609 Level 0 produces no CTF debug information at all.  Thus, @option{-gctf0}
11610 negates @option{-gctf}.
11612 Level 1 produces CTF information for tracebacks only.  This includes callsite
11613 information, but does not include type information.
11615 Level 2 produces type information for entities (functions, data objects etc.)
11616 at file-scope or global-scope only.
11618 @opindex gvms
11619 @item -gvms
11620 Produce debugging information in Alpha/VMS debug format (if that is
11621 supported).  This is the format used by DEBUG on Alpha/VMS systems.
11623 @item -gcodeview
11624 @opindex gcodeview
11625 Produce debugging information in CodeView debug format (if that is
11626 supported).  This is the format used by Microsoft Visual C++ on
11627 Windows.
11629 @item -g@var{level}
11630 @itemx -ggdb@var{level}
11631 @itemx -gvms@var{level}
11632 Request debugging information and also use @var{level} to specify how
11633 much information.  The default level is 2.
11635 Level 0 produces no debug information at all.  Thus, @option{-g0} negates
11636 @option{-g}.
11638 Level 1 produces minimal information, enough for making backtraces in
11639 parts of the program that you don't plan to debug.  This includes
11640 descriptions of functions and external variables, and line number
11641 tables, but no information about local variables.
11643 Level 3 includes extra information, such as all the macro definitions
11644 present in the program.  Some debuggers support macro expansion when
11645 you use @option{-g3}.
11647 If you use multiple @option{-g} options, with or without level numbers,
11648 the last such option is the one that is effective.
11650 @option{-gdwarf} does not accept a concatenated debug level, to avoid
11651 confusion with @option{-gdwarf-@var{level}}.
11652 Instead use an additional @option{-g@var{level}} option to change the
11653 debug level for DWARF.
11655 @opindex feliminate-unused-debug-symbols
11656 @opindex fno-eliminate-unused-debug-symbols
11657 @item -fno-eliminate-unused-debug-symbols
11658 By default, no debug information is produced for symbols that are not actually
11659 used. Use this option if you want debug information for all symbols.
11661 @opindex femit-class-debug-always
11662 @item -femit-class-debug-always
11663 Instead of emitting debugging information for a C++ class in only one
11664 object file, emit it in all object files using the class.  This option
11665 should be used only with debuggers that are unable to handle the way GCC
11666 normally emits debugging information for classes because using this
11667 option increases the size of debugging information by as much as a
11668 factor of two.
11670 @opindex fmerge-debug-strings
11671 @opindex fno-merge-debug-strings
11672 @item -fno-merge-debug-strings
11673 Direct the linker to not merge together strings in the debugging
11674 information that are identical in different object files.  Merging is
11675 not supported by all assemblers or linkers.  Merging decreases the size
11676 of the debug information in the output file at the cost of increasing
11677 link processing time.  Merging is enabled by default.
11679 @opindex fdebug-prefix-map
11680 @item -fdebug-prefix-map=@var{old}=@var{new}
11681 When compiling files residing in directory @file{@var{old}}, record
11682 debugging information describing them as if the files resided in
11683 directory @file{@var{new}} instead.  This can be used to replace a
11684 build-time path with an install-time path in the debug info.  It can
11685 also be used to change an absolute path to a relative path by using
11686 @file{.} for @var{new}.  This can give more reproducible builds, which
11687 are location independent, but may require an extra command to tell GDB
11688 where to find the source files. See also @option{-ffile-prefix-map}
11689 and @option{-fcanon-prefix-map}.
11691 @opindex fvar-tracking
11692 @item -fvar-tracking
11693 Run variable tracking pass.  It computes where variables are stored at each
11694 position in code.  Better debugging information is then generated
11695 (if the debugging information format supports this information).
11697 It is enabled by default when compiling with optimization (@option{-Os},
11698 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
11699 the debug info format supports it.
11701 @opindex fvar-tracking-assignments
11702 @opindex fno-var-tracking-assignments
11703 @item -fvar-tracking-assignments
11704 Annotate assignments to user variables early in the compilation and
11705 attempt to carry the annotations over throughout the compilation all the
11706 way to the end, in an attempt to improve debug information while
11707 optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
11709 It can be enabled even if var-tracking is disabled, in which case
11710 annotations are created and maintained, but discarded at the end.
11711 By default, this flag is enabled together with @option{-fvar-tracking},
11712 except when selective scheduling is enabled.
11714 @opindex gsplit-dwarf
11715 @item -gsplit-dwarf
11716 If DWARF debugging information is enabled, separate as much debugging
11717 information as possible into a separate output file with the extension
11718 @file{.dwo}.  This option allows the build system to avoid linking files with
11719 debug information.  To be useful, this option requires a debugger capable of
11720 reading @file{.dwo} files.
11722 @opindex gdwarf32
11723 @opindex gdwarf64
11724 @item -gdwarf32
11725 @itemx -gdwarf64
11726 If DWARF debugging information is enabled, the @option{-gdwarf32} selects
11727 the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
11728 DWARF format.  The default is target specific, on most targets it is
11729 @option{-gdwarf32} though.  The 32-bit DWARF format is smaller, but
11730 can't support more than 2GiB of debug information in any of the DWARF
11731 debug information sections.  The 64-bit DWARF format allows larger debug
11732 information and might not be well supported by all consumers yet.
11734 @opindex gdescribe-dies
11735 @item -gdescribe-dies
11736 Add description attributes to some DWARF DIEs that have no name attribute,
11737 such as artificial variables, external references and call site
11738 parameter DIEs.
11740 @opindex gpubnames
11741 @item -gpubnames
11742 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
11744 @opindex ggnu-pubnames
11745 @item -ggnu-pubnames
11746 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
11747 suitable for conversion into a GDB@ index.  This option is only useful
11748 with a linker that can produce GDB@ index version 7.
11750 @opindex fdebug-types-section
11751 @opindex fno-debug-types-section
11752 @item -fdebug-types-section
11753 When using DWARF Version 4 or higher, type DIEs can be put into
11754 their own @code{.debug_types} section instead of making them part of the
11755 @code{.debug_info} section.  It is more efficient to put them in a separate
11756 comdat section since the linker can then remove duplicates.
11757 But not all DWARF consumers support @code{.debug_types} sections yet
11758 and on some objects @code{.debug_types} produces larger instead of smaller
11759 debugging information.
11761 @opindex grecord-gcc-switches
11762 @opindex gno-record-gcc-switches
11763 @item -grecord-gcc-switches
11764 @itemx -gno-record-gcc-switches
11765 This switch causes the command-line options used to invoke the
11766 compiler that may affect code generation to be appended to the
11767 DW_AT_producer attribute in DWARF debugging information.  The options
11768 are concatenated with spaces separating them from each other and from
11769 the compiler version.  
11770 It is enabled by default.
11771 See also @option{-frecord-gcc-switches} for another
11772 way of storing compiler options into the object file.  
11774 @opindex gstrict-dwarf
11775 @item -gstrict-dwarf
11776 Disallow using extensions of later DWARF standard version than selected
11777 with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
11778 DWARF extensions from later standard versions is allowed.
11780 @opindex gno-strict-dwarf
11781 @item -gno-strict-dwarf
11782 Allow using extensions of later DWARF standard version than selected with
11783 @option{-gdwarf-@var{version}}.
11785 @opindex gas-loc-support
11786 @item -gas-loc-support
11787 Inform the compiler that the assembler supports @code{.loc} directives.
11788 It may then use them for the assembler to generate DWARF2+ line number
11789 tables.
11791 This is generally desirable, because assembler-generated line-number
11792 tables are a lot more compact than those the compiler can generate
11793 itself.
11795 This option will be enabled by default if, at GCC configure time, the
11796 assembler was found to support such directives.
11798 @opindex gno-as-loc-support
11799 @item -gno-as-loc-support
11800 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
11801 line number tables are to be generated.
11803 @opindex gas-locview-support
11804 @item -gas-locview-support
11805 Inform the compiler that the assembler supports @code{view} assignment
11806 and reset assertion checking in @code{.loc} directives.
11808 This option will be enabled by default if, at GCC configure time, the
11809 assembler was found to support them.
11811 @item -gno-as-locview-support
11812 Force GCC to assign view numbers internally, if
11813 @option{-gvariable-location-views} are explicitly requested.
11815 @opindex gcolumn-info
11816 @opindex gno-column-info
11817 @item -gcolumn-info
11818 @itemx -gno-column-info
11819 Emit location column information into DWARF debugging information, rather
11820 than just file and line.
11821 This option is enabled by default.
11823 @opindex gstatement-frontiers
11824 @opindex gno-statement-frontiers
11825 @item -gstatement-frontiers
11826 @itemx -gno-statement-frontiers
11827 This option causes GCC to create markers in the internal representation
11828 at the beginning of statements, and to keep them roughly in place
11829 throughout compilation, using them to guide the output of @code{is_stmt}
11830 markers in the line number table.  This is enabled by default when
11831 compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2},
11832 @dots{}), and outputting DWARF 2 debug information at the normal level.
11834 @opindex gvariable-location-views
11835 @opindex gvariable-location-views=incompat5
11836 @opindex gno-variable-location-views
11837 @item -gvariable-location-views
11838 @itemx -gvariable-location-views=incompat5
11839 @itemx -gno-variable-location-views
11840 Augment variable location lists with progressive view numbers implied
11841 from the line number table.  This enables debug information consumers to
11842 inspect state at certain points of the program, even if no instructions
11843 associated with the corresponding source locations are present at that
11844 point.  If the assembler lacks support for view numbers in line number
11845 tables, this will cause the compiler to emit the line number table,
11846 which generally makes them somewhat less compact.  The augmented line
11847 number tables and location lists are fully backward-compatible, so they
11848 can be consumed by debug information consumers that are not aware of
11849 these augmentations, but they won't derive any benefit from them either.
11851 This is enabled by default when outputting DWARF 2 debug information at
11852 the normal level, as long as there is assembler support,
11853 @option{-fvar-tracking-assignments} is enabled and
11854 @option{-gstrict-dwarf} is not.  When assembler support is not
11855 available, this may still be enabled, but it will force GCC to output
11856 internal line number tables, and if
11857 @option{-ginternal-reset-location-views} is not enabled, that will most
11858 certainly lead to silently mismatching location views.
11860 There is a proposed representation for view numbers that is not backward
11861 compatible with the location list format introduced in DWARF 5, that can
11862 be enabled with @option{-gvariable-location-views=incompat5}.  This
11863 option may be removed in the future, is only provided as a reference
11864 implementation of the proposed representation.  Debug information
11865 consumers are not expected to support this extended format, and they
11866 would be rendered unable to decode location lists using it.
11868 @opindex ginternal-reset-location-views
11869 @opindex gno-internal-reset-location-views
11870 @item -ginternal-reset-location-views
11871 @itemx -gno-internal-reset-location-views
11872 Attempt to determine location views that can be omitted from location
11873 view lists.  This requires the compiler to have very accurate insn
11874 length estimates, which isn't always the case, and it may cause
11875 incorrect view lists to be generated silently when using an assembler
11876 that does not support location view lists.  The GNU assembler will flag
11877 any such error as a @code{view number mismatch}.  This is only enabled
11878 on ports that define a reliable estimation function.
11880 @opindex ginline-points
11881 @opindex gno-inline-points
11882 @item -ginline-points
11883 @itemx -gno-inline-points
11884 Generate extended debug information for inlined functions.  Location
11885 view tracking markers are inserted at inlined entry points, so that
11886 address and view numbers can be computed and output in debug
11887 information.  This can be enabled independently of location views, in
11888 which case the view numbers won't be output, but it can only be enabled
11889 along with statement frontiers, and it is only enabled by default if
11890 location views are enabled.
11892 @opindex gz
11893 @item -gz@r{[}=@var{type}@r{]}
11894 Produce compressed debug sections in DWARF format, if that is supported.
11895 If @var{type} is not given, the default type depends on the capabilities
11896 of the assembler and linker used.  @var{type} may be one of
11897 @samp{none} (don't compress debug sections), or @samp{zlib} (use zlib
11898 compression in ELF gABI format).  If the linker doesn't support writing
11899 compressed debug sections, the option is rejected.  Otherwise, if the
11900 assembler does not support them, @option{-gz} is silently ignored when
11901 producing object files.
11903 @opindex femit-struct-debug-baseonly
11904 @item -femit-struct-debug-baseonly
11905 Emit debug information for struct-like types
11906 only when the base name of the compilation source file
11907 matches the base name of file in which the struct is defined.
11909 This option substantially reduces the size of debugging information,
11910 but at significant potential loss in type information to the debugger.
11911 See @option{-femit-struct-debug-reduced} for a less aggressive option.
11912 See @option{-femit-struct-debug-detailed} for more detailed control.
11914 This option works only with DWARF debug output.
11916 @opindex femit-struct-debug-reduced
11917 @item -femit-struct-debug-reduced
11918 Emit debug information for struct-like types
11919 only when the base name of the compilation source file
11920 matches the base name of file in which the type is defined,
11921 unless the struct is a template or defined in a system header.
11923 This option significantly reduces the size of debugging information,
11924 with some potential loss in type information to the debugger.
11925 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
11926 See @option{-femit-struct-debug-detailed} for more detailed control.
11928 This option works only with DWARF debug output.
11930 @opindex femit-struct-debug-detailed
11931 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
11932 Specify the struct-like types
11933 for which the compiler generates debug information.
11934 The intent is to reduce duplicate struct debug information
11935 between different object files within the same program.
11937 This option is a detailed version of
11938 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
11939 which serves for most needs.
11941 A specification has the syntax@*
11942 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
11944 The optional first word limits the specification to
11945 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
11946 A struct type is used directly when it is the type of a variable, member.
11947 Indirect uses arise through pointers to structs.
11948 That is, when use of an incomplete struct is valid, the use is indirect.
11949 An example is
11950 @samp{struct one direct; struct two * indirect;}.
11952 The optional second word limits the specification to
11953 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
11954 Generic structs are a bit complicated to explain.
11955 For C++, these are non-explicit specializations of template classes,
11956 or non-template classes within the above.
11957 Other programming languages have generics,
11958 but @option{-femit-struct-debug-detailed} does not yet implement them.
11960 The third word specifies the source files for those
11961 structs for which the compiler should emit debug information.
11962 The values @samp{none} and @samp{any} have the normal meaning.
11963 The value @samp{base} means that
11964 the base of name of the file in which the type declaration appears
11965 must match the base of the name of the main compilation file.
11966 In practice, this means that when compiling @file{foo.c}, debug information
11967 is generated for types declared in that file and @file{foo.h},
11968 but not other header files.
11969 The value @samp{sys} means those types satisfying @samp{base}
11970 or declared in system or compiler headers.
11972 You may need to experiment to determine the best settings for your application.
11974 The default is @option{-femit-struct-debug-detailed=all}.
11976 This option works only with DWARF debug output.
11978 @opindex fdwarf2-cfi-asm
11979 @opindex fno-dwarf2-cfi-asm
11980 @item -fno-dwarf2-cfi-asm
11981 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
11982 instead of using GAS @code{.cfi_*} directives.
11984 @opindex feliminate-unused-debug-types
11985 @opindex fno-eliminate-unused-debug-types
11986 @item -fno-eliminate-unused-debug-types
11987 Normally, when producing DWARF output, GCC avoids producing debug symbol 
11988 output for types that are nowhere used in the source file being compiled.
11989 Sometimes it is useful to have GCC emit debugging
11990 information for all types declared in a compilation
11991 unit, regardless of whether or not they are actually used
11992 in that compilation unit, for example 
11993 if, in the debugger, you want to cast a value to a type that is
11994 not actually used in your program (but is declared).  More often,
11995 however, this results in a significant amount of wasted space.
11996 @end table
11998 @node Optimize Options
11999 @section Options That Control Optimization
12000 @cindex optimize options
12001 @cindex options, optimization
12003 These options control various sorts of optimizations.
12005 Without any optimization option, the compiler's goal is to reduce the
12006 cost of compilation and to make debugging produce the expected
12007 results.  Statements are independent: if you stop the program with a
12008 breakpoint between statements, you can then assign a new value to any
12009 variable or change the program counter to any other statement in the
12010 function and get exactly the results you expect from the source
12011 code.
12013 Turning on optimization flags makes the compiler attempt to improve
12014 the performance and/or code size at the expense of compilation time
12015 and possibly the ability to debug the program.
12017 The compiler performs optimization based on the knowledge it has of the
12018 program.  Compiling multiple files at once to a single output file mode allows
12019 the compiler to use information gained from all of the files when compiling
12020 each of them.
12022 Not all optimizations are controlled directly by a flag.  Only
12023 optimizations that have a flag are listed in this section.
12025 Most optimizations are completely disabled at @option{-O0} or if an
12026 @option{-O} level is not set on the command line, even if individual
12027 optimization flags are specified.  Similarly, @option{-Og} suppresses
12028 many optimization passes.
12030 Depending on the target and how GCC was configured, a slightly different
12031 set of optimizations may be enabled at each @option{-O} level than
12032 those listed here.  You can invoke GCC with @option{-Q --help=optimizers}
12033 to find out the exact set of optimizations that are enabled at each level.
12034 @xref{Overall Options}, for examples.
12036 @table @gcctabopt
12037 @opindex O
12038 @opindex O1
12039 @item -O
12040 @itemx -O1
12041 Optimize.  Optimizing compilation takes somewhat more time, and a lot
12042 more memory for a large function.
12044 With @option{-O}, the compiler tries to reduce code size and execution
12045 time, without performing any optimizations that take a great deal of
12046 compilation time.
12048 @c Note that in addition to the default_options_table list in opts.cc,
12049 @c several optimization flags default to true but control optimization
12050 @c passes that are explicitly disabled at -O0.
12052 @option{-O} turns on the following optimization flags:
12054 @c Please keep the following list alphabetized.
12055 @gccoptlist{-fauto-inc-dec
12056 -fbranch-count-reg
12057 -fcombine-stack-adjustments
12058 -fcompare-elim
12059 -fcprop-registers
12060 -fdce
12061 -fdefer-pop
12062 -fdelayed-branch
12063 -fdse
12064 -fforward-propagate
12065 -fguess-branch-probability
12066 -fif-conversion
12067 -fif-conversion2
12068 -finline-functions-called-once
12069 -fipa-modref
12070 -fipa-profile
12071 -fipa-pure-const
12072 -fipa-reference
12073 -fipa-reference-addressable
12074 -fmerge-constants
12075 -fmove-loop-invariants
12076 -fmove-loop-stores
12077 -fomit-frame-pointer
12078 -freorder-blocks
12079 -fshrink-wrap
12080 -fshrink-wrap-separate
12081 -fsplit-wide-types
12082 -fssa-backprop
12083 -fssa-phiopt
12084 -ftree-bit-ccp
12085 -ftree-ccp
12086 -ftree-ch
12087 -ftree-coalesce-vars
12088 -ftree-copy-prop
12089 -ftree-dce
12090 -ftree-dominator-opts
12091 -ftree-dse
12092 -ftree-forwprop
12093 -ftree-fre
12094 -ftree-phiprop
12095 -ftree-pta
12096 -ftree-scev-cprop
12097 -ftree-sink
12098 -ftree-slsr
12099 -ftree-sra
12100 -ftree-ter
12101 -funit-at-a-time}
12103 @opindex O2
12104 @item -O2
12105 Optimize even more.  GCC performs nearly all supported optimizations
12106 that do not involve a space-speed tradeoff.
12107 As compared to @option{-O}, this option increases both compilation time
12108 and the performance of the generated code.
12110 @option{-O2} turns on all optimization flags specified by @option{-O1}.  It
12111 also turns on the following optimization flags:
12113 @c Please keep the following list alphabetized!
12114 @gccoptlist{-falign-functions  -falign-jumps
12115 -falign-labels  -falign-loops
12116 -fcaller-saves
12117 -fcode-hoisting
12118 -fcrossjumping
12119 -fcse-follow-jumps  -fcse-skip-blocks
12120 -fdelete-null-pointer-checks
12121 -fdevirtualize  -fdevirtualize-speculatively
12122 -fexpensive-optimizations
12123 -ffinite-loops
12124 -fgcse  -fgcse-lm
12125 -fhoist-adjacent-loads
12126 -finline-functions
12127 -finline-small-functions
12128 -findirect-inlining
12129 -fipa-bit-cp  -fipa-cp  -fipa-icf
12130 -fipa-ra  -fipa-sra  -fipa-vrp
12131 -fisolate-erroneous-paths-dereference
12132 -flra-remat
12133 -foptimize-sibling-calls
12134 -foptimize-strlen
12135 -fpartial-inlining
12136 -fpeephole2
12137 -freorder-blocks-algorithm=stc
12138 -freorder-blocks-and-partition  -freorder-functions
12139 -frerun-cse-after-loop
12140 -fschedule-insns  -fschedule-insns2
12141 -fsched-interblock  -fsched-spec
12142 -fstore-merging
12143 -fstrict-aliasing
12144 -fthread-jumps
12145 -ftree-builtin-call-dce
12146 -ftree-loop-vectorize
12147 -ftree-pre
12148 -ftree-slp-vectorize
12149 -ftree-switch-conversion  -ftree-tail-merge
12150 -ftree-vrp
12151 -fvect-cost-model=very-cheap}
12153 Please note the warning under @option{-fgcse} about
12154 invoking @option{-O2} on programs that use computed gotos.
12156 @opindex O3
12157 @item -O3
12158 Optimize yet more.  @option{-O3} turns on all optimizations specified
12159 by @option{-O2} and also turns on the following optimization flags:
12161 @c Please keep the following list alphabetized!
12162 @gccoptlist{-fgcse-after-reload
12163 -fipa-cp-clone
12164 -floop-interchange
12165 -floop-unroll-and-jam
12166 -fpeel-loops
12167 -fpredictive-commoning
12168 -fsplit-loops
12169 -fsplit-paths
12170 -ftree-loop-distribution
12171 -ftree-partial-pre
12172 -funswitch-loops
12173 -fvect-cost-model=dynamic
12174 -fversion-loops-for-strides}
12176 @opindex O0
12177 @item -O0
12178 Reduce compilation time and make debugging produce the expected
12179 results.  This is the default.
12181 @opindex Os
12182 @item -Os
12183 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations 
12184 except those that often increase code size:
12186 @gccoptlist{-falign-functions  -falign-jumps
12187 -falign-labels  -falign-loops
12188 -fprefetch-loop-arrays  -freorder-blocks-algorithm=stc}
12190 It also enables @option{-finline-functions}, causes the compiler to tune for
12191 code size rather than execution speed, and performs further optimizations
12192 designed to reduce code size.
12194 @opindex Ofast
12195 @item -Ofast
12196 Disregard strict standards compliance.  @option{-Ofast} enables all
12197 @option{-O3} optimizations.  It also enables optimizations that are not
12198 valid for all standard-compliant programs.
12199 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
12200 and the Fortran-specific @option{-fstack-arrays}, unless
12201 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
12202 It turns off @option{-fsemantic-interposition}.
12204 @opindex Og
12205 @item -Og
12206 Optimize debugging experience.  @option{-Og} should be the optimization
12207 level of choice for the standard edit-compile-debug cycle, offering
12208 a reasonable level of optimization while maintaining fast compilation
12209 and a good debugging experience.  It is a better choice than @option{-O0}
12210 for producing debuggable code because some compiler passes
12211 that collect debug information are disabled at @option{-O0}.
12213 Like @option{-O0}, @option{-Og} completely disables a number of 
12214 optimization passes so that individual options controlling them have
12215 no effect.  Otherwise @option{-Og} enables all @option{-O1} 
12216 optimization flags except for those that may interfere with debugging:
12218 @gccoptlist{-fbranch-count-reg  -fdelayed-branch
12219 -fdse  -fif-conversion  -fif-conversion2
12220 -finline-functions-called-once
12221 -fmove-loop-invariants  -fmove-loop-stores  -fssa-phiopt
12222 -ftree-bit-ccp  -ftree-dse  -ftree-pta  -ftree-sra}
12224 @opindex Oz
12225 @item -Oz
12226 Optimize aggressively for size rather than speed.  This may increase
12227 the number of instructions executed if those instructions require
12228 fewer bytes to encode.  @option{-Oz} behaves similarly to @option{-Os}
12229 including enabling most @option{-O2} optimizations.
12231 @end table
12233 If you use multiple @option{-O} options, with or without level numbers,
12234 the last such option is the one that is effective.
12236 Options of the form @option{-f@var{flag}} specify machine-independent
12237 flags.  Most flags have both positive and negative forms; the negative
12238 form of @option{-ffoo} is @option{-fno-foo}.  In the table
12239 below, only one of the forms is listed---the one you typically 
12240 use.  You can figure out the other form by either removing @samp{no-}
12241 or adding it.
12243 The following options control specific optimizations.  They are either
12244 activated by @option{-O} options or are related to ones that are.  You
12245 can use the following flags in the rare cases when ``fine-tuning'' of
12246 optimizations to be performed is desired.
12248 @table @gcctabopt
12249 @opindex fno-defer-pop
12250 @opindex fdefer-pop
12251 @item -fno-defer-pop
12252 For machines that must pop arguments after a function call, always pop 
12253 the arguments as soon as each function returns.  
12254 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
12255 this allows the compiler to let arguments accumulate on the stack for several
12256 function calls and pop them all at once.
12258 @opindex fforward-propagate
12259 @item -fforward-propagate
12260 Perform a forward propagation pass on RTL@.  The pass tries to combine two
12261 instructions and checks if the result can be simplified.  If loop unrolling
12262 is active, two passes are performed and the second is scheduled after
12263 loop unrolling.
12265 This option is enabled by default at optimization levels @option{-O1},
12266 @option{-O2}, @option{-O3}, @option{-Os}.
12268 @opindex ffp-contract
12269 @item -ffp-contract=@var{style}
12270 @option{-ffp-contract=off} disables floating-point expression contraction.
12271 @option{-ffp-contract=fast} enables floating-point expression contraction
12272 such as forming of fused multiply-add operations if the target has
12273 native support for them.
12274 @option{-ffp-contract=on} enables floating-point expression contraction
12275 if allowed by the language standard.  This is implemented for C and C++,
12276 where it enables contraction within one expression, but not across
12277 different statements.
12279 The default is @option{-ffp-contract=off} for C in a standards compliant mode
12280 (@option{-std=c11} or similar), @option{-ffp-contract=fast} otherwise.
12282 @opindex fomit-frame-pointer
12283 @item -fomit-frame-pointer
12284 Omit the frame pointer in functions that don't need one.  This avoids the
12285 instructions to save, set up and restore the frame pointer; on many targets
12286 it also makes an extra register available.
12288 On some targets this flag has no effect because the standard calling sequence
12289 always uses a frame pointer, so it cannot be omitted.
12291 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
12292 is used in all functions.  Several targets always omit the frame pointer in
12293 leaf functions.
12295 Enabled by default at @option{-O1} and higher.
12297 @opindex foptimize-sibling-calls
12298 @item -foptimize-sibling-calls
12299 Optimize sibling and tail recursive calls.
12301 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12303 @opindex foptimize-strlen
12304 @item -foptimize-strlen
12305 Optimize various standard C string functions (e.g.@: @code{strlen},
12306 @code{strchr} or @code{strcpy}) and
12307 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
12309 Enabled at levels @option{-O2}, @option{-O3}.
12311 @opindex fno-inline
12312 @opindex finline
12313 @item -fno-inline
12314 Do not expand any functions inline apart from those marked with
12315 the @code{always_inline} attribute.  This is the default when not
12316 optimizing.
12318 Single functions can be exempted from inlining by marking them
12319 with the @code{noinline} attribute.
12321 @opindex finline-small-functions
12322 @item -finline-small-functions
12323 Integrate functions into their callers when their body is smaller than expected
12324 function call code (so overall size of program gets smaller).  The compiler
12325 heuristically decides which functions are simple enough to be worth integrating
12326 in this way.  This inlining applies to all functions, even those not declared
12327 inline.
12329 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12331 @opindex findirect-inlining
12332 @item -findirect-inlining
12333 Inline also indirect calls that are discovered to be known at compile
12334 time thanks to previous inlining.  This option has any effect only
12335 when inlining itself is turned on by the @option{-finline-functions}
12336 or @option{-finline-small-functions} options.
12338 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12340 @opindex finline-functions
12341 @item -finline-functions
12342 Consider all functions for inlining, even if they are not declared inline.
12343 The compiler heuristically decides which functions are worth integrating
12344 in this way.
12346 If all calls to a given function are integrated, and the function is
12347 declared @code{static}, then the function is normally not output as
12348 assembler code in its own right.
12350 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.  Also enabled
12351 by @option{-fprofile-use} and @option{-fauto-profile}.
12353 @opindex finline-functions-called-once
12354 @item -finline-functions-called-once
12355 Consider all @code{static} functions called once for inlining into their
12356 caller even if they are not marked @code{inline}.  If a call to a given
12357 function is integrated, then the function is not output as assembler code
12358 in its own right.
12360 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
12361 but not @option{-Og}.
12363 @opindex fearly-inlining
12364 @item -fearly-inlining
12365 Inline functions marked by @code{always_inline} and functions whose body seems
12366 smaller than the function call overhead early before doing
12367 @option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
12368 makes profiling significantly cheaper and usually inlining faster on programs
12369 having large chains of nested wrapper functions.
12371 Enabled by default.
12373 @opindex fipa-sra
12374 @item -fipa-sra
12375 Perform interprocedural scalar replacement of aggregates, removal of
12376 unused parameters and replacement of parameters passed by reference
12377 by parameters passed by value.
12379 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
12381 @opindex finline-limit
12382 @item -finline-limit=@var{n}
12383 By default, GCC limits the size of functions that can be inlined.  This flag
12384 allows coarse control of this limit.  @var{n} is the size of functions that
12385 can be inlined in number of pseudo instructions.
12387 Inlining is actually controlled by a number of parameters, which may be
12388 specified individually by using @option{--param @var{name}=@var{value}}.
12389 The @option{-finline-limit=@var{n}} option sets some of these parameters
12390 as follows:
12392 @table @gcctabopt
12393 @item max-inline-insns-single
12394 is set to @var{n}/2.
12395 @item max-inline-insns-auto
12396 is set to @var{n}/2.
12397 @end table
12399 See below for a documentation of the individual
12400 parameters controlling inlining and for the defaults of these parameters.
12402 @emph{Note:} there may be no value to @option{-finline-limit} that results
12403 in default behavior.
12405 @emph{Note:} pseudo instruction represents, in this particular context, an
12406 abstract measurement of function's size.  In no way does it represent a count
12407 of assembly instructions and as such its exact meaning might change from one
12408 release to an another.
12410 @opindex fno-keep-inline-dllexport
12411 @opindex fkeep-inline-dllexport
12412 @item -fno-keep-inline-dllexport
12413 This is a more fine-grained version of @option{-fkeep-inline-functions},
12414 which applies only to functions that are declared using the @code{dllexport}
12415 attribute or declspec.  @xref{Function Attributes,,Declaring Attributes of
12416 Functions}.
12418 @opindex fkeep-inline-functions
12419 @item -fkeep-inline-functions
12420 In C, emit @code{static} functions that are declared @code{inline}
12421 into the object file, even if the function has been inlined into all
12422 of its callers.  This switch does not affect functions using the
12423 @code{extern inline} extension in GNU C90@.  In C++, emit any and all
12424 inline functions into the object file.
12426 @opindex fkeep-static-functions
12427 @item -fkeep-static-functions
12428 Emit @code{static} functions into the object file, even if the function
12429 is never used.
12431 @opindex fkeep-static-consts
12432 @item -fkeep-static-consts
12433 Emit variables declared @code{static const} when optimization isn't turned
12434 on, even if the variables aren't referenced.
12436 GCC enables this option by default.  If you want to force the compiler to
12437 check if a variable is referenced, regardless of whether or not
12438 optimization is turned on, use the @option{-fno-keep-static-consts} option.
12440 @opindex fmerge-constants
12441 @item -fmerge-constants
12442 Attempt to merge identical constants (string constants and floating-point
12443 constants) across compilation units.
12445 This option is the default for optimized compilation if the assembler and
12446 linker support it.  Use @option{-fno-merge-constants} to inhibit this
12447 behavior.
12449 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12451 @opindex fmerge-all-constants
12452 @item -fmerge-all-constants
12453 Attempt to merge identical constants and identical variables.
12455 This option implies @option{-fmerge-constants}.  In addition to
12456 @option{-fmerge-constants} this considers e.g.@: even constant initialized
12457 arrays or initialized constant variables with integral or floating-point
12458 types.  Languages like C or C++ require each variable, including multiple
12459 instances of the same variable in recursive calls, to have distinct locations,
12460 so using this option results in non-conforming
12461 behavior.
12463 @opindex fmodulo-sched
12464 @item -fmodulo-sched
12465 Perform swing modulo scheduling immediately before the first scheduling
12466 pass.  This pass looks at innermost loops and reorders their
12467 instructions by overlapping different iterations.
12469 @opindex fmodulo-sched-allow-regmoves
12470 @item -fmodulo-sched-allow-regmoves
12471 Perform more aggressive SMS-based modulo scheduling with register moves
12472 allowed.  By setting this flag certain anti-dependences edges are
12473 deleted, which triggers the generation of reg-moves based on the
12474 life-range analysis.  This option is effective only with
12475 @option{-fmodulo-sched} enabled.
12477 @opindex fno-branch-count-reg
12478 @opindex fbranch-count-reg
12479 @item -fno-branch-count-reg
12480 Disable the optimization pass that scans for opportunities to use 
12481 ``decrement and branch'' instructions on a count register instead of
12482 instruction sequences that decrement a register, compare it against zero, and
12483 then branch based upon the result.  This option is only meaningful on
12484 architectures that support such instructions, which include x86, PowerPC,
12485 IA-64 and S/390.  Note that the @option{-fno-branch-count-reg} option
12486 doesn't remove the decrement and branch instructions from the generated
12487 instruction stream introduced by other optimization passes.
12489 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
12490 except for @option{-Og}.
12492 @opindex fno-function-cse
12493 @opindex ffunction-cse
12494 @item -fno-function-cse
12495 Do not put function addresses in registers; make each instruction that
12496 calls a constant function contain the function's address explicitly.
12498 This option results in less efficient code, but some strange hacks
12499 that alter the assembler output may be confused by the optimizations
12500 performed when this option is not used.
12502 The default is @option{-ffunction-cse}
12504 @opindex fno-zero-initialized-in-bss
12505 @opindex fzero-initialized-in-bss
12506 @item -fno-zero-initialized-in-bss
12507 If the target supports a BSS section, GCC by default puts variables that
12508 are initialized to zero into BSS@.  This can save space in the resulting
12509 code.
12511 This option turns off this behavior because some programs explicitly
12512 rely on variables going to the data section---e.g., so that the
12513 resulting executable can find the beginning of that section and/or make
12514 assumptions based on that.
12516 The default is @option{-fzero-initialized-in-bss}.
12518 @opindex fthread-jumps
12519 @item -fthread-jumps
12520 Perform optimizations that check to see if a jump branches to a
12521 location where another comparison subsumed by the first is found.  If
12522 so, the first branch is redirected to either the destination of the
12523 second branch or a point immediately following it, depending on whether
12524 the condition is known to be true or false.
12526 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12528 @opindex fsplit-wide-types
12529 @item -fsplit-wide-types
12530 When using a type that occupies multiple registers, such as @code{long
12531 long} on a 32-bit system, split the registers apart and allocate them
12532 independently.  This normally generates better code for those types,
12533 but may make debugging more difficult.
12535 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3},
12536 @option{-Os}.
12538 @opindex fsplit-wide-types-early
12539 @item -fsplit-wide-types-early
12540 Fully split wide types early, instead of very late.
12541 This option has no effect unless @option{-fsplit-wide-types} is turned on.
12543 This is the default on some targets.
12545 @opindex fcse-follow-jumps
12546 @item -fcse-follow-jumps
12547 In common subexpression elimination (CSE), scan through jump instructions
12548 when the target of the jump is not reached by any other path.  For
12549 example, when CSE encounters an @code{if} statement with an
12550 @code{else} clause, CSE follows the jump when the condition
12551 tested is false.
12553 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12555 @opindex fcse-skip-blocks
12556 @item -fcse-skip-blocks
12557 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
12558 follow jumps that conditionally skip over blocks.  When CSE
12559 encounters a simple @code{if} statement with no else clause,
12560 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
12561 body of the @code{if}.
12563 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12565 @opindex frerun-cse-after-loop
12566 @item -frerun-cse-after-loop
12567 Re-run common subexpression elimination after loop optimizations are
12568 performed.
12570 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12572 @opindex fgcse
12573 @item -fgcse
12574 Perform a global common subexpression elimination pass.
12575 This pass also performs global constant and copy propagation.
12577 @emph{Note:} When compiling a program using computed gotos, a GCC
12578 extension, you may get better run-time performance if you disable
12579 the global common subexpression elimination pass by adding
12580 @option{-fno-gcse} to the command line.
12582 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12584 @opindex fgcse-lm
12585 @item -fgcse-lm
12586 When @option{-fgcse-lm} is enabled, global common subexpression elimination
12587 attempts to move loads that are only killed by stores into themselves.  This
12588 allows a loop containing a load/store sequence to be changed to a load outside
12589 the loop, and a copy/store within the loop.
12591 Enabled by default when @option{-fgcse} is enabled.
12593 @opindex fgcse-sm
12594 @item -fgcse-sm
12595 When @option{-fgcse-sm} is enabled, a store motion pass is run after
12596 global common subexpression elimination.  This pass attempts to move
12597 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
12598 loops containing a load/store sequence can be changed to a load before
12599 the loop and a store after the loop.
12601 Not enabled at any optimization level.
12603 @opindex fgcse-las
12604 @item -fgcse-las
12605 When @option{-fgcse-las} is enabled, the global common subexpression
12606 elimination pass eliminates redundant loads that come after stores to the
12607 same memory location (both partial and full redundancies).
12609 Not enabled at any optimization level.
12611 @opindex fgcse-after-reload
12612 @item -fgcse-after-reload
12613 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
12614 pass is performed after reload.  The purpose of this pass is to clean up
12615 redundant spilling.
12617 Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}.
12619 @opindex faggressive-loop-optimizations
12620 @item -faggressive-loop-optimizations
12621 This option tells the loop optimizer to use language constraints to
12622 derive bounds for the number of iterations of a loop.  This assumes that
12623 loop code does not invoke undefined behavior by for example causing signed
12624 integer overflows or out-of-bound array accesses.  The bounds for the
12625 number of iterations of a loop are used to guide loop unrolling and peeling
12626 and loop exit test optimizations.
12627 This option is enabled by default.
12629 @opindex funconstrained-commons
12630 @item -funconstrained-commons
12631 This option tells the compiler that variables declared in common blocks
12632 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
12633 prevents certain optimizations that depend on knowing the array bounds.
12635 @opindex fcrossjumping
12636 @item -fcrossjumping
12637 Perform cross-jumping transformation.
12638 This transformation unifies equivalent code and saves code size.  The
12639 resulting code may or may not perform better than without cross-jumping.
12641 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12643 @opindex fauto-inc-dec
12644 @item -fauto-inc-dec
12645 Combine increments or decrements of addresses with memory accesses.
12646 This pass is always skipped on architectures that do not have
12647 instructions to support this.  Enabled by default at @option{-O1} and
12648 higher on architectures that support this.
12650 @opindex fdce
12651 @item -fdce
12652 Perform dead code elimination (DCE) on RTL@.
12653 Enabled by default at @option{-O1} and higher.
12655 @opindex fdse
12656 @item -fdse
12657 Perform dead store elimination (DSE) on RTL@.
12658 Enabled by default at @option{-O1} and higher.
12660 @opindex fif-conversion
12661 @item -fif-conversion
12662 Attempt to transform conditional jumps into branch-less equivalents.  This
12663 includes use of conditional moves, min, max, set flags and abs instructions, and
12664 some tricks doable by standard arithmetics.  The use of conditional execution
12665 on chips where it is available is controlled by @option{-fif-conversion2}.
12667 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12668 not with @option{-Og}.
12670 @opindex fif-conversion2
12671 @item -fif-conversion2
12672 Use conditional execution (where available) to transform conditional jumps into
12673 branch-less equivalents.
12675 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12676 not with @option{-Og}.
12678 @opindex fdeclone-ctor-dtor
12679 @item -fdeclone-ctor-dtor
12680 The C++ ABI requires multiple entry points for constructors and
12681 destructors: one for a base subobject, one for a complete object, and
12682 one for a virtual destructor that calls operator delete afterwards.
12683 For a hierarchy with virtual bases, the base and complete variants are
12684 clones, which means two copies of the function.  With this option, the
12685 base and complete variants are changed to be thunks that call a common
12686 implementation.
12688 Enabled by @option{-Os}.
12690 @opindex fdelete-null-pointer-checks
12691 @item -fdelete-null-pointer-checks
12692 Assume that programs cannot safely dereference null pointers, and that
12693 no code or data element resides at address zero.
12694 This option enables simple constant
12695 folding optimizations at all optimization levels.  In addition, other
12696 optimization passes in GCC use this flag to control global dataflow
12697 analyses that eliminate useless checks for null pointers; these assume
12698 that a memory access to address zero always results in a trap, so
12699 that if a pointer is checked after it has already been dereferenced,
12700 it cannot be null.
12702 Note however that in some environments this assumption is not true.
12703 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
12704 for programs that depend on that behavior.
12706 This option is enabled by default on most targets.  On Nios II ELF, it
12707 defaults to off.  On AVR and MSP430, this option is completely disabled.
12709 Passes that use the dataflow information
12710 are enabled independently at different optimization levels.
12712 @opindex fdevirtualize
12713 @item -fdevirtualize
12714 Attempt to convert calls to virtual functions to direct calls.  This
12715 is done both within a procedure and interprocedurally as part of
12716 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
12717 propagation (@option{-fipa-cp}).
12718 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12720 @opindex fdevirtualize-speculatively
12721 @item -fdevirtualize-speculatively
12722 Attempt to convert calls to virtual functions to speculative direct calls.
12723 Based on the analysis of the type inheritance graph, determine for a given call
12724 the set of likely targets. If the set is small, preferably of size 1, change
12725 the call into a conditional deciding between direct and indirect calls.  The
12726 speculative calls enable more optimizations, such as inlining.  When they seem
12727 useless after further optimization, they are converted back into original form.
12729 @opindex fdevirtualize-at-ltrans
12730 @item -fdevirtualize-at-ltrans
12731 Stream extra information needed for aggressive devirtualization when running
12732 the link-time optimizer in local transformation mode.  
12733 This option enables more devirtualization but
12734 significantly increases the size of streamed data. For this reason it is
12735 disabled by default.
12737 @opindex fexpensive-optimizations
12738 @item -fexpensive-optimizations
12739 Perform a number of minor optimizations that are relatively expensive.
12741 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12743 @opindex free
12744 @item -free
12745 Attempt to remove redundant extension instructions.  This is especially
12746 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
12747 registers after writing to their lower 32-bit half.
12749 Enabled for Alpha, AArch64, LoongArch, PowerPC, RISC-V, SPARC, h83000 and x86 at
12750 levels @option{-O2}, @option{-O3}, @option{-Os}.
12752 @opindex fno-lifetime-dse
12753 @opindex flifetime-dse
12754 @item -fno-lifetime-dse
12755 In C++ the value of an object is only affected by changes within its
12756 lifetime: when the constructor begins, the object has an indeterminate
12757 value, and any changes during the lifetime of the object are dead when
12758 the object is destroyed.  Normally dead store elimination will take
12759 advantage of this; if your code relies on the value of the object
12760 storage persisting beyond the lifetime of the object, you can use this
12761 flag to disable this optimization.  To preserve stores before the
12762 constructor starts (e.g.@: because your operator new clears the object
12763 storage) but still treat the object as dead after the destructor, you
12764 can use @option{-flifetime-dse=1}.  The default behavior can be
12765 explicitly selected with @option{-flifetime-dse=2}.
12766 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
12768 @opindex flive-range-shrinkage
12769 @item -flive-range-shrinkage
12770 Attempt to decrease register pressure through register live range
12771 shrinkage.  This is helpful for fast processors with small or moderate
12772 size register sets.
12774 @opindex fira-algorithm
12775 @item -fira-algorithm=@var{algorithm}
12776 Use the specified coloring algorithm for the integrated register
12777 allocator.  The @var{algorithm} argument can be @samp{priority}, which
12778 specifies Chow's priority coloring, or @samp{CB}, which specifies
12779 Chaitin-Briggs coloring.  Chaitin-Briggs coloring is not implemented
12780 for all architectures, but for those targets that do support it, it is
12781 the default because it generates better code.
12783 @opindex fira-region
12784 @item -fira-region=@var{region}
12785 Use specified regions for the integrated register allocator.  The
12786 @var{region} argument should be one of the following:
12788 @table @samp
12790 @item all
12791 Use all loops as register allocation regions.
12792 This can give the best results for machines with a small and/or
12793 irregular register set.
12795 @item mixed
12796 Use all loops except for loops with small register pressure 
12797 as the regions.  This value usually gives
12798 the best results in most cases and for most architectures,
12799 and is enabled by default when compiling with optimization for speed
12800 (@option{-O}, @option{-O2}, @dots{}).
12802 @item one
12803 Use all functions as a single region.  
12804 This typically results in the smallest code size, and is enabled by default for
12805 @option{-Os} or @option{-O0}.
12807 @end table
12809 @opindex fira-hoist-pressure
12810 @item -fira-hoist-pressure
12811 Use IRA to evaluate register pressure in the code hoisting pass for
12812 decisions to hoist expressions.  This option usually results in smaller
12813 code, but it can slow the compiler down.
12815 This option is enabled at level @option{-Os} for all targets.
12817 @opindex fira-loop-pressure
12818 @item -fira-loop-pressure
12819 Use IRA to evaluate register pressure in loops for decisions to move
12820 loop invariants.  This option usually results in generation
12821 of faster and smaller code on machines with large register files (>= 32
12822 registers), but it can slow the compiler down.
12824 This option is enabled at level @option{-O3} for some targets.
12826 @opindex fno-ira-share-save-slots
12827 @opindex fira-share-save-slots
12828 @item -fno-ira-share-save-slots
12829 Disable sharing of stack slots used for saving call-used hard
12830 registers living through a call.  Each hard register gets a
12831 separate stack slot, and as a result function stack frames are
12832 larger.
12834 @opindex fno-ira-share-spill-slots
12835 @opindex fira-share-spill-slots
12836 @item -fno-ira-share-spill-slots
12837 Disable sharing of stack slots allocated for pseudo-registers.  Each
12838 pseudo-register that does not get a hard register gets a separate
12839 stack slot, and as a result function stack frames are larger.
12841 @opindex flra-remat
12842 @item -flra-remat
12843 Enable CFG-sensitive rematerialization in LRA.  Instead of loading
12844 values of spilled pseudos, LRA tries to rematerialize (recalculate)
12845 values if it is profitable.
12847 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12849 @opindex fdelayed-branch
12850 @item -fdelayed-branch
12851 If supported for the target machine, attempt to reorder instructions
12852 to exploit instruction slots available after delayed branch
12853 instructions.
12855 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os},
12856 but not at @option{-Og}.
12858 @opindex fschedule-insns
12859 @item -fschedule-insns
12860 If supported for the target machine, attempt to reorder instructions to
12861 eliminate execution stalls due to required data being unavailable.  This
12862 helps machines that have slow floating point or memory load instructions
12863 by allowing other instructions to be issued until the result of the load
12864 or floating-point instruction is required.
12866 Enabled at levels @option{-O2}, @option{-O3}.
12868 @opindex fschedule-insns2
12869 @item -fschedule-insns2
12870 Similar to @option{-fschedule-insns}, but requests an additional pass of
12871 instruction scheduling after register allocation has been done.  This is
12872 especially useful on machines with a relatively small number of
12873 registers and where memory load instructions take more than one cycle.
12875 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12877 @opindex fno-sched-interblock
12878 @opindex fsched-interblock
12879 @item -fno-sched-interblock
12880 Disable instruction scheduling across basic blocks, which
12881 is normally enabled when scheduling before register allocation, i.e.@:
12882 with @option{-fschedule-insns} or at @option{-O2} or higher.
12884 @opindex fno-sched-spec
12885 @opindex fsched-spec
12886 @item -fno-sched-spec
12887 Disable speculative motion of non-load instructions, which
12888 is normally enabled when scheduling before register allocation, i.e.@:
12889 with @option{-fschedule-insns} or at @option{-O2} or higher.
12891 @opindex fsched-pressure
12892 @item -fsched-pressure
12893 Enable register pressure sensitive insn scheduling before register
12894 allocation.  This only makes sense when scheduling before register
12895 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
12896 @option{-O2} or higher.  Usage of this option can improve the
12897 generated code and decrease its size by preventing register pressure
12898 increase above the number of available hard registers and subsequent
12899 spills in register allocation.
12901 @opindex fsched-spec-load
12902 @item -fsched-spec-load
12903 Allow speculative motion of some load instructions.  This only makes
12904 sense when scheduling before register allocation, i.e.@: with
12905 @option{-fschedule-insns} or at @option{-O2} or higher.
12907 @opindex fsched-spec-load-dangerous
12908 @item -fsched-spec-load-dangerous
12909 Allow speculative motion of more load instructions.  This only makes
12910 sense when scheduling before register allocation, i.e.@: with
12911 @option{-fschedule-insns} or at @option{-O2} or higher.
12913 @opindex fsched-stalled-insns
12914 @item -fsched-stalled-insns
12915 @itemx -fsched-stalled-insns=@var{n}
12916 Define how many insns (if any) can be moved prematurely from the queue
12917 of stalled insns into the ready list during the second scheduling pass.
12918 @option{-fno-sched-stalled-insns} means that no insns are moved
12919 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
12920 on how many queued insns can be moved prematurely.
12921 @option{-fsched-stalled-insns} without a value is equivalent to
12922 @option{-fsched-stalled-insns=1}.
12924 @opindex fsched-stalled-insns-dep
12925 @item -fsched-stalled-insns-dep
12926 @itemx -fsched-stalled-insns-dep=@var{n}
12927 Define how many insn groups (cycles) are examined for a dependency
12928 on a stalled insn that is a candidate for premature removal from the queue
12929 of stalled insns.  This has an effect only during the second scheduling pass,
12930 and only if @option{-fsched-stalled-insns} is used.
12931 @option{-fno-sched-stalled-insns-dep} is equivalent to
12932 @option{-fsched-stalled-insns-dep=0}.
12933 @option{-fsched-stalled-insns-dep} without a value is equivalent to
12934 @option{-fsched-stalled-insns-dep=1}.
12936 @opindex fsched2-use-superblocks
12937 @item -fsched2-use-superblocks
12938 When scheduling after register allocation, use superblock scheduling.
12939 This allows motion across basic block boundaries,
12940 resulting in faster schedules.  This option is experimental, as not all machine
12941 descriptions used by GCC model the CPU closely enough to avoid unreliable
12942 results from the algorithm.
12944 This only makes sense when scheduling after register allocation, i.e.@: with
12945 @option{-fschedule-insns2} or at @option{-O2} or higher.
12947 @opindex fsched-group-heuristic
12948 @item -fsched-group-heuristic
12949 Enable the group heuristic in the scheduler.  This heuristic favors
12950 the instruction that belongs to a schedule group.  This is enabled
12951 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12952 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12954 @opindex fsched-critical-path-heuristic
12955 @item -fsched-critical-path-heuristic
12956 Enable the critical-path heuristic in the scheduler.  This heuristic favors
12957 instructions on the critical path.  This is enabled by default when
12958 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12959 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12961 @opindex fsched-spec-insn-heuristic
12962 @item -fsched-spec-insn-heuristic
12963 Enable the speculative instruction heuristic in the scheduler.  This
12964 heuristic favors speculative instructions with greater dependency weakness.
12965 This is enabled by default when scheduling is enabled, i.e.@:
12966 with @option{-fschedule-insns} or @option{-fschedule-insns2}
12967 or at @option{-O2} or higher.
12969 @opindex fsched-rank-heuristic
12970 @item -fsched-rank-heuristic
12971 Enable the rank heuristic in the scheduler.  This heuristic favors
12972 the instruction belonging to a basic block with greater size or frequency.
12973 This is enabled by default when scheduling is enabled, i.e.@:
12974 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12975 at @option{-O2} or higher.
12977 @opindex fsched-last-insn-heuristic
12978 @item -fsched-last-insn-heuristic
12979 Enable the last-instruction heuristic in the scheduler.  This heuristic
12980 favors the instruction that is less dependent on the last instruction
12981 scheduled.  This is enabled by default when scheduling is enabled,
12982 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12983 at @option{-O2} or higher.
12985 @opindex fsched-dep-count-heuristic
12986 @item -fsched-dep-count-heuristic
12987 Enable the dependent-count heuristic in the scheduler.  This heuristic
12988 favors the instruction that has more instructions depending on it.
12989 This is enabled by default when scheduling is enabled, i.e.@:
12990 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12991 at @option{-O2} or higher.
12993 @opindex freschedule-modulo-scheduled-loops
12994 @item -freschedule-modulo-scheduled-loops
12995 Modulo scheduling is performed before traditional scheduling.  If a loop
12996 is modulo scheduled, later scheduling passes may change its schedule.  
12997 Use this option to control that behavior.
12999 @opindex fselective-scheduling
13000 @item -fselective-scheduling
13001 Schedule instructions using selective scheduling algorithm.  Selective
13002 scheduling runs instead of the first scheduler pass.
13004 @opindex fselective-scheduling2
13005 @item -fselective-scheduling2
13006 Schedule instructions using selective scheduling algorithm.  Selective
13007 scheduling runs instead of the second scheduler pass.
13009 @opindex fsel-sched-pipelining
13010 @item -fsel-sched-pipelining
13011 Enable software pipelining of innermost loops during selective scheduling.
13012 This option has no effect unless one of @option{-fselective-scheduling} or
13013 @option{-fselective-scheduling2} is turned on.
13015 @opindex fsel-sched-pipelining-outer-loops
13016 @item -fsel-sched-pipelining-outer-loops
13017 When pipelining loops during selective scheduling, also pipeline outer loops.
13018 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
13020 @opindex fsemantic-interposition
13021 @item -fsemantic-interposition
13022 Some object formats, like ELF, allow interposing of symbols by the 
13023 dynamic linker.
13024 This means that for symbols exported from the DSO, the compiler cannot perform
13025 interprocedural propagation, inlining and other optimizations in anticipation
13026 that the function or variable in question may change. While this feature is
13027 useful, for example, to rewrite memory allocation functions by a debugging
13028 implementation, it is expensive in the terms of code quality.
13029 With @option{-fno-semantic-interposition} the compiler assumes that 
13030 if interposition happens for functions the overwriting function will have 
13031 precisely the same semantics (and side effects). 
13032 Similarly if interposition happens
13033 for variables, the constructor of the variable will be the same. The flag
13034 has no effect for functions explicitly declared inline 
13035 (where it is never allowed for interposition to change semantics) 
13036 and for symbols explicitly declared weak.
13038 @opindex fshrink-wrap
13039 @item -fshrink-wrap
13040 Emit function prologues only before parts of the function that need it,
13041 rather than at the top of the function.  This flag is enabled by default at
13042 @option{-O} and higher.
13044 @opindex fshrink-wrap-separate
13045 @item -fshrink-wrap-separate
13046 Shrink-wrap separate parts of the prologue and epilogue separately, so that
13047 those parts are only executed when needed.
13048 This option is on by default, but has no effect unless @option{-fshrink-wrap}
13049 is also turned on and the target supports this.
13051 @opindex fcaller-saves
13052 @item -fcaller-saves
13053 Enable allocation of values to registers that are clobbered by
13054 function calls, by emitting extra instructions to save and restore the
13055 registers around such calls.  Such allocation is done only when it
13056 seems to result in better code.
13058 This option is always enabled by default on certain machines, usually
13059 those which have no call-preserved registers to use instead.
13061 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13063 @opindex fcombine-stack-adjustments
13064 @item -fcombine-stack-adjustments
13065 Tracks stack adjustments (pushes and pops) and stack memory references
13066 and then tries to find ways to combine them.
13068 Enabled by default at @option{-O1} and higher.
13070 @opindex fipa-ra
13071 @item -fipa-ra
13072 Use caller save registers for allocation if those registers are not used by
13073 any called function.  In that case it is not necessary to save and restore
13074 them around calls.  This is only possible if called functions are part of
13075 same compilation unit as current function and they are compiled before it.
13077 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
13078 is disabled if generated code will be instrumented for profiling
13079 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
13080 exactly (this happens on targets that do not expose prologues
13081 and epilogues in RTL).
13083 @opindex fconserve-stack
13084 @item -fconserve-stack
13085 Attempt to minimize stack usage.  The compiler attempts to use less
13086 stack space, even if that makes the program slower.  This option
13087 implies setting the @option{large-stack-frame} parameter to 100
13088 and the @option{large-stack-frame-growth} parameter to 400.
13090 @opindex ftree-reassoc
13091 @item -ftree-reassoc
13092 Perform reassociation on trees.  This flag is enabled by default
13093 at @option{-O1} and higher.
13095 @opindex fcode-hoisting
13096 @item -fcode-hoisting
13097 Perform code hoisting.  Code hoisting tries to move the
13098 evaluation of expressions executed on all paths to the function exit
13099 as early as possible.  This is especially useful as a code size
13100 optimization, but it often helps for code speed as well.
13101 This flag is enabled by default at @option{-O2} and higher.
13103 @opindex ftree-pre
13104 @item -ftree-pre
13105 Perform partial redundancy elimination (PRE) on trees.  This flag is
13106 enabled by default at @option{-O2} and @option{-O3}.
13108 @opindex ftree-partial-pre
13109 @item -ftree-partial-pre
13110 Make partial redundancy elimination (PRE) more aggressive.  This flag is
13111 enabled by default at @option{-O3}.
13113 @opindex ftree-forwprop
13114 @item -ftree-forwprop
13115 Perform forward propagation on trees.  This flag is enabled by default
13116 at @option{-O1} and higher.
13118 @opindex ftree-fre
13119 @item -ftree-fre
13120 Perform full redundancy elimination (FRE) on trees.  The difference
13121 between FRE and PRE is that FRE only considers expressions
13122 that are computed on all paths leading to the redundant computation.
13123 This analysis is faster than PRE, though it exposes fewer redundancies.
13124 This flag is enabled by default at @option{-O1} and higher.
13126 @opindex ftree-phiprop
13127 @item -ftree-phiprop
13128 Perform hoisting of loads from conditional pointers on trees.  This
13129 pass is enabled by default at @option{-O1} and higher.
13131 @opindex fhoist-adjacent-loads
13132 @item -fhoist-adjacent-loads
13133 Speculatively hoist loads from both branches of an if-then-else if the
13134 loads are from adjacent locations in the same structure and the target
13135 architecture has a conditional move instruction.  This flag is enabled
13136 by default at @option{-O2} and higher.
13138 @opindex ftree-copy-prop
13139 @item -ftree-copy-prop
13140 Perform copy propagation on trees.  This pass eliminates unnecessary
13141 copy operations.  This flag is enabled by default at @option{-O1} and
13142 higher.
13144 @opindex fipa-pure-const
13145 @item -fipa-pure-const
13146 Discover which functions are pure or constant.
13147 Enabled by default at @option{-O1} and higher.
13149 @opindex fipa-reference
13150 @item -fipa-reference
13151 Discover which static variables do not escape the
13152 compilation unit.
13153 Enabled by default at @option{-O1} and higher.
13155 @opindex fipa-reference-addressable
13156 @item -fipa-reference-addressable
13157 Discover read-only, write-only and non-addressable static variables.
13158 Enabled by default at @option{-O1} and higher.
13160 @opindex fipa-stack-alignment
13161 @item -fipa-stack-alignment
13162 Reduce stack alignment on call sites if possible.
13163 Enabled by default.
13165 @opindex fipa-pta
13166 @item -fipa-pta
13167 Perform interprocedural pointer analysis and interprocedural modification
13168 and reference analysis.  This option can cause excessive memory and
13169 compile-time usage on large compilation units.  It is not enabled by
13170 default at any optimization level.
13172 @opindex fipa-profile
13173 @item -fipa-profile
13174 Perform interprocedural profile propagation.  The functions called only from
13175 cold functions are marked as cold. Also functions executed once (such as
13176 @code{cold}, @code{noreturn}, static constructors or destructors) are
13177 identified. Cold functions and loop less parts of functions executed once are
13178 then optimized for size.
13179 Enabled by default at @option{-O1} and higher.
13181 @opindex fipa-modref
13182 @item -fipa-modref
13183 Perform interprocedural mod/ref analysis.  This optimization analyzes the side
13184 effects of functions (memory locations that are modified or referenced) and
13185 enables better optimization across the function call boundary.  This flag is
13186 enabled by default at @option{-O1} and higher.
13188 @opindex fipa-cp
13189 @item -fipa-cp
13190 Perform interprocedural constant propagation.
13191 This optimization analyzes the program to determine when values passed
13192 to functions are constants and then optimizes accordingly.
13193 This optimization can substantially increase performance
13194 if the application has constants passed to functions.
13195 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
13196 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13198 @opindex fipa-cp-clone
13199 @item -fipa-cp-clone
13200 Perform function cloning to make interprocedural constant propagation stronger.
13201 When enabled, interprocedural constant propagation performs function cloning
13202 when externally visible function can be called with constant arguments.
13203 Because this optimization can create multiple copies of functions,
13204 it may significantly increase code size
13205 (see @option{--param ipa-cp-unit-growth=@var{value}}).
13206 This flag is enabled by default at @option{-O3}.
13207 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13209 @opindex fipa-bit-cp
13210 @item -fipa-bit-cp
13211 When enabled, perform interprocedural bitwise constant
13212 propagation. This flag is enabled by default at @option{-O2} and
13213 by @option{-fprofile-use} and @option{-fauto-profile}.
13214 It requires that @option{-fipa-cp} is enabled.  
13216 @opindex fipa-vrp
13217 @item -fipa-vrp
13218 When enabled, perform interprocedural propagation of value
13219 ranges. This flag is enabled by default at @option{-O2}. It requires
13220 that @option{-fipa-cp} is enabled.
13222 @opindex fipa-icf
13223 @item -fipa-icf
13224 Perform Identical Code Folding for functions and read-only variables.
13225 The optimization reduces code size and may disturb unwind stacks by replacing
13226 a function by equivalent one with a different name. The optimization works
13227 more effectively with link-time optimization enabled.
13229 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
13230 works on different levels and thus the optimizations are not same - there are
13231 equivalences that are found only by GCC and equivalences found only by Gold.
13233 This flag is enabled by default at @option{-O2} and @option{-Os}.
13235 @opindex flive-patching
13236 @item -flive-patching=@var{level}
13237 Control GCC's optimizations to produce output suitable for live-patching.
13239 If the compiler's optimization uses a function's body or information extracted
13240 from its body to optimize/change another function, the latter is called an
13241 impacted function of the former.  If a function is patched, its impacted
13242 functions should be patched too.
13244 The impacted functions are determined by the compiler's interprocedural
13245 optimizations.  For example, a caller is impacted when inlining a function
13246 into its caller,
13247 cloning a function and changing its caller to call this new clone,
13248 or extracting a function's pureness/constness information to optimize
13249 its direct or indirect callers, etc.
13251 Usually, the more IPA optimizations enabled, the larger the number of
13252 impacted functions for each function.  In order to control the number of
13253 impacted functions and more easily compute the list of impacted function,
13254 IPA optimizations can be partially enabled at two different levels.
13256 The @var{level} argument should be one of the following:
13258 @table @samp
13260 @item inline-clone
13262 Only enable inlining and cloning optimizations, which includes inlining,
13263 cloning, interprocedural scalar replacement of aggregates and partial inlining.
13264 As a result, when patching a function, all its callers and its clones'
13265 callers are impacted, therefore need to be patched as well.
13267 @option{-flive-patching=inline-clone} disables the following optimization flags:
13268 @gccoptlist{-fwhole-program  -fipa-pta  -fipa-reference  -fipa-ra
13269 -fipa-icf  -fipa-icf-functions  -fipa-icf-variables
13270 -fipa-bit-cp  -fipa-vrp  -fipa-pure-const
13271 -fipa-reference-addressable
13272 -fipa-stack-alignment -fipa-modref}
13274 @item inline-only-static
13276 Only enable inlining of static functions.
13277 As a result, when patching a static function, all its callers are impacted
13278 and so need to be patched as well.
13280 In addition to all the flags that @option{-flive-patching=inline-clone}
13281 disables,
13282 @option{-flive-patching=inline-only-static} disables the following additional
13283 optimization flags:
13284 @gccoptlist{-fipa-cp-clone  -fipa-sra  -fpartial-inlining  -fipa-cp}
13286 @end table
13288 When @option{-flive-patching} is specified without any value, the default value
13289 is @var{inline-clone}.
13291 This flag is disabled by default.
13293 Note that @option{-flive-patching} is not supported with link-time optimization
13294 (@option{-flto}).
13296 @opindex fisolate-erroneous-paths-dereference
13297 @item -fisolate-erroneous-paths-dereference
13298 Detect paths that trigger erroneous or undefined behavior due to
13299 dereferencing a null pointer.  Isolate those paths from the main control
13300 flow and turn the statement with erroneous or undefined behavior into a trap.
13301 This flag is enabled by default at @option{-O2} and higher and depends on
13302 @option{-fdelete-null-pointer-checks} also being enabled.
13304 @opindex fisolate-erroneous-paths-attribute
13305 @item -fisolate-erroneous-paths-attribute
13306 Detect paths that trigger erroneous or undefined behavior due to a null value
13307 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
13308 attribute.  Isolate those paths from the main control flow and turn the
13309 statement with erroneous or undefined behavior into a trap.  This is not
13310 currently enabled, but may be enabled by @option{-O2} in the future.
13312 @opindex ftree-sink
13313 @item -ftree-sink
13314 Perform forward store motion on trees.  This flag is
13315 enabled by default at @option{-O1} and higher.
13317 @opindex ftree-bit-ccp
13318 @item -ftree-bit-ccp
13319 Perform sparse conditional bit constant propagation on trees and propagate
13320 pointer alignment information.
13321 This pass only operates on local scalar variables and is enabled by default
13322 at @option{-O1} and higher, except for @option{-Og}.
13323 It requires that @option{-ftree-ccp} is enabled.
13325 @opindex ftree-ccp
13326 @item -ftree-ccp
13327 Perform sparse conditional constant propagation (CCP) on trees.  This
13328 pass only operates on local scalar variables and is enabled by default
13329 at @option{-O1} and higher.
13331 @opindex fssa-backprop
13332 @item -fssa-backprop
13333 Propagate information about uses of a value up the definition chain
13334 in order to simplify the definitions.  For example, this pass strips
13335 sign operations if the sign of a value never matters.  The flag is
13336 enabled by default at @option{-O1} and higher.
13338 @opindex fssa-phiopt
13339 @item -fssa-phiopt
13340 Perform pattern matching on SSA PHI nodes to optimize conditional
13341 code.  This pass is enabled by default at @option{-O1} and higher,
13342 except for @option{-Og}.
13344 @opindex ftree-switch-conversion
13345 @item -ftree-switch-conversion
13346 Perform conversion of simple initializations in a switch to
13347 initializations from a scalar array.  This flag is enabled by default
13348 at @option{-O2} and higher.
13350 @opindex ftree-tail-merge
13351 @item -ftree-tail-merge
13352 Look for identical code sequences.  When found, replace one with a jump to the
13353 other.  This optimization is known as tail merging or cross jumping.  This flag
13354 is enabled by default at @option{-O2} and higher.  The compilation time
13355 in this pass can
13356 be limited using @option{max-tail-merge-comparisons} parameter and
13357 @option{max-tail-merge-iterations} parameter.
13359 @opindex ftree-dce
13360 @item -ftree-dce
13361 Perform dead code elimination (DCE) on trees.  This flag is enabled by
13362 default at @option{-O1} and higher.
13364 @opindex ftree-builtin-call-dce
13365 @item -ftree-builtin-call-dce
13366 Perform conditional dead code elimination (DCE) for calls to built-in functions
13367 that may set @code{errno} but are otherwise free of side effects.  This flag is
13368 enabled by default at @option{-O2} and higher if @option{-Os} is not also
13369 specified.
13371 @opindex ffinite-loops
13372 @opindex fno-finite-loops
13373 @item -ffinite-loops
13374 Assume that a loop with an exit will eventually take the exit and not loop
13375 indefinitely.  This allows the compiler to remove loops that otherwise have
13376 no side-effects, not considering eventual endless looping as such.
13378 This option is enabled by default at @option{-O2} for C++ with -std=c++11
13379 or higher.
13381 @opindex ftree-dominator-opts
13382 @item -ftree-dominator-opts
13383 Perform a variety of simple scalar cleanups (constant/copy
13384 propagation, redundancy elimination, range propagation and expression
13385 simplification) based on a dominator tree traversal.  This also
13386 performs jump threading (to reduce jumps to jumps). This flag is
13387 enabled by default at @option{-O1} and higher.
13389 @opindex ftree-dse
13390 @item -ftree-dse
13391 Perform dead store elimination (DSE) on trees.  A dead store is a store into
13392 a memory location that is later overwritten by another store without
13393 any intervening loads.  In this case the earlier store can be deleted.  This
13394 flag is enabled by default at @option{-O1} and higher.
13396 @opindex ftree-ch
13397 @item -ftree-ch
13398 Perform loop header copying on trees.  This is beneficial since it increases
13399 effectiveness of code motion optimizations.  It also saves one jump.  This flag
13400 is enabled by default at @option{-O1} and higher.  It is not enabled
13401 for @option{-Os}, since it usually increases code size.
13403 @opindex ftree-loop-optimize
13404 @item -ftree-loop-optimize
13405 Perform loop optimizations on trees.  This flag is enabled by default
13406 at @option{-O1} and higher.
13408 @opindex ftree-loop-linear
13409 @opindex floop-strip-mine
13410 @opindex floop-block
13411 @item -ftree-loop-linear
13412 @itemx -floop-strip-mine
13413 @itemx -floop-block
13414 Perform loop nest optimizations.  Same as
13415 @option{-floop-nest-optimize}.  To use this code transformation, GCC has
13416 to be configured with @option{--with-isl} to enable the Graphite loop
13417 transformation infrastructure.
13419 @opindex fgraphite-identity
13420 @item -fgraphite-identity
13421 Enable the identity transformation for graphite.  For every SCoP we generate
13422 the polyhedral representation and transform it back to gimple.  Using
13423 @option{-fgraphite-identity} we can check the costs or benefits of the
13424 GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
13425 are also performed by the code generator isl, like index splitting and
13426 dead code elimination in loops.
13428 @opindex floop-nest-optimize
13429 @item -floop-nest-optimize
13430 Enable the isl based loop nest optimizer.  This is a generic loop nest
13431 optimizer based on the Pluto optimization algorithms.  It calculates a loop
13432 structure optimized for data-locality and parallelism.  This option
13433 is experimental.
13435 @opindex floop-parallelize-all
13436 @item -floop-parallelize-all
13437 Use the Graphite data dependence analysis to identify loops that can
13438 be parallelized.  Parallelize all the loops that can be analyzed to
13439 not contain loop carried dependences without checking that it is
13440 profitable to parallelize the loops.
13442 @opindex ftree-coalesce-vars
13443 @item -ftree-coalesce-vars
13444 While transforming the program out of the SSA representation, attempt to
13445 reduce copying by coalescing versions of different user-defined
13446 variables, instead of just compiler temporaries.  This may severely
13447 limit the ability to debug an optimized program compiled with
13448 @option{-fno-var-tracking-assignments}.  In the negated form, this flag
13449 prevents SSA coalescing of user variables.  This option is enabled by
13450 default if optimization is enabled, and it does very little otherwise.
13452 @opindex ftree-loop-if-convert
13453 @item -ftree-loop-if-convert
13454 Attempt to transform conditional jumps in the innermost loops to
13455 branch-less equivalents.  The intent is to remove control-flow from
13456 the innermost loops in order to improve the ability of the
13457 vectorization pass to handle these loops.  This is enabled by default
13458 if vectorization is enabled.
13460 @opindex ftree-loop-distribution
13461 @item -ftree-loop-distribution
13462 Perform loop distribution.  This flag can improve cache performance on
13463 big loop bodies and allow further loop optimizations, like
13464 parallelization or vectorization, to take place.  For example, the loop
13465 @smallexample
13466 DO I = 1, N
13467   A(I) = B(I) + C
13468   D(I) = E(I) * F
13469 ENDDO
13470 @end smallexample
13471 is transformed to
13472 @smallexample
13473 DO I = 1, N
13474    A(I) = B(I) + C
13475 ENDDO
13476 DO I = 1, N
13477    D(I) = E(I) * F
13478 ENDDO
13479 @end smallexample
13480 This flag is enabled by default at @option{-O3}.
13481 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13483 @opindex ftree-loop-distribute-patterns
13484 @item -ftree-loop-distribute-patterns
13485 Perform loop distribution of patterns that can be code generated with
13486 calls to a library.  This flag is enabled by default at @option{-O2} and
13487 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
13489 This pass distributes the initialization loops and generates a call to
13490 memset zero.  For example, the loop
13491 @smallexample
13492 DO I = 1, N
13493   A(I) = 0
13494   B(I) = A(I) + I
13495 ENDDO
13496 @end smallexample
13497 is transformed to
13498 @smallexample
13499 DO I = 1, N
13500    A(I) = 0
13501 ENDDO
13502 DO I = 1, N
13503    B(I) = A(I) + I
13504 ENDDO
13505 @end smallexample
13506 and the initialization loop is transformed into a call to memset zero.
13507 This flag is enabled by default at @option{-O3}.
13508 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13510 @opindex floop-interchange
13511 @item -floop-interchange
13512 Perform loop interchange outside of graphite.  This flag can improve cache
13513 performance on loop nest and allow further loop optimizations, like
13514 vectorization, to take place.  For example, the loop
13515 @smallexample
13516 for (int i = 0; i < N; i++)
13517   for (int j = 0; j < N; j++)
13518     for (int k = 0; k < N; k++)
13519       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13520 @end smallexample
13521 is transformed to
13522 @smallexample
13523 for (int i = 0; i < N; i++)
13524   for (int k = 0; k < N; k++)
13525     for (int j = 0; j < N; j++)
13526       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13527 @end smallexample
13528 This flag is enabled by default at @option{-O3}.
13529 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13531 @opindex floop-unroll-and-jam
13532 @item -floop-unroll-and-jam
13533 Apply unroll and jam transformations on feasible loops.  In a loop
13534 nest this unrolls the outer loop by some factor and fuses the resulting
13535 multiple inner loops.  This flag is enabled by default at @option{-O3}.
13536 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13538 @opindex ftree-loop-im
13539 @item -ftree-loop-im
13540 Perform loop invariant motion on trees.  This pass moves only invariants that
13541 are hard to handle at RTL level (function calls, operations that expand to
13542 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
13543 operands of conditions that are invariant out of the loop, so that we can use
13544 just trivial invariantness analysis in loop unswitching.  The pass also includes
13545 store motion.
13547 @opindex ftree-loop-ivcanon
13548 @item -ftree-loop-ivcanon
13549 Create a canonical counter for number of iterations in loops for which
13550 determining number of iterations requires complicated analysis.  Later
13551 optimizations then may determine the number easily.  Useful especially
13552 in connection with unrolling.
13554 @opindex ftree-scev-cprop
13555 @item -ftree-scev-cprop
13556 Perform final value replacement.  If a variable is modified in a loop
13557 in such a way that its value when exiting the loop can be determined using
13558 only its initial value and the number of loop iterations, replace uses of
13559 the final value by such a computation, provided it is sufficiently cheap.
13560 This reduces data dependencies and may allow further simplifications.
13561 Enabled by default at @option{-O1} and higher.
13563 @opindex fivopts
13564 @item -fivopts
13565 Perform induction variable optimizations (strength reduction, induction
13566 variable merging and induction variable elimination) on trees.
13568 @opindex ftree-parallelize-loops
13569 @item -ftree-parallelize-loops=n
13570 Parallelize loops, i.e., split their iteration space to run in n threads.
13571 This is only possible for loops whose iterations are independent
13572 and can be arbitrarily reordered.  The optimization is only
13573 profitable on multiprocessor machines, for loops that are CPU-intensive,
13574 rather than constrained e.g.@: by memory bandwidth.  This option
13575 implies @option{-pthread}, and thus is only supported on targets
13576 that have support for @option{-pthread}.
13578 @opindex ftree-pta
13579 @item -ftree-pta
13580 Perform function-local points-to analysis on trees.  This flag is
13581 enabled by default at @option{-O1} and higher, except for @option{-Og}.
13583 @opindex ftree-sra
13584 @item -ftree-sra
13585 Perform scalar replacement of aggregates.  This pass replaces structure
13586 references with scalars to prevent committing structures to memory too
13587 early.  This flag is enabled by default at @option{-O1} and higher,
13588 except for @option{-Og}.
13590 @opindex fstore-merging
13591 @item -fstore-merging
13592 Perform merging of narrow stores to consecutive memory addresses.  This pass
13593 merges contiguous stores of immediate values narrower than a word into fewer
13594 wider stores to reduce the number of instructions.  This is enabled by default
13595 at @option{-O2} and higher as well as @option{-Os}.
13597 @opindex ftree-ter
13598 @item -ftree-ter
13599 Perform temporary expression replacement during the SSA->normal phase.  Single
13600 use/single def temporaries are replaced at their use location with their
13601 defining expression.  This results in non-GIMPLE code, but gives the expanders
13602 much more complex trees to work on resulting in better RTL generation.  This is
13603 enabled by default at @option{-O1} and higher.
13605 @opindex ftree-slsr
13606 @item -ftree-slsr
13607 Perform straight-line strength reduction on trees.  This recognizes related
13608 expressions involving multiplications and replaces them by less expensive
13609 calculations when possible.  This is enabled by default at @option{-O1} and
13610 higher.
13612 @opindex ftree-vectorize
13613 @item -ftree-vectorize
13614 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
13615 and @option{-ftree-slp-vectorize} if not explicitly specified.
13617 @opindex ftree-loop-vectorize
13618 @item -ftree-loop-vectorize
13619 Perform loop vectorization on trees. This flag is enabled by default at
13620 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13621 and @option{-fauto-profile}.
13623 @opindex ftree-slp-vectorize
13624 @item -ftree-slp-vectorize
13625 Perform basic block vectorization on trees. This flag is enabled by default at
13626 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13627 and @option{-fauto-profile}.
13629 @opindex ftrivial-auto-var-init
13630 @item -ftrivial-auto-var-init=@var{choice}
13631 Initialize automatic variables with either a pattern or with zeroes to increase
13632 the security and predictability of a program by preventing uninitialized memory
13633 disclosure and use.
13634 GCC still considers an automatic variable that doesn't have an explicit
13635 initializer as uninitialized, @option{-Wuninitialized} and
13636 @option{-Wanalyzer-use-of-uninitialized-value} will still report
13637 warning messages on such automatic variables and the compiler will
13638 perform optimization as if the variable were uninitialized.
13639 With this option, GCC will also initialize any padding of automatic variables
13640 that have structure or union types to zeroes.
13641 However, the current implementation cannot initialize automatic variables that
13642 are declared between the controlling expression and the first case of a
13643 @code{switch} statement.  Using @option{-Wtrivial-auto-var-init} to report all
13644 such cases.
13646 The three values of @var{choice} are:
13648 @itemize @bullet
13649 @item
13650 @samp{uninitialized} doesn't initialize any automatic variables.
13651 This is C and C++'s default.
13653 @item
13654 @samp{pattern} Initialize automatic variables with values which will likely
13655 transform logic bugs into crashes down the line, are easily recognized in a
13656 crash dump and without being values that programmers can rely on for useful
13657 program semantics.
13658 The current value is byte-repeatable pattern with byte "0xFE".
13659 The values used for pattern initialization might be changed in the future.
13661 @item
13662 @samp{zero} Initialize automatic variables with zeroes.
13663 @end itemize
13665 The default is @samp{uninitialized}.
13667 You can control this behavior for a specific variable by using the variable
13668 attribute @code{uninitialized} (@pxref{Variable Attributes}).
13670 @opindex fvect-cost-model
13671 @item -fvect-cost-model=@var{model}
13672 Alter the cost model used for vectorization.  The @var{model} argument
13673 should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
13674 @samp{very-cheap}.
13675 With the @samp{unlimited} model the vectorized code-path is assumed
13676 to be profitable while with the @samp{dynamic} model a runtime check
13677 guards the vectorized code-path to enable it only for iteration
13678 counts that will likely execute faster than when executing the original
13679 scalar loop.  The @samp{cheap} model disables vectorization of
13680 loops where doing so would be cost prohibitive for example due to
13681 required runtime checks for data dependence or alignment but otherwise
13682 is equal to the @samp{dynamic} model.  The @samp{very-cheap} model only
13683 allows vectorization if the vector code would entirely replace the
13684 scalar code that is being vectorized.  For example, if each iteration
13685 of a vectorized loop would only be able to handle exactly four iterations
13686 of the scalar loop, the @samp{very-cheap} model would only allow
13687 vectorization if the scalar iteration count is known to be a multiple
13688 of four.
13690 The default cost model depends on other optimization flags and is
13691 either @samp{dynamic} or @samp{cheap}.
13693 @opindex fsimd-cost-model
13694 @item -fsimd-cost-model=@var{model}
13695 Alter the cost model used for vectorization of loops marked with the OpenMP
13696 simd directive.  The @var{model} argument should be one of
13697 @samp{unlimited}, @samp{dynamic}, @samp{cheap}.  All values of @var{model}
13698 have the same meaning as described in @option{-fvect-cost-model} and by
13699 default a cost model defined with @option{-fvect-cost-model} is used.
13701 @opindex ftree-vrp
13702 @item -ftree-vrp
13703 Perform Value Range Propagation on trees.  This is similar to the
13704 constant propagation pass, but instead of values, ranges of values are
13705 propagated.  This allows the optimizers to remove unnecessary range
13706 checks like array bound checks and null pointer checks.  This is
13707 enabled by default at @option{-O2} and higher.  Null pointer check
13708 elimination is only done if @option{-fdelete-null-pointer-checks} is
13709 enabled.
13711 @opindex fsplit-paths
13712 @item -fsplit-paths
13713 Split paths leading to loop backedges.  This can improve dead code
13714 elimination and common subexpression elimination.  This is enabled by
13715 default at @option{-O3} and above.
13717 @opindex fsplit-ivs-in-unroller
13718 @item -fsplit-ivs-in-unroller
13719 Enables expression of values of induction variables in later iterations
13720 of the unrolled loop using the value in the first iteration.  This breaks
13721 long dependency chains, thus improving efficiency of the scheduling passes.
13723 A combination of @option{-fweb} and CSE is often sufficient to obtain the
13724 same effect.  However, that is not reliable in cases where the loop body
13725 is more complicated than a single basic block.  It also does not work at all
13726 on some architectures due to restrictions in the CSE pass.
13728 This optimization is enabled by default.
13730 @opindex fvariable-expansion-in-unroller
13731 @item -fvariable-expansion-in-unroller
13732 With this option, the compiler creates multiple copies of some
13733 local variables when unrolling a loop, which can result in superior code.
13735 This optimization is enabled by default for PowerPC targets, but disabled
13736 by default otherwise.
13738 @opindex fpartial-inlining
13739 @item -fpartial-inlining
13740 Inline parts of functions.  This option has any effect only
13741 when inlining itself is turned on by the @option{-finline-functions}
13742 or @option{-finline-small-functions} options.
13744 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13746 @opindex fpredictive-commoning
13747 @item -fpredictive-commoning
13748 Perform predictive commoning optimization, i.e., reusing computations
13749 (especially memory loads and stores) performed in previous
13750 iterations of loops.
13752 This option is enabled at level @option{-O3}.
13753 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13755 @opindex fprefetch-loop-arrays
13756 @item -fprefetch-loop-arrays
13757 If supported by the target machine, generate instructions to prefetch
13758 memory to improve the performance of loops that access large arrays.
13760 This option may generate better or worse code; results are highly
13761 dependent on the structure of loops within the source code.
13763 Disabled at level @option{-Os}.
13765 @opindex fno-printf-return-value
13766 @opindex fprintf-return-value
13767 @item -fno-printf-return-value
13768 Do not substitute constants for known return value of formatted output
13769 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
13770 @code{vsnprintf} (but not @code{printf} of @code{fprintf}).  This
13771 transformation allows GCC to optimize or even eliminate branches based
13772 on the known return value of these functions called with arguments that
13773 are either constant, or whose values are known to be in a range that
13774 makes determining the exact return value possible.  For example, when
13775 @option{-fprintf-return-value} is in effect, both the branch and the
13776 body of the @code{if} statement (but not the call to @code{snprint})
13777 can be optimized away when @code{i} is a 32-bit or smaller integer
13778 because the return value is guaranteed to be at most 8.
13780 @smallexample
13781 char buf[9];
13782 if (snprintf (buf, "%08x", i) >= sizeof buf)
13783   @dots{}
13784 @end smallexample
13786 The @option{-fprintf-return-value} option relies on other optimizations
13787 and yields best results with @option{-O2} and above.  It works in tandem
13788 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
13789 options.  The @option{-fprintf-return-value} option is enabled by default.
13791 @opindex fno-peephole
13792 @opindex fpeephole
13793 @opindex fno-peephole2
13794 @opindex fpeephole2
13795 @item -fno-peephole
13796 @itemx -fno-peephole2
13797 Disable any machine-specific peephole optimizations.  The difference
13798 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
13799 are implemented in the compiler; some targets use one, some use the
13800 other, a few use both.
13802 @option{-fpeephole} is enabled by default.
13803 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13805 @opindex fno-guess-branch-probability
13806 @opindex fguess-branch-probability
13807 @item -fno-guess-branch-probability
13808 Do not guess branch probabilities using heuristics.
13810 GCC uses heuristics to guess branch probabilities if they are
13811 not provided by profiling feedback (@option{-fprofile-arcs}).  These
13812 heuristics are based on the control flow graph.  If some branch probabilities
13813 are specified by @code{__builtin_expect}, then the heuristics are
13814 used to guess branch probabilities for the rest of the control flow graph,
13815 taking the @code{__builtin_expect} info into account.  The interactions
13816 between the heuristics and @code{__builtin_expect} can be complex, and in
13817 some cases, it may be useful to disable the heuristics so that the effects
13818 of @code{__builtin_expect} are easier to understand.
13820 It is also possible to specify expected probability of the expression
13821 with @code{__builtin_expect_with_probability} built-in function.
13823 The default is @option{-fguess-branch-probability} at levels
13824 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
13826 @opindex freorder-blocks
13827 @item -freorder-blocks
13828 Reorder basic blocks in the compiled function in order to reduce number of
13829 taken branches and improve code locality.
13831 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
13833 @opindex freorder-blocks-algorithm
13834 @item -freorder-blocks-algorithm=@var{algorithm}
13835 Use the specified algorithm for basic block reordering.  The
13836 @var{algorithm} argument can be @samp{simple}, which does not increase
13837 code size (except sometimes due to secondary effects like alignment),
13838 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
13839 put all often executed code together, minimizing the number of branches
13840 executed by making extra copies of code.
13842 The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and
13843 @samp{stc} at levels @option{-O2}, @option{-O3}.
13845 @opindex freorder-blocks-and-partition
13846 @item -freorder-blocks-and-partition
13847 In addition to reordering basic blocks in the compiled function, in order
13848 to reduce number of taken branches, partitions hot and cold basic blocks
13849 into separate sections of the assembly and @file{.o} files, to improve
13850 paging and cache locality performance.
13852 This optimization is automatically turned off in the presence of
13853 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
13854 section attribute and on any architecture that does not support named
13855 sections.  When @option{-fsplit-stack} is used this option is not
13856 enabled by default (to avoid linker errors), but may be enabled
13857 explicitly (if using a working linker).
13859 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
13861 @opindex freorder-functions
13862 @item -freorder-functions
13863 Reorder functions in the object file in order to
13864 improve code locality.  This is implemented by using special
13865 subsections @code{.text.hot} for most frequently executed functions and
13866 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
13867 the linker so object file format must support named sections and linker must
13868 place them in a reasonable way.
13870 This option isn't effective unless you either provide profile feedback
13871 (see @option{-fprofile-arcs} for details) or manually annotate functions with 
13872 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
13874 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13876 @opindex fstrict-aliasing
13877 @item -fstrict-aliasing
13878 Allow the compiler to assume the strictest aliasing rules applicable to
13879 the language being compiled.  For C (and C++), this activates
13880 optimizations based on the type of expressions.  In particular, an
13881 object of one type is assumed never to reside at the same address as an
13882 object of a different type, unless the types are almost the same.  For
13883 example, an @code{unsigned int} can alias an @code{int}, but not a
13884 @code{void*} or a @code{double}.  A character type may alias any other
13885 type.
13887 @anchor{Type-punning}Pay special attention to code like this:
13888 @smallexample
13889 union a_union @{
13890   int i;
13891   double d;
13894 int f() @{
13895   union a_union t;
13896   t.d = 3.0;
13897   return t.i;
13899 @end smallexample
13900 The practice of reading from a different union member than the one most
13901 recently written to (called ``type-punning'') is common.  Even with
13902 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
13903 is accessed through the union type.  So, the code above works as
13904 expected.  @xref{Structures unions enumerations and bit-fields
13905 implementation}.  However, this code might not:
13906 @smallexample
13907 int f() @{
13908   union a_union t;
13909   int* ip;
13910   t.d = 3.0;
13911   ip = &t.i;
13912   return *ip;
13914 @end smallexample
13916 Similarly, access by taking the address, casting the resulting pointer
13917 and dereferencing the result has undefined behavior, even if the cast
13918 uses a union type, e.g.:
13919 @smallexample
13920 int f() @{
13921   double d = 3.0;
13922   return ((union a_union *) &d)->i;
13924 @end smallexample
13926 The @option{-fstrict-aliasing} option is enabled at levels
13927 @option{-O2}, @option{-O3}, @option{-Os}.
13929 @opindex fipa-strict-aliasing
13930 @item -fipa-strict-aliasing
13931 Controls whether rules of @option{-fstrict-aliasing} are applied across
13932 function boundaries.  Note that if multiple functions gets inlined into a
13933 single function the memory accesses are no longer considered to be crossing a
13934 function boundary.
13936 The @option{-fipa-strict-aliasing} option is enabled by default and is
13937 effective only in combination with @option{-fstrict-aliasing}.
13939 @opindex falign-functions
13940 @item -falign-functions
13941 @itemx -falign-functions=@var{n}
13942 @itemx -falign-functions=@var{n}:@var{m}
13943 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
13944 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
13945 Align the start of functions to the next power-of-two greater than or
13946 equal to @var{n}, skipping up to @var{m}-1 bytes.  This ensures that at
13947 least the first @var{m} bytes of the function can be fetched by the CPU
13948 without crossing an @var{n}-byte alignment boundary.
13950 If @var{m} is not specified, it defaults to @var{n}.
13952 Examples: @option{-falign-functions=32} aligns functions to the next
13953 32-byte boundary, @option{-falign-functions=24} aligns to the next
13954 32-byte boundary only if this can be done by skipping 23 bytes or less,
13955 @option{-falign-functions=32:7} aligns to the next
13956 32-byte boundary only if this can be done by skipping 6 bytes or less.
13958 The second pair of @var{n2}:@var{m2} values allows you to specify
13959 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
13960 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
13961 otherwise aligns to the next 32-byte boundary if this can be done
13962 by skipping 2 bytes or less.
13963 If @var{m2} is not specified, it defaults to @var{n2}.
13965 Some assemblers only support this flag when @var{n} is a power of two;
13966 in that case, it is rounded up.
13968 @option{-fno-align-functions} and @option{-falign-functions=1} are
13969 equivalent and mean that functions are not aligned.
13971 If @var{n} is not specified or is zero, use a machine-dependent default.
13972 The maximum allowed @var{n} option value is 65536.
13974 Enabled at levels @option{-O2}, @option{-O3}.
13976 @item -flimit-function-alignment
13977 If this option is enabled, the compiler tries to avoid unnecessarily
13978 overaligning functions. It attempts to instruct the assembler to align
13979 by the amount specified by @option{-falign-functions}, but not to
13980 skip more bytes than the size of the function.
13982 @opindex falign-labels
13983 @item -falign-labels
13984 @itemx -falign-labels=@var{n}
13985 @itemx -falign-labels=@var{n}:@var{m}
13986 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
13987 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
13988 Align all branch targets to a power-of-two boundary.
13990 Parameters of this option are analogous to the @option{-falign-functions} option.
13991 @option{-fno-align-labels} and @option{-falign-labels=1} are
13992 equivalent and mean that labels are not aligned.
13994 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
13995 are greater than this value, then their values are used instead.
13997 If @var{n} is not specified or is zero, use a machine-dependent default
13998 which is very likely to be @samp{1}, meaning no alignment.
13999 The maximum allowed @var{n} option value is 65536.
14001 Enabled at levels @option{-O2}, @option{-O3}.
14003 @opindex falign-loops
14004 @item -falign-loops
14005 @itemx -falign-loops=@var{n}
14006 @itemx -falign-loops=@var{n}:@var{m}
14007 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
14008 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
14009 Align loops to a power-of-two boundary.  If the loops are executed
14010 many times, this makes up for any execution of the dummy padding
14011 instructions.
14013 If @option{-falign-labels} is greater than this value, then its value
14014 is used instead.
14016 Parameters of this option are analogous to the @option{-falign-functions} option.
14017 @option{-fno-align-loops} and @option{-falign-loops=1} are
14018 equivalent and mean that loops are not aligned.
14019 The maximum allowed @var{n} option value is 65536.
14021 If @var{n} is not specified or is zero, use a machine-dependent default.
14023 Enabled at levels @option{-O2}, @option{-O3}.
14025 @opindex falign-jumps
14026 @item -falign-jumps
14027 @itemx -falign-jumps=@var{n}
14028 @itemx -falign-jumps=@var{n}:@var{m}
14029 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
14030 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
14031 Align branch targets to a power-of-two boundary, for branch targets
14032 where the targets can only be reached by jumping.  In this case,
14033 no dummy operations need be executed.
14035 If @option{-falign-labels} is greater than this value, then its value
14036 is used instead.
14038 Parameters of this option are analogous to the @option{-falign-functions} option.
14039 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
14040 equivalent and mean that loops are not aligned.
14042 If @var{n} is not specified or is zero, use a machine-dependent default.
14043 The maximum allowed @var{n} option value is 65536.
14045 Enabled at levels @option{-O2}, @option{-O3}.
14047 @opindex fno-allocation-dce
14048 @item -fno-allocation-dce
14049 Do not remove unused C++ allocations in dead code elimination.
14051 @opindex fallow-store-data-races
14052 @item -fallow-store-data-races
14053 Allow the compiler to perform optimizations that may introduce new data races
14054 on stores, without proving that the variable cannot be concurrently accessed
14055 by other threads.  Does not affect optimization of local data.  It is safe to
14056 use this option if it is known that global data will not be accessed by
14057 multiple threads.
14059 Examples of optimizations enabled by @option{-fallow-store-data-races} include
14060 hoisting or if-conversions that may cause a value that was already in memory
14061 to be re-written with that same value.  Such re-writing is safe in a single
14062 threaded context but may be unsafe in a multi-threaded context.  Note that on
14063 some processors, if-conversions may be required in order to enable
14064 vectorization.
14066 Enabled at level @option{-Ofast}.
14068 @opindex funit-at-a-time
14069 @item -funit-at-a-time
14070 This option is left for compatibility reasons. @option{-funit-at-a-time}
14071 has no effect, while @option{-fno-unit-at-a-time} implies
14072 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
14074 Enabled by default.
14076 @opindex fno-toplevel-reorder
14077 @opindex ftoplevel-reorder
14078 @item -fno-toplevel-reorder
14079 Do not reorder top-level functions, variables, and @code{asm}
14080 statements.  Output them in the same order that they appear in the
14081 input file.  When this option is used, unreferenced static variables
14082 are not removed.  This option is intended to support existing code
14083 that relies on a particular ordering.  For new code, it is better to
14084 use attributes when possible.
14086 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
14087 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
14088 Additionally @option{-fno-toplevel-reorder} implies
14089 @option{-fno-section-anchors}.
14091 @opindex funreachable-traps
14092 @item -funreachable-traps
14093 With this option, the compiler turns calls to
14094 @code{__builtin_unreachable} into traps, instead of using them for
14095 optimization.  This also affects any such calls implicitly generated
14096 by the compiler.
14098 This option has the same effect as @option{-fsanitize=unreachable
14099 -fsanitize-trap=unreachable}, but does not affect the values of those
14100 options.  If @option{-fsanitize=unreachable} is enabled, that option
14101 takes priority over this one.
14103 This option is enabled by default at @option{-O0} and @option{-Og}.
14105 @opindex fweb
14106 @item -fweb
14107 Constructs webs as commonly used for register allocation purposes and assign
14108 each web individual pseudo register.  This allows the register allocation pass
14109 to operate on pseudos directly, but also strengthens several other optimization
14110 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
14111 however, make debugging impossible, since variables no longer stay in a
14112 ``home register''.
14114 Enabled by default with @option{-funroll-loops}.
14116 @opindex fwhole-program
14117 @item -fwhole-program
14118 Assume that the current compilation unit represents the whole program being
14119 compiled.  All public functions and variables with the exception of @code{main}
14120 and those merged by attribute @code{externally_visible} become static functions
14121 and in effect are optimized more aggressively by interprocedural optimizers.
14123 With @option{-flto} this option has a limited use.  In most cases the
14124 precise list of symbols used or exported from the binary is known the
14125 resolution info passed to the link-time optimizer by the linker plugin.  It is
14126 still useful if no linker plugin is used or during incremental link step when
14127 final code is produced (with @option{-flto}
14128 @option{-flinker-output=nolto-rel}).
14130 @opindex flto
14131 @item -flto[=@var{n}]
14132 This option runs the standard link-time optimizer.  When invoked
14133 with source code, it generates GIMPLE (one of GCC's internal
14134 representations) and writes it to special ELF sections in the object
14135 file.  When the object files are linked together, all the function
14136 bodies are read from these ELF sections and instantiated as if they
14137 had been part of the same translation unit.
14139 To use the link-time optimizer, @option{-flto} and optimization
14140 options should be specified at compile time and during the final link.
14141 It is recommended that you compile all the files participating in the
14142 same link with the same options and also specify those options at
14143 link time.  
14144 For example:
14146 @smallexample
14147 gcc -c -O2 -flto foo.c
14148 gcc -c -O2 -flto bar.c
14149 gcc -o myprog -flto -O2 foo.o bar.o
14150 @end smallexample
14152 The first two invocations to GCC save a bytecode representation
14153 of GIMPLE into special ELF sections inside @file{foo.o} and
14154 @file{bar.o}.  The final invocation reads the GIMPLE bytecode from
14155 @file{foo.o} and @file{bar.o}, merges the two files into a single
14156 internal image, and compiles the result as usual.  Since both
14157 @file{foo.o} and @file{bar.o} are merged into a single image, this
14158 causes all the interprocedural analyses and optimizations in GCC to
14159 work across the two files as if they were a single one.  This means,
14160 for example, that the inliner is able to inline functions in
14161 @file{bar.o} into functions in @file{foo.o} and vice-versa.
14163 Another (simpler) way to enable link-time optimization is:
14165 @smallexample
14166 gcc -o myprog -flto -O2 foo.c bar.c
14167 @end smallexample
14169 The above generates bytecode for @file{foo.c} and @file{bar.c},
14170 merges them together into a single GIMPLE representation and optimizes
14171 them as usual to produce @file{myprog}.
14173 The important thing to keep in mind is that to enable link-time
14174 optimizations you need to use the GCC driver to perform the link step.
14175 GCC automatically performs link-time optimization if any of the
14176 objects involved were compiled with the @option{-flto} command-line option.  
14177 You can always override
14178 the automatic decision to do link-time optimization
14179 by passing @option{-fno-lto} to the link command.
14181 To make whole program optimization effective, it is necessary to make
14182 certain whole program assumptions.  The compiler needs to know
14183 what functions and variables can be accessed by libraries and runtime
14184 outside of the link-time optimized unit.  When supported by the linker,
14185 the linker plugin (see @option{-fuse-linker-plugin}) passes information
14186 to the compiler about used and externally visible symbols.  When
14187 the linker plugin is not available, @option{-fwhole-program} should be
14188 used to allow the compiler to make these assumptions, which leads
14189 to more aggressive optimization decisions.
14191 When a file is compiled with @option{-flto} without
14192 @option{-fuse-linker-plugin}, the generated object file is larger than
14193 a regular object file because it contains GIMPLE bytecodes and the usual
14194 final code (see @option{-ffat-lto-objects}).  This means that
14195 object files with LTO information can be linked as normal object
14196 files; if @option{-fno-lto} is passed to the linker, no
14197 interprocedural optimizations are applied.  Note that when
14198 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
14199 but you cannot perform a regular, non-LTO link on them.
14201 When producing the final binary, GCC only
14202 applies link-time optimizations to those files that contain bytecode.
14203 Therefore, you can mix and match object files and libraries with
14204 GIMPLE bytecodes and final object code.  GCC automatically selects
14205 which files to optimize in LTO mode and which files to link without
14206 further processing.
14208 Generally, options specified at link time override those
14209 specified at compile time, although in some cases GCC attempts to infer
14210 link-time options from the settings used to compile the input files.
14212 If you do not specify an optimization level option @option{-O} at
14213 link time, then GCC uses the highest optimization level 
14214 used when compiling the object files.  Note that it is generally 
14215 ineffective to specify an optimization level option only at link time and 
14216 not at compile time, for two reasons.  First, compiling without 
14217 optimization suppresses compiler passes that gather information 
14218 needed for effective optimization at link time.  Second, some early
14219 optimization passes can be performed only at compile time and 
14220 not at link time.
14222 There are some code generation flags preserved by GCC when
14223 generating bytecodes, as they need to be used during the final link.
14224 Currently, the following options and their settings are taken from
14225 the first object file that explicitly specifies them: 
14226 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
14227 @option{-fgnu-tm} and all the @option{-m} target flags.
14229 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
14230 @option{-fPIE} are combined based on the following scheme:
14232 @smallexample
14233 @option{-fPIC} + @option{-fpic} = @option{-fpic}
14234 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
14235 @option{-fpic/-fPIC} + (no option) = (no option)
14236 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
14237 @option{-fpic} + @option{-fPIE} = @option{-fpie}
14238 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
14239 @end smallexample
14241 Certain ABI-changing flags are required to match in all compilation units,
14242 and trying to override this at link time with a conflicting value
14243 is ignored.  This includes options such as @option{-freg-struct-return}
14244 and @option{-fpcc-struct-return}. 
14246 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
14247 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
14248 are passed through to the link stage and merged conservatively for
14249 conflicting translation units.  Specifically
14250 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
14251 precedence; and for example @option{-ffp-contract=off} takes precedence
14252 over @option{-ffp-contract=fast}.  You can override them at link time.
14254 Diagnostic options such as @option{-Wstringop-overflow} are passed
14255 through to the link stage and their setting matches that of the
14256 compile-step at function granularity.  Note that this matters only
14257 for diagnostics emitted during optimization.  Note that code
14258 transforms such as inlining can lead to warnings being enabled
14259 or disabled for regions if code not consistent with the setting
14260 at compile time.
14262 When you need to pass options to the assembler via @option{-Wa} or
14263 @option{-Xassembler} make sure to either compile such translation
14264 units with @option{-fno-lto} or consistently use the same assembler
14265 options on all translation units.  You can alternatively also
14266 specify assembler options at LTO link time.
14268 To enable debug info generation you need to supply @option{-g} at
14269 compile time.  If any of the input files at link time were built
14270 with debug info generation enabled the link will enable debug info
14271 generation as well.  Any elaborate debug info settings
14272 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
14273 at the linker command line and mixing different settings in different
14274 translation units is discouraged.
14276 If LTO encounters objects with C linkage declared with incompatible
14277 types in separate translation units to be linked together (undefined
14278 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
14279 issued.  The behavior is still undefined at run time.  Similar
14280 diagnostics may be raised for other languages.
14282 Another feature of LTO is that it is possible to apply interprocedural
14283 optimizations on files written in different languages:
14285 @smallexample
14286 gcc -c -flto foo.c
14287 g++ -c -flto bar.cc
14288 gfortran -c -flto baz.f90
14289 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
14290 @end smallexample
14292 Notice that the final link is done with @command{g++} to get the C++
14293 runtime libraries and @option{-lgfortran} is added to get the Fortran
14294 runtime libraries.  In general, when mixing languages in LTO mode, you
14295 should use the same link command options as when mixing languages in a
14296 regular (non-LTO) compilation.
14298 If object files containing GIMPLE bytecode are stored in a library archive, say
14299 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
14300 are using a linker with plugin support.  To create static libraries suitable
14301 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
14302 and @command{ranlib}; 
14303 to show the symbols of object files with GIMPLE bytecode, use
14304 @command{gcc-nm}.  Those commands require that @command{ar}, @command{ranlib}
14305 and @command{nm} have been compiled with plugin support.  At link time, use the
14306 flag @option{-fuse-linker-plugin} to ensure that the library participates in
14307 the LTO optimization process:
14309 @smallexample
14310 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
14311 @end smallexample
14313 With the linker plugin enabled, the linker extracts the needed
14314 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
14315 to make them part of the aggregated GIMPLE image to be optimized.
14317 If you are not using a linker with plugin support and/or do not
14318 enable the linker plugin, then the objects inside @file{libfoo.a}
14319 are extracted and linked as usual, but they do not participate
14320 in the LTO optimization process.  In order to make a static library suitable
14321 for both LTO optimization and usual linkage, compile its object files with
14322 @option{-flto} @option{-ffat-lto-objects}.
14324 Link-time optimizations do not require the presence of the whole program to
14325 operate.  If the program does not require any symbols to be exported, it is
14326 possible to combine @option{-flto} and @option{-fwhole-program} to allow
14327 the interprocedural optimizers to use more aggressive assumptions which may
14328 lead to improved optimization opportunities.
14329 Use of @option{-fwhole-program} is not needed when linker plugin is
14330 active (see @option{-fuse-linker-plugin}).
14332 The current implementation of LTO makes no
14333 attempt to generate bytecode that is portable between different
14334 types of hosts.  The bytecode files are versioned and there is a
14335 strict version check, so bytecode files generated in one version of
14336 GCC do not work with an older or newer version of GCC.
14338 Link-time optimization does not work well with generation of debugging
14339 information on systems other than those using a combination of ELF and
14340 DWARF.
14342 If you specify the optional @var{n}, the optimization and code
14343 generation done at link time is executed in parallel using @var{n}
14344 parallel jobs by utilizing an installed @command{make} program.  The
14345 environment variable @env{MAKE} may be used to override the program
14346 used.
14348 You can also specify @option{-flto=jobserver} to use GNU make's
14349 job server mode to determine the number of parallel jobs. This
14350 is useful when the Makefile calling GCC is already executing in parallel.
14351 You must prepend a @samp{+} to the command recipe in the parent Makefile
14352 for this to work.  This option likely only works if @env{MAKE} is
14353 GNU make.  Even without the option value, GCC tries to automatically
14354 detect a running GNU make's job server.
14356 Use @option{-flto=auto} to use GNU make's job server, if available,
14357 or otherwise fall back to autodetection of the number of CPU threads
14358 present in your system.
14360 @opindex flto-partition
14361 @item -flto-partition=@var{alg}
14362 Specify the partitioning algorithm used by the link-time optimizer.
14363 The value is either @samp{1to1} to specify a partitioning mirroring
14364 the original source files or @samp{balanced} to specify partitioning
14365 into equally sized chunks (whenever possible) or @samp{max} to create
14366 new partition for every symbol where possible.  Specifying @samp{none}
14367 as an algorithm disables partitioning and streaming completely. 
14368 The default value is @samp{balanced}. While @samp{1to1} can be used
14369 as an workaround for various code ordering issues, the @samp{max}
14370 partitioning is intended for internal testing only.
14371 The value @samp{one} specifies that exactly one partition should be
14372 used while the value @samp{none} bypasses partitioning and executes
14373 the link-time optimization step directly from the WPA phase.
14375 @opindex flto-compression-level
14376 @item -flto-compression-level=@var{n}
14377 This option specifies the level of compression used for intermediate
14378 language written to LTO object files, and is only meaningful in
14379 conjunction with LTO mode (@option{-flto}).  GCC currently supports two
14380 LTO compression algorithms. For zstd, valid values are 0 (no compression)
14381 to 19 (maximum compression), while zlib supports values from 0 to 9.
14382 Values outside this range are clamped to either minimum or maximum
14383 of the supported values.  If the option is not given,
14384 a default balanced compression setting is used.
14386 @opindex fuse-linker-plugin
14387 @item -fuse-linker-plugin
14388 Enables the use of a linker plugin during link-time optimization.  This
14389 option relies on plugin support in the linker, which is available in gold
14390 or in GNU ld 2.21 or newer.
14392 This option enables the extraction of object files with GIMPLE bytecode out
14393 of library archives. This improves the quality of optimization by exposing
14394 more code to the link-time optimizer.  This information specifies what
14395 symbols can be accessed externally (by non-LTO object or during dynamic
14396 linking).  Resulting code quality improvements on binaries (and shared
14397 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
14398 See @option{-flto} for a description of the effect of this flag and how to
14399 use it.
14401 This option is enabled by default when LTO support in GCC is enabled
14402 and GCC was configured for use with
14403 a linker supporting plugins (GNU ld 2.21 or newer or gold).
14405 @opindex ffat-lto-objects
14406 @item -ffat-lto-objects
14407 Fat LTO objects are object files that contain both the intermediate language
14408 and the object code. This makes them usable for both LTO linking and normal
14409 linking. This option is effective only when compiling with @option{-flto}
14410 and is ignored at link time.
14412 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
14413 requires the complete toolchain to be aware of LTO. It requires a linker with
14414 linker plugin support for basic functionality.  Additionally,
14415 @command{nm}, @command{ar} and @command{ranlib}
14416 need to support linker plugins to allow a full-featured build environment
14417 (capable of building static libraries etc).  GCC provides the @command{gcc-ar},
14418 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
14419 to these tools. With non fat LTO makefiles need to be modified to use them.
14421 Note that modern binutils provide plugin auto-load mechanism.
14422 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
14423 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
14424 @command{gcc-ranlib}).
14426 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
14427 support.
14429 @opindex fcompare-elim
14430 @item -fcompare-elim
14431 After register allocation and post-register allocation instruction splitting,
14432 identify arithmetic instructions that compute processor flags similar to a
14433 comparison operation based on that arithmetic.  If possible, eliminate the
14434 explicit comparison operation.
14436 This pass only applies to certain targets that cannot explicitly represent
14437 the comparison operation before register allocation is complete.
14439 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14441 @opindex ffold-mem-offsets
14442 @item -ffold-mem-offsets
14443 @itemx -fno-fold-mem-offsets
14444 Try to eliminate add instructions by folding them in memory loads/stores.
14446 Enabled at levels @option{-O2}, @option{-O3}.
14448 @opindex fcprop-registers
14449 @item -fcprop-registers
14450 After register allocation and post-register allocation instruction splitting,
14451 perform a copy-propagation pass to try to reduce scheduling dependencies
14452 and occasionally eliminate the copy.
14454 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14456 @opindex fprofile-correction
14457 @item -fprofile-correction
14458 Profiles collected using an instrumented binary for multi-threaded programs may
14459 be inconsistent due to missed counter updates. When this option is specified,
14460 GCC uses heuristics to correct or smooth out such inconsistencies. By
14461 default, GCC emits an error message when an inconsistent profile is detected.
14463 This option is enabled by @option{-fauto-profile}.
14465 @opindex fprofile-partial-training
14466 @item -fprofile-partial-training
14467 With @code{-fprofile-use} all portions of programs not executed during train
14468 run are optimized agressively for size rather than speed.  In some cases it is
14469 not practical to train all possible hot paths in the program. (For
14470 example, program may contain functions specific for a given hardware and
14471 trianing may not cover all hardware configurations program is run on.)  With
14472 @code{-fprofile-partial-training} profile feedback will be ignored for all
14473 functions not executed during the train run leading them to be optimized as if
14474 they were compiled without profile feedback. This leads to better performance
14475 when train run is not representative but also leads to significantly bigger
14476 code.
14478 @opindex fprofile-use
14479 @item -fprofile-use
14480 @itemx -fprofile-use=@var{path}
14481 Enable profile feedback-directed optimizations, 
14482 and the following optimizations, many of which
14483 are generally profitable only with profile feedback available:
14485 @gccoptlist{-fbranch-probabilities  -fprofile-values
14486 -funroll-loops  -fpeel-loops  -ftracer  -fvpt
14487 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp
14488 -fpredictive-commoning  -fsplit-loops  -funswitch-loops
14489 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize
14490 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns
14491 -fprofile-reorder-functions}
14493 Before you can use this option, you must first generate profiling information.
14494 @xref{Instrumentation Options}, for information about the
14495 @option{-fprofile-generate} option.
14497 By default, GCC emits an error message if the feedback profiles do not
14498 match the source code.  This error can be turned into a warning by using
14499 @option{-Wno-error=coverage-mismatch}.  Note this may result in poorly
14500 optimized code.  Additionally, by default, GCC also emits a warning message if
14501 the feedback profiles do not exist (see @option{-Wmissing-profile}).
14503 If @var{path} is specified, GCC looks at the @var{path} to find
14504 the profile feedback data files. See @option{-fprofile-dir}.
14506 @opindex fauto-profile
14507 @item -fauto-profile
14508 @itemx -fauto-profile=@var{path}
14509 Enable sampling-based feedback-directed optimizations, 
14510 and the following optimizations,
14511 many of which are generally profitable only with profile feedback available:
14513 @gccoptlist{-fbranch-probabilities  -fprofile-values
14514 -funroll-loops  -fpeel-loops  -ftracer  -fvpt
14515 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp
14516 -fpredictive-commoning  -fsplit-loops  -funswitch-loops
14517 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize
14518 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns
14519 -fprofile-correction}
14521 @var{path} is the name of a file containing AutoFDO profile information.
14522 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
14524 Producing an AutoFDO profile data file requires running your program
14525 with the @command{perf} utility on a supported GNU/Linux target system.
14526 For more information, see @uref{https://perf.wiki.kernel.org/}.
14528 E.g.
14529 @smallexample
14530 perf record -e br_inst_retired:near_taken -b -o perf.data \
14531     -- your_program
14532 @end smallexample
14534 Then use the @command{create_gcov} tool to convert the raw profile data
14535 to a format that can be used by GCC.@  You must also supply the 
14536 unstripped binary for your program to this tool.  
14537 See @uref{https://github.com/google/autofdo}.
14539 E.g.
14540 @smallexample
14541 create_gcov --binary=your_program.unstripped --profile=perf.data \
14542     --gcov=profile.afdo
14543 @end smallexample
14544 @end table
14546 The following options control compiler behavior regarding floating-point 
14547 arithmetic.  These options trade off between speed and
14548 correctness.  All must be specifically enabled.
14550 @table @gcctabopt
14551 @opindex ffloat-store
14552 @item -ffloat-store
14553 Do not store floating-point variables in registers, and inhibit other
14554 options that might change whether a floating-point value is taken from a
14555 register or memory.
14557 @cindex floating-point precision
14558 This option prevents undesirable excess precision on machines such as
14559 the 68000 where the floating registers (of the 68881) keep more
14560 precision than a @code{double} is supposed to have.  Similarly for the
14561 x86 architecture.  For most programs, the excess precision does only
14562 good, but a few programs rely on the precise definition of IEEE floating
14563 point.  Use @option{-ffloat-store} for such programs, after modifying
14564 them to store all pertinent intermediate computations into variables.
14566 @opindex fexcess-precision
14567 @item -fexcess-precision=@var{style}
14568 This option allows further control over excess precision on machines
14569 where floating-point operations occur in a format with more precision or
14570 range than the IEEE standard and interchange floating-point types.  By
14571 default, @option{-fexcess-precision=fast} is in effect; this means that
14572 operations may be carried out in a wider precision than the types specified
14573 in the source if that would result in faster code, and it is unpredictable
14574 when rounding to the types specified in the source code takes place.
14575 When compiling C or C++, if @option{-fexcess-precision=standard} is specified
14576 then excess precision follows the rules specified in ISO C99 or C++; in particular,
14577 both casts and assignments cause values to be rounded to their
14578 semantic types (whereas @option{-ffloat-store} only affects
14579 assignments).  This option is enabled by default for C or C++ if a strict
14580 conformance option such as @option{-std=c99} or @option{-std=c++17} is used.
14581 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
14582 regardless of whether a strict conformance option is used.
14584 @opindex mfpmath
14585 @option{-fexcess-precision=standard} is not implemented for languages
14586 other than C or C++.  On the x86, it has no effect if @option{-mfpmath=sse}
14587 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
14588 semantics apply without excess precision, and in the latter, rounding
14589 is unpredictable.
14591 @opindex ffast-math
14592 @item -ffast-math
14593 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
14594 @option{-ffinite-math-only}, @option{-fno-rounding-math},
14595 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
14596 @option{-fexcess-precision=fast}.
14598 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
14600 This option is not turned on by any @option{-O} option besides
14601 @option{-Ofast} since it can result in incorrect output for programs
14602 that depend on an exact implementation of IEEE or ISO rules/specifications
14603 for math functions. It may, however, yield faster code for programs
14604 that do not require the guarantees of these specifications.
14606 @opindex fno-math-errno
14607 @opindex fmath-errno
14608 @item -fno-math-errno
14609 Do not set @code{errno} after calling math functions that are executed
14610 with a single instruction, e.g., @code{sqrt}.  A program that relies on
14611 IEEE exceptions for math error handling may want to use this flag
14612 for speed while maintaining IEEE arithmetic compatibility.
14614 This option is not turned on by any @option{-O} option since
14615 it can result in incorrect output for programs that depend on
14616 an exact implementation of IEEE or ISO rules/specifications for
14617 math functions. It may, however, yield faster code for programs
14618 that do not require the guarantees of these specifications.
14620 The default is @option{-fmath-errno}.
14622 On Darwin systems, the math library never sets @code{errno}.  There is
14623 therefore no reason for the compiler to consider the possibility that
14624 it might, and @option{-fno-math-errno} is the default.
14626 @opindex funsafe-math-optimizations
14627 @item -funsafe-math-optimizations
14629 Allow optimizations for floating-point arithmetic that (a) assume
14630 that arguments and results are valid and (b) may violate IEEE or
14631 ANSI standards.  When used at link time, it may include libraries
14632 or startup files that change the default FPU control word or other
14633 similar optimizations.
14635 This option is not turned on by any @option{-O} option since
14636 it can result in incorrect output for programs that depend on
14637 an exact implementation of IEEE or ISO rules/specifications for
14638 math functions. It may, however, yield faster code for programs
14639 that do not require the guarantees of these specifications.
14640 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
14641 @option{-fassociative-math} and @option{-freciprocal-math}.
14643 The default is @option{-fno-unsafe-math-optimizations}.
14645 @opindex fassociative-math
14646 @item -fassociative-math
14648 Allow re-association of operands in series of floating-point operations.
14649 This violates the ISO C and C++ language standard by possibly changing
14650 computation result.  NOTE: re-ordering may change the sign of zero as
14651 well as ignore NaNs and inhibit or create underflow or overflow (and
14652 thus cannot be used on code that relies on rounding behavior like
14653 @code{(x + 2**52) - 2**52}.  May also reorder floating-point comparisons
14654 and thus may not be used when ordered comparisons are required.
14655 This option requires that both @option{-fno-signed-zeros} and
14656 @option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
14657 much sense with @option{-frounding-math}. For Fortran the option
14658 is automatically enabled when both @option{-fno-signed-zeros} and
14659 @option{-fno-trapping-math} are in effect.
14661 The default is @option{-fno-associative-math}.
14663 @opindex freciprocal-math
14664 @item -freciprocal-math
14666 Allow the reciprocal of a value to be used instead of dividing by
14667 the value if this enables optimizations.  For example @code{x / y}
14668 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
14669 is subject to common subexpression elimination.  Note that this loses
14670 precision and increases the number of flops operating on the value.
14672 The default is @option{-fno-reciprocal-math}.
14674 @opindex ffinite-math-only
14675 @item -ffinite-math-only
14676 Allow optimizations for floating-point arithmetic that assume
14677 that arguments and results are not NaNs or +-Infs.
14679 This option is not turned on by any @option{-O} option since
14680 it can result in incorrect output for programs that depend on
14681 an exact implementation of IEEE or ISO rules/specifications for
14682 math functions. It may, however, yield faster code for programs
14683 that do not require the guarantees of these specifications.
14685 The default is @option{-fno-finite-math-only}.
14687 @opindex fno-signed-zeros
14688 @opindex fsigned-zeros
14689 @item -fno-signed-zeros
14690 Allow optimizations for floating-point arithmetic that ignore the
14691 signedness of zero.  IEEE arithmetic specifies the behavior of
14692 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
14693 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
14694 This option implies that the sign of a zero result isn't significant.
14696 The default is @option{-fsigned-zeros}.
14698 @opindex fno-trapping-math
14699 @opindex ftrapping-math
14700 @item -fno-trapping-math
14701 Compile code assuming that floating-point operations cannot generate
14702 user-visible traps.  These traps include division by zero, overflow,
14703 underflow, inexact result and invalid operation.  This option requires
14704 that @option{-fno-signaling-nans} be in effect.  Setting this option may
14705 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
14707 This option should never be turned on by any @option{-O} option since
14708 it can result in incorrect output for programs that depend on
14709 an exact implementation of IEEE or ISO rules/specifications for
14710 math functions.
14712 The default is @option{-ftrapping-math}.
14714 Future versions of GCC may provide finer control of this setting
14715 using C99's @code{FENV_ACCESS} pragma.  This command-line option
14716 will be used along with @option{-frounding-math} to specify the
14717 default state for @code{FENV_ACCESS}.
14719 @opindex frounding-math
14720 @item -frounding-math
14721 Disable transformations and optimizations that assume default floating-point
14722 rounding behavior.  This is round-to-zero for all floating point
14723 to integer conversions, and round-to-nearest for all other arithmetic
14724 truncations.  This option should be specified for programs that change
14725 the FP rounding mode dynamically, or that may be executed with a
14726 non-default rounding mode.  This option disables constant folding of
14727 floating-point expressions at compile time (which may be affected by
14728 rounding mode) and arithmetic transformations that are unsafe in the
14729 presence of sign-dependent rounding modes.
14731 The default is @option{-fno-rounding-math}.
14733 This option is experimental and does not currently guarantee to
14734 disable all GCC optimizations that are affected by rounding mode.
14735 Future versions of GCC may provide finer control of this setting
14736 using C99's @code{FENV_ACCESS} pragma.  This command-line option
14737 will be used along with @option{-ftrapping-math} to specify the
14738 default state for @code{FENV_ACCESS}.
14740 @opindex fsignaling-nans
14741 @item -fsignaling-nans
14742 Compile code assuming that IEEE signaling NaNs may generate user-visible
14743 traps during floating-point operations.  Setting this option disables
14744 optimizations that may change the number of exceptions visible with
14745 signaling NaNs.  This option implies @option{-ftrapping-math}.
14747 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
14748 be defined.
14750 The default is @option{-fno-signaling-nans}.
14752 This option is experimental and does not currently guarantee to
14753 disable all GCC optimizations that affect signaling NaN behavior.
14755 @opindex fno-fp-int-builtin-inexact
14756 @opindex ffp-int-builtin-inexact
14757 @item -fno-fp-int-builtin-inexact
14758 Do not allow the built-in functions @code{ceil}, @code{floor},
14759 @code{round} and @code{trunc}, and their @code{float} and @code{long
14760 double} variants, to generate code that raises the ``inexact''
14761 floating-point exception for noninteger arguments.  ISO C99 and C11
14762 allow these functions to raise the ``inexact'' exception, but ISO/IEC
14763 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
14764 ISO C23, does not allow these functions to do so.
14766 The default is @option{-ffp-int-builtin-inexact}, allowing the
14767 exception to be raised, unless C23 or a later C standard is selected.
14768 This option does nothing unless @option{-ftrapping-math} is in effect.
14770 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
14771 generate a call to a library function then the ``inexact'' exception
14772 may be raised if the library implementation does not follow TS 18661.
14774 @opindex fsingle-precision-constant
14775 @item -fsingle-precision-constant
14776 Treat floating-point constants as single precision instead of
14777 implicitly converting them to double-precision constants.
14779 @opindex fcx-limited-range
14780 @item -fcx-limited-range
14781 When enabled, this option states that a range reduction step is not
14782 needed when performing complex division.  Also, there is no checking
14783 whether the result of a complex multiplication or division is @code{NaN
14784 + I*NaN}, with an attempt to rescue the situation in that case.  The
14785 default is @option{-fno-cx-limited-range}, but is enabled by
14786 @option{-ffast-math}.
14788 This option controls the default setting of the ISO C99
14789 @code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
14790 all languages.
14792 @opindex fcx-fortran-rules
14793 @item -fcx-fortran-rules
14794 Complex multiplication and division follow Fortran rules.  Range
14795 reduction is done as part of complex division, but there is no checking
14796 whether the result of a complex multiplication or division is @code{NaN
14797 + I*NaN}, with an attempt to rescue the situation in that case.
14799 The default is @option{-fno-cx-fortran-rules}.
14801 @end table
14803 The following options control optimizations that may improve
14804 performance, but are not enabled by any @option{-O} options.  This
14805 section includes experimental options that may produce broken code.
14807 @table @gcctabopt
14808 @opindex fbranch-probabilities
14809 @item -fbranch-probabilities
14810 After running a program compiled with @option{-fprofile-arcs}
14811 (@pxref{Instrumentation Options}),
14812 you can compile it a second time using
14813 @option{-fbranch-probabilities}, to improve optimizations based on
14814 the number of times each branch was taken.  When a program
14815 compiled with @option{-fprofile-arcs} exits, it saves arc execution
14816 counts to a file called @file{@var{sourcename}.gcda} for each source
14817 file.  The information in this data file is very dependent on the
14818 structure of the generated code, so you must use the same source code
14819 and the same optimization options for both compilations.
14820 See details about the file naming in @option{-fprofile-arcs}.
14822 With @option{-fbranch-probabilities}, GCC puts a
14823 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
14824 These can be used to improve optimization.  Currently, they are only
14825 used in one place: in @file{reorg.cc}, instead of guessing which path a
14826 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
14827 exactly determine which path is taken more often.
14829 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14831 @opindex fprofile-values
14832 @item -fprofile-values
14833 If combined with @option{-fprofile-arcs}, it adds code so that some
14834 data about values of expressions in the program is gathered.
14836 With @option{-fbranch-probabilities}, it reads back the data gathered
14837 from profiling values of expressions for usage in optimizations.
14839 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
14840 @option{-fauto-profile}.
14842 @opindex fprofile-reorder-functions
14843 @item -fprofile-reorder-functions
14844 Function reordering based on profile instrumentation collects
14845 first time of execution of a function and orders these functions
14846 in ascending order.
14848 Enabled with @option{-fprofile-use}.
14850 @opindex fvpt
14851 @item -fvpt
14852 If combined with @option{-fprofile-arcs}, this option instructs the compiler
14853 to add code to gather information about values of expressions.
14855 With @option{-fbranch-probabilities}, it reads back the data gathered
14856 and actually performs the optimizations based on them.
14857 Currently the optimizations include specialization of division operations
14858 using the knowledge about the value of the denominator.
14860 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
14862 @opindex frename-registers
14863 @item -frename-registers
14864 Attempt to avoid false dependencies in scheduled code by making use
14865 of registers left over after register allocation.  This optimization
14866 most benefits processors with lots of registers.  Depending on the
14867 debug information format adopted by the target, however, it can
14868 make debugging impossible, since variables no longer stay in
14869 a ``home register''.
14871 Enabled by default with @option{-funroll-loops}.
14873 @opindex fschedule-fusion
14874 @item -fschedule-fusion
14875 Performs a target dependent pass over the instruction stream to schedule
14876 instructions of same type together because target machine can execute them
14877 more efficiently if they are adjacent to each other in the instruction flow.
14879 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14881 @opindex ftracer
14882 @item -ftracer
14883 Perform tail duplication to enlarge superblock size.  This transformation
14884 simplifies the control flow of the function allowing other optimizations to do
14885 a better job.
14887 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14889 @opindex funroll-loops
14890 @item -funroll-loops
14891 Unroll loops whose number of iterations can be determined at compile time or
14892 upon entry to the loop.  @option{-funroll-loops} implies
14893 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
14894 It also turns on complete loop peeling (i.e.@: complete removal of loops with
14895 a small constant number of iterations).  This option makes code larger, and may
14896 or may not make it run faster.
14898 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14900 @opindex funroll-all-loops
14901 @item -funroll-all-loops
14902 Unroll all loops, even if their number of iterations is uncertain when
14903 the loop is entered.  This usually makes programs run more slowly.
14904 @option{-funroll-all-loops} implies the same options as
14905 @option{-funroll-loops}.
14907 @opindex fpeel-loops
14908 @item -fpeel-loops
14909 Peels loops for which there is enough information that they do not
14910 roll much (from profile feedback or static analysis).  It also turns on
14911 complete loop peeling (i.e.@: complete removal of loops with small constant
14912 number of iterations).
14914 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
14916 @opindex fmove-loop-invariants
14917 @item -fmove-loop-invariants
14918 Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
14919 at level @option{-O1} and higher, except for @option{-Og}.
14921 @opindex fmove-loop-stores
14922 @item -fmove-loop-stores
14923 Enables the loop store motion pass in the GIMPLE loop optimizer.  This
14924 moves invariant stores to after the end of the loop in exchange for
14925 carrying the stored value in a register across the iteration.
14926 Note for this option to have an effect @option{-ftree-loop-im} has to
14927 be enabled as well.  Enabled at level @option{-O1} and higher, except
14928 for @option{-Og}.
14930 @opindex fsplit-loops
14931 @item -fsplit-loops
14932 Split a loop into two if it contains a condition that's always true
14933 for one side of the iteration space and false for the other.
14935 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14937 @opindex funswitch-loops
14938 @item -funswitch-loops
14939 Move branches with loop invariant conditions out of the loop, with duplicates
14940 of the loop on both branches (modified according to result of the condition).
14942 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14944 @opindex fversion-loops-for-strides
14945 @item -fversion-loops-for-strides
14946 If a loop iterates over an array with a variable stride, create another
14947 version of the loop that assumes the stride is always one.  For example:
14949 @smallexample
14950 for (int i = 0; i < n; ++i)
14951   x[i * stride] = @dots{};
14952 @end smallexample
14954 becomes:
14956 @smallexample
14957 if (stride == 1)
14958   for (int i = 0; i < n; ++i)
14959     x[i] = @dots{};
14960 else
14961   for (int i = 0; i < n; ++i)
14962     x[i * stride] = @dots{};
14963 @end smallexample
14965 This is particularly useful for assumed-shape arrays in Fortran where
14966 (for example) it allows better vectorization assuming contiguous accesses.
14967 This flag is enabled by default at @option{-O3}.
14968 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14970 @opindex ffunction-sections
14971 @opindex fdata-sections
14972 @item -ffunction-sections
14973 @itemx -fdata-sections
14974 Place each function or data item into its own section in the output
14975 file if the target supports arbitrary sections.  The name of the
14976 function or the name of the data item determines the section's name
14977 in the output file.
14979 Use these options on systems where the linker can perform optimizations to
14980 improve locality of reference in the instruction space.  Most systems using the
14981 ELF object format have linkers with such optimizations.  On AIX, the linker
14982 rearranges sections (CSECTs) based on the call graph.  The performance impact
14983 varies.
14985 Together with a linker garbage collection (linker @option{--gc-sections}
14986 option) these options may lead to smaller statically-linked executables (after
14987 stripping).
14989 On ELF/DWARF systems these options do not degenerate the quality of the debug
14990 information.  There could be issues with other object files/debug info formats.
14992 Only use these options when there are significant benefits from doing so.  When
14993 you specify these options, the assembler and linker create larger object and
14994 executable files and are also slower.  These options affect code generation.
14995 They prevent optimizations by the compiler and assembler using relative
14996 locations inside a translation unit since the locations are unknown until
14997 link time.  An example of such an optimization is relaxing calls to short call
14998 instructions.
15000 @opindex fstdarg-opt
15001 @item -fstdarg-opt
15002 Optimize the prologue of variadic argument functions with respect to usage of
15003 those arguments.
15005 @opindex fsection-anchors
15006 @item -fsection-anchors
15007 Try to reduce the number of symbolic address calculations by using
15008 shared ``anchor'' symbols to address nearby objects.  This transformation
15009 can help to reduce the number of GOT entries and GOT accesses on some
15010 targets.
15012 For example, the implementation of the following function @code{foo}:
15014 @smallexample
15015 static int a, b, c;
15016 int foo (void) @{ return a + b + c; @}
15017 @end smallexample
15019 @noindent
15020 usually calculates the addresses of all three variables, but if you
15021 compile it with @option{-fsection-anchors}, it accesses the variables
15022 from a common anchor point instead.  The effect is similar to the
15023 following pseudocode (which isn't valid C):
15025 @smallexample
15026 int foo (void)
15028   register int *xr = &x;
15029   return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
15031 @end smallexample
15033 Not all targets support this option.
15035 @opindex fzero-call-used-regs
15036 @item -fzero-call-used-regs=@var{choice}
15037 Zero call-used registers at function return to increase program
15038 security by either mitigating Return-Oriented Programming (ROP)
15039 attacks or preventing information leakage through registers.
15041 The possible values of @var{choice} are the same as for the
15042 @code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
15043 The default is @samp{skip}.
15045 You can control this behavior for a specific function by using the function
15046 attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
15048 @opindex param
15049 @item --param @var{name}=@var{value}
15050 In some places, GCC uses various constants to control the amount of
15051 optimization that is done.  For example, GCC does not inline functions
15052 that contain more than a certain number of instructions.  You can
15053 control some of these constants on the command line using the
15054 @option{--param} option.
15056 The names of specific parameters, and the meaning of the values, are
15057 tied to the internals of the compiler, and are subject to change
15058 without notice in future releases.
15060 In order to get the minimal, maximal and default values of a parameter,
15061 use the @option{--help=param -Q} options.
15063 In each case, the @var{value} is an integer.  The following choices
15064 of @var{name} are recognized for all targets:
15066 @table @gcctabopt
15067 @item predictable-branch-outcome
15068 When branch is predicted to be taken with probability lower than this threshold
15069 (in percent), then it is considered well predictable.
15071 @item max-rtl-if-conversion-insns
15072 RTL if-conversion tries to remove conditional branches around a block and
15073 replace them with conditionally executed instructions.  This parameter
15074 gives the maximum number of instructions in a block which should be
15075 considered for if-conversion.  The compiler will
15076 also use other heuristics to decide whether if-conversion is likely to be
15077 profitable.
15079 @item max-rtl-if-conversion-predictable-cost
15080 RTL if-conversion will try to remove conditional branches around a block
15081 and replace them with conditionally executed instructions.  These parameters
15082 give the maximum permissible cost for the sequence that would be generated
15083 by if-conversion depending on whether the branch is statically determined
15084 to be predictable or not.  The units for this parameter are the same as
15085 those for the GCC internal seq_cost metric.  The compiler will try to
15086 provide a reasonable default for this parameter using the BRANCH_COST
15087 target macro.
15089 @item max-crossjump-edges
15090 The maximum number of incoming edges to consider for cross-jumping.
15091 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
15092 the number of edges incoming to each block.  Increasing values mean
15093 more aggressive optimization, making the compilation time increase with
15094 probably small improvement in executable size.
15096 @item min-crossjump-insns
15097 The minimum number of instructions that must be matched at the end
15098 of two blocks before cross-jumping is performed on them.  This
15099 value is ignored in the case where all instructions in the block being
15100 cross-jumped from are matched.
15102 @item max-grow-copy-bb-insns
15103 The maximum code size expansion factor when copying basic blocks
15104 instead of jumping.  The expansion is relative to a jump instruction.
15106 @item max-goto-duplication-insns
15107 The maximum number of instructions to duplicate to a block that jumps
15108 to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
15109 passes, GCC factors computed gotos early in the compilation process,
15110 and unfactors them as late as possible.  Only computed jumps at the
15111 end of a basic blocks with no more than max-goto-duplication-insns are
15112 unfactored.
15114 @item max-delay-slot-insn-search
15115 The maximum number of instructions to consider when looking for an
15116 instruction to fill a delay slot.  If more than this arbitrary number of
15117 instructions are searched, the time savings from filling the delay slot
15118 are minimal, so stop searching.  Increasing values mean more
15119 aggressive optimization, making the compilation time increase with probably
15120 small improvement in execution time.
15122 @item max-delay-slot-live-search
15123 When trying to fill delay slots, the maximum number of instructions to
15124 consider when searching for a block with valid live register
15125 information.  Increasing this arbitrarily chosen value means more
15126 aggressive optimization, increasing the compilation time.  This parameter
15127 should be removed when the delay slot code is rewritten to maintain the
15128 control-flow graph.
15130 @item max-gcse-memory
15131 The approximate maximum amount of memory in @code{kB} that can be allocated in
15132 order to perform the global common subexpression elimination
15133 optimization.  If more memory than specified is required, the
15134 optimization is not done.
15136 @item max-gcse-insertion-ratio
15137 If the ratio of expression insertions to deletions is larger than this value
15138 for any expression, then RTL PRE inserts or removes the expression and thus
15139 leaves partially redundant computations in the instruction stream.
15141 @item max-pending-list-length
15142 The maximum number of pending dependencies scheduling allows
15143 before flushing the current state and starting over.  Large functions
15144 with few branches or calls can create excessively large lists which
15145 needlessly consume memory and resources.
15147 @item max-modulo-backtrack-attempts
15148 The maximum number of backtrack attempts the scheduler should make
15149 when modulo scheduling a loop.  Larger values can exponentially increase
15150 compilation time.
15152 @item max-inline-functions-called-once-loop-depth
15153 Maximal loop depth of a call considered by inline heuristics that tries to
15154 inline all functions called once.
15156 @item max-inline-functions-called-once-insns
15157 Maximal estimated size of functions produced while inlining functions called
15158 once.
15160 @item max-inline-insns-single
15161 Several parameters control the tree inliner used in GCC@.  This number sets the
15162 maximum number of instructions (counted in GCC's internal representation) in a
15163 single function that the tree inliner considers for inlining.  This only
15164 affects functions declared inline and methods implemented in a class
15165 declaration (C++). 
15168 @item max-inline-insns-auto
15169 When you use @option{-finline-functions} (included in @option{-O3}),
15170 a lot of functions that would otherwise not be considered for inlining
15171 by the compiler are investigated.  To those functions, a different
15172 (more restrictive) limit compared to functions declared inline can
15173 be applied (@option{--param max-inline-insns-auto}).
15175 @item max-inline-insns-small
15176 This is bound applied to calls which are considered relevant with
15177 @option{-finline-small-functions}.
15179 @item max-inline-insns-size
15180 This is bound applied to calls which are optimized for size. Small growth
15181 may be desirable to anticipate optimization oppurtunities exposed by inlining.
15183 @item uninlined-function-insns
15184 Number of instructions accounted by inliner for function overhead such as
15185 function prologue and epilogue.
15187 @item uninlined-function-time
15188 Extra time accounted by inliner for function overhead such as time needed to
15189 execute function prologue and epilogue.
15191 @item inline-heuristics-hint-percent
15192 The scale (in percents) applied to @option{inline-insns-single},
15193 @option{inline-insns-single-O2}, @option{inline-insns-auto}
15194 when inline heuristics hints that inlining is
15195 very profitable (will enable later optimizations).
15197 @item uninlined-thunk-insns
15198 @item uninlined-thunk-time
15199 Same as @option{--param uninlined-function-insns} and
15200 @option{--param uninlined-function-time} but applied to function thunks.
15202 @item inline-min-speedup
15203 When estimated performance improvement of caller + callee runtime exceeds this
15204 threshold (in percent), the function can be inlined regardless of the limit on
15205 @option{--param max-inline-insns-single} and @option{--param
15206 max-inline-insns-auto}.
15208 @item large-function-insns
15209 The limit specifying really large functions.  For functions larger than this
15210 limit after inlining, inlining is constrained by
15211 @option{--param large-function-growth}.  This parameter is useful primarily
15212 to avoid extreme compilation time caused by non-linear algorithms used by the
15213 back end.
15215 @item large-function-growth
15216 Specifies maximal growth of large function caused by inlining in percents.
15217 For example, parameter value 100 limits large function growth to 2.0 times
15218 the original size.
15220 @item large-unit-insns
15221 The limit specifying large translation unit.  Growth caused by inlining of
15222 units larger than this limit is limited by @option{--param inline-unit-growth}.
15223 For small units this might be too tight.
15224 For example, consider a unit consisting of function A
15225 that is inline and B that just calls A three times.  If B is small relative to
15226 A, the growth of unit is 300\% and yet such inlining is very sane.  For very
15227 large units consisting of small inlineable functions, however, the overall unit
15228 growth limit is needed to avoid exponential explosion of code size.  Thus for
15229 smaller units, the size is increased to @option{--param large-unit-insns}
15230 before applying @option{--param inline-unit-growth}.
15232 @item lazy-modules
15233 Maximum number of concurrently open C++ module files when lazy loading.
15235 @item inline-unit-growth
15236 Specifies maximal overall growth of the compilation unit caused by inlining.
15237 For example, parameter value 20 limits unit growth to 1.2 times the original
15238 size. Cold functions (either marked cold via an attribute or by profile
15239 feedback) are not accounted into the unit size.
15241 @item ipa-cp-unit-growth
15242 Specifies maximal overall growth of the compilation unit caused by
15243 interprocedural constant propagation.  For example, parameter value 10 limits
15244 unit growth to 1.1 times the original size.
15246 @item ipa-cp-large-unit-insns
15247 The size of translation unit that IPA-CP pass considers large.
15249 @item large-stack-frame
15250 The limit specifying large stack frames.  While inlining the algorithm is trying
15251 to not grow past this limit too much.
15253 @item large-stack-frame-growth
15254 Specifies maximal growth of large stack frames caused by inlining in percents.
15255 For example, parameter value 1000 limits large stack frame growth to 11 times
15256 the original size.
15258 @item max-inline-insns-recursive
15259 @itemx max-inline-insns-recursive-auto
15260 Specifies the maximum number of instructions an out-of-line copy of a
15261 self-recursive inline
15262 function can grow into by performing recursive inlining.
15264 @option{--param max-inline-insns-recursive} applies to functions
15265 declared inline.
15266 For functions not declared inline, recursive inlining
15267 happens only when @option{-finline-functions} (included in @option{-O3}) is
15268 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
15270 @item max-inline-recursive-depth
15271 @itemx max-inline-recursive-depth-auto
15272 Specifies the maximum recursion depth used for recursive inlining.
15274 @option{--param max-inline-recursive-depth} applies to functions
15275 declared inline.  For functions not declared inline, recursive inlining
15276 happens only when @option{-finline-functions} (included in @option{-O3}) is
15277 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
15279 @item min-inline-recursive-probability
15280 Recursive inlining is profitable only for function having deep recursion
15281 in average and can hurt for function having little recursion depth by
15282 increasing the prologue size or complexity of function body to other
15283 optimizers.
15285 When profile feedback is available (see @option{-fprofile-generate}) the actual
15286 recursion depth can be guessed from the probability that function recurses
15287 via a given call expression.  This parameter limits inlining only to call
15288 expressions whose probability exceeds the given threshold (in percents).
15290 @item early-inlining-insns
15291 Specify growth that the early inliner can make.  In effect it increases
15292 the amount of inlining for code having a large abstraction penalty.
15294 @item max-early-inliner-iterations
15295 Limit of iterations of the early inliner.  This basically bounds
15296 the number of nested indirect calls the early inliner can resolve.
15297 Deeper chains are still handled by late inlining.
15299 @item comdat-sharing-probability
15300 Probability (in percent) that C++ inline function with comdat visibility
15301 are shared across multiple compilation units.
15303 @item modref-max-bases
15304 @item modref-max-refs
15305 @item modref-max-accesses
15306 Specifies the maximal number of base pointers, references and accesses stored
15307 for a single function by mod/ref analysis.
15309 @item modref-max-tests
15310 Specifies the maxmal number of tests alias oracle can perform to disambiguate
15311 memory locations using the mod/ref information.  This parameter ought to be
15312 bigger than @option{--param modref-max-bases} and @option{--param
15313 modref-max-refs}.
15315 @item modref-max-depth
15316 Specifies the maximum depth of DFS walk used by modref escape analysis.
15317 Setting to 0 disables the analysis completely.
15319 @item modref-max-escape-points
15320 Specifies the maximum number of escape points tracked by modref per SSA-name.
15322 @item modref-max-adjustments
15323 Specifies the maximum number the access range is enlarged during modref dataflow
15324 analysis.
15326 @item profile-func-internal-id
15327 A parameter to control whether to use function internal id in profile
15328 database lookup. If the value is 0, the compiler uses an id that
15329 is based on function assembler name and filename, which makes old profile
15330 data more tolerant to source changes such as function reordering etc.
15332 @item min-vect-loop-bound
15333 The minimum number of iterations under which loops are not vectorized
15334 when @option{-ftree-vectorize} is used.  The number of iterations after
15335 vectorization needs to be greater than the value specified by this option
15336 to allow vectorization.
15338 @item gcse-cost-distance-ratio
15339 Scaling factor in calculation of maximum distance an expression
15340 can be moved by GCSE optimizations.  This is currently supported only in the
15341 code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
15342 is with simple expressions, i.e., the expressions that have cost
15343 less than @option{gcse-unrestricted-cost}.  Specifying 0 disables
15344 hoisting of simple expressions.
15346 @item gcse-unrestricted-cost
15347 Cost, roughly measured as the cost of a single typical machine
15348 instruction, at which GCSE optimizations do not constrain
15349 the distance an expression can travel.  This is currently
15350 supported only in the code hoisting pass.  The lesser the cost,
15351 the more aggressive code hoisting is.  Specifying 0 
15352 allows all expressions to travel unrestricted distances.
15354 @item max-hoist-depth
15355 The depth of search in the dominator tree for expressions to hoist.
15356 This is used to avoid quadratic behavior in hoisting algorithm.
15357 The value of 0 does not limit on the search, but may slow down compilation
15358 of huge functions.
15360 @item max-tail-merge-comparisons
15361 The maximum amount of similar bbs to compare a bb with.  This is used to
15362 avoid quadratic behavior in tree tail merging.
15364 @item max-tail-merge-iterations
15365 The maximum amount of iterations of the pass over the function.  This is used to
15366 limit compilation time in tree tail merging.
15368 @item store-merging-allow-unaligned
15369 Allow the store merging pass to introduce unaligned stores if it is legal to
15370 do so.
15372 @item max-stores-to-merge
15373 The maximum number of stores to attempt to merge into wider stores in the store
15374 merging pass.
15376 @item max-store-chains-to-track
15377 The maximum number of store chains to track at the same time in the attempt
15378 to merge them into wider stores in the store merging pass.
15380 @item max-stores-to-track
15381 The maximum number of stores to track at the same time in the attemt to
15382 to merge them into wider stores in the store merging pass.
15384 @item max-unrolled-insns
15385 The maximum number of instructions that a loop may have to be unrolled.
15386 If a loop is unrolled, this parameter also determines how many times
15387 the loop code is unrolled.
15389 @item max-average-unrolled-insns
15390 The maximum number of instructions biased by probabilities of their execution
15391 that a loop may have to be unrolled.  If a loop is unrolled,
15392 this parameter also determines how many times the loop code is unrolled.
15394 @item max-unroll-times
15395 The maximum number of unrollings of a single loop.
15397 @item max-peeled-insns
15398 The maximum number of instructions that a loop may have to be peeled.
15399 If a loop is peeled, this parameter also determines how many times
15400 the loop code is peeled.
15402 @item max-peel-times
15403 The maximum number of peelings of a single loop.
15405 @item max-peel-branches
15406 The maximum number of branches on the hot path through the peeled sequence.
15408 @item max-completely-peeled-insns
15409 The maximum number of insns of a completely peeled loop.
15411 @item max-completely-peel-times
15412 The maximum number of iterations of a loop to be suitable for complete peeling.
15414 @item max-completely-peel-loop-nest-depth
15415 The maximum depth of a loop nest suitable for complete peeling.
15417 @item max-unswitch-insns
15418 The maximum number of insns of an unswitched loop.
15420 @item max-unswitch-depth
15421 The maximum depth of a loop nest to be unswitched.
15423 @item lim-expensive
15424 The minimum cost of an expensive expression in the loop invariant motion.
15426 @item min-loop-cond-split-prob
15427 When FDO profile information is available, @option{min-loop-cond-split-prob}
15428 specifies minimum threshold for probability of semi-invariant condition
15429 statement to trigger loop split.
15431 @item iv-consider-all-candidates-bound
15432 Bound on number of candidates for induction variables, below which
15433 all candidates are considered for each use in induction variable
15434 optimizations.  If there are more candidates than this,
15435 only the most relevant ones are considered to avoid quadratic time complexity.
15437 @item iv-max-considered-uses
15438 The induction variable optimizations give up on loops that contain more
15439 induction variable uses.
15441 @item iv-always-prune-cand-set-bound
15442 If the number of candidates in the set is smaller than this value,
15443 always try to remove unnecessary ivs from the set
15444 when adding a new one.
15446 @item avg-loop-niter
15447 Average number of iterations of a loop.
15449 @item dse-max-object-size
15450 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
15451 Larger values may result in larger compilation times.
15453 @item dse-max-alias-queries-per-store
15454 Maximum number of queries into the alias oracle per store.
15455 Larger values result in larger compilation times and may result in more
15456 removed dead stores.
15458 @item scev-max-expr-size
15459 Bound on size of expressions used in the scalar evolutions analyzer.
15460 Large expressions slow the analyzer.
15462 @item scev-max-expr-complexity
15463 Bound on the complexity of the expressions in the scalar evolutions analyzer.
15464 Complex expressions slow the analyzer.
15466 @item max-tree-if-conversion-phi-args
15467 Maximum number of arguments in a PHI supported by TREE if conversion
15468 unless the loop is marked with simd pragma.
15470 @item vect-max-layout-candidates
15471 The maximum number of possible vector layouts (such as permutations)
15472 to consider when optimizing to-be-vectorized code.
15474 @item vect-max-version-for-alignment-checks
15475 The maximum number of run-time checks that can be performed when
15476 doing loop versioning for alignment in the vectorizer.
15478 @item vect-max-version-for-alias-checks
15479 The maximum number of run-time checks that can be performed when
15480 doing loop versioning for alias in the vectorizer.
15482 @item vect-max-peeling-for-alignment
15483 The maximum number of loop peels to enhance access alignment
15484 for vectorizer. Value -1 means no limit.
15486 @item max-iterations-to-track
15487 The maximum number of iterations of a loop the brute-force algorithm
15488 for analysis of the number of iterations of the loop tries to evaluate.
15490 @item hot-bb-count-fraction
15491 The denominator n of fraction 1/n of the maximal execution count of a
15492 basic block in the entire program that a basic block needs to at least
15493 have in order to be considered hot.  The default is 10000, which means
15494 that a basic block is considered hot if its execution count is greater
15495 than 1/10000 of the maximal execution count.  0 means that it is never
15496 considered hot.  Used in non-LTO mode.
15498 @item hot-bb-count-ws-permille
15499 The number of most executed permilles, ranging from 0 to 1000, of the
15500 profiled execution of the entire program to which the execution count
15501 of a basic block must be part of in order to be considered hot.  The
15502 default is 990, which means that a basic block is considered hot if
15503 its execution count contributes to the upper 990 permilles, or 99.0%,
15504 of the profiled execution of the entire program.  0 means that it is
15505 never considered hot.  Used in LTO mode.
15507 @item hot-bb-frequency-fraction
15508 The denominator n of fraction 1/n of the execution frequency of the
15509 entry block of a function that a basic block of this function needs
15510 to at least have in order to be considered hot.  The default is 1000,
15511 which means that a basic block is considered hot in a function if it
15512 is executed more frequently than 1/1000 of the frequency of the entry
15513 block of the function.  0 means that it is never considered hot.
15515 @item unlikely-bb-count-fraction
15516 The denominator n of fraction 1/n of the number of profiled runs of
15517 the entire program below which the execution count of a basic block
15518 must be in order for the basic block to be considered unlikely executed.
15519 The default is 20, which means that a basic block is considered unlikely
15520 executed if it is executed in fewer than 1/20, or 5%, of the runs of
15521 the program.  0 means that it is always considered unlikely executed.
15523 @item max-predicted-iterations
15524 The maximum number of loop iterations we predict statically.  This is useful
15525 in cases where a function contains a single loop with known bound and
15526 another loop with unknown bound.
15527 The known number of iterations is predicted correctly, while
15528 the unknown number of iterations average to roughly 10.  This means that the
15529 loop without bounds appears artificially cold relative to the other one.
15531 @item builtin-expect-probability
15532 Control the probability of the expression having the specified value. This
15533 parameter takes a percentage (i.e.@: 0 ... 100) as input.
15535 @item builtin-string-cmp-inline-length
15536 The maximum length of a constant string for a builtin string cmp call 
15537 eligible for inlining.
15539 @item align-threshold
15541 Select fraction of the maximal frequency of executions of a basic block in
15542 a function to align the basic block.
15544 @item align-loop-iterations
15546 A loop expected to iterate at least the selected number of iterations is
15547 aligned.
15549 @item tracer-dynamic-coverage
15550 @itemx tracer-dynamic-coverage-feedback
15552 This value is used to limit superblock formation once the given percentage of
15553 executed instructions is covered.  This limits unnecessary code size
15554 expansion.
15556 The @option{tracer-dynamic-coverage-feedback} parameter
15557 is used only when profile
15558 feedback is available.  The real profiles (as opposed to statically estimated
15559 ones) are much less balanced allowing the threshold to be larger value.
15561 @item tracer-max-code-growth
15562 Stop tail duplication once code growth has reached given percentage.  This is
15563 a rather artificial limit, as most of the duplicates are eliminated later in
15564 cross jumping, so it may be set to much higher values than is the desired code
15565 growth.
15567 @item tracer-min-branch-ratio
15569 Stop reverse growth when the reverse probability of best edge is less than this
15570 threshold (in percent).
15572 @item tracer-min-branch-probability
15573 @itemx tracer-min-branch-probability-feedback
15575 Stop forward growth if the best edge has probability lower than this
15576 threshold.
15578 Similarly to @option{tracer-dynamic-coverage} two parameters are
15579 provided.  @option{tracer-min-branch-probability-feedback} is used for
15580 compilation with profile feedback and @option{tracer-min-branch-probability}
15581 compilation without.  The value for compilation with profile feedback
15582 needs to be more conservative (higher) in order to make tracer
15583 effective.
15585 @item stack-clash-protection-guard-size
15586 Specify the size of the operating system provided stack guard as
15587 2 raised to @var{num} bytes.  Higher values may reduce the
15588 number of explicit probes, but a value larger than the operating system
15589 provided guard will leave code vulnerable to stack clash style attacks.
15591 @item stack-clash-protection-probe-interval
15592 Stack clash protection involves probing stack space as it is allocated.  This
15593 param controls the maximum distance between probes into the stack as 2 raised
15594 to @var{num} bytes.  Higher values may reduce the number of explicit probes, but a value
15595 larger than the operating system provided guard will leave code vulnerable to
15596 stack clash style attacks.
15598 @item max-cse-path-length
15600 The maximum number of basic blocks on path that CSE considers.
15602 @item max-cse-insns
15603 The maximum number of instructions CSE processes before flushing.
15605 @item ggc-min-expand
15607 GCC uses a garbage collector to manage its own memory allocation.  This
15608 parameter specifies the minimum percentage by which the garbage
15609 collector's heap should be allowed to expand between collections.
15610 Tuning this may improve compilation speed; it has no effect on code
15611 generation.
15613 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
15614 RAM >= 1GB@.  If @code{getrlimit} is available, the notion of ``RAM'' is
15615 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
15616 GCC is not able to calculate RAM on a particular platform, the lower
15617 bound of 30% is used.  Setting this parameter and
15618 @option{ggc-min-heapsize} to zero causes a full collection to occur at
15619 every opportunity.  This is extremely slow, but can be useful for
15620 debugging.
15622 @item ggc-min-heapsize
15624 Minimum size of the garbage collector's heap before it begins bothering
15625 to collect garbage.  The first collection occurs after the heap expands
15626 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
15627 tuning this may improve compilation speed, and has no effect on code
15628 generation.
15630 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
15631 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
15632 with a lower bound of 4096 (four megabytes) and an upper bound of
15633 131072 (128 megabytes).  If GCC is not able to calculate RAM on a
15634 particular platform, the lower bound is used.  Setting this parameter
15635 very large effectively disables garbage collection.  Setting this
15636 parameter and @option{ggc-min-expand} to zero causes a full collection
15637 to occur at every opportunity.
15639 @item max-reload-search-insns
15640 The maximum number of instruction reload should look backward for equivalent
15641 register.  Increasing values mean more aggressive optimization, making the
15642 compilation time increase with probably slightly better performance.
15644 @item max-cselib-memory-locations
15645 The maximum number of memory locations cselib should take into account.
15646 Increasing values mean more aggressive optimization, making the compilation time
15647 increase with probably slightly better performance.
15649 @item max-sched-ready-insns
15650 The maximum number of instructions ready to be issued the scheduler should
15651 consider at any given time during the first scheduling pass.  Increasing
15652 values mean more thorough searches, making the compilation time increase
15653 with probably little benefit.
15655 @item max-sched-region-blocks
15656 The maximum number of blocks in a region to be considered for
15657 interblock scheduling.
15659 @item max-pipeline-region-blocks
15660 The maximum number of blocks in a region to be considered for
15661 pipelining in the selective scheduler.
15663 @item max-sched-region-insns
15664 The maximum number of insns in a region to be considered for
15665 interblock scheduling.
15667 @item max-pipeline-region-insns
15668 The maximum number of insns in a region to be considered for
15669 pipelining in the selective scheduler.
15671 @item min-spec-prob
15672 The minimum probability (in percents) of reaching a source block
15673 for interblock speculative scheduling.
15675 @item max-sched-extend-regions-iters
15676 The maximum number of iterations through CFG to extend regions.
15677 A value of 0 disables region extensions.
15679 @item max-sched-insn-conflict-delay
15680 The maximum conflict delay for an insn to be considered for speculative motion.
15682 @item sched-spec-prob-cutoff
15683 The minimal probability of speculation success (in percents), so that
15684 speculative insns are scheduled.
15686 @item sched-state-edge-prob-cutoff
15687 The minimum probability an edge must have for the scheduler to save its
15688 state across it.
15690 @item sched-mem-true-dep-cost
15691 Minimal distance (in CPU cycles) between store and load targeting same
15692 memory locations.
15694 @item selsched-max-lookahead
15695 The maximum size of the lookahead window of selective scheduling.  It is a
15696 depth of search for available instructions.
15698 @item selsched-max-sched-times
15699 The maximum number of times that an instruction is scheduled during
15700 selective scheduling.  This is the limit on the number of iterations
15701 through which the instruction may be pipelined.
15703 @item selsched-insns-to-rename
15704 The maximum number of best instructions in the ready list that are considered
15705 for renaming in the selective scheduler.
15707 @item sms-min-sc
15708 The minimum value of stage count that swing modulo scheduler
15709 generates.
15711 @item max-last-value-rtl
15712 The maximum size measured as number of RTLs that can be recorded in an expression
15713 in combiner for a pseudo register as last known value of that register.
15715 @item max-combine-insns
15716 The maximum number of instructions the RTL combiner tries to combine.
15718 @item integer-share-limit
15719 Small integer constants can use a shared data structure, reducing the
15720 compiler's memory usage and increasing its speed.  This sets the maximum
15721 value of a shared integer constant.
15723 @item ssp-buffer-size
15724 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
15725 protection when @option{-fstack-protector} is used.
15727 @item min-size-for-stack-sharing
15728 The minimum size of variables taking part in stack slot sharing when not
15729 optimizing.
15731 @item max-jump-thread-duplication-stmts
15732 Maximum number of statements allowed in a block that needs to be
15733 duplicated when threading jumps.
15735 @item max-jump-thread-paths
15736 The maximum number of paths to consider when searching for jump threading
15737 opportunities.  When arriving at a block, incoming edges are only considered
15738 if the number of paths to be searched so far multiplied by the number of
15739 incoming edges does not exhaust the specified maximum number of paths to
15740 consider.
15742 @item max-fields-for-field-sensitive
15743 Maximum number of fields in a structure treated in
15744 a field sensitive manner during pointer analysis.
15746 @item prefetch-latency
15747 Estimate on average number of instructions that are executed before
15748 prefetch finishes.  The distance prefetched ahead is proportional
15749 to this constant.  Increasing this number may also lead to less
15750 streams being prefetched (see @option{simultaneous-prefetches}).
15752 @item simultaneous-prefetches
15753 Maximum number of prefetches that can run at the same time.
15755 @item l1-cache-line-size
15756 The size of cache line in L1 data cache, in bytes.
15758 @item l1-cache-size
15759 The size of L1 data cache, in kilobytes.
15761 @item l2-cache-size
15762 The size of L2 data cache, in kilobytes.
15764 @item prefetch-dynamic-strides
15765 Whether the loop array prefetch pass should issue software prefetch hints
15766 for strides that are non-constant.  In some cases this may be
15767 beneficial, though the fact the stride is non-constant may make it
15768 hard to predict when there is clear benefit to issuing these hints.
15770 Set to 1 if the prefetch hints should be issued for non-constant
15771 strides.  Set to 0 if prefetch hints should be issued only for strides that
15772 are known to be constant and below @option{prefetch-minimum-stride}.
15774 @item prefetch-minimum-stride
15775 Minimum constant stride, in bytes, to start using prefetch hints for.  If
15776 the stride is less than this threshold, prefetch hints will not be issued.
15778 This setting is useful for processors that have hardware prefetchers, in
15779 which case there may be conflicts between the hardware prefetchers and
15780 the software prefetchers.  If the hardware prefetchers have a maximum
15781 stride they can handle, it should be used here to improve the use of
15782 software prefetchers.
15784 A value of -1 means we don't have a threshold and therefore
15785 prefetch hints can be issued for any constant stride.
15787 This setting is only useful for strides that are known and constant.
15789 @item destructive-interference-size
15790 @item constructive-interference-size
15791 The values for the C++17 variables
15792 @code{std::hardware_destructive_interference_size} and
15793 @code{std::hardware_constructive_interference_size}.  The destructive
15794 interference size is the minimum recommended offset between two
15795 independent concurrently-accessed objects; the constructive
15796 interference size is the maximum recommended size of contiguous memory
15797 accessed together.  Typically both will be the size of an L1 cache
15798 line for the target, in bytes.  For a generic target covering a range of L1
15799 cache line sizes, typically the constructive interference size will be
15800 the small end of the range and the destructive size will be the large
15801 end.
15803 The destructive interference size is intended to be used for layout,
15804 and thus has ABI impact.  The default value is not expected to be
15805 stable, and on some targets varies with @option{-mtune}, so use of
15806 this variable in a context where ABI stability is important, such as
15807 the public interface of a library, is strongly discouraged; if it is
15808 used in that context, users can stabilize the value using this
15809 option.
15811 The constructive interference size is less sensitive, as it is
15812 typically only used in a @samp{static_assert} to make sure that a type
15813 fits within a cache line.
15815 See also @option{-Winterference-size}.
15817 @item loop-interchange-max-num-stmts
15818 The maximum number of stmts in a loop to be interchanged.
15820 @item loop-interchange-stride-ratio
15821 The minimum ratio between stride of two loops for interchange to be profitable.
15823 @item min-insn-to-prefetch-ratio
15824 The minimum ratio between the number of instructions and the
15825 number of prefetches to enable prefetching in a loop.
15827 @item prefetch-min-insn-to-mem-ratio
15828 The minimum ratio between the number of instructions and the
15829 number of memory references to enable prefetching in a loop.
15831 @item use-canonical-types
15832 Whether the compiler should use the ``canonical'' type system.
15833 Should always be 1, which uses a more efficient internal
15834 mechanism for comparing types in C++ and Objective-C++.  However, if
15835 bugs in the canonical type system are causing compilation failures,
15836 set this value to 0 to disable canonical types.
15838 @item switch-conversion-max-branch-ratio
15839 Switch initialization conversion refuses to create arrays that are
15840 bigger than @option{switch-conversion-max-branch-ratio} times the number of
15841 branches in the switch.
15843 @item max-partial-antic-length
15844 Maximum length of the partial antic set computed during the tree
15845 partial redundancy elimination optimization (@option{-ftree-pre}) when
15846 optimizing at @option{-O3} and above.  For some sorts of source code
15847 the enhanced partial redundancy elimination optimization can run away,
15848 consuming all of the memory available on the host machine.  This
15849 parameter sets a limit on the length of the sets that are computed,
15850 which prevents the runaway behavior.  Setting a value of 0 for
15851 this parameter allows an unlimited set length.
15853 @item rpo-vn-max-loop-depth
15854 Maximum loop depth that is value-numbered optimistically.
15855 When the limit hits the innermost
15856 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
15857 loop nest are value-numbered optimistically and the remaining ones not.
15859 @item sccvn-max-alias-queries-per-access
15860 Maximum number of alias-oracle queries we perform when looking for
15861 redundancies for loads and stores.  If this limit is hit the search
15862 is aborted and the load or store is not considered redundant.  The
15863 number of queries is algorithmically limited to the number of
15864 stores on all paths from the load to the function entry.
15866 @item ira-max-loops-num
15867 IRA uses regional register allocation by default.  If a function
15868 contains more loops than the number given by this parameter, only at most
15869 the given number of the most frequently-executed loops form regions
15870 for regional register allocation.
15872 @item ira-max-conflict-table-size 
15873 Although IRA uses a sophisticated algorithm to compress the conflict
15874 table, the table can still require excessive amounts of memory for
15875 huge functions.  If the conflict table for a function could be more
15876 than the size in MB given by this parameter, the register allocator
15877 instead uses a faster, simpler, and lower-quality
15878 algorithm that does not require building a pseudo-register conflict table.  
15880 @item ira-loop-reserved-regs
15881 IRA can be used to evaluate more accurate register pressure in loops
15882 for decisions to move loop invariants (see @option{-O3}).  The number
15883 of available registers reserved for some other purposes is given
15884 by this parameter.  Default of the parameter
15885 is the best found from numerous experiments.
15887 @item ira-consider-dup-in-all-alts
15888 Make IRA to consider matching constraint (duplicated operand number)
15889 heavily in all available alternatives for preferred register class.
15890 If it is set as zero, it means IRA only respects the matching
15891 constraint when it's in the only available alternative with an
15892 appropriate register class.  Otherwise, it means IRA will check all
15893 available alternatives for preferred register class even if it has
15894 found some choice with an appropriate register class and respect the
15895 found qualified matching constraint.
15897 @item ira-simple-lra-insn-threshold
15898 Approximate function insn number in 1K units triggering simple local RA.
15900 @item lra-inheritance-ebb-probability-cutoff
15901 LRA tries to reuse values reloaded in registers in subsequent insns.
15902 This optimization is called inheritance.  EBB is used as a region to
15903 do this optimization.  The parameter defines a minimal fall-through
15904 edge probability in percentage used to add BB to inheritance EBB in
15905 LRA.  The default value was chosen
15906 from numerous runs of SPEC2000 on x86-64.
15908 @item loop-invariant-max-bbs-in-loop
15909 Loop invariant motion can be very expensive, both in compilation time and
15910 in amount of needed compile-time memory, with very large loops.  Loops
15911 with more basic blocks than this parameter won't have loop invariant
15912 motion optimization performed on them.
15914 @item loop-max-datarefs-for-datadeps
15915 Building data dependencies is expensive for very large loops.  This
15916 parameter limits the number of data references in loops that are
15917 considered for data dependence analysis.  These large loops are no
15918 handled by the optimizations using loop data dependencies.
15920 @item max-vartrack-size
15921 Sets a maximum number of hash table slots to use during variable
15922 tracking dataflow analysis of any function.  If this limit is exceeded
15923 with variable tracking at assignments enabled, analysis for that
15924 function is retried without it, after removing all debug insns from
15925 the function.  If the limit is exceeded even without debug insns, var
15926 tracking analysis is completely disabled for the function.  Setting
15927 the parameter to zero makes it unlimited.
15929 @item max-vartrack-expr-depth
15930 Sets a maximum number of recursion levels when attempting to map
15931 variable names or debug temporaries to value expressions.  This trades
15932 compilation time for more complete debug information.  If this is set too
15933 low, value expressions that are available and could be represented in
15934 debug information may end up not being used; setting this higher may
15935 enable the compiler to find more complex debug expressions, but compile
15936 time and memory use may grow.
15938 @item max-debug-marker-count
15939 Sets a threshold on the number of debug markers (e.g.@: begin stmt
15940 markers) to avoid complexity explosion at inlining or expanding to RTL.
15941 If a function has more such gimple stmts than the set limit, such stmts
15942 will be dropped from the inlined copy of a function, and from its RTL
15943 expansion.
15945 @item min-nondebug-insn-uid
15946 Use uids starting at this parameter for nondebug insns.  The range below
15947 the parameter is reserved exclusively for debug insns created by
15948 @option{-fvar-tracking-assignments}, but debug insns may get
15949 (non-overlapping) uids above it if the reserved range is exhausted.
15951 @item ipa-sra-deref-prob-threshold
15952 IPA-SRA replaces a pointer which is known not be NULL with one or more
15953 new parameters only when the probability (in percent, relative to
15954 function entry) of it being dereferenced is higher than this parameter.
15956 @item ipa-sra-ptr-growth-factor
15957 IPA-SRA replaces a pointer to an aggregate with one or more new
15958 parameters only when their cumulative size is less or equal to
15959 @option{ipa-sra-ptr-growth-factor} times the size of the original
15960 pointer parameter.
15962 @item ipa-sra-ptrwrap-growth-factor
15963 Additional maximum allowed growth of total size of new parameters
15964 that ipa-sra replaces a pointer to an aggregate with,
15965 if it points to a local variable that the caller only writes to and
15966 passes it as an argument to other functions.
15968 @item ipa-sra-max-replacements
15969 Maximum pieces of an aggregate that IPA-SRA tracks.  As a
15970 consequence, it is also the maximum number of replacements of a formal
15971 parameter.
15973 @item sra-max-scalarization-size-Ospeed
15974 @itemx sra-max-scalarization-size-Osize
15975 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
15976 replace scalar parts of aggregates with uses of independent scalar
15977 variables.  These parameters control the maximum size, in storage units,
15978 of aggregate which is considered for replacement when compiling for
15979 speed
15980 (@option{sra-max-scalarization-size-Ospeed}) or size
15981 (@option{sra-max-scalarization-size-Osize}) respectively.
15983 @item sra-max-propagations
15984 The maximum number of artificial accesses that Scalar Replacement of
15985 Aggregates (SRA) will track, per one local variable, in order to
15986 facilitate copy propagation.
15988 @item tm-max-aggregate-size
15989 When making copies of thread-local variables in a transaction, this
15990 parameter specifies the size in bytes after which variables are
15991 saved with the logging functions as opposed to save/restore code
15992 sequence pairs.  This option only applies when using
15993 @option{-fgnu-tm}.
15995 @item graphite-max-nb-scop-params
15996 To avoid exponential effects in the Graphite loop transforms, the
15997 number of parameters in a Static Control Part (SCoP) is bounded.
15998 A value of zero can be used to lift
15999 the bound.  A variable whose value is unknown at compilation time and
16000 defined outside a SCoP is a parameter of the SCoP.
16002 @item hardcfr-max-blocks
16003 Disable @option{-fharden-control-flow-redundancy} for functions with a
16004 larger number of blocks than the specified value.  Zero removes any
16005 limit.
16007 @item hardcfr-max-inline-blocks
16008 Force @option{-fharden-control-flow-redundancy} to use out-of-line
16009 checking for functions with a larger number of basic blocks than the
16010 specified value.
16012 @item loop-block-tile-size
16013 Loop blocking or strip mining transforms, enabled with
16014 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
16015 loop in the loop nest by a given number of iterations.  The strip
16016 length can be changed using the @option{loop-block-tile-size}
16017 parameter.
16019 @item ipa-jump-function-lookups
16020 Specifies number of statements visited during jump function offset discovery.
16022 @item ipa-cp-value-list-size
16023 IPA-CP attempts to track all possible values and types passed to a function's
16024 parameter in order to propagate them and perform devirtualization.
16025 @option{ipa-cp-value-list-size} is the maximum number of values and types it
16026 stores per one formal parameter of a function.
16028 @item ipa-cp-eval-threshold
16029 IPA-CP calculates its own score of cloning profitability heuristics
16030 and performs those cloning opportunities with scores that exceed
16031 @option{ipa-cp-eval-threshold}.
16033 @item ipa-cp-max-recursive-depth
16034 Maximum depth of recursive cloning for self-recursive function.
16036 @item ipa-cp-min-recursive-probability
16037 Recursive cloning only when the probability of call being executed exceeds
16038 the parameter.
16040 @item ipa-cp-profile-count-base
16041 When using @option{-fprofile-use} option, IPA-CP will consider the measured
16042 execution count of a call graph edge at this percentage position in their
16043 histogram as the basis for its heuristics calculation.
16045 @item ipa-cp-recursive-freq-factor
16046 The number of times interprocedural copy propagation expects recursive
16047 functions to call themselves.
16049 @item ipa-cp-recursion-penalty
16050 Percentage penalty the recursive functions will receive when they
16051 are evaluated for cloning.
16053 @item ipa-cp-single-call-penalty
16054 Percentage penalty functions containing a single call to another
16055 function will receive when they are evaluated for cloning.
16057 @item ipa-max-agg-items
16058 IPA-CP is also capable to propagate a number of scalar values passed
16059 in an aggregate. @option{ipa-max-agg-items} controls the maximum
16060 number of such values per one parameter.
16062 @item ipa-cp-loop-hint-bonus
16063 When IPA-CP determines that a cloning candidate would make the number
16064 of iterations of a loop known, it adds a bonus of
16065 @option{ipa-cp-loop-hint-bonus} to the profitability score of
16066 the candidate.
16068 @item ipa-max-loop-predicates
16069 The maximum number of different predicates IPA will use to describe when
16070 loops in a function have known properties.
16072 @item ipa-max-aa-steps
16073 During its analysis of function bodies, IPA-CP employs alias analysis
16074 in order to track values pointed to by function parameters.  In order
16075 not spend too much time analyzing huge functions, it gives up and
16076 consider all memory clobbered after examining
16077 @option{ipa-max-aa-steps} statements modifying memory.
16079 @item ipa-max-switch-predicate-bounds
16080 Maximal number of boundary endpoints of case ranges of switch statement.
16081 For switch exceeding this limit, IPA-CP will not construct cloning cost
16082 predicate, which is used to estimate cloning benefit, for default case
16083 of the switch statement.
16085 @item ipa-max-param-expr-ops
16086 IPA-CP will analyze conditional statement that references some function
16087 parameter to estimate benefit for cloning upon certain constant value.
16088 But if number of operations in a parameter expression exceeds
16089 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
16090 one, and is not handled by IPA analysis.
16092 @item lto-partitions
16093 Specify desired number of partitions produced during WHOPR compilation.
16094 The number of partitions should exceed the number of CPUs used for compilation.
16096 @item lto-min-partition
16097 Size of minimal partition for WHOPR (in estimated instructions).
16098 This prevents expenses of splitting very small programs into too many
16099 partitions.
16101 @item lto-max-partition
16102 Size of max partition for WHOPR (in estimated instructions).
16103 to provide an upper bound for individual size of partition.
16104 Meant to be used only with balanced partitioning.
16106 @item lto-max-streaming-parallelism
16107 Maximal number of parallel processes used for LTO streaming.
16109 @item cxx-max-namespaces-for-diagnostic-help
16110 The maximum number of namespaces to consult for suggestions when C++
16111 name lookup fails for an identifier.
16113 @item sink-frequency-threshold
16114 The maximum relative execution frequency (in percents) of the target block
16115 relative to a statement's original block to allow statement sinking of a
16116 statement.  Larger numbers result in more aggressive statement sinking.
16117 A small positive adjustment is applied for
16118 statements with memory operands as those are even more profitable so sink.
16120 @item max-stores-to-sink
16121 The maximum number of conditional store pairs that can be sunk.  Set to 0
16122 if either vectorization (@option{-ftree-vectorize}) or if-conversion
16123 (@option{-ftree-loop-if-convert}) is disabled.
16125 @item case-values-threshold
16126 The smallest number of different values for which it is best to use a
16127 jump-table instead of a tree of conditional branches.  If the value is
16128 0, use the default for the machine.
16130 @item jump-table-max-growth-ratio-for-size
16131 The maximum code size growth ratio when expanding
16132 into a jump table (in percent).  The parameter is used when
16133 optimizing for size.
16135 @item jump-table-max-growth-ratio-for-speed
16136 The maximum code size growth ratio when expanding
16137 into a jump table (in percent).  The parameter is used when
16138 optimizing for speed.
16140 @item tree-reassoc-width
16141 Set the maximum number of instructions executed in parallel in
16142 reassociated tree. This parameter overrides target dependent
16143 heuristics used by default if has non zero value.
16145 @item sched-pressure-algorithm
16146 Choose between the two available implementations of
16147 @option{-fsched-pressure}.  Algorithm 1 is the original implementation
16148 and is the more likely to prevent instructions from being reordered.
16149 Algorithm 2 was designed to be a compromise between the relatively
16150 conservative approach taken by algorithm 1 and the rather aggressive
16151 approach taken by the default scheduler.  It relies more heavily on
16152 having a regular register file and accurate register pressure classes.
16153 See @file{haifa-sched.cc} in the GCC sources for more details.
16155 The default choice depends on the target.
16157 @item max-slsr-cand-scan
16158 Set the maximum number of existing candidates that are considered when
16159 seeking a basis for a new straight-line strength reduction candidate.
16161 @item asan-globals
16162 Enable buffer overflow detection for global objects.  This kind
16163 of protection is enabled by default if you are using
16164 @option{-fsanitize=address} option.
16165 To disable global objects protection use @option{--param asan-globals=0}.
16167 @item asan-stack
16168 Enable buffer overflow detection for stack objects.  This kind of
16169 protection is enabled by default when using @option{-fsanitize=address}.
16170 To disable stack protection use @option{--param asan-stack=0} option.
16172 @item asan-instrument-reads
16173 Enable buffer overflow detection for memory reads.  This kind of
16174 protection is enabled by default when using @option{-fsanitize=address}.
16175 To disable memory reads protection use
16176 @option{--param asan-instrument-reads=0}.
16178 @item asan-instrument-writes
16179 Enable buffer overflow detection for memory writes.  This kind of
16180 protection is enabled by default when using @option{-fsanitize=address}.
16181 To disable memory writes protection use
16182 @option{--param asan-instrument-writes=0} option.
16184 @item asan-memintrin
16185 Enable detection for built-in functions.  This kind of protection
16186 is enabled by default when using @option{-fsanitize=address}.
16187 To disable built-in functions protection use
16188 @option{--param asan-memintrin=0}.
16190 @item asan-use-after-return
16191 Enable detection of use-after-return.  This kind of protection
16192 is enabled by default when using the @option{-fsanitize=address} option.
16193 To disable it use @option{--param asan-use-after-return=0}.
16195 Note: By default the check is disabled at run time.  To enable it,
16196 add @code{detect_stack_use_after_return=1} to the environment variable
16197 @env{ASAN_OPTIONS}.
16199 @item asan-instrumentation-with-call-threshold
16200 If number of memory accesses in function being instrumented
16201 is greater or equal to this number, use callbacks instead of inline checks.
16202 E.g. to disable inline code use
16203 @option{--param asan-instrumentation-with-call-threshold=0}.
16205 @item asan-kernel-mem-intrinsic-prefix
16206 If nonzero, prefix calls to @code{memcpy}, @code{memset} and @code{memmove}
16207 with @samp{__asan_} or @samp{__hwasan_}
16208 for @option{-fsanitize=kernel-address} or @samp{-fsanitize=kernel-hwaddress},
16209 respectively.
16211 @item hwasan-instrument-stack
16212 Enable hwasan instrumentation of statically sized stack-allocated variables.
16213 This kind of instrumentation is enabled by default when using
16214 @option{-fsanitize=hwaddress} and disabled by default when using
16215 @option{-fsanitize=kernel-hwaddress}.
16216 To disable stack instrumentation use
16217 @option{--param hwasan-instrument-stack=0}, and to enable it use
16218 @option{--param hwasan-instrument-stack=1}.
16220 @item hwasan-random-frame-tag
16221 When using stack instrumentation, decide tags for stack variables using a
16222 deterministic sequence beginning at a random tag for each frame.  With this
16223 parameter unset tags are chosen using the same sequence but beginning from 1.
16224 This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
16225 for @option{-fsanitize=kernel-hwaddress}.
16226 To disable it use @option{--param hwasan-random-frame-tag=0}.
16228 @item hwasan-instrument-allocas
16229 Enable hwasan instrumentation of dynamically sized stack-allocated variables.
16230 This kind of instrumentation is enabled by default when using
16231 @option{-fsanitize=hwaddress} and disabled by default when using
16232 @option{-fsanitize=kernel-hwaddress}.
16233 To disable instrumentation of such variables use
16234 @option{--param hwasan-instrument-allocas=0}, and to enable it use
16235 @option{--param hwasan-instrument-allocas=1}.
16237 @item hwasan-instrument-reads
16238 Enable hwasan checks on memory reads.  Instrumentation of reads is enabled by
16239 default for both @option{-fsanitize=hwaddress} and
16240 @option{-fsanitize=kernel-hwaddress}.
16241 To disable checking memory reads use
16242 @option{--param hwasan-instrument-reads=0}.
16244 @item hwasan-instrument-writes
16245 Enable hwasan checks on memory writes.  Instrumentation of writes is enabled by
16246 default for both @option{-fsanitize=hwaddress} and
16247 @option{-fsanitize=kernel-hwaddress}.
16248 To disable checking memory writes use
16249 @option{--param hwasan-instrument-writes=0}.
16251 @item hwasan-instrument-mem-intrinsics
16252 Enable hwasan instrumentation of builtin functions.  Instrumentation of these
16253 builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
16254 and @option{-fsanitize=kernel-hwaddress}.
16255 To disable instrumentation of builtin functions use
16256 @option{--param hwasan-instrument-mem-intrinsics=0}.
16258 @item use-after-scope-direct-emission-threshold
16259 If the size of a local variable in bytes is smaller or equal to this
16260 number, directly poison (or unpoison) shadow memory instead of using
16261 run-time callbacks.
16263 @item tsan-distinguish-volatile
16264 Emit special instrumentation for accesses to volatiles.
16266 @item tsan-instrument-func-entry-exit
16267 Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
16269 @item max-fsm-thread-path-insns
16270 Maximum number of instructions to copy when duplicating blocks on a
16271 finite state automaton jump thread path.
16273 @item threader-debug
16274 threader-debug=[none|all] Enables verbose dumping of the threader solver.
16276 @item parloops-chunk-size
16277 Chunk size of omp schedule for loops parallelized by parloops.
16279 @item parloops-schedule
16280 Schedule type of omp schedule for loops parallelized by parloops (static,
16281 dynamic, guided, auto, runtime).
16283 @item parloops-min-per-thread
16284 The minimum number of iterations per thread of an innermost parallelized
16285 loop for which the parallelized variant is preferred over the single threaded
16286 one.  Note that for a parallelized loop nest the
16287 minimum number of iterations of the outermost loop per thread is two.
16289 @item max-ssa-name-query-depth
16290 Maximum depth of recursion when querying properties of SSA names in things
16291 like fold routines.  One level of recursion corresponds to following a
16292 use-def chain.
16294 @item max-speculative-devirt-maydefs
16295 The maximum number of may-defs we analyze when looking for a must-def
16296 specifying the dynamic type of an object that invokes a virtual call
16297 we may be able to devirtualize speculatively.
16299 @item ranger-debug
16300 Specifies the type of debug output to be issued for ranges.
16302 @item unroll-jam-min-percent
16303 The minimum percentage of memory references that must be optimized
16304 away for the unroll-and-jam transformation to be considered profitable.
16306 @item unroll-jam-max-unroll
16307 The maximum number of times the outer loop should be unrolled by
16308 the unroll-and-jam transformation.
16310 @item max-rtl-if-conversion-unpredictable-cost
16311 Maximum permissible cost for the sequence that would be generated
16312 by the RTL if-conversion pass for a branch that is considered unpredictable.
16314 @item max-variable-expansions-in-unroller
16315 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
16316 of times that an individual variable will be expanded during loop unrolling.
16318 @item partial-inlining-entry-probability
16319 Maximum probability of the entry BB of split region
16320 (in percent relative to entry BB of the function)
16321 to make partial inlining happen.
16323 @item max-tracked-strlens
16324 Maximum number of strings for which strlen optimization pass will
16325 track string lengths.
16327 @item gcse-after-reload-partial-fraction
16328 The threshold ratio for performing partial redundancy
16329 elimination after reload.
16331 @item gcse-after-reload-critical-fraction
16332 The threshold ratio of critical edges execution count that
16333 permit performing redundancy elimination after reload.
16335 @item max-loop-header-insns
16336 The maximum number of insns in loop header duplicated
16337 by the copy loop headers pass.
16339 @item vect-epilogues-nomask
16340 Enable loop epilogue vectorization using smaller vector size.
16342 @item vect-partial-vector-usage
16343 Controls when the loop vectorizer considers using partial vector loads
16344 and stores as an alternative to falling back to scalar code.  0 stops
16345 the vectorizer from ever using partial vector loads and stores.  1 allows
16346 partial vector loads and stores if vectorization removes the need for the
16347 code to iterate.  2 allows partial vector loads and stores in all loops.
16348 The parameter only has an effect on targets that support partial
16349 vector loads and stores.
16351 @item vect-inner-loop-cost-factor
16352 The maximum factor which the loop vectorizer applies to the cost of statements
16353 in an inner loop relative to the loop being vectorized.  The factor applied
16354 is the maximum of the estimated number of iterations of the inner loop and
16355 this parameter.  The default value of this parameter is 50.
16357 @item vect-induction-float
16358 Enable loop vectorization of floating point inductions.
16360 @item vrp-sparse-threshold
16361 Maximum number of basic blocks before VRP uses a sparse bitmap cache.
16363 @item vrp-switch-limit
16364 Maximum number of outgoing edges in a switch before VRP will not process it.
16366 @item vrp-vector-threshold
16367 Maximum number of basic blocks for VRP to use a basic cache vector.
16369 @item avoid-fma-max-bits
16370 Maximum number of bits for which we avoid creating FMAs.
16372 @item sms-loop-average-count-threshold
16373 A threshold on the average loop count considered by the swing modulo scheduler.
16375 @item sms-dfa-history
16376 The number of cycles the swing modulo scheduler considers when checking
16377 conflicts using DFA.
16379 @item graphite-allow-codegen-errors
16380 Whether codegen errors should be ICEs when @option{-fchecking}.
16382 @item sms-max-ii-factor
16383 A factor for tuning the upper bound that swing modulo scheduler
16384 uses for scheduling a loop.
16386 @item lra-max-considered-reload-pseudos
16387 The max number of reload pseudos which are considered during
16388 spilling a non-reload pseudo.
16390 @item max-pow-sqrt-depth
16391 Maximum depth of sqrt chains to use when synthesizing exponentiation
16392 by a real constant.
16394 @item max-dse-active-local-stores
16395 Maximum number of active local stores in RTL dead store elimination.
16397 @item asan-instrument-allocas
16398 Enable asan allocas/VLAs protection.
16400 @item max-iterations-computation-cost
16401 Bound on the cost of an expression to compute the number of iterations.
16403 @item max-isl-operations
16404 Maximum number of isl operations, 0 means unlimited.
16406 @item graphite-max-arrays-per-scop
16407 Maximum number of arrays per scop.
16409 @item max-vartrack-reverse-op-size
16410 Max. size of loc list for which reverse ops should be added.
16412 @item fsm-scale-path-stmts
16413 Scale factor to apply to the number of statements in a threading path
16414 crossing a loop backedge when comparing to
16415 @option{--param=max-jump-thread-duplication-stmts}.
16417 @item uninit-control-dep-attempts
16418 Maximum number of nested calls to search for control dependencies
16419 during uninitialized variable analysis.
16421 @item uninit-max-chain-len
16422 Maximum number of predicates anded for each predicate ored in the normalized
16423 predicate chain.
16425 @item uninit-max-num-chains
16426 Maximum number of predicates ored in the normalized predicate chain.
16428 @item sched-autopref-queue-depth
16429 Hardware autoprefetcher scheduler model control flag.
16430 Number of lookahead cycles the model looks into; at '
16431 ' only enable instruction sorting heuristic.
16433 @item loop-versioning-max-inner-insns
16434 The maximum number of instructions that an inner loop can have
16435 before the loop versioning pass considers it too big to copy.
16437 @item loop-versioning-max-outer-insns
16438 The maximum number of instructions that an outer loop can have
16439 before the loop versioning pass considers it too big to copy,
16440 discounting any instructions in inner loops that directly benefit
16441 from versioning.
16443 @item ssa-name-def-chain-limit
16444 The maximum number of SSA_NAME assignments to follow in determining
16445 a property of a variable such as its value.  This limits the number
16446 of iterations or recursive calls GCC performs when optimizing certain
16447 statements or when determining their validity prior to issuing
16448 diagnostics.
16450 @item store-merging-max-size
16451 Maximum size of a single store merging region in bytes.
16453 @item hash-table-verification-limit
16454 The number of elements for which hash table verification is done
16455 for each searched element.
16457 @item max-find-base-term-values
16458 Maximum number of VALUEs handled during a single find_base_term call.
16460 @item analyzer-max-enodes-per-program-point
16461 The maximum number of exploded nodes per program point within
16462 the analyzer, before terminating analysis of that point.
16464 @item analyzer-max-constraints
16465 The maximum number of constraints per state.
16467 @item analyzer-min-snodes-for-call-summary
16468 The minimum number of supernodes within a function for the
16469 analyzer to consider summarizing its effects at call sites.
16471 @item analyzer-max-enodes-for-full-dump
16472 The maximum depth of exploded nodes that should appear in a dot dump
16473 before switching to a less verbose format.
16475 @item analyzer-max-recursion-depth
16476 The maximum number of times a callsite can appear in a call stack
16477 within the analyzer, before terminating analysis of a call that would
16478 recurse deeper.
16480 @item analyzer-max-svalue-depth
16481 The maximum depth of a symbolic value, before approximating
16482 the value as unknown.
16484 @item analyzer-max-infeasible-edges
16485 The maximum number of infeasible edges to reject before declaring
16486 a diagnostic as infeasible.
16488 @item gimple-fe-computed-hot-bb-threshold
16489 The number of executions of a basic block which is considered hot.
16490 The parameter is used only in GIMPLE FE.
16492 @item analyzer-bb-explosion-factor
16493 The maximum number of 'after supernode' exploded nodes within the analyzer
16494 per supernode, before terminating analysis.
16496 @item analyzer-text-art-string-ellipsis-threshold
16497 The number of bytes at which to ellipsize string literals in analyzer text art diagrams.
16499 @item analyzer-text-art-ideal-canvas-width
16500 The ideal width in characters of text art diagrams generated by the analyzer.
16502 @item analyzer-text-art-string-ellipsis-head-len
16503 The number of literal bytes to show at the head of a string literal in text art when ellipsizing it.
16505 @item analyzer-text-art-string-ellipsis-tail-len
16506 The number of literal bytes to show at the tail of a string literal in text art when ellipsizing it.
16508 @item ranger-logical-depth
16509 Maximum depth of logical expression evaluation ranger will look through
16510 when evaluating outgoing edge ranges.
16512 @item ranger-recompute-depth
16513 Maximum depth of instruction chains to consider for recomputation
16514 in the outgoing range calculator.
16516 @item relation-block-limit
16517 Maximum number of relations the oracle will register in a basic block.
16519 @item min-pagesize
16520 Minimum page size for warning purposes.
16522 @item openacc-kernels
16523 Specify mode of OpenACC `kernels' constructs handling.
16524 With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
16525 constructs are decomposed into parts, a sequence of compute
16526 constructs, each then handled individually.
16527 This is work in progress.
16528 With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
16529 constructs are handled by the @samp{parloops} pass, en bloc.
16530 This is the current default.
16532 @item openacc-privatization
16533 Control whether the @option{-fopt-info-omp-note} and applicable
16534 @option{-fdump-tree-*-details} options emit OpenACC privatization diagnostics.
16535 With @option{--param=openacc-privatization=quiet}, don't diagnose.
16536 This is the current default.
16537 With @option{--param=openacc-privatization=noisy}, do diagnose.
16539 @end table
16541 The following choices of @var{name} are available on AArch64 targets:
16543 @table @gcctabopt
16544 @item aarch64-sve-compare-costs
16545 When vectorizing for SVE, consider using ``unpacked'' vectors for
16546 smaller elements and use the cost model to pick the cheapest approach.
16547 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
16549 Using unpacked vectors includes storing smaller elements in larger
16550 containers and accessing elements with extending loads and truncating
16551 stores.
16553 @item aarch64-float-recp-precision
16554 The number of Newton iterations for calculating the reciprocal for float type.
16555 The precision of division is proportional to this param when division
16556 approximation is enabled.  The default value is 1.
16558 @item aarch64-double-recp-precision
16559 The number of Newton iterations for calculating the reciprocal for double type.
16560 The precision of division is propotional to this param when division
16561 approximation is enabled.  The default value is 2.
16563 @item aarch64-autovec-preference
16564 Force an ISA selection strategy for auto-vectorization.  Accepts values from
16565 0 to 4, inclusive.
16566 @table @samp
16567 @item 0
16568 Use the default heuristics.
16569 @item 1
16570 Use only Advanced SIMD for auto-vectorization.
16571 @item 2
16572 Use only SVE for auto-vectorization.
16573 @item 3
16574 Use both Advanced SIMD and SVE.  Prefer Advanced SIMD when the costs are
16575 deemed equal.
16576 @item 4
16577 Use both Advanced SIMD and SVE.  Prefer SVE when the costs are deemed equal.
16578 @end table
16579 The default value is 0.
16581 @item aarch64-ldp-policy
16582 Fine-grained policy for load pairs.
16583 With @option{--param=aarch64-ldp-policy=default}, use the policy of the
16584 tuning structure.  This is the current default.
16585 With @option{--param=aarch64-ldp-policy=always}, emit ldp regardless
16586 of alignment.
16587 With @option{--param=aarch64-ldp-policy=never}, do not emit ldp.
16588 With @option{--param=aarch64-ldp-policy=aligned}, emit ldp only if the
16589 source pointer is aligned to at least double the alignment of the type.
16591 @item aarch64-stp-policy
16592 Fine-grained policy for store pairs.
16593 With @option{--param=aarch64-stp-policy=default}, use the policy of the
16594 tuning structure.  This is the current default.
16595 With @option{--param=aarch64-stp-policy=always}, emit stp regardless
16596 of alignment.
16597 With @option{--param=aarch64-stp-policy=never}, do not emit stp.
16598 With @option{--param=aarch64-stp-policy=aligned}, emit stp only if the
16599 source pointer is aligned to at least double the alignment of the type.
16601 @item aarch64-loop-vect-issue-rate-niters
16602 The tuning for some AArch64 CPUs tries to take both latencies and issue
16603 rates into account when deciding whether a loop should be vectorized
16604 using SVE, vectorized using Advanced SIMD, or not vectorized at all.
16605 If this parameter is set to @var{n}, GCC will not use this heuristic
16606 for loops that are known to execute in fewer than @var{n} Advanced
16607 SIMD iterations.
16609 @item aarch64-vect-unroll-limit
16610 The vectorizer will use available tuning information to determine whether it
16611 would be beneficial to unroll the main vectorized loop and by how much.  This
16612 parameter set's the upper bound of how much the vectorizer will unroll the main
16613 loop.  The default value is four.
16615 @end table
16617 The following choices of @var{name} are available on i386 and x86_64 targets:
16619 @table @gcctabopt
16620 @item x86-stlf-window-ninsns
16621 Instructions number above which STFL stall penalty can be compensated.
16623 @item x86-stv-max-visits
16624 The maximum number of use and def visits when discovering a STV chain before
16625 the discovery is aborted.
16627 @end table
16629 @end table
16631 @node Instrumentation Options
16632 @section Program Instrumentation Options
16633 @cindex instrumentation options
16634 @cindex program instrumentation options
16635 @cindex run-time error checking options
16636 @cindex profiling options
16637 @cindex options, program instrumentation
16638 @cindex options, run-time error checking
16639 @cindex options, profiling
16641 GCC supports a number of command-line options that control adding
16642 run-time instrumentation to the code it normally generates.  
16643 For example, one purpose of instrumentation is collect profiling
16644 statistics for use in finding program hot spots, code coverage
16645 analysis, or profile-guided optimizations.
16646 Another class of program instrumentation is adding run-time checking 
16647 to detect programming errors like invalid pointer
16648 dereferences or out-of-bounds array accesses, as well as deliberately
16649 hostile attacks such as stack smashing or C++ vtable hijacking.
16650 There is also a general hook which can be used to implement other
16651 forms of tracing or function-level instrumentation for debug or
16652 program analysis purposes.
16654 @table @gcctabopt
16655 @cindex @command{prof}
16656 @cindex @command{gprof}
16657 @opindex p
16658 @opindex pg
16659 @item -p
16660 @itemx -pg
16661 Generate extra code to write profile information suitable for the
16662 analysis program @command{prof} (for @option{-p}) or @command{gprof}
16663 (for @option{-pg}).  You must use this option when compiling
16664 the source files you want data about, and you must also use it when
16665 linking.
16667 You can use the function attribute @code{no_instrument_function} to
16668 suppress profiling of individual functions when compiling with these options.
16669 @xref{Common Function Attributes}.
16671 @opindex fprofile-arcs
16672 @item -fprofile-arcs
16673 Add code so that program flow @dfn{arcs} are instrumented.  During
16674 execution the program records how many times each branch and call is
16675 executed and how many times it is taken or returns.  On targets that support
16676 constructors with priority support, profiling properly handles constructors,
16677 destructors and C++ constructors (and destructors) of classes which are used
16678 as a type of a global variable.
16680 When the compiled
16681 program exits it saves this data to a file called
16682 @file{@var{auxname}.gcda} for each source file.  The data may be used for
16683 profile-directed optimizations (@option{-fbranch-probabilities}), or for
16684 test coverage analysis (@option{-ftest-coverage}).  Each object file's
16685 @var{auxname} is generated from the name of the output file, if
16686 explicitly specified and it is not the final executable, otherwise it is
16687 the basename of the source file.  In both cases any suffix is removed
16688 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
16689 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
16691 Note that if a command line directly links source files, the corresponding
16692 @var{.gcda} files will be prefixed with the unsuffixed name of the output file.
16693 E.g. @code{gcc a.c b.c -o binary} would generate @file{binary-a.gcda} and
16694 @file{binary-b.gcda} files.
16696 @xref{Cross-profiling}.
16698 @cindex @command{gcov}
16699 @opindex coverage
16700 @item --coverage
16702 This option is used to compile and link code instrumented for coverage
16703 analysis.  The option is a synonym for @option{-fprofile-arcs}
16704 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
16705 linking).  See the documentation for those options for more details.
16707 @itemize
16709 @item
16710 Compile the source files with @option{-fprofile-arcs} plus optimization
16711 and code generation options.  For test coverage analysis, use the
16712 additional @option{-ftest-coverage} option.  You do not need to profile
16713 every source file in a program.
16715 @item
16716 Compile the source files additionally with @option{-fprofile-abs-path}
16717 to create absolute path names in the @file{.gcno} files.  This allows
16718 @command{gcov} to find the correct sources in projects where compilations
16719 occur with different working directories.
16721 @item
16722 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
16723 (the latter implies the former).
16725 @item
16726 Run the program on a representative workload to generate the arc profile
16727 information.  This may be repeated any number of times.  You can run
16728 concurrent instances of your program, and provided that the file system
16729 supports locking, the data files will be correctly updated.  Unless
16730 a strict ISO C dialect option is in effect, @code{fork} calls are
16731 detected and correctly handled without double counting.
16733 Moreover, an object file can be recompiled multiple times
16734 and the corresponding @file{.gcda} file merges as long as
16735 the source file and the compiler options are unchanged.
16737 @item
16738 For profile-directed optimizations, compile the source files again with
16739 the same optimization and code generation options plus
16740 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
16741 Control Optimization}).
16743 @item
16744 For test coverage analysis, use @command{gcov} to produce human readable
16745 information from the @file{.gcno} and @file{.gcda} files.  Refer to the
16746 @command{gcov} documentation for further information.
16748 @end itemize
16750 With @option{-fprofile-arcs}, for each function of your program GCC
16751 creates a program flow graph, then finds a spanning tree for the graph.
16752 Only arcs that are not on the spanning tree have to be instrumented: the
16753 compiler adds code to count the number of times that these arcs are
16754 executed.  When an arc is the only exit or only entrance to a block, the
16755 instrumentation code can be added to the block; otherwise, a new basic
16756 block must be created to hold the instrumentation code.
16758 @need 2000
16759 @opindex ftest-coverage
16760 @item -ftest-coverage
16761 Produce a notes file that the @command{gcov} code-coverage utility
16762 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
16763 show program coverage.  Each source file's note file is called
16764 @file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
16765 above for a description of @var{auxname} and instructions on how to
16766 generate test coverage data.  Coverage data matches the source files
16767 more closely if you do not optimize.
16769 @opindex fprofile-abs-path
16770 @item -fprofile-abs-path
16771 Automatically convert relative source file names to absolute path names
16772 in the @file{.gcno} files.  This allows @command{gcov} to find the correct
16773 sources in projects where compilations occur with different working
16774 directories.
16776 @opindex fprofile-dir
16777 @item -fprofile-dir=@var{path}
16779 Set the directory to search for the profile data files in to @var{path}.
16780 This option affects only the profile data generated by
16781 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
16782 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
16783 and its related options.  Both absolute and relative paths can be used.
16784 By default, GCC uses the current directory as @var{path}, thus the
16785 profile data file appears in the same directory as the object file.
16786 In order to prevent the file name clashing, if the object file name is
16787 not an absolute path, we mangle the absolute path of the
16788 @file{@var{sourcename}.gcda} file and use it as the file name of a
16789 @file{.gcda} file.  See details about the file naming in @option{-fprofile-arcs}.
16790 See similar option @option{-fprofile-note}.
16792 When an executable is run in a massive parallel environment, it is recommended
16793 to save profile to different folders.  That can be done with variables
16794 in @var{path} that are exported during run-time:
16796 @table @gcctabopt
16798 @item %p
16799 process ID.
16801 @item %q@{VAR@}
16802 value of environment variable @var{VAR}
16804 @end table
16806 @opindex fprofile-generate
16807 @item -fprofile-generate
16808 @itemx -fprofile-generate=@var{path}
16810 Enable options usually used for instrumenting application to produce
16811 profile useful for later recompilation with profile feedback based
16812 optimization.  You must use @option{-fprofile-generate} both when
16813 compiling and when linking your program.
16815 The following options are enabled:
16816 @option{-fprofile-arcs}, @option{-fprofile-values},
16817 @option{-finline-functions}, and @option{-fipa-bit-cp}.
16819 If @var{path} is specified, GCC looks at the @var{path} to find
16820 the profile feedback data files. See @option{-fprofile-dir}.
16822 To optimize the program based on the collected profile information, use
16823 @option{-fprofile-use}.  @xref{Optimize Options}, for more information.
16825 @opindex fprofile-info-section
16826 @item -fprofile-info-section
16827 @itemx -fprofile-info-section=@var{name}
16829 Register the profile information in the specified section instead of using a
16830 constructor/destructor.  The section name is @var{name} if it is specified,
16831 otherwise the section name defaults to @code{.gcov_info}.  A pointer to the
16832 profile information generated by @option{-fprofile-arcs} is placed in the
16833 specified section for each translation unit.  This option disables the profile
16834 information registration through a constructor and it disables the profile
16835 information processing through a destructor.  This option is not intended to be
16836 used in hosted environments such as GNU/Linux.  It targets freestanding
16837 environments (for example embedded systems) with limited resources which do not
16838 support constructors/destructors or the C library file I/O.
16840 The linker could collect the input sections in a continuous memory block and
16841 define start and end symbols.  A GNU linker script example which defines a
16842 linker output section follows:
16844 @smallexample
16845   .gcov_info      :
16846   @{
16847     PROVIDE (__gcov_info_start = .);
16848     KEEP (*(.gcov_info))
16849     PROVIDE (__gcov_info_end = .);
16850   @}
16851 @end smallexample
16853 The program could dump the profiling information registered in this linker set
16854 for example like this:
16856 @smallexample
16857 #include <gcov.h>
16858 #include <stdio.h>
16859 #include <stdlib.h>
16861 extern const struct gcov_info *const __gcov_info_start[];
16862 extern const struct gcov_info *const __gcov_info_end[];
16864 static void
16865 dump (const void *d, unsigned n, void *arg)
16867   const unsigned char *c = d;
16869   for (unsigned i = 0; i < n; ++i)
16870     printf ("%02x", c[i]);
16873 static void
16874 filename (const char *f, void *arg)
16876   __gcov_filename_to_gcfn (f, dump, arg );
16879 static void *
16880 allocate (unsigned length, void *arg)
16882   return malloc (length);
16885 static void
16886 dump_gcov_info (void)
16888   const struct gcov_info *const *info = __gcov_info_start;
16889   const struct gcov_info *const *end = __gcov_info_end;
16891   /* Obfuscate variable to prevent compiler optimizations.  */
16892   __asm__ ("" : "+r" (info));
16894   while (info != end)
16895   @{
16896     void *arg = NULL;
16897     __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
16898     putchar ('\n');
16899     ++info;
16900   @}
16904 main (void)
16906   dump_gcov_info ();
16907   return 0;
16909 @end smallexample
16911 The @command{merge-stream} subcommand of @command{gcov-tool} may be used to
16912 deserialize the data stream generated by the @code{__gcov_filename_to_gcfn} and
16913 @code{__gcov_info_to_gcda} functions and merge the profile information into
16914 @file{.gcda} files on the host filesystem.
16916 @opindex fprofile-note
16917 @item -fprofile-note=@var{path}
16919 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
16920 location.  If you combine the option with multiple source files,
16921 the @file{.gcno} file will be overwritten.
16923 @opindex fprofile-prefix-path
16924 @item -fprofile-prefix-path=@var{path}
16926 This option can be used in combination with
16927 @option{profile-generate=}@var{profile_dir} and
16928 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
16929 directory of built source tree.  By default @var{profile_dir} will contain
16930 files with mangled absolute paths of all object files in the built project.
16931 This is not desirable when directory used to build the instrumented binary
16932 differs from the directory used to build the binary optimized with profile
16933 feedback because the profile data will not be found during the optimized build.
16934 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
16935 pointing to the base directory of the build can be used to strip the irrelevant
16936 part of the path and keep all file names relative to the main build directory.
16938 @opindex fprofile-prefix-map
16939 @item -fprofile-prefix-map=@var{old}=@var{new}
16940 When compiling files residing in directory @file{@var{old}}, record
16941 profiling information (with @option{--coverage})
16942 describing them as if the files resided in
16943 directory @file{@var{new}} instead.
16944 See also @option{-ffile-prefix-map} and @option{-fcanon-prefix-map}.
16946 @opindex fprofile-update
16947 @item -fprofile-update=@var{method}
16949 Alter the update method for an application instrumented for profile
16950 feedback based optimization.  The @var{method} argument should be one of
16951 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
16952 The first one is useful for single-threaded applications,
16953 while the second one prevents profile corruption by emitting thread-safe code.
16955 @strong{Warning:} When an application does not properly join all threads
16956 (or creates an detached thread), a profile file can be still corrupted.
16958 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
16959 when supported by a target, or to @samp{single} otherwise.  The GCC driver
16960 automatically selects @samp{prefer-atomic} when @option{-pthread}
16961 is present in the command line.
16963 @opindex fprofile-filter-files
16964 @item -fprofile-filter-files=@var{regex}
16966 Instrument only functions from files whose name matches
16967 any of the regular expressions (separated by semi-colons).
16969 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
16970 only @file{main.c} and all C files starting with 'module'.
16972 @opindex fprofile-exclude-files
16973 @item -fprofile-exclude-files=@var{regex}
16975 Instrument only functions from files whose name does not match
16976 any of the regular expressions (separated by semi-colons).
16978 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
16979 of all files that are located in the @file{/usr/} folder.
16981 @opindex fprofile-reproducible
16982 @item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
16983 Control level of reproducibility of profile gathered by
16984 @code{-fprofile-generate}.  This makes it possible to rebuild program
16985 with same outcome which is useful, for example, for distribution
16986 packages.
16988 With @option{-fprofile-reproducible=serial} the profile gathered by
16989 @option{-fprofile-generate} is reproducible provided the trained program
16990 behaves the same at each invocation of the train run, it is not
16991 multi-threaded and profile data streaming is always done in the same
16992 order.  Note that profile streaming happens at the end of program run but
16993 also before @code{fork} function is invoked.
16995 Note that it is quite common that execution counts of some part of
16996 programs depends, for example, on length of temporary file names or
16997 memory space randomization (that may affect hash-table collision rate).
16998 Such non-reproducible part of programs may be annotated by
16999 @code{no_instrument_function} function attribute. @command{gcov-dump} with
17000 @option{-l} can be used to dump gathered data and verify that they are
17001 indeed reproducible.
17003 With @option{-fprofile-reproducible=parallel-runs} collected profile
17004 stays reproducible regardless the order of streaming of the data into
17005 gcda files.  This setting makes it possible to run multiple instances of
17006 instrumented program in parallel (such as with @code{make -j}). This
17007 reduces quality of gathered data, in particular of indirect call
17008 profiling.
17010 @opindex fsanitize=address
17011 @item -fsanitize=address
17012 Enable AddressSanitizer, a fast memory error detector.
17013 Memory access instructions are instrumented to detect
17014 out-of-bounds and use-after-free bugs.
17015 The option enables @option{-fsanitize-address-use-after-scope}.
17016 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
17017 more details.  The run-time behavior can be influenced using the
17018 @env{ASAN_OPTIONS} environment variable.  When set to @code{help=1},
17019 the available options are shown at startup of the instrumented program.  See
17020 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
17021 for a list of supported options.
17022 The option cannot be combined with @option{-fsanitize=thread} or
17023 @option{-fsanitize=hwaddress}.  Note that the only target
17024 @option{-fsanitize=hwaddress} is currently supported on is AArch64.
17026 To get more accurate stack traces, it is possible to use options such as
17027 @option{-O0}, @option{-O1}, or @option{-Og} (which, for instance, prevent
17028 most function inlining), @option{-fno-optimize-sibling-calls} (which prevents
17029 optimizing sibling and tail recursive calls; this option is implicit for
17030 @option{-O0}, @option{-O1}, or @option{-Og}), or @option{-fno-ipa-icf} (which
17031 disables Identical Code Folding for functions).  Since multiple runs of the
17032 program may yield backtraces with different addresses due to ASLR (Address
17033 Space Layout Randomization), it may be desirable to turn ASLR off.  On Linux,
17034 this can be achieved with @samp{setarch `uname -m` -R ./prog}.
17036 @opindex fsanitize=kernel-address
17037 @item -fsanitize=kernel-address
17038 Enable AddressSanitizer for Linux kernel.
17039 See @uref{https://github.com/google/kernel-sanitizers} for more details.
17041 @opindex fsanitize=hwaddress
17042 @item -fsanitize=hwaddress
17043 Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
17044 ignore the top byte of a pointer to allow the detection of memory errors with
17045 a low memory overhead.
17046 Memory access instructions are instrumented to detect out-of-bounds and
17047 use-after-free bugs.
17048 The option enables @option{-fsanitize-address-use-after-scope}.
17050 @uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
17051 for more details.  The run-time behavior can be influenced using the
17052 @env{HWASAN_OPTIONS} environment variable.  When set to @code{help=1},
17053 the available options are shown at startup of the instrumented program.
17054 The option cannot be combined with @option{-fsanitize=thread} or
17055 @option{-fsanitize=address}, and is currently only available on AArch64.
17057 @opindex fsanitize=kernel-hwaddress
17058 @item -fsanitize=kernel-hwaddress
17059 Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
17060 Similar to @option{-fsanitize=kernel-address} but using an alternate
17061 instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
17062 instrumentation differences necessary for compiling the Linux kernel.
17063 These differences are to avoid hwasan library initialization calls and to
17064 account for the stack pointer having a different value in its top byte.
17066 @emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
17067 Instrumenting the stack and alloca calls are not on by default but are still
17068 possible by specifying the command-line options
17069 @option{--param hwasan-instrument-stack=1} and
17070 @option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
17071 tag is not implemented for kernel instrumentation.
17073 @opindex fsanitize=pointer-compare
17074 @item -fsanitize=pointer-compare
17075 Instrument comparison operation (<, <=, >, >=) with pointer operands.
17076 The option must be combined with either @option{-fsanitize=kernel-address} or
17077 @option{-fsanitize=address}
17078 The option cannot be combined with @option{-fsanitize=thread}.
17079 Note: By default the check is disabled at run time.  To enable it,
17080 add @code{detect_invalid_pointer_pairs=2} to the environment variable
17081 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
17082 invalid operation only when both pointers are non-null.
17084 @opindex fsanitize=pointer-subtract
17085 @item -fsanitize=pointer-subtract
17086 Instrument subtraction with pointer operands.
17087 The option must be combined with either @option{-fsanitize=kernel-address} or
17088 @option{-fsanitize=address}
17089 The option cannot be combined with @option{-fsanitize=thread}.
17090 Note: By default the check is disabled at run time.  To enable it,
17091 add @code{detect_invalid_pointer_pairs=2} to the environment variable
17092 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
17093 invalid operation only when both pointers are non-null.
17095 @opindex fsanitize=shadow-call-stack
17096 @item -fsanitize=shadow-call-stack
17097 Enable ShadowCallStack, a security enhancement mechanism used to protect
17098 programs against return address overwrites (e.g. stack buffer overflows.)
17099 It works by saving a function's return address to a separately allocated
17100 shadow call stack in the function prologue and restoring the return address
17101 from the shadow call stack in the function epilogue.  Instrumentation only
17102 occurs in functions that need to save the return address to the stack.
17104 Currently it only supports the aarch64 platform.  It is specifically
17105 designed for linux kernels that enable the CONFIG_SHADOW_CALL_STACK option.
17106 For the user space programs, runtime support is not currently provided
17107 in libc and libgcc.  Users who want to use this feature in user space need
17108 to provide their own support for the runtime.  It should be noted that
17109 this may cause the ABI rules to be broken.
17111 On aarch64, the instrumentation makes use of the platform register @code{x18}.
17112 This generally means that any code that may run on the same thread as code
17113 compiled with ShadowCallStack must be compiled with the flag
17114 @option{-ffixed-x18}, otherwise functions compiled without
17115 @option{-ffixed-x18} might clobber @code{x18} and so corrupt the shadow
17116 stack pointer.
17118 Also, because there is no userspace runtime support, code compiled with
17119 ShadowCallStack cannot use exception handling.  Use @option{-fno-exceptions}
17120 to turn off exceptions.
17122 See @uref{https://clang.llvm.org/docs/ShadowCallStack.html} for more
17123 details.
17125 @opindex fsanitize=thread
17126 @item -fsanitize=thread
17127 Enable ThreadSanitizer, a fast data race detector.
17128 Memory access instructions are instrumented to detect
17129 data race bugs.  See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
17130 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
17131 environment variable; see
17132 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
17133 supported options.
17134 The option cannot be combined with @option{-fsanitize=address},
17135 @option{-fsanitize=leak}.
17137 Note that sanitized atomic builtins cannot throw exceptions when
17138 operating on invalid memory addresses with non-call exceptions
17139 (@option{-fnon-call-exceptions}).
17141 @opindex fsanitize=leak
17142 @item -fsanitize=leak
17143 Enable LeakSanitizer, a memory leak detector.
17144 This option only matters for linking of executables.
17145 The executable is linked against a library that overrides @code{malloc}
17146 and other allocator functions.  See
17147 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
17148 details.  The run-time behavior can be influenced using the
17149 @env{LSAN_OPTIONS} environment variable.
17150 The option cannot be combined with @option{-fsanitize=thread}.
17152 @opindex fsanitize=undefined
17153 @item -fsanitize=undefined
17154 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
17155 Various computations are instrumented to detect undefined behavior
17156 at runtime.  See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details.   The run-time behavior can be influenced using the
17157 @env{UBSAN_OPTIONS} environment variable.  Current suboptions are:
17159 @table @gcctabopt
17161 @opindex fsanitize=shift
17162 @item -fsanitize=shift
17163 This option enables checking that the result of a shift operation is
17164 not undefined.  Note that what exactly is considered undefined differs
17165 slightly between C and C++, as well as between ISO C90 and C99, etc.
17166 This option has two suboptions, @option{-fsanitize=shift-base} and
17167 @option{-fsanitize=shift-exponent}.
17169 @opindex fsanitize=shift-exponent
17170 @item -fsanitize=shift-exponent
17171 This option enables checking that the second argument of a shift operation
17172 is not negative and is smaller than the precision of the promoted first
17173 argument.
17175 @opindex fsanitize=shift-base
17176 @item -fsanitize=shift-base
17177 If the second argument of a shift operation is within range, check that the
17178 result of a shift operation is not undefined.  Note that what exactly is
17179 considered undefined differs slightly between C and C++, as well as between
17180 ISO C90 and C99, etc.
17182 @opindex fsanitize=integer-divide-by-zero
17183 @item -fsanitize=integer-divide-by-zero
17184 Detect integer division by zero.
17186 @opindex fsanitize=unreachable
17187 @item -fsanitize=unreachable
17188 With this option, the compiler turns the @code{__builtin_unreachable}
17189 call into a diagnostics message call instead.  When reaching the
17190 @code{__builtin_unreachable} call, the behavior is undefined.
17192 @opindex fsanitize=vla-bound
17193 @item -fsanitize=vla-bound
17194 This option instructs the compiler to check that the size of a variable
17195 length array is positive.
17197 @opindex fsanitize=null
17198 @item -fsanitize=null
17199 This option enables pointer checking.  Particularly, the application
17200 built with this option turned on will issue an error message when it
17201 tries to dereference a NULL pointer, or if a reference (possibly an
17202 rvalue reference) is bound to a NULL pointer, or if a method is invoked
17203 on an object pointed by a NULL pointer.
17205 @opindex fsanitize=return
17206 @item -fsanitize=return
17207 This option enables return statement checking.  Programs
17208 built with this option turned on will issue an error message
17209 when the end of a non-void function is reached without actually
17210 returning a value.  This option works in C++ only.
17212 @opindex fsanitize=signed-integer-overflow
17213 @item -fsanitize=signed-integer-overflow
17214 This option enables signed integer overflow checking.  We check that
17215 the result of @code{+}, @code{*}, and both unary and binary @code{-}
17216 does not overflow in the signed arithmetics.  This also detects
17217 @code{INT_MIN / -1} signed division.  Note, integer promotion
17218 rules must be taken into account.  That is, the following is not an
17219 overflow:
17220 @smallexample
17221 signed char a = SCHAR_MAX;
17222 a++;
17223 @end smallexample
17225 @opindex fsanitize=bounds
17226 @item -fsanitize=bounds
17227 This option enables instrumentation of array bounds.  Various out of bounds
17228 accesses are detected.  Flexible array members, flexible array member-like
17229 arrays, and initializers of variables with static storage are not
17230 instrumented, with the exception of flexible array member-like arrays
17231 for which @code{-fstrict-flex-arrays} or @code{-fstrict-flex-arrays=}
17232 options or @code{strict_flex_array} attributes say they shouldn't be treated
17233 like flexible array member-like arrays.
17235 @opindex fsanitize=bounds-strict
17236 @item -fsanitize=bounds-strict
17237 This option enables strict instrumentation of array bounds.  Most out of bounds
17238 accesses are detected, including flexible array member-like arrays.
17239 Initializers of variables with static storage are not instrumented.
17241 @opindex fsanitize=alignment
17242 @item -fsanitize=alignment
17244 This option enables checking of alignment of pointers when they are
17245 dereferenced, or when a reference is bound to insufficiently aligned target,
17246 or when a method or constructor is invoked on insufficiently aligned object.
17248 @opindex fsanitize=object-size
17249 @item -fsanitize=object-size
17250 This option enables instrumentation of memory references using the
17251 @code{__builtin_dynamic_object_size} function.  Various out of bounds
17252 pointer accesses are detected.
17254 @opindex fsanitize=float-divide-by-zero
17255 @item -fsanitize=float-divide-by-zero
17256 Detect floating-point division by zero.  Unlike other similar options,
17257 @option{-fsanitize=float-divide-by-zero} is not enabled by
17258 @option{-fsanitize=undefined}, since floating-point division by zero can
17259 be a legitimate way of obtaining infinities and NaNs.
17261 @opindex fsanitize=float-cast-overflow
17262 @item -fsanitize=float-cast-overflow
17263 This option enables floating-point type to integer conversion checking.
17264 We check that the result of the conversion does not overflow.
17265 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
17266 not enabled by @option{-fsanitize=undefined}.
17267 This option does not work well with @code{FE_INVALID} exceptions enabled.
17269 @opindex fsanitize=nonnull-attribute
17270 @item -fsanitize=nonnull-attribute
17272 This option enables instrumentation of calls, checking whether null values
17273 are not passed to arguments marked as requiring a non-null value by the
17274 @code{nonnull} function attribute.
17276 @opindex fsanitize=returns-nonnull-attribute
17277 @item -fsanitize=returns-nonnull-attribute
17279 This option enables instrumentation of return statements in functions
17280 marked with @code{returns_nonnull} function attribute, to detect returning
17281 of null values from such functions.
17283 @opindex fsanitize=bool
17284 @item -fsanitize=bool
17286 This option enables instrumentation of loads from bool.  If a value other
17287 than 0/1 is loaded, a run-time error is issued.
17289 @opindex fsanitize=enum
17290 @item -fsanitize=enum
17292 This option enables instrumentation of loads from an enum type.  If
17293 a value outside the range of values for the enum type is loaded,
17294 a run-time error is issued.
17296 @opindex fsanitize=vptr
17297 @item -fsanitize=vptr
17299 This option enables instrumentation of C++ member function calls, member
17300 accesses and some conversions between pointers to base and derived classes,
17301 to verify the referenced object has the correct dynamic type.
17303 @opindex fsanitize=pointer-overflow
17304 @item -fsanitize=pointer-overflow
17306 This option enables instrumentation of pointer arithmetics.  If the pointer
17307 arithmetics overflows, a run-time error is issued.
17309 @opindex fsanitize=builtin
17310 @item -fsanitize=builtin
17312 This option enables instrumentation of arguments to selected builtin
17313 functions.  If an invalid value is passed to such arguments, a run-time
17314 error is issued.  E.g.@ passing 0 as the argument to @code{__builtin_ctz}
17315 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
17316 by this option.
17318 @end table
17320 Note that sanitizers tend to increase the rate of false positive
17321 warnings, most notably those around @option{-Wmaybe-uninitialized}.
17322 We recommend against combining @option{-Werror} and [the use of]
17323 sanitizers.
17325 While @option{-ftrapv} causes traps for signed overflows to be emitted,
17326 @option{-fsanitize=undefined} gives a diagnostic message.
17327 This currently works only for the C family of languages.
17329 @opindex fno-sanitize=all
17330 @item -fno-sanitize=all
17332 This option disables all previously enabled sanitizers.
17333 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
17334 together.
17336 @opindex fasan-shadow-offset
17337 @item -fasan-shadow-offset=@var{number}
17338 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
17339 It is useful for experimenting with different shadow memory layouts in
17340 Kernel AddressSanitizer.
17342 @opindex fsanitize-sections
17343 @item -fsanitize-sections=@var{s1},@var{s2},...
17344 Sanitize global variables in selected user-defined sections.  @var{si} may
17345 contain wildcards.
17347 @opindex fsanitize-recover
17348 @opindex fno-sanitize-recover
17349 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
17350 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
17351 mentioned in comma-separated list of @var{opts}.  Enabling this option
17352 for a sanitizer component causes it to attempt to continue
17353 running the program as if no error happened.  This means multiple
17354 runtime errors can be reported in a single program run, and the exit
17355 code of the program may indicate success even when errors
17356 have been reported.  The @option{-fno-sanitize-recover=} option
17357 can be used to alter
17358 this behavior: only the first detected error is reported
17359 and program then exits with a non-zero exit code.
17361 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
17362 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
17363 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
17364 @option{-fsanitize=bounds-strict},
17365 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
17366 For these sanitizers error recovery is turned on by default,
17367 except @option{-fsanitize=address}, for which this feature is experimental.
17368 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
17369 accepted, the former enables recovery for all sanitizers that support it,
17370 the latter disables recovery for all sanitizers that support it.
17372 Even if a recovery mode is turned on the compiler side, it needs to be also
17373 enabled on the runtime library side, otherwise the failures are still fatal.
17374 The runtime library defaults to @code{halt_on_error=0} for
17375 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
17376 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
17377 setting the @code{halt_on_error} flag in the corresponding environment variable.
17379 Syntax without an explicit @var{opts} parameter is deprecated.  It is
17380 equivalent to specifying an @var{opts} list of:
17382 @smallexample
17383 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
17384 @end smallexample
17386 @opindex fsanitize-address-use-after-scope
17387 @item -fsanitize-address-use-after-scope
17388 Enable sanitization of local variables to detect use-after-scope bugs.
17389 The option sets @option{-fstack-reuse} to @samp{none}.
17391 @opindex fsanitize-trap
17392 @opindex fno-sanitize-trap
17393 @item -fsanitize-trap@r{[}=@var{opts}@r{]}
17394 The @option{-fsanitize-trap=} option instructs the compiler to
17395 report for sanitizers mentioned in comma-separated list of @var{opts}
17396 undefined behavior using @code{__builtin_trap} rather than a @code{libubsan}
17397 library routine.  If this option is enabled for certain sanitizer,
17398 it takes precedence over the @option{-fsanitizer-recover=} for that
17399 sanitizer, @code{__builtin_trap} will be emitted and be fatal regardless
17400 of whether recovery is enabled or disabled using @option{-fsanitize-recover=}.
17402 The advantage of this is that the @code{libubsan} library is not needed
17403 and is not linked in, so this is usable even in freestanding environments.
17405 Currently this feature works with @option{-fsanitize=undefined} (and its suboptions
17406 except for @option{-fsanitize=vptr}), @option{-fsanitize=float-cast-overflow},
17407 @option{-fsanitize=float-divide-by-zero} and
17408 @option{-fsanitize=bounds-strict}.  @code{-fsanitize-trap=all} can be also
17409 specified, which enables it for @code{undefined} suboptions,
17410 @option{-fsanitize=float-cast-overflow},
17411 @option{-fsanitize=float-divide-by-zero} and
17412 @option{-fsanitize=bounds-strict}.
17413 If @code{-fsanitize-trap=undefined} or @code{-fsanitize-trap=all} is used
17414 and @code{-fsanitize=vptr} is enabled on the command line, the
17415 instrumentation is silently ignored as the instrumentation always needs
17416 @code{libubsan} support, @option{-fsanitize-trap=vptr} is not allowed.
17418 @opindex fsanitize-undefined-trap-on-error
17419 @item -fsanitize-undefined-trap-on-error
17420 The @option{-fsanitize-undefined-trap-on-error} option is deprecated
17421 equivalent of @option{-fsanitize-trap=all}.
17423 @opindex fsanitize-coverage=trace-pc
17424 @item -fsanitize-coverage=trace-pc
17425 Enable coverage-guided fuzzing code instrumentation.
17426 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
17428 @opindex fsanitize-coverage=trace-cmp
17429 @item -fsanitize-coverage=trace-cmp
17430 Enable dataflow guided fuzzing code instrumentation.
17431 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
17432 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
17433 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
17434 variable or @code{__sanitizer_cov_trace_const_cmp1},
17435 @code{__sanitizer_cov_trace_const_cmp2},
17436 @code{__sanitizer_cov_trace_const_cmp4} or
17437 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
17438 operand constant, @code{__sanitizer_cov_trace_cmpf} or
17439 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
17440 @code{__sanitizer_cov_trace_switch} for switch statements.
17442 @opindex fcf-protection
17443 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
17444 Enable code instrumentation of control-flow transfers to increase
17445 program security by checking that target addresses of control-flow
17446 transfer instructions (such as indirect function call, function return,
17447 indirect jump) are valid.  This prevents diverting the flow of control
17448 to an unexpected target.  This is intended to protect against such
17449 threats as Return-oriented Programming (ROP), and similarly
17450 call/jmp-oriented programming (COP/JOP).
17452 The value @code{branch} tells the compiler to implement checking of
17453 validity of control-flow transfer at the point of indirect branch
17454 instructions, i.e.@: call/jmp instructions.  The value @code{return}
17455 implements checking of validity at the point of returning from a
17456 function.  The value @code{full} is an alias for specifying both
17457 @code{branch} and @code{return}. The value @code{none} turns off
17458 instrumentation.
17460 The value @code{check} is used for the final link with link-time
17461 optimization (LTO).  An error is issued if LTO object files are
17462 compiled with different @option{-fcf-protection} values.  The
17463 value @code{check} is ignored at the compile time.
17465 The macro @code{__CET__} is defined when @option{-fcf-protection} is
17466 used.  The first bit of @code{__CET__} is set to 1 for the value
17467 @code{branch} and the second bit of @code{__CET__} is set to 1 for
17468 the @code{return}.
17470 You can also use the @code{nocf_check} attribute to identify
17471 which functions and calls should be skipped from instrumentation
17472 (@pxref{Function Attributes}).
17474 Currently the x86 GNU/Linux target provides an implementation based
17475 on Intel Control-flow Enforcement Technology (CET) which works for
17476 i686 processor or newer.
17478 @opindex fharden-compares
17479 @item -fharden-compares
17480 For every logical test that survives gimple optimizations and is
17481 @emph{not} the condition in a conditional branch (for example,
17482 conditions tested for conditional moves, or to store in boolean
17483 variables), emit extra code to compute and verify the reversed
17484 condition, and to call @code{__builtin_trap} if the results do not
17485 match.  Use with @samp{-fharden-conditional-branches} to cover all
17486 conditionals.
17488 @opindex fharden-conditional-branches
17489 @item -fharden-conditional-branches
17490 For every non-vectorized conditional branch that survives gimple
17491 optimizations, emit extra code to compute and verify the reversed
17492 condition, and to call @code{__builtin_trap} if the result is
17493 unexpected.  Use with @samp{-fharden-compares} to cover all
17494 conditionals.
17496 @opindex fharden-control-flow-redundancy
17497 @item -fharden-control-flow-redundancy
17498 Emit extra code to set booleans when entering basic blocks, and to
17499 verify and trap, at function exits, when the booleans do not form an
17500 execution path that is compatible with the control flow graph.
17502 Verification takes place before returns, before mandatory tail calls
17503 (see below) and, optionally, before escaping exceptions with
17504 @option{-fhardcfr-check-exceptions}, before returning calls with
17505 @option{-fhardcfr-check-returning-calls}, and before noreturn calls with
17506 @option{-fhardcfr-check-noreturn-calls}).  Tuning options
17507 @option{--param hardcfr-max-blocks} and @option{--param
17508 hardcfr-max-inline-blocks} are available.
17510 Tail call optimization takes place too late to affect control flow
17511 redundancy, but calls annotated as mandatory tail calls by language
17512 front-ends, and any calls marked early enough as potential tail calls
17513 would also have verification issued before the call, but these
17514 possibilities are merely theoretical, as these conditions can only be
17515 met when using custom compiler plugins.
17517 @opindex fhardcfr-skip-leaf
17518 @item -fhardcfr-skip-leaf
17519 Disable @option{-fharden-control-flow-redundancy} in leaf functions.
17521 @opindex fhardcfr-check-exceptions
17522 @opindex fno-hardcfr-check-exceptions
17523 @item -fhardcfr-check-exceptions
17524 When @option{-fharden-control-flow-redundancy} is active, check the
17525 recorded execution path against the control flow graph at exception
17526 escape points, as if the function body was wrapped with a cleanup
17527 handler that performed the check and reraised.  This option is enabled
17528 by default; use @option{-fno-hardcfr-check-exceptions} to disable it.
17530 @opindex fhardcfr-check-returning-calls
17531 @opindex fno-hardcfr-check-returning-calls
17532 @item -fhardcfr-check-returning-calls
17533 When @option{-fharden-control-flow-redundancy} is active, check the
17534 recorded execution path against the control flow graph before any
17535 function call immediately followed by a return of its result, if any, so
17536 as to not prevent tail-call optimization, whether or not it is
17537 ultimately optimized to a tail call.
17539 This option is enabled by default whenever sibling call optimizations
17540 are enabled (see @option{-foptimize-sibling-calls}), but it can be
17541 enabled (or disabled, using its negated form) explicitly, regardless of
17542 the optimizations.
17544 @opindex fhardcfr-check-noreturn-calls
17545 @item -fhardcfr-check-noreturn-calls=@r{[}always@r{|}no-xthrow@r{|}nothrow@r{|}never@r{]}
17546 When @option{-fharden-control-flow-redundancy} is active, check the
17547 recorded execution path against the control flow graph before
17548 @code{noreturn} calls, either all of them (@option{always}), those that
17549 aren't expected to return control to the caller through an exception
17550 (@option{no-xthrow}, the default), those that may not return control to
17551 the caller through an exception either (@option{nothrow}), or none of
17552 them (@option{never}).
17554 Checking before a @code{noreturn} function that may return control to
17555 the caller through an exception may cause checking to be performed more
17556 than once, if the exception is caught in the caller, whether by a
17557 handler or a cleanup.  When @option{-fhardcfr-check-exceptions} is also
17558 enabled, the compiler will avoid associating a @code{noreturn} call with
17559 the implicitly-added cleanup handler, since it would be redundant with
17560 the check performed before the call, but other handlers or cleanups in
17561 the function, if activated, will modify the recorded execution path and
17562 check it again when another checkpoint is hit.  The checkpoint may even
17563 be another @code{noreturn} call, so checking may end up performed
17564 multiple times.
17566 Various optimizers may cause calls to be marked as @code{noreturn}
17567 and/or @code{nothrow}, even in the absence of the corresponding
17568 attributes, which may affect the placement of checks before calls, as
17569 well as the addition of implicit cleanup handlers for them.  This
17570 unpredictability, and the fact that raising and reraising exceptions
17571 frequently amounts to implicitly calling @code{noreturn} functions, have
17572 made @option{no-xthrow} the default setting for this option: it excludes
17573 from the @code{noreturn} treatment only internal functions used to
17574 (re)raise exceptions, that are not affected by these optimizations.
17576 @opindex fstack-protector
17577 @item -fstack-protector
17578 Emit extra code to check for buffer overflows, such as stack smashing
17579 attacks.  This is done by adding a guard variable to functions with
17580 vulnerable objects.  This includes functions that call @code{alloca}, and
17581 functions with buffers larger than or equal to 8 bytes.  The guards are
17582 initialized when a function is entered and then checked when the function
17583 exits.  If a guard check fails, an error message is printed and the program
17584 exits.  Only variables that are actually allocated on the stack are
17585 considered, optimized away variables or variables allocated in registers
17586 don't count.
17588 @opindex fstack-protector-all
17589 @item -fstack-protector-all
17590 Like @option{-fstack-protector} except that all functions are protected.
17592 @opindex fstack-protector-strong
17593 @item -fstack-protector-strong
17594 Like @option{-fstack-protector} but includes additional functions to
17595 be protected --- those that have local array definitions, or have
17596 references to local frame addresses.  Only variables that are actually
17597 allocated on the stack are considered, optimized away variables or variables
17598 allocated in registers don't count.
17600 @opindex fstack-protector-explicit
17601 @item -fstack-protector-explicit
17602 Like @option{-fstack-protector} but only protects those functions which
17603 have the @code{stack_protect} attribute.
17605 @opindex fstack-check
17606 @item -fstack-check
17607 Generate code to verify that you do not go beyond the boundary of the
17608 stack.  You should specify this flag if you are running in an
17609 environment with multiple threads, but you only rarely need to specify it in
17610 a single-threaded environment since stack overflow is automatically
17611 detected on nearly all systems if there is only one stack.
17613 Note that this switch does not actually cause checking to be done; the
17614 operating system or the language runtime must do that.  The switch causes
17615 generation of code to ensure that they see the stack being extended.
17617 You can additionally specify a string parameter: @samp{no} means no
17618 checking, @samp{generic} means force the use of old-style checking,
17619 @samp{specific} means use the best checking method and is equivalent
17620 to bare @option{-fstack-check}.
17622 Old-style checking is a generic mechanism that requires no specific
17623 target support in the compiler but comes with the following drawbacks:
17625 @enumerate
17626 @item
17627 Modified allocation strategy for large objects: they are always
17628 allocated dynamically if their size exceeds a fixed threshold.  Note this
17629 may change the semantics of some code.
17631 @item
17632 Fixed limit on the size of the static frame of functions: when it is
17633 topped by a particular function, stack checking is not reliable and
17634 a warning is issued by the compiler.
17636 @item
17637 Inefficiency: because of both the modified allocation strategy and the
17638 generic implementation, code performance is hampered.
17639 @end enumerate
17641 Note that old-style stack checking is also the fallback method for
17642 @samp{specific} if no target support has been added in the compiler.
17644 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
17645 and stack overflows.  @samp{specific} is an excellent choice when compiling
17646 Ada code.  It is not generally sufficient to protect against stack-clash
17647 attacks.  To protect against those you want @samp{-fstack-clash-protection}.
17649 @opindex fstack-clash-protection
17650 @item -fstack-clash-protection
17651 Generate code to prevent stack clash style attacks.  When this option is
17652 enabled, the compiler will only allocate one page of stack space at a time
17653 and each page is accessed immediately after allocation.  Thus, it prevents
17654 allocations from jumping over any stack guard page provided by the
17655 operating system.
17657 Most targets do not fully support stack clash protection.  However, on
17658 those targets @option{-fstack-clash-protection} will protect dynamic stack
17659 allocations.  @option{-fstack-clash-protection} may also provide limited
17660 protection for static stack allocations if the target supports
17661 @option{-fstack-check=specific}.
17663 @opindex fstack-limit-register
17664 @opindex fstack-limit-symbol
17665 @opindex fno-stack-limit
17666 @item -fstack-limit-register=@var{reg}
17667 @itemx -fstack-limit-symbol=@var{sym}
17668 @itemx -fno-stack-limit
17669 Generate code to ensure that the stack does not grow beyond a certain value,
17670 either the value of a register or the address of a symbol.  If a larger
17671 stack is required, a signal is raised at run time.  For most targets,
17672 the signal is raised before the stack overruns the boundary, so
17673 it is possible to catch the signal without taking special precautions.
17675 For instance, if the stack starts at absolute address @samp{0x80000000}
17676 and grows downwards, you can use the flags
17677 @option{-fstack-limit-symbol=__stack_limit} and
17678 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
17679 of 128KB@.  Note that this may only work with the GNU linker.
17681 You can locally override stack limit checking by using the
17682 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
17684 @opindex fsplit-stack
17685 @item -fsplit-stack
17686 Generate code to automatically split the stack before it overflows.
17687 The resulting program has a discontiguous stack which can only
17688 overflow if the program is unable to allocate any more memory.  This
17689 is most useful when running threaded programs, as it is no longer
17690 necessary to calculate a good stack size to use for each thread.  This
17691 is currently only implemented for the x86 targets running
17692 GNU/Linux.
17694 When code compiled with @option{-fsplit-stack} calls code compiled
17695 without @option{-fsplit-stack}, there may not be much stack space
17696 available for the latter code to run.  If compiling all code,
17697 including library code, with @option{-fsplit-stack} is not an option,
17698 then the linker can fix up these calls so that the code compiled
17699 without @option{-fsplit-stack} always has a large stack.  Support for
17700 this is implemented in the gold linker in GNU binutils release 2.21
17701 and later.
17703 @opindex fvtable-verify
17704 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
17705 This option is only available when compiling C++ code.
17706 It turns on (or off, if using @option{-fvtable-verify=none}) the security
17707 feature that verifies at run time, for every virtual call, that
17708 the vtable pointer through which the call is made is valid for the type of
17709 the object, and has not been corrupted or overwritten.  If an invalid vtable
17710 pointer is detected at run time, an error is reported and execution of the
17711 program is immediately halted.
17713 This option causes run-time data structures to be built at program startup,
17714 which are used for verifying the vtable pointers.  
17715 The options @samp{std} and @samp{preinit}
17716 control the timing of when these data structures are built.  In both cases the
17717 data structures are built before execution reaches @code{main}.  Using
17718 @option{-fvtable-verify=std} causes the data structures to be built after
17719 shared libraries have been loaded and initialized.
17720 @option{-fvtable-verify=preinit} causes them to be built before shared
17721 libraries have been loaded and initialized.
17723 If this option appears multiple times in the command line with different
17724 values specified, @samp{none} takes highest priority over both @samp{std} and
17725 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
17727 @opindex fvtv-debug
17728 @item -fvtv-debug
17729 When used in conjunction with @option{-fvtable-verify=std} or 
17730 @option{-fvtable-verify=preinit}, causes debug versions of the 
17731 runtime functions for the vtable verification feature to be called.  
17732 This flag also causes the compiler to log information about which 
17733 vtable pointers it finds for each class.
17734 This information is written to a file named @file{vtv_set_ptr_data.log} 
17735 in the directory named by the environment variable @env{VTV_LOGS_DIR} 
17736 if that is defined or the current working directory otherwise.
17738 Note:  This feature @emph{appends} data to the log file. If you want a fresh log
17739 file, be sure to delete any existing one.
17741 @opindex fvtv-counts
17742 @item -fvtv-counts
17743 This is a debugging flag.  When used in conjunction with
17744 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
17745 causes the compiler to keep track of the total number of virtual calls
17746 it encounters and the number of verifications it inserts.  It also
17747 counts the number of calls to certain run-time library functions
17748 that it inserts and logs this information for each compilation unit.
17749 The compiler writes this information to a file named
17750 @file{vtv_count_data.log} in the directory named by the environment
17751 variable @env{VTV_LOGS_DIR} if that is defined or the current working
17752 directory otherwise.  It also counts the size of the vtable pointer sets
17753 for each class, and writes this information to @file{vtv_class_set_sizes.log}
17754 in the same directory.
17756 Note:  This feature @emph{appends} data to the log files.  To get fresh log
17757 files, be sure to delete any existing ones.
17759 @opindex finstrument-functions
17760 @item -finstrument-functions
17761 Generate instrumentation calls for entry and exit to functions.  Just
17762 after function entry and just before function exit, the following
17763 profiling functions are called with the address of the current
17764 function and its call site.  (On some platforms,
17765 @code{__builtin_return_address} does not work beyond the current
17766 function, so the call site information may not be available to the
17767 profiling functions otherwise.)
17769 @smallexample
17770 void __cyg_profile_func_enter (void *this_fn,
17771                                void *call_site);
17772 void __cyg_profile_func_exit  (void *this_fn,
17773                                void *call_site);
17774 @end smallexample
17776 The first argument is the address of the start of the current function,
17777 which may be looked up exactly in the symbol table.
17779 This instrumentation is also done for functions expanded inline in other
17780 functions.  The profiling calls indicate where, conceptually, the
17781 inline function is entered and exited.  This means that addressable
17782 versions of such functions must be available.  If all your uses of a
17783 function are expanded inline, this may mean an additional expansion of
17784 code size.  If you use @code{extern inline} in your C code, an
17785 addressable version of such functions must be provided.  (This is
17786 normally the case anyway, but if you get lucky and the optimizer always
17787 expands the functions inline, you might have gotten away without
17788 providing static copies.)
17790 A function may be given the attribute @code{no_instrument_function}, in
17791 which case this instrumentation is not done.  This can be used, for
17792 example, for the profiling functions listed above, high-priority
17793 interrupt routines, and any functions from which the profiling functions
17794 cannot safely be called (perhaps signal handlers, if the profiling
17795 routines generate output or allocate memory).
17796 @xref{Common Function Attributes}.
17798 @opindex finstrument-functions-once
17799 @item -finstrument-functions-once
17800 This is similar to @option{-finstrument-functions}, but the profiling
17801 functions are called only once per instrumented function, i.e. the first
17802 profiling function is called after the first entry into the instrumented
17803 function and the second profiling function is called before the exit
17804 corresponding to this first entry.
17806 The definition of @code{once} for the purpose of this option is a little
17807 vague because the implementation is not protected against data races.
17808 As a result, the implementation only guarantees that the profiling
17809 functions are called at @emph{least} once per process and at @emph{most}
17810 once per thread, but the calls are always paired, that is to say, if a
17811 thread calls the first function, then it will call the second function,
17812 unless it never reaches the exit of the instrumented function.
17814 @opindex finstrument-functions-exclude-file-list
17815 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
17817 Set the list of functions that are excluded from instrumentation (see
17818 the description of @option{-finstrument-functions}).  If the file that
17819 contains a function definition matches with one of @var{file}, then
17820 that function is not instrumented.  The match is done on substrings:
17821 if the @var{file} parameter is a substring of the file name, it is
17822 considered to be a match.
17824 For example:
17826 @smallexample
17827 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
17828 @end smallexample
17830 @noindent
17831 excludes any inline function defined in files whose pathnames
17832 contain @file{/bits/stl} or @file{include/sys}.
17834 If, for some reason, you want to include letter @samp{,} in one of
17835 @var{sym}, write @samp{\,}. For example,
17836 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
17837 (note the single quote surrounding the option).
17839 @opindex finstrument-functions-exclude-function-list
17840 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
17842 This is similar to @option{-finstrument-functions-exclude-file-list},
17843 but this option sets the list of function names to be excluded from
17844 instrumentation.  The function name to be matched is its user-visible
17845 name, such as @code{vector<int> blah(const vector<int> &)}, not the
17846 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
17847 match is done on substrings: if the @var{sym} parameter is a substring
17848 of the function name, it is considered to be a match.  For C99 and C++
17849 extended identifiers, the function name must be given in UTF-8, not
17850 using universal character names.
17852 @opindex fpatchable-function-entry
17853 @item -fpatchable-function-entry=@var{N}[,@var{M}]
17854 Generate @var{N} NOPs right at the beginning
17855 of each function, with the function entry point before the @var{M}th NOP.
17856 If @var{M} is omitted, it defaults to @code{0} so the
17857 function entry points to the address just at the first NOP.
17858 The NOP instructions reserve extra space which can be used to patch in
17859 any desired instrumentation at run time, provided that the code segment
17860 is writable.  The amount of space is controllable indirectly via
17861 the number of NOPs; the NOP instruction used corresponds to the instruction
17862 emitted by the internal GCC back-end interface @code{gen_nop}.  This behavior
17863 is target-specific and may also depend on the architecture variant and/or
17864 other compilation options.
17866 For run-time identification, the starting addresses of these areas,
17867 which correspond to their respective function entries minus @var{M},
17868 are additionally collected in the @code{__patchable_function_entries}
17869 section of the resulting binary.
17871 Note that the value of @code{__attribute__ ((patchable_function_entry
17872 (N,M)))} takes precedence over command-line option
17873 @option{-fpatchable-function-entry=N,M}.  This can be used to increase
17874 the area size or to remove it completely on a single function.
17875 If @code{N=0}, no pad location is recorded.
17877 The NOP instructions are inserted at---and maybe before, depending on
17878 @var{M}---the function entry address, even before the prologue.  On
17879 PowerPC with the ELFv2 ABI, for a function with dual entry points,
17880 the local entry point is this function entry address.
17882 The maximum value of @var{N} and @var{M} is 65535.  On PowerPC with the
17883 ELFv2 ABI, for a function with dual entry points, the supported values
17884 for @var{M} are 0, 2, 6 and 14.
17885 @end table
17888 @node Preprocessor Options
17889 @section Options Controlling the Preprocessor
17890 @cindex preprocessor options
17891 @cindex options, preprocessor
17893 These options control the C preprocessor, which is run on each C source
17894 file before actual compilation.
17896 If you use the @option{-E} option, nothing is done except preprocessing.
17897 Some of these options make sense only together with @option{-E} because
17898 they cause the preprocessor output to be unsuitable for actual
17899 compilation.
17901 In addition to the options listed here, there are a number of options 
17902 to control search paths for include files documented in 
17903 @ref{Directory Options}.  
17904 Options to control preprocessor diagnostics are listed in 
17905 @ref{Warning Options}.
17907 @table @gcctabopt
17908 @include cppopts.texi
17910 @opindex Wp
17911 @item -Wp,@var{option}
17912 You can use @option{-Wp,@var{option}} to bypass the compiler driver
17913 and pass @var{option} directly through to the preprocessor.  If
17914 @var{option} contains commas, it is split into multiple options at the
17915 commas.  However, many options are modified, translated or interpreted
17916 by the compiler driver before being passed to the preprocessor, and
17917 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
17918 interface is undocumented and subject to change, so whenever possible
17919 you should avoid using @option{-Wp} and let the driver handle the
17920 options instead.
17922 @opindex Xpreprocessor
17923 @item -Xpreprocessor @var{option}
17924 Pass @var{option} as an option to the preprocessor.  You can use this to
17925 supply system-specific preprocessor options that GCC does not 
17926 recognize.
17928 If you want to pass an option that takes an argument, you must use
17929 @option{-Xpreprocessor} twice, once for the option and once for the argument.
17931 @opindex no-integrated-cpp
17932 @item -no-integrated-cpp
17933 Perform preprocessing as a separate pass before compilation.
17934 By default, GCC performs preprocessing as an integrated part of
17935 input tokenization and parsing.
17936 If this option is provided, the appropriate language front end
17937 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
17938 and Objective-C, respectively) is instead invoked twice,
17939 once for preprocessing only and once for actual compilation
17940 of the preprocessed input.
17941 This option may be useful in conjunction with the @option{-B} or
17942 @option{-wrapper} options to specify an alternate preprocessor or
17943 perform additional processing of the program source between
17944 normal preprocessing and compilation.
17946 @opindex flarge-source-files
17947 @item -flarge-source-files
17948 Adjust GCC to expect large source files, at the expense of slower
17949 compilation and higher memory usage.
17951 Specifically, GCC normally tracks both column numbers and line numbers
17952 within source files and it normally prints both of these numbers in
17953 diagnostics.  However, once it has processed a certain number of source
17954 lines, it stops tracking column numbers and only tracks line numbers.
17955 This means that diagnostics for later lines do not include column numbers.
17956 It also means that options like @option{-Wmisleading-indentation} cease to work
17957 at that point, although the compiler prints a note if this happens.
17958 Passing @option{-flarge-source-files} significantly increases the number
17959 of source lines that GCC can process before it stops tracking columns.
17961 @end table
17963 @node Assembler Options
17964 @section Passing Options to the Assembler
17966 @c prevent bad page break with this line
17967 You can pass options to the assembler.
17969 @table @gcctabopt
17970 @opindex Wa
17971 @item -Wa,@var{option}
17972 Pass @var{option} as an option to the assembler.  If @var{option}
17973 contains commas, it is split into multiple options at the commas.
17975 @opindex Xassembler
17976 @item -Xassembler @var{option}
17977 Pass @var{option} as an option to the assembler.  You can use this to
17978 supply system-specific assembler options that GCC does not
17979 recognize.
17981 If you want to pass an option that takes an argument, you must use
17982 @option{-Xassembler} twice, once for the option and once for the argument.
17984 @end table
17986 @node Link Options
17987 @section Options for Linking
17988 @cindex link options
17989 @cindex options, linking
17991 These options come into play when the compiler links object files into
17992 an executable output file.  They are meaningless if the compiler is
17993 not doing a link step.
17995 @table @gcctabopt
17996 @cindex file names
17997 @item @var{object-file-name}
17998 A file name that does not end in a special recognized suffix is
17999 considered to name an object file or library.  (Object files are
18000 distinguished from libraries by the linker according to the file
18001 contents.)  If linking is done, these object files are used as input
18002 to the linker.
18004 @opindex c
18005 @opindex S
18006 @opindex E
18007 @item -c
18008 @itemx -S
18009 @itemx -E
18010 If any of these options is used, then the linker is not run, and
18011 object file names should not be used as arguments.  @xref{Overall
18012 Options}.
18014 @opindex flinker-output
18015 @item -flinker-output=@var{type}
18016 This option controls code generation of the link-time optimizer.  By
18017 default the linker output is automatically determined by the linker
18018 plugin.  For debugging the compiler and if incremental linking with a 
18019 non-LTO object file is desired, it may be useful to control the type
18020 manually.
18022 If @var{type} is @samp{exec}, code generation produces a static
18023 binary. In this case @option{-fpic} and @option{-fpie} are both
18024 disabled.
18026 If @var{type} is @samp{dyn}, code generation produces a shared
18027 library.  In this case @option{-fpic} or @option{-fPIC} is preserved,
18028 but not enabled automatically.  This allows to build shared libraries
18029 without position-independent code on architectures where this is
18030 possible, i.e.@: on x86.
18032 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
18033 executable. This results in similar optimizations as @samp{exec}
18034 except that @option{-fpie} is not disabled if specified at compilation
18035 time.
18037 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
18038 done.  The sections containing intermediate code for link-time optimization are
18039 merged, pre-optimized, and output to the resulting object file. In addition, if
18040 @option{-ffat-lto-objects} is specified, binary code is produced for future
18041 non-LTO linking. The object file produced by incremental linking is smaller
18042 than a static library produced from the same object files.  At link time the
18043 result of incremental linking also loads faster than a static
18044 library assuming that the majority of objects in the library are used.
18046 Finally @samp{nolto-rel} configures the compiler for incremental linking where
18047 code generation is forced, a final binary is produced, and the intermediate
18048 code for later link-time optimization is stripped. When multiple object files
18049 are linked together the resulting code is better optimized than with
18050 link-time optimizations disabled (for example, cross-module inlining 
18051 happens), but most of benefits of whole program optimizations are lost. 
18053 During the incremental link (by @option{-r}) the linker plugin defaults to
18054 @option{rel}. With current interfaces to GNU Binutils it is however not
18055 possible to incrementally link LTO objects and non-LTO objects into a single
18056 mixed object file.  If any of object files in incremental link cannot
18057 be used for link-time optimization, the linker plugin issues a warning and
18058 uses @samp{nolto-rel}. To maintain whole program optimization, it is
18059 recommended to link such objects into static library instead. Alternatively it
18060 is possible to use H.J. Lu's binutils with support for mixed objects.
18062 @opindex fuse-ld=bfd
18063 @item -fuse-ld=bfd
18064 Use the @command{bfd} linker instead of the default linker.
18066 @opindex fuse-ld=gold
18067 @item -fuse-ld=gold
18068 Use the @command{gold} linker instead of the default linker.
18070 @opindex fuse-ld=lld
18071 @item -fuse-ld=lld
18072 Use the LLVM @command{lld} linker instead of the default linker.
18074 @opindex fuse-ld=mold
18075 @item -fuse-ld=mold
18076 Use the Modern Linker (@command{mold}) instead of the default linker.
18078 @cindex Libraries
18079 @opindex l
18080 @item -l@var{library}
18081 @itemx -l @var{library}
18082 Search the library named @var{library} when linking.  (The second
18083 alternative with the library as a separate argument is only for
18084 POSIX compliance and is not recommended.)
18086 The @option{-l} option is passed directly to the linker by GCC.  Refer
18087 to your linker documentation for exact details.  The general
18088 description below applies to the GNU linker.  
18090 The linker searches a standard list of directories for the library.
18091 The directories searched include several standard system directories
18092 plus any that you specify with @option{-L}.
18094 Static libraries are archives of object files, and have file names
18095 like @file{lib@var{library}.a}.  Some targets also support shared
18096 libraries, which typically have names like @file{lib@var{library}.so}.
18097 If both static and shared libraries are found, the linker gives
18098 preference to linking with the shared library unless the
18099 @option{-static} option is used.
18101 It makes a difference where in the command you write this option; the
18102 linker searches and processes libraries and object files in the order they
18103 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
18104 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
18105 to functions in @samp{z}, those functions may not be loaded.
18107 @opindex lobjc
18108 @item -lobjc
18109 You need this special case of the @option{-l} option in order to
18110 link an Objective-C or Objective-C++ program.
18112 @opindex nostartfiles
18113 @item -nostartfiles
18114 Do not use the standard system startup files when linking.
18115 The standard system libraries are used normally, unless @option{-nostdlib},
18116 @option{-nolibc}, or @option{-nodefaultlibs} is used.
18118 @opindex nodefaultlibs
18119 @item -nodefaultlibs
18120 Do not use the standard system libraries when linking.
18121 Only the libraries you specify are passed to the linker, and options
18122 specifying linkage of the system libraries, such as @option{-static-libgcc}
18123 or @option{-shared-libgcc}, are ignored.  
18124 The standard startup files are used normally, unless @option{-nostartfiles}
18125 is used.  
18127 The compiler may generate calls to @code{memcmp},
18128 @code{memset}, @code{memcpy} and @code{memmove}.
18129 These entries are usually resolved by entries in
18130 libc.  These entry points should be supplied through some other
18131 mechanism when this option is specified.
18133 @opindex nolibc
18134 @item -nolibc
18135 Do not use the C library or system libraries tightly coupled with it when
18136 linking.  Still link with the startup files, @file{libgcc} or toolchain
18137 provided language support libraries such as @file{libgnat}, @file{libgfortran}
18138 or @file{libstdc++} unless options preventing their inclusion are used as
18139 well.  This typically removes @option{-lc} from the link command line, as well
18140 as system libraries that normally go with it and become meaningless when
18141 absence of a C library is assumed, for example @option{-lpthread} or
18142 @option{-lm} in some configurations.  This is intended for bare-board
18143 targets when there is indeed no C library available.
18145 @opindex nostdlib
18146 @item -nostdlib
18147 Do not use the standard system startup files or libraries when linking.
18148 No startup files and only the libraries you specify are passed to
18149 the linker, and options specifying linkage of the system libraries, such as
18150 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
18152 The compiler may generate calls to @code{memcmp}, @code{memset},
18153 @code{memcpy} and @code{memmove}.
18154 These entries are usually resolved by entries in
18155 libc.  These entry points should be supplied through some other
18156 mechanism when this option is specified.
18158 @cindex @option{-lgcc}, use with @option{-nostdlib}
18159 @cindex @option{-nostdlib} and unresolved references
18160 @cindex unresolved references and @option{-nostdlib}
18161 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
18162 @cindex @option{-nodefaultlibs} and unresolved references
18163 @cindex unresolved references and @option{-nodefaultlibs}
18164 One of the standard libraries bypassed by @option{-nostdlib} and
18165 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
18166 which GCC uses to overcome shortcomings of particular machines, or special
18167 needs for some languages.
18168 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
18169 Collection (GCC) Internals},
18170 for more discussion of @file{libgcc.a}.)
18171 In most cases, you need @file{libgcc.a} even when you want to avoid
18172 other standard libraries.  In other words, when you specify @option{-nostdlib}
18173 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
18174 This ensures that you have no unresolved references to internal GCC
18175 library subroutines.
18176 (An example of such an internal subroutine is @code{__main}, used to ensure C++
18177 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
18178 GNU Compiler Collection (GCC) Internals}.)
18180 @opindex nostdlib++
18181 @item -nostdlib++
18182 Do not implicitly link with standard C++ libraries.
18184 @opindex e
18185 @opindex entry
18186 @item -e @var{entry}
18187 @itemx --entry=@var{entry}
18189 Specify that the program entry point is @var{entry}.  The argument is
18190 interpreted by the linker; the GNU linker accepts either a symbol name
18191 or an address.
18193 @opindex pie
18194 @item -pie
18195 Produce a dynamically linked position independent executable on targets
18196 that support it.  For predictable results, you must also specify the same
18197 set of options used for compilation (@option{-fpie}, @option{-fPIE},
18198 or model suboptions) when you specify this linker option.
18200 @opindex no-pie
18201 @item -no-pie
18202 Don't produce a dynamically linked position independent executable.
18204 @opindex static-pie
18205 @item -static-pie
18206 Produce a static position independent executable on targets that support
18207 it.  A static position independent executable is similar to a static
18208 executable, but can be loaded at any address without a dynamic linker.
18209 For predictable results, you must also specify the same set of options
18210 used for compilation (@option{-fpie}, @option{-fPIE}, or model
18211 suboptions) when you specify this linker option.
18213 @opindex pthread
18214 @item -pthread
18215 Link with the POSIX threads library.  This option is supported on 
18216 GNU/Linux targets, most other Unix derivatives, and also on 
18217 x86 Cygwin and MinGW targets.  On some targets this option also sets 
18218 flags for the preprocessor, so it should be used consistently for both
18219 compilation and linking.
18221 @opindex r
18222 @item -r
18223 Produce a relocatable object as output.  This is also known as partial
18224 linking.
18226 @opindex rdynamic
18227 @item -rdynamic
18228 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
18229 that support it. This instructs the linker to add all symbols, not
18230 only used ones, to the dynamic symbol table. This option is needed
18231 for some uses of @code{dlopen} or to allow obtaining backtraces
18232 from within a program.
18234 @opindex s
18235 @item -s
18236 Remove all symbol table and relocation information from the executable.
18238 @opindex static
18239 @item -static
18240 On systems that support dynamic linking, this overrides @option{-pie}
18241 and prevents linking with the shared libraries.  On other systems, this
18242 option has no effect.
18244 @opindex shared
18245 @item -shared
18246 Produce a shared object which can then be linked with other objects to
18247 form an executable.  Not all systems support this option.  For predictable
18248 results, you must also specify the same set of options used for compilation
18249 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
18250 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
18251 needs to build supplementary stub code for constructors to work.  On
18252 multi-libbed systems, @samp{gcc -shared} must select the correct support
18253 libraries to link against.  Failing to supply the correct flags may lead
18254 to subtle defects.  Supplying them in cases where they are not necessary
18255 is innocuous.  @option{-shared} suppresses the addition of startup code
18256 to alter the floating-point environment as done with @option{-ffast-math},
18257 @option{-Ofast} or @option{-funsafe-math-optimizations} on some targets.}
18259 @opindex shared-libgcc
18260 @opindex static-libgcc
18261 @item -shared-libgcc
18262 @itemx -static-libgcc
18263 On systems that provide @file{libgcc} as a shared library, these options
18264 force the use of either the shared or static version, respectively.
18265 If no shared version of @file{libgcc} was built when the compiler was
18266 configured, these options have no effect.
18268 There are several situations in which an application should use the
18269 shared @file{libgcc} instead of the static version.  The most common
18270 of these is when the application wishes to throw and catch exceptions
18271 across different shared libraries.  In that case, each of the libraries
18272 as well as the application itself should use the shared @file{libgcc}.
18274 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
18275 whenever you build a shared library or a main executable, because C++
18276 programs typically use exceptions, so this is the right thing to do.
18278 If, instead, you use the GCC driver to create shared libraries, you may
18279 find that they are not always linked with the shared @file{libgcc}.
18280 If GCC finds, at its configuration time, that you have a non-GNU linker
18281 or a GNU linker that does not support option @option{--eh-frame-hdr},
18282 it links the shared version of @file{libgcc} into shared libraries
18283 by default.  Otherwise, it takes advantage of the linker and optimizes
18284 away the linking with the shared version of @file{libgcc}, linking with
18285 the static version of libgcc by default.  This allows exceptions to
18286 propagate through such shared libraries, without incurring relocation
18287 costs at library load time.
18289 However, if a library or main executable is supposed to throw or catch
18290 exceptions, you must link it using the G++ driver, or using the option
18291 @option{-shared-libgcc}, such that it is linked with the shared
18292 @file{libgcc}.
18294 @opindex static-libasan
18295 @item -static-libasan
18296 When the @option{-fsanitize=address} option is used to link a program,
18297 the GCC driver automatically links against @option{libasan}.  If
18298 @file{libasan} is available as a shared library, and the @option{-static}
18299 option is not used, then this links against the shared version of
18300 @file{libasan}.  The @option{-static-libasan} option directs the GCC
18301 driver to link @file{libasan} statically, without necessarily linking
18302 other libraries statically.
18304 @opindex static-libtsan
18305 @item -static-libtsan
18306 When the @option{-fsanitize=thread} option is used to link a program,
18307 the GCC driver automatically links against @option{libtsan}.  If
18308 @file{libtsan} is available as a shared library, and the @option{-static}
18309 option is not used, then this links against the shared version of
18310 @file{libtsan}.  The @option{-static-libtsan} option directs the GCC
18311 driver to link @file{libtsan} statically, without necessarily linking
18312 other libraries statically.
18314 @opindex static-liblsan
18315 @item -static-liblsan
18316 When the @option{-fsanitize=leak} option is used to link a program,
18317 the GCC driver automatically links against @option{liblsan}.  If
18318 @file{liblsan} is available as a shared library, and the @option{-static}
18319 option is not used, then this links against the shared version of
18320 @file{liblsan}.  The @option{-static-liblsan} option directs the GCC
18321 driver to link @file{liblsan} statically, without necessarily linking
18322 other libraries statically.
18324 @opindex static-libubsan
18325 @item -static-libubsan
18326 When the @option{-fsanitize=undefined} option is used to link a program,
18327 the GCC driver automatically links against @option{libubsan}.  If
18328 @file{libubsan} is available as a shared library, and the @option{-static}
18329 option is not used, then this links against the shared version of
18330 @file{libubsan}.  The @option{-static-libubsan} option directs the GCC
18331 driver to link @file{libubsan} statically, without necessarily linking
18332 other libraries statically.
18334 @opindex static-libstdc++
18335 @item -static-libstdc++
18336 When the @command{g++} program is used to link a C++ program, it
18337 normally automatically links against @option{libstdc++}.  If
18338 @file{libstdc++} is available as a shared library, and the
18339 @option{-static} option is not used, then this links against the
18340 shared version of @file{libstdc++}.  That is normally fine.  However, it
18341 is sometimes useful to freeze the version of @file{libstdc++} used by
18342 the program without going all the way to a fully static link.  The
18343 @option{-static-libstdc++} option directs the @command{g++} driver to
18344 link @file{libstdc++} statically, without necessarily linking other
18345 libraries statically.
18347 @opindex symbolic
18348 @item -symbolic
18349 Bind references to global symbols when building a shared object.  Warn
18350 about any unresolved references (unless overridden by the link editor
18351 option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support
18352 this option.
18354 @opindex T
18355 @cindex linker script
18356 @item -T @var{script}
18357 Use @var{script} as the linker script.  This option is supported by most
18358 systems using the GNU linker.  On some targets, such as bare-board
18359 targets without an operating system, the @option{-T} option may be required
18360 when linking to avoid references to undefined symbols.
18362 @opindex Xlinker
18363 @item -Xlinker @var{option}
18364 Pass @var{option} as an option to the linker.  You can use this to
18365 supply system-specific linker options that GCC does not recognize.
18367 If you want to pass an option that takes a separate argument, you must use
18368 @option{-Xlinker} twice, once for the option and once for the argument.
18369 For example, to pass @option{-assert definitions}, you must write
18370 @option{-Xlinker -assert -Xlinker definitions}.  It does not work to write
18371 @option{-Xlinker "-assert definitions"}, because this passes the entire
18372 string as a single argument, which is not what the linker expects.
18374 When using the GNU linker, it is usually more convenient to pass
18375 arguments to linker options using the @option{@var{option}=@var{value}}
18376 syntax than as separate arguments.  For example, you can specify
18377 @option{-Xlinker -Map=output.map} rather than
18378 @option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
18379 this syntax for command-line options.
18381 @opindex Wl
18382 @item -Wl,@var{option}
18383 Pass @var{option} as an option to the linker.  If @var{option} contains
18384 commas, it is split into multiple options at the commas.  You can use this
18385 syntax to pass an argument to the option.
18386 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
18387 linker.  When using the GNU linker, you can also get the same effect with
18388 @option{-Wl,-Map=output.map}.
18390 @opindex u
18391 @item -u @var{symbol}
18392 Pretend the symbol @var{symbol} is undefined, to force linking of
18393 library modules to define it.  You can use @option{-u} multiple times with
18394 different symbols to force loading of additional library modules.
18396 @opindex z
18397 @item -z @var{keyword}
18398 @option{-z} is passed directly on to the linker along with the keyword
18399 @var{keyword}. See the section in the documentation of your linker for
18400 permitted values and their meanings.
18401 @end table
18403 @node Directory Options
18404 @section Options for Directory Search
18405 @cindex directory options
18406 @cindex options, directory search
18407 @cindex search path
18409 These options specify directories to search for header files, for
18410 libraries and for parts of the compiler:
18412 @table @gcctabopt
18413 @include cppdiropts.texi
18415 @opindex iplugindir=
18416 @item -iplugindir=@var{dir}
18417 Set the directory to search for plugins that are passed
18418 by @option{-fplugin=@var{name}} instead of
18419 @option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
18420 to be used by the user, but only passed by the driver.
18422 @opindex L
18423 @item -L@var{dir}
18424 Add directory @var{dir} to the list of directories to be searched
18425 for @option{-l}.
18427 @opindex B
18428 @item -B@var{prefix}
18429 This option specifies where to find the executables, libraries,
18430 include files, and data files of the compiler itself.
18432 The compiler driver program runs one or more of the subprograms
18433 @command{cpp}, @command{cc1}, @command{as} and @command{ld}.  It tries
18434 @var{prefix} as a prefix for each program it tries to run, both with and
18435 without @samp{@var{machine}/@var{version}/} for the corresponding target
18436 machine and compiler version.
18438 For each subprogram to be run, the compiler driver first tries the
18439 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
18440 is not specified, the driver tries two standard prefixes, 
18441 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
18442 those results in a file name that is found, the unmodified program
18443 name is searched for using the directories specified in your
18444 @env{PATH} environment variable.
18446 The compiler checks to see if the path provided by @option{-B}
18447 refers to a directory, and if necessary it adds a directory
18448 separator character at the end of the path.
18450 @option{-B} prefixes that effectively specify directory names also apply
18451 to libraries in the linker, because the compiler translates these
18452 options into @option{-L} options for the linker.  They also apply to
18453 include files in the preprocessor, because the compiler translates these
18454 options into @option{-isystem} options for the preprocessor.  In this case,
18455 the compiler appends @samp{include} to the prefix.
18457 The runtime support file @file{libgcc.a} can also be searched for using
18458 the @option{-B} prefix, if needed.  If it is not found there, the two
18459 standard prefixes above are tried, and that is all.  The file is left
18460 out of the link if it is not found by those means.
18462 Another way to specify a prefix much like the @option{-B} prefix is to use
18463 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
18464 Variables}.
18466 As a special kludge, if the path provided by @option{-B} is
18467 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
18468 9, then it is replaced by @file{[dir/]include}.  This is to help
18469 with boot-strapping the compiler.
18471 @opindex no-canonical-prefixes
18472 @item -no-canonical-prefixes
18473 Do not expand any symbolic links, resolve references to @samp{/../}
18474 or @samp{/./}, or make the path absolute when generating a relative
18475 prefix.
18477 @opindex sysroot
18478 @item --sysroot=@var{dir}
18479 Use @var{dir} as the logical root directory for headers and libraries.
18480 For example, if the compiler normally searches for headers in
18481 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
18482 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
18484 If you use both this option and the @option{-isysroot} option, then
18485 the @option{--sysroot} option applies to libraries, but the
18486 @option{-isysroot} option applies to header files.
18488 The GNU linker (beginning with version 2.16) has the necessary support
18489 for this option.  If your linker does not support this option, the
18490 header file aspect of @option{--sysroot} still works, but the
18491 library aspect does not.
18493 @opindex no-sysroot-suffix
18494 @item --no-sysroot-suffix
18495 For some targets, a suffix is added to the root directory specified
18496 with @option{--sysroot}, depending on the other options used, so that
18497 headers may for example be found in
18498 @file{@var{dir}/@var{suffix}/usr/include} instead of
18499 @file{@var{dir}/usr/include}.  This option disables the addition of
18500 such a suffix.
18502 @end table
18504 @node Code Gen Options
18505 @section Options for Code Generation Conventions
18506 @cindex code generation conventions
18507 @cindex options, code generation
18508 @cindex run-time options
18510 These machine-independent options control the interface conventions
18511 used in code generation.
18513 Most of them have both positive and negative forms; the negative form
18514 of @option{-ffoo} is @option{-fno-foo}.  In the table below, only
18515 one of the forms is listed---the one that is not the default.  You
18516 can figure out the other form by either removing @samp{no-} or adding
18519 @table @gcctabopt
18520 @opindex fstack_reuse
18521 @item -fstack-reuse=@var{reuse-level}
18522 This option controls stack space reuse for user declared local/auto variables
18523 and compiler generated temporaries.  @var{reuse_level} can be @samp{all},
18524 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
18525 local variables and temporaries, @samp{named_vars} enables the reuse only for
18526 user defined local variables with names, and @samp{none} disables stack reuse
18527 completely. The default value is @samp{all}. The option is needed when the
18528 program extends the lifetime of a scoped local variable or a compiler generated
18529 temporary beyond the end point defined by the language.  When a lifetime of
18530 a variable ends, and if the variable lives in memory, the optimizing compiler
18531 has the freedom to reuse its stack space with other temporaries or scoped
18532 local variables whose live range does not overlap with it. Legacy code extending
18533 local lifetime is likely to break with the stack reuse optimization.
18535 For example,
18537 @smallexample
18538    int *p;
18539    @{
18540      int local1;
18542      p = &local1;
18543      local1 = 10;
18544      ....
18545    @}
18546    @{
18547       int local2;
18548       local2 = 20;
18549       ...
18550    @}
18552    if (*p == 10)  // out of scope use of local1
18553      @{
18555      @}
18556 @end smallexample
18558 Another example:
18559 @smallexample
18561    struct A
18562    @{
18563        A(int k) : i(k), j(k) @{ @}
18564        int i;
18565        int j;
18566    @};
18568    A *ap;
18570    void foo(const A& ar)
18571    @{
18572       ap = &ar;
18573    @}
18575    void bar()
18576    @{
18577       foo(A(10)); // temp object's lifetime ends when foo returns
18579       @{
18580         A a(20);
18581         ....
18582       @}
18583       ap->i+= 10;  // ap references out of scope temp whose space
18584                    // is reused with a. What is the value of ap->i?
18585    @}
18587 @end smallexample
18589 The lifetime of a compiler generated temporary is well defined by the C++
18590 standard. When a lifetime of a temporary ends, and if the temporary lives
18591 in memory, the optimizing compiler has the freedom to reuse its stack
18592 space with other temporaries or scoped local variables whose live range
18593 does not overlap with it. However some of the legacy code relies on
18594 the behavior of older compilers in which temporaries' stack space is
18595 not reused, the aggressive stack reuse can lead to runtime errors. This
18596 option is used to control the temporary stack reuse optimization.
18598 @opindex ftrapv
18599 @item -ftrapv
18600 This option generates traps for signed overflow on addition, subtraction,
18601 multiplication operations.
18602 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18603 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18604 @option{-fwrapv} being effective.  Note that only active options override, so
18605 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18606 results in @option{-ftrapv} being effective.
18608 @opindex fwrapv
18609 @item -fwrapv
18610 This option instructs the compiler to assume that signed arithmetic
18611 overflow of addition, subtraction and multiplication wraps around
18612 using twos-complement representation.  This flag enables some optimizations
18613 and disables others.
18614 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18615 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18616 @option{-fwrapv} being effective.  Note that only active options override, so
18617 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18618 results in @option{-ftrapv} being effective.
18620 @opindex fwrapv-pointer
18621 @item -fwrapv-pointer
18622 This option instructs the compiler to assume that pointer arithmetic
18623 overflow on addition and subtraction wraps around using twos-complement
18624 representation.  This flag disables some optimizations which assume
18625 pointer overflow is invalid.
18627 @opindex fstrict-overflow
18628 @item -fstrict-overflow
18629 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
18630 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
18632 @opindex fexceptions
18633 @item -fexceptions
18634 Enable exception handling.  Generates extra code needed to propagate
18635 exceptions.  For some targets, this implies GCC generates frame
18636 unwind information for all functions, which can produce significant data
18637 size overhead, although it does not affect execution.  If you do not
18638 specify this option, GCC enables it by default for languages like
18639 C++ that normally require exception handling, and disables it for
18640 languages like C that do not normally require it.  However, you may need
18641 to enable this option when compiling C code that needs to interoperate
18642 properly with exception handlers written in C++.  You may also wish to
18643 disable this option if you are compiling older C++ programs that don't
18644 use exception handling.
18646 @opindex fnon-call-exceptions
18647 @item -fnon-call-exceptions
18648 Generate code that allows trapping instructions to throw exceptions.
18649 Note that this requires platform-specific runtime support that does
18650 not exist everywhere.  Moreover, it only allows @emph{trapping}
18651 instructions to throw exceptions, i.e.@: memory references or floating-point
18652 instructions.  It does not allow exceptions to be thrown from
18653 arbitrary signal handlers such as @code{SIGALRM}.  This enables
18654 @option{-fexceptions}.
18656 @opindex fdelete-dead-exceptions
18657 @item -fdelete-dead-exceptions
18658 Consider that instructions that may throw exceptions but don't otherwise
18659 contribute to the execution of the program can be optimized away.
18660 This does not affect calls to functions except those with the
18661 @code{pure} or @code{const} attributes.
18662 This option is enabled by default for the Ada and C++ compilers, as permitted by
18663 the language specifications.
18664 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
18666 @opindex funwind-tables
18667 @item -funwind-tables
18668 Similar to @option{-fexceptions}, except that it just generates any needed
18669 static data, but does not affect the generated code in any other way.
18670 You normally do not need to enable this option; instead, a language processor
18671 that needs this handling enables it on your behalf.
18673 @opindex fasynchronous-unwind-tables
18674 @item -fasynchronous-unwind-tables
18675 Generate unwind table in DWARF format, if supported by target machine.  The
18676 table is exact at each instruction boundary, so it can be used for stack
18677 unwinding from asynchronous events (such as debugger or garbage collector).
18679 @opindex fno-gnu-unique
18680 @opindex fgnu-unique
18681 @item -fno-gnu-unique
18682 On systems with recent GNU assembler and C library, the C++ compiler
18683 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
18684 of template static data members and static local variables in inline
18685 functions are unique even in the presence of @code{RTLD_LOCAL}; this
18686 is necessary to avoid problems with a library used by two different
18687 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
18688 therefore disagreeing with the other one about the binding of the
18689 symbol.  But this causes @code{dlclose} to be ignored for affected
18690 DSOs; if your program relies on reinitialization of a DSO via
18691 @code{dlclose} and @code{dlopen}, you can use
18692 @option{-fno-gnu-unique}.
18694 @opindex fpcc-struct-return
18695 @item -fpcc-struct-return
18696 Return ``short'' @code{struct} and @code{union} values in memory like
18697 longer ones, rather than in registers.  This convention is less
18698 efficient, but it has the advantage of allowing intercallability between
18699 GCC-compiled files and files compiled with other compilers, particularly
18700 the Portable C Compiler (pcc).
18702 The precise convention for returning structures in memory depends
18703 on the target configuration macros.
18705 Short structures and unions are those whose size and alignment match
18706 that of some integer type.
18708 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
18709 switch is not binary compatible with code compiled with the
18710 @option{-freg-struct-return} switch.
18711 Use it to conform to a non-default application binary interface.
18713 @opindex freg-struct-return
18714 @item -freg-struct-return
18715 Return @code{struct} and @code{union} values in registers when possible.
18716 This is more efficient for small structures than
18717 @option{-fpcc-struct-return}.
18719 If you specify neither @option{-fpcc-struct-return} nor
18720 @option{-freg-struct-return}, GCC defaults to whichever convention is
18721 standard for the target.  If there is no standard convention, GCC
18722 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
18723 the principal compiler.  In those cases, we can choose the standard, and
18724 we chose the more efficient register return alternative.
18726 @strong{Warning:} code compiled with the @option{-freg-struct-return}
18727 switch is not binary compatible with code compiled with the
18728 @option{-fpcc-struct-return} switch.
18729 Use it to conform to a non-default application binary interface.
18731 @opindex fshort-enums
18732 @item -fshort-enums
18733 Allocate to an @code{enum} type only as many bytes as it needs for the
18734 declared range of possible values.  Specifically, the @code{enum} type
18735 is equivalent to the smallest integer type that has enough room.
18736 This option has no effect for an enumeration type with a fixed underlying
18737 type.
18739 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
18740 code that is not binary compatible with code generated without that switch.
18741 Use it to conform to a non-default application binary interface.
18743 @opindex fshort-wchar
18744 @item -fshort-wchar
18745 Override the underlying type for @code{wchar_t} to be @code{short
18746 unsigned int} instead of the default for the target.  This option is
18747 useful for building programs to run under WINE@.
18749 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
18750 code that is not binary compatible with code generated without that switch.
18751 Use it to conform to a non-default application binary interface.
18753 @opindex fcommon
18754 @opindex fno-common
18755 @cindex tentative definitions
18756 @item -fcommon
18757 In C code, this option controls the placement of global variables
18758 defined without an initializer, known as @dfn{tentative definitions}
18759 in the C standard.  Tentative definitions are distinct from declarations
18760 of a variable with the @code{extern} keyword, which do not allocate storage.
18762 The default is @option{-fno-common}, which specifies that the compiler places
18763 uninitialized global variables in the BSS section of the object file.
18764 This inhibits the merging of tentative definitions by the linker so you get a
18765 multiple-definition error if the same variable is accidentally defined in more
18766 than one compilation unit.
18768 The @option{-fcommon} places uninitialized global variables in a common block.
18769 This allows the linker to resolve all tentative definitions of the same variable
18770 in different compilation units to the same object, or to a non-tentative
18771 definition.  This behavior is inconsistent with C++, and on many targets implies
18772 a speed and code size penalty on global variable references.  It is mainly
18773 useful to enable legacy code to link without errors.
18775 @opindex fno-ident
18776 @opindex fident
18777 @item -fno-ident
18778 Ignore the @code{#ident} directive.
18780 @opindex finhibit-size-directive
18781 @item -finhibit-size-directive
18782 Don't output a @code{.size} assembler directive, or anything else that
18783 would cause trouble if the function is split in the middle, and the
18784 two halves are placed at locations far apart in memory.  This option is
18785 used when compiling @file{crtstuff.c}; you should not need to use it
18786 for anything else.
18788 @opindex fverbose-asm
18789 @item -fverbose-asm
18790 Put extra commentary information in the generated assembly code to
18791 make it more readable.  This option is generally only of use to those
18792 who actually need to read the generated assembly code (perhaps while
18793 debugging the compiler itself).
18795 @option{-fno-verbose-asm}, the default, causes the
18796 extra information to be omitted and is useful when comparing two assembler
18797 files.
18799 The added comments include:
18801 @itemize @bullet
18803 @item
18804 information on the compiler version and command-line options,
18806 @item
18807 the source code lines associated with the assembly instructions,
18808 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
18810 @item
18811 hints on which high-level expressions correspond to
18812 the various assembly instruction operands.
18814 @end itemize
18816 For example, given this C source file:
18818 @smallexample
18819 int test (int n)
18821   int i;
18822   int total = 0;
18824   for (i = 0; i < n; i++)
18825     total += i * i;
18827   return total;
18829 @end smallexample
18831 compiling to (x86_64) assembly via @option{-S} and emitting the result
18832 direct to stdout via @option{-o} @option{-}
18834 @smallexample
18835 gcc -S test.c -fverbose-asm -Os -o -
18836 @end smallexample
18838 gives output similar to this:
18840 @smallexample
18841         .file   "test.c"
18842 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
18843   [...snip...]
18844 # options passed:
18845   [...snip...]
18847         .text
18848         .globl  test
18849         .type   test, @@function
18850 test:
18851 .LFB0:
18852         .cfi_startproc
18853 # test.c:4:   int total = 0;
18854         xorl    %eax, %eax      # <retval>
18855 # test.c:6:   for (i = 0; i < n; i++)
18856         xorl    %edx, %edx      # i
18857 .L2:
18858 # test.c:6:   for (i = 0; i < n; i++)
18859         cmpl    %edi, %edx      # n, i
18860         jge     .L5     #,
18861 # test.c:7:     total += i * i;
18862         movl    %edx, %ecx      # i, tmp92
18863         imull   %edx, %ecx      # i, tmp92
18864 # test.c:6:   for (i = 0; i < n; i++)
18865         incl    %edx    # i
18866 # test.c:7:     total += i * i;
18867         addl    %ecx, %eax      # tmp92, <retval>
18868         jmp     .L2     #
18869 .L5:
18870 # test.c:10: @}
18871         ret
18872         .cfi_endproc
18873 .LFE0:
18874         .size   test, .-test
18875         .ident  "GCC: (GNU) 7.0.0 20160809 (experimental)"
18876         .section        .note.GNU-stack,"",@@progbits
18877 @end smallexample
18879 The comments are intended for humans rather than machines and hence the
18880 precise format of the comments is subject to change.
18882 @opindex frecord-gcc-switches
18883 @item -frecord-gcc-switches
18884 This switch causes the command line used to invoke the
18885 compiler to be recorded into the object file that is being created.
18886 This switch is only implemented on some targets and the exact format
18887 of the recording is target and binary file format dependent, but it
18888 usually takes the form of a section containing ASCII text.  This
18889 switch is related to the @option{-fverbose-asm} switch, but that
18890 switch only records information in the assembler output file as
18891 comments, so it never reaches the object file.
18892 See also @option{-grecord-gcc-switches} for another
18893 way of storing compiler options into the object file.
18895 @opindex fpic
18896 @cindex global offset table
18897 @cindex PIC
18898 @item -fpic
18899 Generate position-independent code (PIC) suitable for use in a shared
18900 library, if supported for the target machine.  Such code accesses all
18901 constant addresses through a global offset table (GOT)@.  The dynamic
18902 loader resolves the GOT entries when the program starts (the dynamic
18903 loader is not part of GCC; it is part of the operating system).  If
18904 the GOT size for the linked executable exceeds a machine-specific
18905 maximum size, you get an error message from the linker indicating that
18906 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
18907 instead.  (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
18908 on the m68k and RS/6000.  The x86 has no such limit.)
18910 Position-independent code requires special support, and therefore works
18911 only on certain machines.  For the x86, GCC supports PIC for System V
18912 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
18913 position-independent.
18915 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18916 are defined to 1.
18918 @opindex fPIC
18919 @item -fPIC
18920 If supported for the target machine, emit position-independent code,
18921 suitable for dynamic linking and avoiding any limit on the size of the
18922 global offset table.  This option makes a difference on AArch64, m68k,
18923 PowerPC and SPARC@.
18925 Position-independent code requires special support, and therefore works
18926 only on certain machines.
18928 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18929 are defined to 2.
18931 @opindex fpie
18932 @opindex fPIE
18933 @item -fpie
18934 @itemx -fPIE
18935 These options are similar to @option{-fpic} and @option{-fPIC}, but the
18936 generated position-independent code can be only linked into executables.
18937 Usually these options are used to compile code that will be linked using
18938 the @option{-pie} GCC option.
18940 @option{-fpie} and @option{-fPIE} both define the macros
18941 @code{__pie__} and @code{__PIE__}.  The macros have the value 1
18942 for @option{-fpie} and 2 for @option{-fPIE}.
18944 @opindex fno-plt
18945 @opindex fplt
18946 @item -fno-plt
18947 Do not use the PLT for external function calls in position-independent code.
18948 Instead, load the callee address at call sites from the GOT and branch to it.
18949 This leads to more efficient code by eliminating PLT stubs and exposing
18950 GOT loads to optimizations.  On architectures such as 32-bit x86 where
18951 PLT stubs expect the GOT pointer in a specific register, this gives more
18952 register allocation freedom to the compiler.
18953 Lazy binding requires use of the PLT; 
18954 with @option{-fno-plt} all external symbols are resolved at load time.
18956 Alternatively, the function attribute @code{noplt} can be used to avoid calls
18957 through the PLT for specific external functions.
18959 In position-dependent code, a few targets also convert calls to
18960 functions that are marked to not use the PLT to use the GOT instead.
18962 @opindex fno-jump-tables
18963 @opindex fjump-tables
18964 @item -fno-jump-tables
18965 Do not use jump tables for switch statements even where it would be
18966 more efficient than other code generation strategies.  This option is
18967 of use in conjunction with @option{-fpic} or @option{-fPIC} for
18968 building code that forms part of a dynamic linker and cannot
18969 reference the address of a jump table.  On some targets, jump tables
18970 do not require a GOT and this option is not needed.
18972 @opindex fno-bit-tests
18973 @opindex fbit-tests
18974 @item -fno-bit-tests
18975 Do not use bit tests for switch statements even where it would be
18976 more efficient than other code generation strategies.
18978 @opindex ffixed
18979 @item -ffixed-@var{reg}
18980 Treat the register named @var{reg} as a fixed register; generated code
18981 should never refer to it (except perhaps as a stack pointer, frame
18982 pointer or in some other fixed role).
18984 @var{reg} must be the name of a register.  The register names accepted
18985 are machine-specific and are defined in the @code{REGISTER_NAMES}
18986 macro in the machine description macro file.
18988 This flag does not have a negative form, because it specifies a
18989 three-way choice.
18991 @opindex fcall-used
18992 @item -fcall-used-@var{reg}
18993 Treat the register named @var{reg} as an allocable register that is
18994 clobbered by function calls.  It may be allocated for temporaries or
18995 variables that do not live across a call.  Functions compiled this way
18996 do not save and restore the register @var{reg}.
18998 It is an error to use this flag with the frame pointer or stack pointer.
18999 Use of this flag for other registers that have fixed pervasive roles in
19000 the machine's execution model produces disastrous results.
19002 This flag does not have a negative form, because it specifies a
19003 three-way choice.
19005 @opindex fcall-saved
19006 @item -fcall-saved-@var{reg}
19007 Treat the register named @var{reg} as an allocable register saved by
19008 functions.  It may be allocated even for temporaries or variables that
19009 live across a call.  Functions compiled this way save and restore
19010 the register @var{reg} if they use it.
19012 It is an error to use this flag with the frame pointer or stack pointer.
19013 Use of this flag for other registers that have fixed pervasive roles in
19014 the machine's execution model produces disastrous results.
19016 A different sort of disaster results from the use of this flag for
19017 a register in which function values may be returned.
19019 This flag does not have a negative form, because it specifies a
19020 three-way choice.
19022 @opindex fpack-struct
19023 @item -fpack-struct[=@var{n}]
19024 Without a value specified, pack all structure members together without
19025 holes.  When a value is specified (which must be a small power of two), pack
19026 structure members according to this value, representing the maximum
19027 alignment (that is, objects with default alignment requirements larger than
19028 this are output potentially unaligned at the next fitting location.
19030 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
19031 code that is not binary compatible with code generated without that switch.
19032 Additionally, it makes the code suboptimal.
19033 Use it to conform to a non-default application binary interface.
19035 @opindex fleading-underscore
19036 @item -fleading-underscore
19037 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
19038 change the way C symbols are represented in the object file.  One use
19039 is to help link with legacy assembly code.
19041 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
19042 generate code that is not binary compatible with code generated without that
19043 switch.  Use it to conform to a non-default application binary interface.
19044 Not all targets provide complete support for this switch.
19046 @opindex ftls-model
19047 @item -ftls-model=@var{model}
19048 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
19049 The @var{model} argument should be one of @samp{global-dynamic},
19050 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
19051 Note that the choice is subject to optimization: the compiler may use
19052 a more efficient model for symbols not visible outside of the translation
19053 unit, or if @option{-fpic} is not given on the command line.
19055 The default without @option{-fpic} is @samp{initial-exec}; with
19056 @option{-fpic} the default is @samp{global-dynamic}.
19058 @opindex ftrampolines
19059 @item -ftrampolines
19060 For targets that normally need trampolines for nested functions, always
19061 generate them instead of using descriptors.  Otherwise, for targets that
19062 do not need them, like for example HP-PA or IA-64, do nothing.
19064 A trampoline is a small piece of code that is created at run time on the
19065 stack when the address of a nested function is taken, and is used to call
19066 the nested function indirectly.  Therefore, it requires the stack to be
19067 made executable in order for the program to work properly.
19069 @option{-fno-trampolines} is enabled by default on a language by language
19070 basis to let the compiler avoid generating them, if it computes that this
19071 is safe, and replace them with descriptors.  Descriptors are made up of data
19072 only, but the generated code must be prepared to deal with them.  As of this
19073 writing, @option{-fno-trampolines} is enabled by default only for Ada.
19075 Moreover, code compiled with @option{-ftrampolines} and code compiled with
19076 @option{-fno-trampolines} are not binary compatible if nested functions are
19077 present.  This option must therefore be used on a program-wide basis and be
19078 manipulated with extreme care.
19080 For languages other than Ada, the @code{-ftrampolines} and
19081 @code{-fno-trampolines} options currently have no effect, and
19082 trampolines are always generated on platforms that need them
19083 for nested functions.
19085 @opindex ftrampoline-impl
19086 @item -ftrampoline-impl=@r{[}stack@r{|}heap@r{]}
19087 By default, trampolines are generated on stack.  However, certain platforms
19088 (such as the Apple M1) do not permit an executable stack.  Compiling with
19089 @option{-ftrampoline-impl=heap} generate calls to
19090 @code{__builtin_nested_func_ptr_created} and
19091 @code{__builtin_nested_func_ptr_deleted} in order to allocate and
19092 deallocate trampoline space on the executable heap.  These functions are
19093 implemented in libgcc, and will only be provided on specific targets:
19094 x86_64 Darwin, x86_64 and aarch64 Linux.  @emph{PLEASE NOTE}: Heap
19095 trampolines are @emph{not} guaranteed to be correctly deallocated if you
19096 @code{setjmp}, instantiate nested functions, and then @code{longjmp} back
19097 to a state prior to having allocated those nested functions.
19099 @opindex fvisibility
19100 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
19101 Set the default ELF image symbol visibility to the specified option---all
19102 symbols are marked with this unless overridden within the code.
19103 Using this feature can very substantially improve linking and
19104 load times of shared object libraries, produce more optimized
19105 code, provide near-perfect API export and prevent symbol clashes.
19106 It is @strong{strongly} recommended that you use this in any shared objects
19107 you distribute.
19109 Despite the nomenclature, @samp{default} always means public; i.e.,
19110 available to be linked against from outside the shared object.
19111 @samp{protected} and @samp{internal} are pretty useless in real-world
19112 usage so the only other commonly used option is @samp{hidden}.
19113 The default if @option{-fvisibility} isn't specified is
19114 @samp{default}, i.e., make every symbol public.
19116 A good explanation of the benefits offered by ensuring ELF
19117 symbols have the correct visibility is given by ``How To Write
19118 Shared Libraries'' by Ulrich Drepper (which can be found at
19119 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
19120 solution made possible by this option to marking things hidden when
19121 the default is public is to make the default hidden and mark things
19122 public.  This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
19123 and @code{__attribute__ ((visibility("default")))} instead of
19124 @code{__declspec(dllexport)} you get almost identical semantics with
19125 identical syntax.  This is a great boon to those working with
19126 cross-platform projects.
19128 For those adding visibility support to existing code, you may find
19129 @code{#pragma GCC visibility} of use.  This works by you enclosing
19130 the declarations you wish to set visibility for with (for example)
19131 @code{#pragma GCC visibility push(hidden)} and
19132 @code{#pragma GCC visibility pop}.
19133 Bear in mind that symbol visibility should be viewed @strong{as
19134 part of the API interface contract} and thus all new code should
19135 always specify visibility when it is not the default; i.e., declarations
19136 only for use within the local DSO should @strong{always} be marked explicitly
19137 as hidden as so to avoid PLT indirection overheads---making this
19138 abundantly clear also aids readability and self-documentation of the code.
19139 Note that due to ISO C++ specification requirements, @code{operator new} and
19140 @code{operator delete} must always be of default visibility.
19142 Be aware that headers from outside your project, in particular system
19143 headers and headers from any other library you use, may not be
19144 expecting to be compiled with visibility other than the default.  You
19145 may need to explicitly say @code{#pragma GCC visibility push(default)}
19146 before including any such headers.
19148 @code{extern} declarations are not affected by @option{-fvisibility}, so
19149 a lot of code can be recompiled with @option{-fvisibility=hidden} with
19150 no modifications.  However, this means that calls to @code{extern}
19151 functions with no explicit visibility use the PLT, so it is more
19152 effective to use @code{__attribute ((visibility))} and/or
19153 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
19154 declarations should be treated as hidden.
19156 Note that @option{-fvisibility} does affect C++ vague linkage
19157 entities. This means that, for instance, an exception class that is
19158 be thrown between DSOs must be explicitly marked with default
19159 visibility so that the @samp{type_info} nodes are unified between
19160 the DSOs.
19162 An overview of these techniques, their benefits and how to use them
19163 is at @uref{https://gcc.gnu.org/@/wiki/@/Visibility}.
19165 @opindex fstrict-volatile-bitfields
19166 @item -fstrict-volatile-bitfields
19167 This option should be used if accesses to volatile bit-fields (or other
19168 structure fields, although the compiler usually honors those types
19169 anyway) should use a single access of the width of the
19170 field's type, aligned to a natural alignment if possible.  For
19171 example, targets with memory-mapped peripheral registers might require
19172 all such accesses to be 16 bits wide; with this flag you can
19173 declare all peripheral bit-fields as @code{unsigned short} (assuming short
19174 is 16 bits on these targets) to force GCC to use 16-bit accesses
19175 instead of, perhaps, a more efficient 32-bit access.
19177 If this option is disabled, the compiler uses the most efficient
19178 instruction.  In the previous example, that might be a 32-bit load
19179 instruction, even though that accesses bytes that do not contain
19180 any portion of the bit-field, or memory-mapped registers unrelated to
19181 the one being updated.
19183 In some cases, such as when the @code{packed} attribute is applied to a 
19184 structure field, it may not be possible to access the field with a single
19185 read or write that is correctly aligned for the target machine.  In this
19186 case GCC falls back to generating multiple accesses rather than code that 
19187 will fault or truncate the result at run time.
19189 Note:  Due to restrictions of the C/C++11 memory model, write accesses are
19190 not allowed to touch non bit-field members.  It is therefore recommended
19191 to define all bits of the field's type as bit-field members.
19193 The default value of this option is determined by the application binary
19194 interface for the target processor.
19196 @opindex fsync-libcalls
19197 @item -fsync-libcalls
19198 This option controls whether any out-of-line instance of the @code{__sync}
19199 family of functions may be used to implement the C++11 @code{__atomic}
19200 family of functions.
19202 The default value of this option is enabled, thus the only useful form
19203 of the option is @option{-fno-sync-libcalls}.  This option is used in
19204 the implementation of the @file{libatomic} runtime library.
19206 @end table
19208 @node Developer Options
19209 @section GCC Developer Options
19210 @cindex developer options
19211 @cindex debugging GCC
19212 @cindex debug dump options
19213 @cindex dump options
19214 @cindex compilation statistics
19216 This section describes command-line options that are primarily of
19217 interest to GCC developers, including options to support compiler
19218 testing and investigation of compiler bugs and compile-time
19219 performance problems.  This includes options that produce debug dumps
19220 at various points in the compilation; that print statistics such as
19221 memory use and execution time; and that print information about GCC's
19222 configuration, such as where it searches for libraries.  You should
19223 rarely need to use any of these options for ordinary compilation and
19224 linking tasks.
19226 Many developer options that cause GCC to dump output to a file take an
19227 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
19228 or @samp{-} to dump to standard output, and @samp{stderr} for standard
19229 error.
19231 If @samp{=@var{filename}} is omitted, a default dump file name is
19232 constructed by concatenating the base dump file name, a pass number,
19233 phase letter, and pass name.  The base dump file name is the name of
19234 output file produced by the compiler if explicitly specified and not
19235 an executable; otherwise it is the source file name.
19236 The pass number is determined by the order passes are registered with
19237 the compiler's pass manager. 
19238 This is generally the same as the order of execution, but passes
19239 registered by plugins, target-specific passes, or passes that are
19240 otherwise registered late are numbered higher than the pass named
19241 @samp{final}, even if they are executed earlier.  The phase letter is
19242 one of @samp{i} (inter-procedural analysis), @samp{l}
19243 (language-specific), @samp{r} (RTL), or @samp{t} (tree). 
19244 The files are created in the directory of the output file. 
19246 @table @gcctabopt
19248 @opindex fcallgraph-info
19249 @item -fcallgraph-info
19250 @itemx -fcallgraph-info=@var{MARKERS}
19251 Makes the compiler output callgraph information for the program, on a
19252 per-object-file basis.  The information is generated in the common VCG
19253 format.  It can be decorated with additional, per-node and/or per-edge
19254 information, if a list of comma-separated markers is additionally
19255 specified.  When the @code{su} marker is specified, the callgraph is
19256 decorated with stack usage information; it is equivalent to
19257 @option{-fstack-usage}.  When the @code{da} marker is specified, the
19258 callgraph is decorated with information about dynamically allocated
19259 objects.
19261 When compiling with @option{-flto}, no callgraph information is output
19262 along with the object file.  At LTO link time, @option{-fcallgraph-info}
19263 may generate multiple callgraph information files next to intermediate
19264 LTO output files.
19266 @opindex d
19267 @opindex fdump-rtl-@var{pass}
19268 @item -d@var{letters}
19269 @itemx -fdump-rtl-@var{pass}
19270 @itemx -fdump-rtl-@var{pass}=@var{filename}
19271 Says to make debugging dumps during compilation at times specified by
19272 @var{letters}.  This is used for debugging the RTL-based passes of the
19273 compiler.
19275 Some @option{-d@var{letters}} switches have different meaning when
19276 @option{-E} is used for preprocessing.  @xref{Preprocessor Options},
19277 for information about preprocessor-specific dump options.
19279 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
19280 @option{-d} option @var{letters}.  Here are the possible
19281 letters for use in @var{pass} and @var{letters}, and their meanings:
19283 @table @gcctabopt
19285 @opindex fdump-rtl-alignments
19286 @item -fdump-rtl-alignments
19287 Dump after branch alignments have been computed.
19289 @opindex fdump-rtl-asmcons
19290 @item -fdump-rtl-asmcons
19291 Dump after fixing rtl statements that have unsatisfied in/out constraints.
19293 @opindex fdump-rtl-auto_inc_dec
19294 @item -fdump-rtl-auto_inc_dec
19295 Dump after auto-inc-dec discovery.  This pass is only run on
19296 architectures that have auto inc or auto dec instructions.
19298 @opindex fdump-rtl-barriers
19299 @item -fdump-rtl-barriers
19300 Dump after cleaning up the barrier instructions.
19302 @opindex fdump-rtl-bbpart
19303 @item -fdump-rtl-bbpart
19304 Dump after partitioning hot and cold basic blocks.
19306 @opindex fdump-rtl-bbro
19307 @item -fdump-rtl-bbro
19308 Dump after block reordering.
19310 @opindex fdump-rtl-btl2
19311 @opindex fdump-rtl-btl2
19312 @item -fdump-rtl-btl1
19313 @itemx -fdump-rtl-btl2
19314 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
19315 after the two branch
19316 target load optimization passes.
19318 @opindex fdump-rtl-bypass
19319 @item -fdump-rtl-bypass
19320 Dump after jump bypassing and control flow optimizations.
19322 @opindex fdump-rtl-combine
19323 @item -fdump-rtl-combine
19324 Dump after the RTL instruction combination pass.
19326 @opindex fdump-rtl-compgotos
19327 @item -fdump-rtl-compgotos
19328 Dump after duplicating the computed gotos.
19330 @opindex fdump-rtl-ce1
19331 @opindex fdump-rtl-ce2
19332 @opindex fdump-rtl-ce3
19333 @item -fdump-rtl-ce1
19334 @itemx -fdump-rtl-ce2
19335 @itemx -fdump-rtl-ce3
19336 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
19337 @option{-fdump-rtl-ce3} enable dumping after the three
19338 if conversion passes.
19340 @opindex fdump-rtl-cprop_hardreg
19341 @item -fdump-rtl-cprop_hardreg
19342 Dump after hard register copy propagation.
19344 @opindex fdump-rtl-csa
19345 @item -fdump-rtl-csa
19346 Dump after combining stack adjustments.
19348 @opindex fdump-rtl-cse1
19349 @opindex fdump-rtl-cse2
19350 @item -fdump-rtl-cse1
19351 @itemx -fdump-rtl-cse2
19352 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
19353 the two common subexpression elimination passes.
19355 @opindex fdump-rtl-dce
19356 @item -fdump-rtl-dce
19357 Dump after the standalone dead code elimination passes.
19359 @opindex fdump-rtl-dbr
19360 @item -fdump-rtl-dbr
19361 Dump after delayed branch scheduling.
19363 @opindex fdump-rtl-dce1
19364 @opindex fdump-rtl-dce2
19365 @item -fdump-rtl-dce1
19366 @itemx -fdump-rtl-dce2
19367 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
19368 the two dead store elimination passes.
19370 @opindex fdump-rtl-eh
19371 @item -fdump-rtl-eh
19372 Dump after finalization of EH handling code.
19374 @opindex fdump-rtl-eh_ranges
19375 @item -fdump-rtl-eh_ranges
19376 Dump after conversion of EH handling range regions.
19378 @opindex fdump-rtl-expand
19379 @item -fdump-rtl-expand
19380 Dump after RTL generation.
19382 @opindex fdump-rtl-fwprop1
19383 @opindex fdump-rtl-fwprop2
19384 @item -fdump-rtl-fwprop1
19385 @itemx -fdump-rtl-fwprop2
19386 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
19387 dumping after the two forward propagation passes.
19389 @opindex fdump-rtl-gcse1
19390 @opindex fdump-rtl-gcse2
19391 @item -fdump-rtl-gcse1
19392 @itemx -fdump-rtl-gcse2
19393 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
19394 after global common subexpression elimination.
19396 @opindex fdump-rtl-init-regs
19397 @item -fdump-rtl-init-regs
19398 Dump after the initialization of the registers.
19400 @opindex fdump-rtl-initvals
19401 @item -fdump-rtl-initvals
19402 Dump after the computation of the initial value sets.
19404 @opindex fdump-rtl-into_cfglayout
19405 @item -fdump-rtl-into_cfglayout
19406 Dump after converting to cfglayout mode.
19408 @opindex fdump-rtl-ira
19409 @item -fdump-rtl-ira
19410 Dump after iterated register allocation.
19412 @opindex fdump-rtl-jump
19413 @item -fdump-rtl-jump
19414 Dump after the second jump optimization.
19416 @opindex fdump-rtl-loop2
19417 @item -fdump-rtl-loop2
19418 @option{-fdump-rtl-loop2} enables dumping after the rtl
19419 loop optimization passes.
19421 @opindex fdump-rtl-mach
19422 @item -fdump-rtl-mach
19423 Dump after performing the machine dependent reorganization pass, if that
19424 pass exists.
19426 @opindex fdump-rtl-mode_sw
19427 @item -fdump-rtl-mode_sw
19428 Dump after removing redundant mode switches.
19430 @opindex fdump-rtl-rnreg
19431 @item -fdump-rtl-rnreg
19432 Dump after register renumbering.
19434 @opindex fdump-rtl-outof_cfglayout
19435 @item -fdump-rtl-outof_cfglayout
19436 Dump after converting from cfglayout mode.
19438 @opindex fdump-rtl-peephole2
19439 @item -fdump-rtl-peephole2
19440 Dump after the peephole pass.
19442 @opindex fdump-rtl-postreload
19443 @item -fdump-rtl-postreload
19444 Dump after post-reload optimizations.
19446 @opindex fdump-rtl-pro_and_epilogue
19447 @item -fdump-rtl-pro_and_epilogue
19448 Dump after generating the function prologues and epilogues.
19450 @opindex fdump-rtl-sched1
19451 @opindex fdump-rtl-sched2
19452 @item -fdump-rtl-sched1
19453 @itemx -fdump-rtl-sched2
19454 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
19455 after the basic block scheduling passes.
19457 @opindex fdump-rtl-ree
19458 @item -fdump-rtl-ree
19459 Dump after sign/zero extension elimination.
19461 @opindex fdump-rtl-seqabstr
19462 @item -fdump-rtl-seqabstr
19463 Dump after common sequence discovery.
19465 @opindex fdump-rtl-shorten
19466 @item -fdump-rtl-shorten
19467 Dump after shortening branches.
19469 @opindex fdump-rtl-sibling
19470 @item -fdump-rtl-sibling
19471 Dump after sibling call optimizations.
19473 @opindex fdump-rtl-split1
19474 @opindex fdump-rtl-split2
19475 @opindex fdump-rtl-split3
19476 @opindex fdump-rtl-split4
19477 @opindex fdump-rtl-split5
19478 @item -fdump-rtl-split1
19479 @itemx -fdump-rtl-split2
19480 @itemx -fdump-rtl-split3
19481 @itemx -fdump-rtl-split4
19482 @itemx -fdump-rtl-split5
19483 These options enable dumping after five rounds of
19484 instruction splitting.
19486 @opindex fdump-rtl-sms
19487 @item -fdump-rtl-sms
19488 Dump after modulo scheduling.  This pass is only run on some
19489 architectures.
19491 @opindex fdump-rtl-stack
19492 @item -fdump-rtl-stack
19493 Dump after conversion from GCC's ``flat register file'' registers to the
19494 x87's stack-like registers.  This pass is only run on x86 variants.
19496 @opindex fdump-rtl-subreg1
19497 @opindex fdump-rtl-subreg2
19498 @item -fdump-rtl-subreg1
19499 @itemx -fdump-rtl-subreg2
19500 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
19501 the two subreg expansion passes.
19503 @opindex fdump-rtl-unshare
19504 @item -fdump-rtl-unshare
19505 Dump after all rtl has been unshared.
19507 @opindex fdump-rtl-vartrack
19508 @item -fdump-rtl-vartrack
19509 Dump after variable tracking.
19511 @opindex fdump-rtl-vregs
19512 @item -fdump-rtl-vregs
19513 Dump after converting virtual registers to hard registers.
19515 @opindex fdump-rtl-web
19516 @item -fdump-rtl-web
19517 Dump after live range splitting.
19519 @opindex fdump-rtl-regclass
19520 @opindex fdump-rtl-subregs_of_mode_init
19521 @opindex fdump-rtl-subregs_of_mode_finish
19522 @opindex fdump-rtl-dfinit
19523 @opindex fdump-rtl-dfinish
19524 @item -fdump-rtl-regclass
19525 @itemx -fdump-rtl-subregs_of_mode_init
19526 @itemx -fdump-rtl-subregs_of_mode_finish
19527 @itemx -fdump-rtl-dfinit
19528 @itemx -fdump-rtl-dfinish
19529 These dumps are defined but always produce empty files.
19531 @opindex da
19532 @opindex fdump-rtl-all
19533 @item -da
19534 @itemx -fdump-rtl-all
19535 Produce all the dumps listed above.
19537 @opindex dA
19538 @item -dA
19539 Annotate the assembler output with miscellaneous debugging information.
19541 @opindex dD
19542 @item -dD
19543 Dump all macro definitions, at the end of preprocessing, in addition to
19544 normal output.
19546 @opindex dH
19547 @item -dH
19548 Produce a core dump whenever an error occurs.
19550 @opindex dp
19551 @item -dp
19552 Annotate the assembler output with a comment indicating which
19553 pattern and alternative is used.  The length and cost of each instruction are
19554 also printed.
19556 @opindex dP
19557 @item -dP
19558 Dump the RTL in the assembler output as a comment before each instruction.
19559 Also turns on @option{-dp} annotation.
19561 @opindex dx
19562 @item -dx
19563 Just generate RTL for a function instead of compiling it.  Usually used
19564 with @option{-fdump-rtl-expand}.
19565 @end table
19567 @opindex fdump-debug
19568 @item -fdump-debug
19569 Dump debugging information generated during the debug
19570 generation phase.
19572 @opindex fdump-earlydebug
19573 @item -fdump-earlydebug
19574 Dump debugging information generated during the early debug
19575 generation phase.
19577 @opindex fdump-noaddr
19578 @item -fdump-noaddr
19579 When doing debugging dumps, suppress address output.  This makes it more
19580 feasible to use diff on debugging dumps for compiler invocations with
19581 different compiler binaries and/or different
19582 text / bss / data / heap / stack / dso start locations.
19584 @opindex freport-bug
19585 @item -freport-bug
19586 Collect and dump debug information into a temporary file if an
19587 internal compiler error (ICE) occurs.
19589 @opindex fdump-unnumbered
19590 @item -fdump-unnumbered
19591 When doing debugging dumps, suppress instruction numbers and address output.
19592 This makes it more feasible to use diff on debugging dumps for compiler
19593 invocations with different options, in particular with and without
19594 @option{-g}.
19596 @opindex fdump-unnumbered-links
19597 @item -fdump-unnumbered-links
19598 When doing debugging dumps (see @option{-d} option above), suppress
19599 instruction numbers for the links to the previous and next instructions
19600 in a sequence.
19602 @opindex fdump-ipa
19603 @item -fdump-ipa-@var{switch}
19604 @itemx -fdump-ipa-@var{switch}-@var{options}
19605 Control the dumping at various stages of inter-procedural analysis
19606 language tree to a file.  The file name is generated by appending a
19607 switch specific suffix to the source file name, and the file is created
19608 in the same directory as the output file.  The following dumps are
19609 possible:
19611 @table @samp
19612 @item all
19613 Enables all inter-procedural analysis dumps.
19615 @item cgraph
19616 Dumps information about call-graph optimization, unused function removal,
19617 and inlining decisions.
19619 @item inline
19620 Dump after function inlining.
19622 @end table
19624 Additionally, the options @option{-optimized}, @option{-missed},
19625 @option{-note}, and @option{-all} can be provided, with the same meaning
19626 as for @option{-fopt-info}, defaulting to @option{-optimized}.
19628 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
19629 information on callsites that were inlined, along with callsites
19630 that were not inlined.
19632 By default, the dump will contain messages about successful
19633 optimizations (equivalent to @option{-optimized}) together with
19634 low-level details about the analysis.
19636 @opindex fdump-lang
19637 @item -fdump-lang
19638 Dump language-specific information.  The file name is made by appending
19639 @file{.lang} to the source file name.
19641 @opindex fdump-lang-all
19642 @opindex fdump-lang
19643 @item -fdump-lang-all
19644 @itemx -fdump-lang-@var{switch}
19645 @itemx -fdump-lang-@var{switch}-@var{options}
19646 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
19647 Control the dumping of language-specific information.  The @var{options}
19648 and @var{filename} portions behave as described in the
19649 @option{-fdump-tree} option.  The following @var{switch} values are
19650 accepted:
19652 @table @samp
19653 @item all
19655 Enable all language-specific dumps.
19657 @item class
19658 Dump class hierarchy information.  Virtual table information is emitted
19659 unless '@option{slim}' is specified.  This option is applicable to C++ only.
19661 @item module
19662 Dump module information.  Options @option{lineno} (locations),
19663 @option{graph} (reachability), @option{blocks} (clusters),
19664 @option{uid} (serialization), @option{alias} (mergeable),
19665 @option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
19666 (macros) may provide additional information.  This option is
19667 applicable to C++ only.
19669 @item raw
19670 Dump the raw internal tree data.  This option is applicable to C++ only.
19672 @end table
19674 @opindex fdump-passes
19675 @item -fdump-passes
19676 Print on @file{stderr} the list of optimization passes that are turned
19677 on and off by the current command-line options.
19679 @opindex fdump-statistics
19680 @item -fdump-statistics-@var{option}
19681 Enable and control dumping of pass statistics in a separate file.  The
19682 file name is generated by appending a suffix ending in
19683 @samp{.statistics} to the source file name, and the file is created in
19684 the same directory as the output file.  If the @samp{-@var{option}}
19685 form is used, @samp{-stats} causes counters to be summed over the
19686 whole compilation unit while @samp{-details} dumps every event as
19687 the passes generate them.  The default with no option is to sum
19688 counters for each function compiled.
19690 @opindex fdump-tree-all
19691 @opindex fdump-tree
19692 @item -fdump-tree-all
19693 @itemx -fdump-tree-@var{switch}
19694 @itemx -fdump-tree-@var{switch}-@var{options}
19695 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
19696 Control the dumping at various stages of processing the intermediate
19697 language tree to a file.  If the @samp{-@var{options}}
19698 form is used, @var{options} is a list of @samp{-} separated options
19699 which control the details of the dump.  Not all options are applicable
19700 to all dumps; those that are not meaningful are ignored.  The
19701 following options are available
19703 @table @samp
19704 @item address
19705 Print the address of each node.  Usually this is not meaningful as it
19706 changes according to the environment and source file.  Its primary use
19707 is for tying up a dump file with a debug environment.
19708 @item asmname
19709 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
19710 in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
19711 use working backward from mangled names in the assembly file.
19712 @item slim
19713 When dumping front-end intermediate representations, inhibit dumping
19714 of members of a scope or body of a function merely because that scope
19715 has been reached.  Only dump such items when they are directly reachable
19716 by some other path.
19718 When dumping pretty-printed trees, this option inhibits dumping the
19719 bodies of control structures.
19721 When dumping RTL, print the RTL in slim (condensed) form instead of
19722 the default LISP-like representation.
19723 @item raw
19724 Print a raw representation of the tree.  By default, trees are
19725 pretty-printed into a C-like representation.
19726 @item details
19727 Enable more detailed dumps (not honored by every dump option). Also
19728 include information from the optimization passes.
19729 @item stats
19730 Enable dumping various statistics about the pass (not honored by every dump
19731 option).
19732 @item blocks
19733 Enable showing basic block boundaries (disabled in raw dumps).
19734 @item graph
19735 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
19736 dump a representation of the control flow graph suitable for viewing with
19737 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}.  Each function in
19738 the file is pretty-printed as a subgraph, so that GraphViz can render them
19739 all in a single plot.
19741 This option currently only works for RTL dumps, and the RTL is always
19742 dumped in slim form.
19743 @item vops
19744 Enable showing virtual operands for every statement.
19745 @item lineno
19746 Enable showing line numbers for statements.
19747 @item uid
19748 Enable showing the unique ID (@code{DECL_UID}) for each variable.
19749 @item verbose
19750 Enable showing the tree dump for each statement.
19751 @item eh
19752 Enable showing the EH region number holding each statement.
19753 @item scev
19754 Enable showing scalar evolution analysis details.
19755 @item optimized
19756 Enable showing optimization information (only available in certain
19757 passes).
19758 @item missed
19759 Enable showing missed optimization information (only available in certain
19760 passes).
19761 @item note
19762 Enable other detailed optimization information (only available in
19763 certain passes).
19764 @item all
19765 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
19766 and @option{lineno}.
19767 @item optall
19768 Turn on all optimization options, i.e., @option{optimized},
19769 @option{missed}, and @option{note}.
19770 @end table
19772 To determine what tree dumps are available or find the dump for a pass
19773 of interest follow the steps below.
19775 @enumerate
19776 @item
19777 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
19778 look for a code that corresponds to the pass you are interested in.
19779 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
19780 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
19781 The number at the end distinguishes distinct invocations of the same pass.
19782 @item
19783 To enable the creation of the dump file, append the pass code to
19784 the @option{-fdump-} option prefix and invoke GCC with it.  For example,
19785 to enable the dump from the Early Value Range Propagation pass, invoke
19786 GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
19787 specify the name of the dump file.  If you don't specify one, GCC
19788 creates as described below.
19789 @item
19790 Find the pass dump in a file whose name is composed of three components
19791 separated by a period: the name of the source file GCC was invoked to
19792 compile, a numeric suffix indicating the pass number followed by the
19793 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
19794 and finally the pass code.  For example, the Early VRP pass dump might
19795 be in a file named @file{myfile.c.038t.evrp} in the current working
19796 directory.  Note that the numeric codes are not stable and may change
19797 from one version of GCC to another.
19798 @end enumerate
19800 @opindex fopt-info
19801 @item -fopt-info
19802 @itemx -fopt-info-@var{options}
19803 @itemx -fopt-info-@var{options}=@var{filename}
19804 Controls optimization dumps from various optimization passes. If the
19805 @samp{-@var{options}} form is used, @var{options} is a list of
19806 @samp{-} separated option keywords to select the dump details and
19807 optimizations.  
19809 The @var{options} can be divided into three groups:
19810 @enumerate
19811 @item
19812 options describing what kinds of messages should be emitted,
19813 @item
19814 options describing the verbosity of the dump, and
19815 @item
19816 options describing which optimizations should be included.
19817 @end enumerate
19818 The options from each group can be freely mixed as they are
19819 non-overlapping. However, in case of any conflicts,
19820 the later options override the earlier options on the command
19821 line. 
19823 The following options control which kinds of messages should be emitted:
19825 @table @samp
19826 @item optimized
19827 Print information when an optimization is successfully applied. It is
19828 up to a pass to decide which information is relevant. For example, the
19829 vectorizer passes print the source location of loops which are
19830 successfully vectorized.
19831 @item missed
19832 Print information about missed optimizations. Individual passes
19833 control which information to include in the output. 
19834 @item note
19835 Print verbose information about optimizations, such as certain
19836 transformations, more detailed messages about decisions etc.
19837 @item all
19838 Print detailed optimization information. This includes
19839 @samp{optimized}, @samp{missed}, and @samp{note}.
19840 @end table
19842 The following option controls the dump verbosity:
19844 @table @samp
19845 @item internals
19846 By default, only ``high-level'' messages are emitted. This option enables
19847 additional, more detailed, messages, which are likely to only be of interest
19848 to GCC developers.
19849 @end table
19851 One or more of the following option keywords can be used to describe a
19852 group of optimizations:
19854 @table @samp
19855 @item ipa
19856 Enable dumps from all interprocedural optimizations.
19857 @item loop
19858 Enable dumps from all loop optimizations.
19859 @item inline
19860 Enable dumps from all inlining optimizations.
19861 @item omp
19862 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
19863 @item vec
19864 Enable dumps from all vectorization optimizations.
19865 @item optall
19866 Enable dumps from all optimizations. This is a superset of
19867 the optimization groups listed above.
19868 @end table
19870 If @var{options} is
19871 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
19872 about successful optimizations from all the passes, omitting messages
19873 that are treated as ``internals''.
19875 If the @var{filename} is provided, then the dumps from all the
19876 applicable optimizations are concatenated into the @var{filename}.
19877 Otherwise the dump is output onto @file{stderr}. Though multiple
19878 @option{-fopt-info} options are accepted, only one of them can include
19879 a @var{filename}. If other filenames are provided then all but the
19880 first such option are ignored.
19882 Note that the output @var{filename} is overwritten
19883 in case of multiple translation units. If a combined output from
19884 multiple translation units is desired, @file{stderr} should be used
19885 instead.
19887 In the following example, the optimization info is output to
19888 @file{stderr}:
19890 @smallexample
19891 gcc -O3 -fopt-info
19892 @end smallexample
19894 This example:
19895 @smallexample
19896 gcc -O3 -fopt-info-missed=missed.all
19897 @end smallexample
19899 @noindent
19900 outputs missed optimization report from all the passes into
19901 @file{missed.all}, and this one:
19903 @smallexample
19904 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
19905 @end smallexample
19907 @noindent
19908 prints information about missed optimization opportunities from
19909 vectorization passes on @file{stderr}.  
19910 Note that @option{-fopt-info-vec-missed} is equivalent to 
19911 @option{-fopt-info-missed-vec}.  The order of the optimization group
19912 names and message types listed after @option{-fopt-info} does not matter.
19914 As another example,
19915 @smallexample
19916 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
19917 @end smallexample
19919 @noindent
19920 outputs information about missed optimizations as well as
19921 optimized locations from all the inlining passes into
19922 @file{inline.txt}.
19924 Finally, consider:
19926 @smallexample
19927 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
19928 @end smallexample
19930 @noindent
19931 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
19932 in conflict since only one output file is allowed. In this case, only
19933 the first option takes effect and the subsequent options are
19934 ignored. Thus only @file{vec.miss} is produced which contains
19935 dumps from the vectorizer about missed opportunities.
19937 @opindex fsave-optimization-record
19938 @item -fsave-optimization-record
19939 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
19940 were performed, for those optimizations that support @option{-fopt-info}.
19942 This option is experimental and the format of the data within the
19943 compressed JSON file is subject to change.
19945 It is roughly equivalent to a machine-readable version of
19946 @option{-fopt-info-all}, as a collection of messages with source file,
19947 line number and column number, with the following additional data for
19948 each message:
19950 @itemize @bullet
19952 @item
19953 the execution count of the code being optimized, along with metadata about
19954 whether this was from actual profile data, or just an estimate, allowing
19955 consumers to prioritize messages by code hotness,
19957 @item
19958 the function name of the code being optimized, where applicable,
19960 @item
19961 the ``inlining chain'' for the code being optimized, so that when
19962 a function is inlined into several different places (which might
19963 themselves be inlined), the reader can distinguish between the copies,
19965 @item
19966 objects identifying those parts of the message that refer to expressions,
19967 statements or symbol-table nodes, which of these categories they are, and,
19968 when available, their source code location,
19970 @item
19971 the GCC pass that emitted the message, and
19973 @item
19974 the location in GCC's own code from which the message was emitted
19976 @end itemize
19978 Additionally, some messages are logically nested within other
19979 messages, reflecting implementation details of the optimization
19980 passes.
19982 @opindex fsched-verbose
19983 @item -fsched-verbose=@var{n}
19984 On targets that use instruction scheduling, this option controls the
19985 amount of debugging output the scheduler prints to the dump files.
19987 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
19988 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
19989 For @var{n} greater than one, it also output basic block probabilities,
19990 detailed ready list information and unit/insn info.  For @var{n} greater
19991 than two, it includes RTL at abort point, control-flow and regions info.
19992 And for @var{n} over four, @option{-fsched-verbose} also includes
19993 dependence info.
19997 @opindex fdisable-
19998 @opindex fenable-
19999 @item -fenable-@var{kind}-@var{pass}
20000 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
20002 This is a set of options that are used to explicitly disable/enable
20003 optimization passes.  These options are intended for use for debugging GCC.
20004 Compiler users should use regular options for enabling/disabling
20005 passes instead.
20007 @table @gcctabopt
20009 @item -fdisable-ipa-@var{pass}
20010 Disable IPA pass @var{pass}. @var{pass} is the pass name.  If the same pass is
20011 statically invoked in the compiler multiple times, the pass name should be
20012 appended with a sequential number starting from 1.
20014 @item -fdisable-rtl-@var{pass}
20015 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
20016 Disable RTL pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
20017 statically invoked in the compiler multiple times, the pass name should be
20018 appended with a sequential number starting from 1.  @var{range-list} is a 
20019 comma-separated list of function ranges or assembler names.  Each range is a number
20020 pair separated by a colon.  The range is inclusive in both ends.  If the range
20021 is trivial, the number pair can be simplified as a single number.  If the
20022 function's call graph node's @var{uid} falls within one of the specified ranges,
20023 the @var{pass} is disabled for that function.  The @var{uid} is shown in the
20024 function header of a dump file, and the pass names can be dumped by using
20025 option @option{-fdump-passes}.
20027 @item -fdisable-tree-@var{pass}
20028 @itemx -fdisable-tree-@var{pass}=@var{range-list}
20029 Disable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description of
20030 option arguments.
20032 @item -fenable-ipa-@var{pass}
20033 Enable IPA pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
20034 statically invoked in the compiler multiple times, the pass name should be
20035 appended with a sequential number starting from 1.
20037 @item -fenable-rtl-@var{pass}
20038 @itemx -fenable-rtl-@var{pass}=@var{range-list}
20039 Enable RTL pass @var{pass}.  See @option{-fdisable-rtl} for option argument
20040 description and examples.
20042 @item -fenable-tree-@var{pass}
20043 @itemx -fenable-tree-@var{pass}=@var{range-list}
20044 Enable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description
20045 of option arguments.
20047 @end table
20049 Here are some examples showing uses of these options.
20051 @smallexample
20053 # disable ccp1 for all functions
20054    -fdisable-tree-ccp1
20055 # disable complete unroll for function whose cgraph node uid is 1
20056    -fenable-tree-cunroll=1
20057 # disable gcse2 for functions at the following ranges [1,1],
20058 # [300,400], and [400,1000]
20059 # disable gcse2 for functions foo and foo2
20060    -fdisable-rtl-gcse2=foo,foo2
20061 # disable early inlining
20062    -fdisable-tree-einline
20063 # disable ipa inlining
20064    -fdisable-ipa-inline
20065 # enable tree full unroll
20066    -fenable-tree-unroll
20068 @end smallexample
20070 @opindex fchecking
20071 @opindex fno-checking
20072 @item -fchecking
20073 @itemx -fchecking=@var{n}
20074 Enable internal consistency checking.  The default depends on
20075 the compiler configuration.  @option{-fchecking=2} enables further
20076 internal consistency checking that might affect code generation.
20078 @opindex frandom-seed
20079 @item -frandom-seed=@var{string}
20080 This option provides a seed that GCC uses in place of
20081 random numbers in generating certain symbol names
20082 that have to be different in every compiled file.  It is also used to
20083 place unique stamps in coverage data files and the object files that
20084 produce them.  You can use the @option{-frandom-seed} option to produce
20085 reproducibly identical object files.
20087 The @var{string} can either be a number (decimal, octal or hex) or an
20088 arbitrary string (in which case it's converted to a number by
20089 computing CRC32).
20091 The @var{string} should be different for every file you compile.
20093 @opindex save-temps
20094 @item -save-temps
20095 Store the usual ``temporary'' intermediate files permanently; name them
20096 as auxiliary output files, as specified described under
20097 @option{-dumpbase} and @option{-dumpdir}.
20099 When used in combination with the @option{-x} command-line option,
20100 @option{-save-temps} is sensible enough to avoid overwriting an
20101 input source file with the same extension as an intermediate file.
20102 The corresponding intermediate file may be obtained by renaming the
20103 source file before using @option{-save-temps}.
20105 @opindex save-temps=cwd
20106 @item -save-temps=cwd
20107 Equivalent to @option{-save-temps -dumpdir ./}.
20109 @opindex save-temps=obj
20110 @item -save-temps=obj
20111 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
20112 @file{outdir/} is the directory of the output file specified after the
20113 @option{-o} option, including any directory separators.  If the
20114 @option{-o} option is not used, the @option{-save-temps=obj} switch
20115 behaves like @option{-save-temps=cwd}.
20117 @opindex time
20118 @item -time@r{[}=@var{file}@r{]}
20119 Report the CPU time taken by each subprocess in the compilation
20120 sequence.  For C source files, this is the compiler proper and assembler
20121 (plus the linker if linking is done).
20123 Without the specification of an output file, the output looks like this:
20125 @smallexample
20126 # cc1 0.12 0.01
20127 # as 0.00 0.01
20128 @end smallexample
20130 The first number on each line is the ``user time'', that is time spent
20131 executing the program itself.  The second number is ``system time'',
20132 time spent executing operating system routines on behalf of the program.
20133 Both numbers are in seconds.
20135 With the specification of an output file, the output is appended to the
20136 named file, and it looks like this:
20138 @smallexample
20139 0.12 0.01 cc1 @var{options}
20140 0.00 0.01 as @var{options}
20141 @end smallexample
20143 The ``user time'' and the ``system time'' are moved before the program
20144 name, and the options passed to the program are displayed, so that one
20145 can later tell what file was being compiled, and with which options.
20147 @opindex fdump-final-insns
20148 @item -fdump-final-insns@r{[}=@var{file}@r{]}
20149 Dump the final internal representation (RTL) to @var{file}.  If the
20150 optional argument is omitted (or if @var{file} is @code{.}), the name
20151 of the dump file is determined by appending @code{.gkd} to the
20152 dump base name, see @option{-dumpbase}.
20154 @opindex fcompare-debug
20155 @opindex fno-compare-debug
20156 @item -fcompare-debug@r{[}=@var{opts}@r{]}
20157 If no error occurs during compilation, run the compiler a second time,
20158 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
20159 passed to the second compilation.  Dump the final internal
20160 representation in both compilations, and print an error if they differ.
20162 If the equal sign is omitted, the default @option{-gtoggle} is used.
20164 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
20165 and nonzero, implicitly enables @option{-fcompare-debug}.  If
20166 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
20167 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
20168 is used.
20170 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
20171 is equivalent to @option{-fno-compare-debug}, which disables the dumping
20172 of the final representation and the second compilation, preventing even
20173 @env{GCC_COMPARE_DEBUG} from taking effect.
20175 To verify full coverage during @option{-fcompare-debug} testing, set
20176 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
20177 which GCC rejects as an invalid option in any actual compilation
20178 (rather than preprocessing, assembly or linking).  To get just a
20179 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
20180 not overridden} will do.
20182 @opindex fcompare-debug-second
20183 @item -fcompare-debug-second
20184 This option is implicitly passed to the compiler for the second
20185 compilation requested by @option{-fcompare-debug}, along with options to
20186 silence warnings, and omitting other options that would cause the compiler
20187 to produce output to files or to standard output as a side effect.  Dump
20188 files and preserved temporary files are renamed so as to contain the
20189 @code{.gk} additional extension during the second compilation, to avoid
20190 overwriting those generated by the first.
20192 When this option is passed to the compiler driver, it causes the
20193 @emph{first} compilation to be skipped, which makes it useful for little
20194 other than debugging the compiler proper.
20196 @opindex gtoggle
20197 @item -gtoggle
20198 Turn off generation of debug info, if leaving out this option
20199 generates it, or turn it on at level 2 otherwise.  The position of this
20200 argument in the command line does not matter; it takes effect after all
20201 other options are processed, and it does so only once, no matter how
20202 many times it is given.  This is mainly intended to be used with
20203 @option{-fcompare-debug}.
20205 @opindex fvar-tracking-assignments-toggle
20206 @opindex fno-var-tracking-assignments-toggle
20207 @item -fvar-tracking-assignments-toggle
20208 Toggle @option{-fvar-tracking-assignments}, in the same way that
20209 @option{-gtoggle} toggles @option{-g}.
20211 @opindex Q
20212 @item -Q
20213 Makes the compiler print out each function name as it is compiled, and
20214 print some statistics about each pass when it finishes.
20216 @opindex ftime-report
20217 @item -ftime-report
20218 Makes the compiler print some statistics to stderr about the time consumed
20219 by each pass when it finishes.
20221 If SARIF output of diagnostics was requested via
20222 @option{-fdiagnostics-format=sarif-file} or
20223 @option{-fdiagnostics-format=sarif-stderr} then the @option{-ftime-report}
20224 information is instead emitted in JSON form as part of SARIF output.  The
20225 precise format of this JSON data is subject to change, and the values may
20226 not exactly match those emitted to stderr due to being written out at a
20227 slightly different place within the compiler.
20229 @opindex ftime-report-details
20230 @item -ftime-report-details
20231 Record the time consumed by infrastructure parts separately for each pass.
20233 @opindex fira-verbose
20234 @item -fira-verbose=@var{n}
20235 Control the verbosity of the dump file for the integrated register allocator.
20236 The default value is 5.  If the value @var{n} is greater or equal to 10,
20237 the dump output is sent to stderr using the same format as @var{n} minus 10.
20239 @opindex flto-report
20240 @item -flto-report
20241 Prints a report with internal details on the workings of the link-time
20242 optimizer.  The contents of this report vary from version to version.
20243 It is meant to be useful to GCC developers when processing object
20244 files in LTO mode (via @option{-flto}).
20246 Disabled by default.
20248 @opindex flto-report-wpa
20249 @item -flto-report-wpa
20250 Like @option{-flto-report}, but only print for the WPA phase of link-time
20251 optimization.
20253 @opindex fmem-report
20254 @item -fmem-report
20255 Makes the compiler print some statistics about permanent memory
20256 allocation when it finishes.
20258 @opindex fmem-report-wpa
20259 @item -fmem-report-wpa
20260 Makes the compiler print some statistics about permanent memory
20261 allocation for the WPA phase only.
20263 @opindex fpre-ipa-mem-report
20264 @opindex fpost-ipa-mem-report
20265 @item -fpre-ipa-mem-report
20266 @item -fpost-ipa-mem-report
20267 Makes the compiler print some statistics about permanent memory
20268 allocation before or after interprocedural optimization.
20270 @opindex fmultiflags
20271 @item -fmultiflags
20272 This option enables multilib-aware @code{TFLAGS} to be used to build
20273 target libraries with options different from those the compiler is
20274 configured to use by default, through the use of specs (@xref{Spec
20275 Files}) set up by compiler internals, by the target, or by builders at
20276 configure time.
20278 Like @code{TFLAGS}, this allows the target libraries to be built for
20279 portable baseline environments, while the compiler defaults to more
20280 demanding ones.  That's useful because users can easily override the
20281 defaults the compiler is configured to use to build their own programs,
20282 if the defaults are not ideal for their target environment, whereas
20283 rebuilding the runtime libraries is usually not as easy or desirable.
20285 Unlike @code{TFLAGS}, the use of specs enables different flags to be
20286 selected for different multilibs.  The way to accomplish that is to
20287 build with @samp{make TFLAGS=-fmultiflags}, after configuring
20288 @samp{--with-specs=%@{fmultiflags:...@}}.
20290 This option is discarded by the driver once it's done processing driver
20291 self spec.
20293 It is also useful to check that @code{TFLAGS} are being used to build
20294 all target libraries, by configuring a non-bootstrap compiler
20295 @samp{--with-specs='%@{!fmultiflags:%emissing TFLAGS@}'} and building
20296 the compiler and target libraries.
20298 @opindex fprofile-report
20299 @item -fprofile-report
20300 Makes the compiler print some statistics about consistency of the
20301 (estimated) profile and effect of individual passes.
20303 @opindex fstack-usage
20304 @item -fstack-usage
20305 Makes the compiler output stack usage information for the program, on a
20306 per-function basis.  The filename for the dump is made by appending
20307 @file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
20308 the output file, if explicitly specified and it is not an executable,
20309 otherwise it is the basename of the source file.  An entry is made up
20310 of three fields:
20312 @itemize
20313 @item
20314 The name of the function.
20315 @item
20316 A number of bytes.
20317 @item
20318 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
20319 @end itemize
20321 The qualifier @code{static} means that the function manipulates the stack
20322 statically: a fixed number of bytes are allocated for the frame on function
20323 entry and released on function exit; no stack adjustments are otherwise made
20324 in the function.  The second field is this fixed number of bytes.
20326 The qualifier @code{dynamic} means that the function manipulates the stack
20327 dynamically: in addition to the static allocation described above, stack
20328 adjustments are made in the body of the function, for example to push/pop
20329 arguments around function calls.  If the qualifier @code{bounded} is also
20330 present, the amount of these adjustments is bounded at compile time and
20331 the second field is an upper bound of the total amount of stack used by
20332 the function.  If it is not present, the amount of these adjustments is
20333 not bounded at compile time and the second field only represents the
20334 bounded part.
20336 @opindex fstats
20337 @item -fstats
20338 Emit statistics about front-end processing at the end of the compilation.
20339 This option is supported only by the C++ front end, and
20340 the information is generally only useful to the G++ development team.
20342 @opindex fdbg-cnt-list
20343 @item -fdbg-cnt-list
20344 Print the name and the counter upper bound for all debug counters.
20347 @opindex fdbg-cnt
20348 @item -fdbg-cnt=@var{counter-value-list}
20349 Set the internal debug counter lower and upper bound.  @var{counter-value-list}
20350 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
20351 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
20352 the name of the counter and list of closed intervals.
20353 The @var{lower_bound} is optional and is zero
20354 initialized if not set.
20355 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
20356 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
20357 eleventh invocation.
20358 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
20360 @opindex print-file-name
20361 @item -print-file-name=@var{library}
20362 Print the full absolute name of the library file @var{library} that
20363 would be used when linking---and don't do anything else.  With this
20364 option, GCC does not compile or link anything; it just prints the
20365 file name.
20367 @opindex print-multi-directory
20368 @item -print-multi-directory
20369 Print the directory name corresponding to the multilib selected by any
20370 other switches present in the command line.  This directory is supposed
20371 to exist in @env{GCC_EXEC_PREFIX}.
20373 @opindex print-multi-lib
20374 @item -print-multi-lib
20375 Print the mapping from multilib directory names to compiler switches
20376 that enable them.  The directory name is separated from the switches by
20377 @samp{;}, and each switch starts with an @samp{@@} instead of the
20378 @samp{-}, without spaces between multiple switches.  This is supposed to
20379 ease shell processing.
20381 @opindex print-multi-os-directory
20382 @item -print-multi-os-directory
20383 Print the path to OS libraries for the selected
20384 multilib, relative to some @file{lib} subdirectory.  If OS libraries are
20385 present in the @file{lib} subdirectory and no multilibs are used, this is
20386 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
20387 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
20388 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
20389 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
20391 @opindex print-multiarch
20392 @item -print-multiarch
20393 Print the path to OS libraries for the selected multiarch,
20394 relative to some @file{lib} subdirectory.
20396 @opindex print-prog-name
20397 @item -print-prog-name=@var{program}
20398 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
20400 @opindex print-libgcc-file-name
20401 @item -print-libgcc-file-name
20402 Same as @option{-print-file-name=libgcc.a}.
20404 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
20405 but you do want to link with @file{libgcc.a}.  You can do:
20407 @smallexample
20408 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
20409 @end smallexample
20411 @opindex print-search-dirs
20412 @item -print-search-dirs
20413 Print the name of the configured installation directory and a list of
20414 program and library directories @command{gcc} searches---and don't do anything else.
20416 This is useful when @command{gcc} prints the error message
20417 @samp{installation problem, cannot exec cpp0: No such file or directory}.
20418 To resolve this you either need to put @file{cpp0} and the other compiler
20419 components where @command{gcc} expects to find them, or you can set the environment
20420 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
20421 Don't forget the trailing @samp{/}.
20422 @xref{Environment Variables}.
20424 @opindex print-sysroot
20425 @item -print-sysroot
20426 Print the target sysroot directory that is used during
20427 compilation.  This is the target sysroot specified either at configure
20428 time or using the @option{--sysroot} option, possibly with an extra
20429 suffix that depends on compilation options.  If no target sysroot is
20430 specified, the option prints nothing.
20432 @opindex print-sysroot-headers-suffix
20433 @item -print-sysroot-headers-suffix
20434 Print the suffix added to the target sysroot when searching for
20435 headers, or give an error if the compiler is not configured with such
20436 a suffix---and don't do anything else.
20438 @opindex dumpmachine
20439 @item -dumpmachine
20440 Print the compiler's target machine (for example,
20441 @samp{i686-pc-linux-gnu})---and don't do anything else.
20443 @opindex dumpversion
20444 @item -dumpversion
20445 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
20446 anything else.  This is the compiler version used in filesystem paths and
20447 specs. Depending on how the compiler has been configured it can be just
20448 a single number (major version), two numbers separated by a dot (major and
20449 minor version) or three numbers separated by dots (major, minor and patchlevel
20450 version).
20452 @opindex dumpfullversion
20453 @item -dumpfullversion
20454 Print the full compiler version---and don't do anything else. The output is
20455 always three numbers separated by dots, major, minor and patchlevel version.
20457 @opindex dumpspecs
20458 @item -dumpspecs
20459 Print the compiler's built-in specs---and don't do anything else.  (This
20460 is used when GCC itself is being built.)  @xref{Spec Files}.
20461 @end table
20463 @node Submodel Options
20464 @section Machine-Dependent Options
20465 @cindex submodel options
20466 @cindex specifying hardware config
20467 @cindex hardware models and configurations, specifying
20468 @cindex target-dependent options
20469 @cindex machine-dependent options
20471 Each target machine supported by GCC can have its own options---for
20472 example, to allow you to compile for a particular processor variant or
20473 ABI, or to control optimizations specific to that machine.  By
20474 convention, the names of machine-specific options start with
20475 @samp{-m}.
20477 Some configurations of the compiler also support additional target-specific
20478 options, usually for compatibility with other compilers on the same
20479 platform.
20481 @c This list is ordered alphanumerically by subsection name.
20482 @c It should be the same order and spelling as these options are listed
20483 @c in Machine Dependent Options
20485 @menu
20486 * AArch64 Options::
20487 * Adapteva Epiphany Options::
20488 * AMD GCN Options::
20489 * ARC Options::
20490 * ARM Options::
20491 * AVR Options::
20492 * Blackfin Options::
20493 * C6X Options::
20494 * CRIS Options::
20495 * C-SKY Options::
20496 * Darwin Options::
20497 * DEC Alpha Options::
20498 * eBPF Options::
20499 * FR30 Options::
20500 * FT32 Options::
20501 * FRV Options::
20502 * GNU/Linux Options::
20503 * H8/300 Options::
20504 * HPPA Options::
20505 * IA-64 Options::
20506 * LM32 Options::
20507 * LoongArch Options::
20508 * M32C Options::
20509 * M32R/D Options::
20510 * M680x0 Options::
20511 * MCore Options::
20512 * MicroBlaze Options::
20513 * MIPS Options::
20514 * MMIX Options::
20515 * MN10300 Options::
20516 * Moxie Options::
20517 * MSP430 Options::
20518 * NDS32 Options::
20519 * Nios II Options::
20520 * Nvidia PTX Options::
20521 * OpenRISC Options::
20522 * PDP-11 Options::
20523 * PowerPC Options::
20524 * PRU Options::
20525 * RISC-V Options::
20526 * RL78 Options::
20527 * RS/6000 and PowerPC Options::
20528 * RX Options::
20529 * S/390 and zSeries Options::
20530 * SH Options::
20531 * Solaris 2 Options::
20532 * SPARC Options::
20533 * System V Options::
20534 * V850 Options::
20535 * VAX Options::
20536 * Visium Options::
20537 * VMS Options::
20538 * VxWorks Options::
20539 * x86 Options::
20540 * x86 Windows Options::
20541 * Xstormy16 Options::
20542 * Xtensa Options::
20543 * zSeries Options::
20544 @end menu
20546 @node AArch64 Options
20547 @subsection AArch64 Options
20548 @cindex AArch64 Options
20550 These options are defined for AArch64 implementations:
20552 @table @gcctabopt
20554 @opindex mabi
20555 @item -mabi=@var{name}
20556 Generate code for the specified data model.  Permissible values
20557 are @samp{ilp32} for SysV-like data model where int, long int and pointers
20558 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
20559 but long int and pointers are 64 bits.
20561 The default depends on the specific target configuration.  Note that
20562 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
20563 entire program with the same ABI, and link with a compatible set of libraries.
20565 @opindex mbig-endian
20566 @item -mbig-endian
20567 Generate big-endian code.  This is the default when GCC is configured for an
20568 @samp{aarch64_be-*-*} target.
20570 @opindex mgeneral-regs-only
20571 @item -mgeneral-regs-only
20572 Generate code which uses only the general-purpose registers.  This will prevent
20573 the compiler from using floating-point and Advanced SIMD registers but will not
20574 impose any restrictions on the assembler.
20576 @opindex mlittle-endian
20577 @item -mlittle-endian
20578 Generate little-endian code.  This is the default when GCC is configured for an
20579 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
20581 @opindex mcmodel=tiny
20582 @item -mcmodel=tiny
20583 Generate code for the tiny code model.  The program and its statically defined
20584 symbols must be within 1MB of each other.  Programs can be statically or
20585 dynamically linked.
20587 @opindex mcmodel=small
20588 @item -mcmodel=small
20589 Generate code for the small code model.  The program and its statically defined
20590 symbols must be within 4GB of each other.  Programs can be statically or
20591 dynamically linked.  This is the default code model.
20593 @opindex mcmodel=large
20594 @item -mcmodel=large
20595 Generate code for the large code model.  This makes no assumptions about
20596 addresses and sizes of sections.  Programs can be statically linked only.  The
20597 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
20598 @option{-fpic} and @option{-fPIC}.
20600 @item -mtp=@var{name}
20601 @opindex mtp
20602 Specify the system register to use as a thread pointer.  The valid values
20603 are @samp{tpidr_el0}, @samp{tpidrro_el0}, @samp{tpidr_el1}, @samp{tpidr_el2},
20604 @samp{tpidr_el3}.  For backwards compatibility the aliases @samp{el0},
20605 @samp{el1}, @samp{el2}, @samp{el3} are also accepted.
20606 The default setting is @samp{tpidr_el0}.  It is recommended to compile all
20607 code intended to interoperate with the same value of this option to avoid
20608 accessing a different thread pointer from the wrong exception level.
20610 @opindex mstrict-align
20611 @opindex mno-strict-align
20612 @item -mstrict-align
20613 @itemx -mno-strict-align
20614 Avoid or allow generating memory accesses that may not be aligned on a natural
20615 object boundary as described in the architecture specification.
20617 @opindex momit-leaf-frame-pointer
20618 @opindex mno-omit-leaf-frame-pointer
20619 @item -momit-leaf-frame-pointer
20620 @itemx -mno-omit-leaf-frame-pointer
20621 Omit or keep the frame pointer in leaf functions.  The former behavior is the
20622 default.
20624 @opindex mstack-protector-guard
20625 @opindex mstack-protector-guard-reg
20626 @opindex mstack-protector-guard-offset
20627 @item -mstack-protector-guard=@var{guard}
20628 @itemx -mstack-protector-guard-reg=@var{reg}
20629 @itemx -mstack-protector-guard-offset=@var{offset}
20630 Generate stack protection code using canary at @var{guard}.  Supported
20631 locations are @samp{global} for a global canary or @samp{sysreg} for a
20632 canary in an appropriate system register.
20634 With the latter choice the options
20635 @option{-mstack-protector-guard-reg=@var{reg}} and
20636 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
20637 which system register to use as base register for reading the canary,
20638 and from what offset from that base register. There is no default
20639 register or offset as this is entirely for use within the Linux
20640 kernel.
20642 @opindex mtls-dialect=desc
20643 @item -mtls-dialect=desc
20644 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
20645 of TLS variables.  This is the default.
20647 @opindex mtls-dialect=traditional
20648 @item -mtls-dialect=traditional
20649 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
20650 of TLS variables.
20652 @opindex mtls-size
20653 @item -mtls-size=@var{size}
20654 Specify bit size of immediate TLS offsets.  Valid values are 12, 24, 32, 48.
20655 This option requires binutils 2.26 or newer.
20657 @opindex mfix-cortex-a53-835769
20658 @opindex mno-fix-cortex-a53-835769
20659 @item -mfix-cortex-a53-835769
20660 @itemx -mno-fix-cortex-a53-835769
20661 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
20662 This involves inserting a NOP instruction between memory instructions and
20663 64-bit integer multiply-accumulate instructions.
20665 @opindex mfix-cortex-a53-843419
20666 @opindex mno-fix-cortex-a53-843419
20667 @item -mfix-cortex-a53-843419
20668 @itemx -mno-fix-cortex-a53-843419
20669 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
20670 This erratum workaround is made at link time and this will only pass the
20671 corresponding flag to the linker.
20673 @opindex mlow-precision-recip-sqrt
20674 @opindex mno-low-precision-recip-sqrt
20675 @item -mlow-precision-recip-sqrt
20676 @itemx -mno-low-precision-recip-sqrt
20677 Enable or disable the reciprocal square root approximation.
20678 This option only has an effect if @option{-ffast-math} or
20679 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20680 precision of reciprocal square root results to about 16 bits for
20681 single precision and to 32 bits for double precision.
20683 @opindex mlow-precision-sqrt
20684 @opindex mno-low-precision-sqrt
20685 @item -mlow-precision-sqrt
20686 @itemx -mno-low-precision-sqrt
20687 Enable or disable the square root approximation.
20688 This option only has an effect if @option{-ffast-math} or
20689 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20690 precision of square root results to about 16 bits for
20691 single precision and to 32 bits for double precision.
20692 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
20694 @opindex mlow-precision-div
20695 @opindex mno-low-precision-div
20696 @item -mlow-precision-div
20697 @itemx -mno-low-precision-div
20698 Enable or disable the division approximation.
20699 This option only has an effect if @option{-ffast-math} or
20700 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20701 precision of division results to about 16 bits for
20702 single precision and to 32 bits for double precision.
20704 @item -mtrack-speculation
20705 @itemx -mno-track-speculation
20706 Enable or disable generation of additional code to track speculative
20707 execution through conditional branches.  The tracking state can then
20708 be used by the compiler when expanding calls to
20709 @code{__builtin_speculation_safe_copy} to permit a more efficient code
20710 sequence to be generated.
20712 @item -moutline-atomics
20713 @itemx -mno-outline-atomics
20714 Enable or disable calls to out-of-line helpers to implement atomic operations.
20715 These helpers will, at runtime, determine if the LSE instructions from
20716 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
20717 instructions that are present in the base ARMv8.0 ISA.
20719 This option is only applicable when compiling for the base ARMv8.0
20720 instruction set.  If using a later revision, e.g. @option{-march=armv8.1-a}
20721 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
20722 used directly.  The same applies when using @option{-mcpu=} when the
20723 selected cpu supports the @samp{lse} feature.
20724 This option is on by default.
20726 @opindex march
20727 @item -march=@var{name}
20728 Specify the name of the target architecture and, optionally, one or
20729 more feature modifiers.  This option has the form
20730 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
20732 The table below summarizes the permissible values for @var{arch}
20733 and the features that they enable by default:
20735 @multitable @columnfractions 0.20 0.20 0.60
20736 @headitem @var{arch} value @tab Architecture @tab Includes by default
20737 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
20738 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
20739 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
20740 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
20741 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
20742 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
20743 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
20744 @item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64}
20745 @item @samp{armv8.8-a} @tab Armv8.8-a @tab @samp{armv8.7-a}, @samp{+mops}
20746 @item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2}
20747 @item @samp{armv9.1-a} @tab Armv9.1-A @tab @samp{armv9-a}, @samp{+bf16}, @samp{+i8mm}
20748 @item @samp{armv9.2-a} @tab Armv9.2-A @tab @samp{armv9.1-a}, @samp{+ls64}
20749 @item @samp{armv9.3-a} @tab Armv9.3-A @tab @samp{armv9.2-a}, @samp{+mops}
20750 @item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
20751 @end multitable
20753 The value @samp{native} is available on native AArch64 GNU/Linux and
20754 causes the compiler to pick the architecture of the host system.  This
20755 option has no effect if the compiler is unable to recognize the
20756 architecture of the host system,
20758 The permissible values for @var{feature} are listed in the sub-section
20759 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20760 Feature Modifiers}.  Where conflicting feature modifiers are
20761 specified, the right-most feature is used.
20763 GCC uses @var{name} to determine what kind of instructions it can emit
20764 when generating assembly code.  If @option{-march} is specified
20765 without either of @option{-mtune} or @option{-mcpu} also being
20766 specified, the code is tuned to perform well across a range of target
20767 processors implementing the target architecture.
20769 @opindex mtune
20770 @item -mtune=@var{name}
20771 Specify the name of the target processor for which GCC should tune the
20772 performance of the code.  Permissible values for this option are:
20773 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
20774 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
20775 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
20776 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
20777 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
20778 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
20779 @samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
20780 @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{neoverse-v2}, @samp{qdf24xx},
20781 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
20782 @samp{octeontx}, @samp{octeontx81},  @samp{octeontx83},
20783 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
20784 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
20785 @samp{octeontx2f95mm},
20786 @samp{a64fx},
20787 @samp{thunderx}, @samp{thunderxt88},
20788 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
20789 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
20790 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20791 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20792 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
20793 @samp{cortex-r82}, @samp{cortex-x1}, @samp{cortex-x1c}, @samp{cortex-x2},
20794 @samp{cortex-x3}, @samp{cortex-x4}, @samp{cortex-a510}, @samp{cortex-a520},
20795 @samp{cortex-a710}, @samp{cortex-a715}, @samp{cortex-a720}, @samp{ampere1},
20796 @samp{ampere1a}, and @samp{native}.
20798 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20799 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20800 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
20801 should tune for a big.LITTLE system.
20803 The value @samp{neoverse-512tvb} specifies that GCC should tune
20804 for Neoverse cores that (a) implement SVE and (b) have a total vector
20805 bandwidth of 512 bits per cycle.  In other words, the option tells GCC to
20806 tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
20807 instructions a cycle and that can execute an equivalent number of SVE
20808 arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
20809 This is more general than tuning for a specific core like Neoverse V1
20810 but is more specific than the default tuning described below.
20812 Additionally on native AArch64 GNU/Linux systems the value
20813 @samp{native} tunes performance to the host system.  This option has no effect
20814 if the compiler is unable to recognize the processor of the host system.
20816 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
20817 are specified, the code is tuned to perform well across a range
20818 of target processors.
20820 This option cannot be suffixed by feature modifiers.
20822 @opindex mcpu
20823 @item -mcpu=@var{name}
20824 Specify the name of the target processor, optionally suffixed by one
20825 or more feature modifiers.  This option has the form
20826 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
20827 the permissible values for @var{cpu} are the same as those available
20828 for @option{-mtune}.  The permissible values for @var{feature} are
20829 documented in the sub-section on
20830 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20831 Feature Modifiers}.  Where conflicting feature modifiers are
20832 specified, the right-most feature is used.
20834 GCC uses @var{name} to determine what kind of instructions it can emit when
20835 generating assembly code (as if by @option{-march}) and to determine
20836 the target processor for which to tune for performance (as if
20837 by @option{-mtune}).  Where this option is used in conjunction
20838 with @option{-march} or @option{-mtune}, those options take precedence
20839 over the appropriate part of this option.
20841 @option{-mcpu=neoverse-512tvb} is special in that it does not refer
20842 to a specific core, but instead refers to all Neoverse cores that
20843 (a) implement SVE and (b) have a total vector bandwidth of 512 bits
20844 a cycle.  Unless overridden by @option{-march},
20845 @option{-mcpu=neoverse-512tvb} generates code that can run on a
20846 Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
20847 these properties.  Unless overridden by @option{-mtune},
20848 @option{-mcpu=neoverse-512tvb} tunes code in the same way as for
20849 @option{-mtune=neoverse-512tvb}.
20851 @opindex moverride
20852 @item -moverride=@var{string}
20853 Override tuning decisions made by the back-end in response to a
20854 @option{-mtune=} switch.  The syntax, semantics, and accepted values
20855 for @var{string} in this option are not guaranteed to be consistent
20856 across releases.
20858 This option is only intended to be useful when developing GCC.
20860 @opindex mverbose-cost-dump
20861 @item -mverbose-cost-dump
20862 Enable verbose cost model dumping in the debug dump files.  This option is
20863 provided for use in debugging the compiler.
20865 @opindex mpc-relative-literal-loads
20866 @opindex mno-pc-relative-literal-loads
20867 @item -mpc-relative-literal-loads
20868 @itemx -mno-pc-relative-literal-loads
20869 Enable or disable PC-relative literal loads.  With this option literal pools are
20870 accessed using a single instruction and emitted after each function.  This
20871 limits the maximum size of functions to 1MB.  This is enabled by default for
20872 @option{-mcmodel=tiny}.
20874 @opindex msign-return-address
20875 @item -msign-return-address=@var{scope}
20876 Select the function scope on which return address signing will be applied.
20877 Permissible values are @samp{none}, which disables return address signing,
20878 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
20879 functions, and @samp{all}, which enables pointer signing for all functions.  The
20880 default value is @samp{none}. This option has been deprecated by
20881 -mbranch-protection.
20883 @opindex mbranch-protection
20884 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
20885 Select the branch protection features to use.
20886 @samp{none} is the default and turns off all types of branch protection.
20887 @samp{standard} turns on all types of branch protection features.  If a feature
20888 has additional tuning options, then @samp{standard} sets it to its standard
20889 level.
20890 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
20891 level: signing functions that save the return address to memory (non-leaf
20892 functions will practically always do this) using the a-key.  The optional
20893 argument @samp{leaf} can be used to extend the signing to include leaf
20894 functions.  The optional argument @samp{b-key} can be used to sign the functions
20895 with the B-key instead of the A-key.
20896 @samp{bti} turns on branch target identification mechanism.
20898 @opindex mharden-sls
20899 @item -mharden-sls=@var{opts}
20900 Enable compiler hardening against straight line speculation (SLS).
20901 @var{opts} is a comma-separated list of the following options:
20902 @table @samp
20903 @item retbr
20904 @item blr
20905 @end table
20906 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
20907 @samp{-mharden-sls=none} disables all SLS hardening.
20909 @opindex msve-vector-bits
20910 @item -msve-vector-bits=@var{bits}
20911 Specify the number of bits in an SVE vector register.  This option only has
20912 an effect when SVE is enabled.
20914 GCC supports two forms of SVE code generation: ``vector-length
20915 agnostic'' output that works with any size of vector register and
20916 ``vector-length specific'' output that allows GCC to make assumptions
20917 about the vector length when it is useful for optimization reasons.
20918 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
20919 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
20920 Specifying @samp{scalable} selects vector-length agnostic
20921 output.  At present @samp{-msve-vector-bits=128} also generates vector-length
20922 agnostic output for big-endian targets.  All other values generate
20923 vector-length specific code.  The behavior of these values may change
20924 in future releases and no value except @samp{scalable} should be
20925 relied on for producing code that is portable across different
20926 hardware SVE vector lengths.
20928 The default is @samp{-msve-vector-bits=scalable}, which produces
20929 vector-length agnostic code.
20930 @end table
20932 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
20933 @anchor{aarch64-feature-modifiers}
20934 @cindex @option{-march} feature modifiers
20935 @cindex @option{-mcpu} feature modifiers
20936 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
20937 the following and their inverses @option{no@var{feature}}:
20939 @table @samp
20940 @item crc
20941 Enable CRC extension.  This is on by default for
20942 @option{-march=armv8.1-a}.
20943 @item crypto
20944 Enable Crypto extension.  This also enables Advanced SIMD and floating-point
20945 instructions.
20946 @item fp
20947 Enable floating-point instructions.  This is on by default for all possible
20948 values for options @option{-march} and @option{-mcpu}.
20949 @item simd
20950 Enable Advanced SIMD instructions.  This also enables floating-point
20951 instructions.  This is on by default for all possible values for options
20952 @option{-march} and @option{-mcpu}.
20953 @item sve
20954 Enable Scalable Vector Extension instructions.  This also enables Advanced
20955 SIMD and floating-point instructions.
20956 @item lse
20957 Enable Large System Extension instructions.  This is on by default for
20958 @option{-march=armv8.1-a}.
20959 @item rdma
20960 Enable Round Double Multiply Accumulate instructions.  This is on by default
20961 for @option{-march=armv8.1-a}.
20962 @item fp16
20963 Enable FP16 extension.  This also enables floating-point instructions.
20964 @item fp16fml
20965 Enable FP16 fmla extension.  This also enables FP16 extensions and
20966 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.
20968 @item rcpc
20969 Enable the RCpc extension.  This enables the use of the LDAPR instructions for
20970 load-acquire atomic semantics, and passes it on to the assembler, enabling
20971 inline asm statements to use instructions from the RCpc extension.
20972 @item dotprod
20973 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
20974 @item aes
20975 Enable the Armv8-a aes and pmull crypto extension.  This also enables Advanced
20976 SIMD instructions.
20977 @item sha2
20978 Enable the Armv8-a sha2 crypto extension.  This also enables Advanced SIMD instructions.
20979 @item sha3
20980 Enable the sha512 and sha3 crypto extension.  This also enables Advanced SIMD
20981 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
20982 @item sm4
20983 Enable the sm3 and sm4 crypto extension.  This also enables Advanced SIMD instructions.
20984 Use of this option with architectures prior to Armv8.2-A is not supported.
20985 @item profile
20986 Enable the Statistical Profiling extension.  This option is only to enable the
20987 extension at the assembler level and does not affect code generation.
20988 @item rng
20989 Enable the Armv8.5-a Random Number instructions.  This option is only to
20990 enable the extension at the assembler level and does not affect code
20991 generation.
20992 @item memtag
20993 Enable the Armv8.5-a Memory Tagging Extensions.
20994 Use of this option with architectures prior to Armv8.5-A is not supported.
20995 @item sb
20996 Enable the Armv8-a Speculation Barrier instruction.  This option is only to
20997 enable the extension at the assembler level and does not affect code
20998 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
20999 @item ssbs
21000 Enable the Armv8-a Speculative Store Bypass Safe instruction.  This option
21001 is only to enable the extension at the assembler level and does not affect code
21002 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
21003 @item predres
21004 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
21005 This option is only to enable the extension at the assembler level and does
21006 not affect code generation.  This option is enabled by default for
21007 @option{-march=armv8.5-a}.
21008 @item sve2
21009 Enable the Armv8-a Scalable Vector Extension 2.  This also enables SVE
21010 instructions.
21011 @item sve2-bitperm
21012 Enable SVE2 bitperm instructions.  This also enables SVE2 instructions.
21013 @item sve2-sm4
21014 Enable SVE2 sm4 instructions.  This also enables SVE2 instructions.
21015 @item sve2-aes
21016 Enable SVE2 aes instructions.  This also enables SVE2 instructions.
21017 @item sve2-sha3
21018 Enable SVE2 sha3 instructions.  This also enables SVE2 instructions.
21019 @item tme
21020 Enable the Transactional Memory Extension.
21021 @item i8mm
21022 Enable 8-bit Integer Matrix Multiply instructions.  This also enables
21023 Advanced SIMD and floating-point instructions.  This option is enabled by
21024 default for @option{-march=armv8.6-a}.  Use of this option with architectures
21025 prior to Armv8.2-A is not supported.
21026 @item f32mm
21027 Enable 32-bit Floating point Matrix Multiply instructions.  This also enables
21028 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
21029 not supported.
21030 @item f64mm
21031 Enable 64-bit Floating point Matrix Multiply instructions.  This also enables
21032 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
21033 not supported.
21034 @item bf16
21035 Enable brain half-precision floating-point instructions.  This also enables
21036 Advanced SIMD and floating-point instructions.  This option is enabled by
21037 default for @option{-march=armv8.6-a}.  Use of this option with architectures
21038 prior to Armv8.2-A is not supported.
21039 @item ls64
21040 Enable the 64-byte atomic load and store instructions for accelerators.
21041 This option is enabled by default for @option{-march=armv8.7-a}.
21042 @item mops
21043 Enable the instructions to accelerate memory operations like @code{memcpy},
21044 @code{memmove}, @code{memset}.  This option is enabled by default for
21045 @option{-march=armv8.8-a}
21046 @item flagm
21047 Enable the Flag Manipulation instructions Extension.
21048 @item pauth
21049 Enable the Pointer Authentication Extension.
21050 @item cssc
21051 Enable the Common Short Sequence Compression instructions.
21053 @end table
21055 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
21056 which implies @option{fp}.
21057 Conversely, @option{nofp} implies @option{nosimd}, which implies
21058 @option{nocrypto}, @option{noaes} and @option{nosha2}.
21060 @node Adapteva Epiphany Options
21061 @subsection Adapteva Epiphany Options
21063 These @samp{-m} options are defined for Adapteva Epiphany:
21065 @table @gcctabopt
21066 @opindex mhalf-reg-file
21067 @item -mhalf-reg-file
21068 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
21069 That allows code to run on hardware variants that lack these registers.
21071 @opindex mprefer-short-insn-regs
21072 @item -mprefer-short-insn-regs
21073 Preferentially allocate registers that allow short instruction generation.
21074 This can result in increased instruction count, so this may either reduce or
21075 increase overall code size.
21077 @opindex mbranch-cost
21078 @item -mbranch-cost=@var{num}
21079 Set the cost of branches to roughly @var{num} ``simple'' instructions.
21080 This cost is only a heuristic and is not guaranteed to produce
21081 consistent results across releases.
21083 @opindex mcmove
21084 @item -mcmove
21085 Enable the generation of conditional moves.
21087 @opindex mnops
21088 @item -mnops=@var{num}
21089 Emit @var{num} NOPs before every other generated instruction.
21091 @opindex mno-soft-cmpsf
21092 @opindex msoft-cmpsf
21093 @item -mno-soft-cmpsf
21094 For single-precision floating-point comparisons, emit an @code{fsub} instruction
21095 and test the flags.  This is faster than a software comparison, but can
21096 get incorrect results in the presence of NaNs, or when two different small
21097 numbers are compared such that their difference is calculated as zero.
21098 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
21099 software comparisons.
21101 @opindex mstack-offset
21102 @item -mstack-offset=@var{num}
21103 Set the offset between the top of the stack and the stack pointer.
21104 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
21105 can be used by leaf functions without stack allocation.
21106 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
21107 Note also that this option changes the ABI; compiling a program with a
21108 different stack offset than the libraries have been compiled with
21109 generally does not work.
21110 This option can be useful if you want to evaluate if a different stack
21111 offset would give you better code, but to actually use a different stack
21112 offset to build working programs, it is recommended to configure the
21113 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
21115 @opindex mno-round-nearest
21116 @opindex mround-nearest
21117 @item -mno-round-nearest
21118 Make the scheduler assume that the rounding mode has been set to
21119 truncating.  The default is @option{-mround-nearest}.
21121 @opindex mlong-calls
21122 @item -mlong-calls
21123 If not otherwise specified by an attribute, assume all calls might be beyond
21124 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
21125 function address into a register before performing a (otherwise direct) call.
21126 This is the default.
21128 @opindex short-calls
21129 @item -mshort-calls
21130 If not otherwise specified by an attribute, assume all direct calls are
21131 in the range of the @code{b} / @code{bl} instructions, so use these instructions
21132 for direct calls.  The default is @option{-mlong-calls}.
21134 @opindex msmall16
21135 @item -msmall16
21136 Assume addresses can be loaded as 16-bit unsigned values.  This does not
21137 apply to function addresses for which @option{-mlong-calls} semantics
21138 are in effect.
21140 @opindex mfp-mode
21141 @item -mfp-mode=@var{mode}
21142 Set the prevailing mode of the floating-point unit.
21143 This determines the floating-point mode that is provided and expected
21144 at function call and return time.  Making this mode match the mode you
21145 predominantly need at function start can make your programs smaller and
21146 faster by avoiding unnecessary mode switches.
21148 @var{mode} can be set to one the following values:
21150 @table @samp
21151 @item caller
21152 Any mode at function entry is valid, and retained or restored when
21153 the function returns, and when it calls other functions.
21154 This mode is useful for compiling libraries or other compilation units
21155 you might want to incorporate into different programs with different
21156 prevailing FPU modes, and the convenience of being able to use a single
21157 object file outweighs the size and speed overhead for any extra
21158 mode switching that might be needed, compared with what would be needed
21159 with a more specific choice of prevailing FPU mode.
21161 @item truncate
21162 This is the mode used for floating-point calculations with
21163 truncating (i.e.@: round towards zero) rounding mode.  That includes
21164 conversion from floating point to integer.
21166 @item round-nearest
21167 This is the mode used for floating-point calculations with
21168 round-to-nearest-or-even rounding mode.
21170 @item int
21171 This is the mode used to perform integer calculations in the FPU, e.g.@:
21172 integer multiply, or integer multiply-and-accumulate.
21173 @end table
21175 The default is @option{-mfp-mode=caller}
21177 @opindex mno-split-lohi
21178 @opindex msplit-lohi
21179 @opindex mno-postinc
21180 @opindex mpostinc
21181 @opindex mno-postmodify
21182 @opindex mpostmodify
21183 @item -mno-split-lohi
21184 @itemx -mno-postinc
21185 @itemx -mno-postmodify
21186 Code generation tweaks that disable, respectively, splitting of 32-bit
21187 loads, generation of post-increment addresses, and generation of
21188 post-modify addresses.  The defaults are @option{msplit-lohi},
21189 @option{-mpost-inc}, and @option{-mpost-modify}.
21191 @opindex mno-vect-double
21192 @opindex mvect-double
21193 @item -mnovect-double
21194 Change the preferred SIMD mode to SImode.  The default is
21195 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
21197 @opindex max-vect-align
21198 @item -max-vect-align=@var{num}
21199 The maximum alignment for SIMD vector mode types.
21200 @var{num} may be 4 or 8.  The default is 8.
21201 Note that this is an ABI change, even though many library function
21202 interfaces are unaffected if they don't use SIMD vector modes
21203 in places that affect size and/or alignment of relevant types.
21205 @opindex msplit-vecmove-early
21206 @item -msplit-vecmove-early
21207 Split vector moves into single word moves before reload.  In theory this
21208 can give better register allocation, but so far the reverse seems to be
21209 generally the case.
21211 @opindex m1reg-
21212 @item -m1reg-@var{reg}
21213 Specify a register to hold the constant @minus{}1, which makes loading small negative
21214 constants and certain bitmasks faster.
21215 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
21216 which specify use of that register as a fixed register,
21217 and @samp{none}, which means that no register is used for this
21218 purpose.  The default is @option{-m1reg-none}.
21220 @end table
21222 @node AMD GCN Options
21223 @subsection AMD GCN Options
21224 @cindex AMD GCN Options
21226 These options are defined specifically for the AMD GCN port.
21228 @table @gcctabopt
21230 @opindex march
21231 @opindex mtune
21232 @item -march=@var{gpu}
21233 @itemx -mtune=@var{gpu}
21234 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
21237 @table @samp
21238 @item fiji
21239 Compile for GCN3 Fiji devices (gfx803).  Support deprecated; availablility
21240 depends on how GCC has been configured, see @option{--with-arch} and
21241 @option{--with-multilib-list}.
21243 @item gfx900
21244 Compile for GCN5 Vega 10 devices (gfx900).
21246 @item gfx906
21247 Compile for GCN5 Vega 20 devices (gfx906).
21249 @item gfx908
21250 Compile for CDNA1 Instinct MI100 series devices (gfx908).
21252 @item gfx90a
21253 Compile for CDNA2 Instinct MI200 series devices (gfx90a).
21255 @end table
21257 @opindex msram-ecc
21258 @item -msram-ecc=on
21259 @itemx -msram-ecc=off
21260 @itemx -msram-ecc=any
21261 Compile binaries suitable for devices with the SRAM-ECC feature enabled,
21262 disabled, or either mode.  This feature can be enabled per-process on some
21263 devices.  The compiled code must match the device mode. The default is
21264 @samp{any}, for devices that support it.
21266 @opindex mstack-size
21267 @item -mstack-size=@var{bytes}
21268 Specify how many @var{bytes} of stack space will be requested for each GPU
21269 thread (wave-front).  Beware that there may be many threads and limited memory
21270 available.  The size of the stack allocation may also have an impact on
21271 run-time performance.  The default is 32KB when using OpenACC or OpenMP, and
21272 1MB otherwise.
21274 @opindex mxnack
21275 @item -mxnack=on
21276 @itemx -mxnack=off
21277 @itemx -mxnack=any
21278 Compile binaries suitable for devices with the XNACK feature enabled, disabled,
21279 or either mode.  Some devices always require XNACK and some allow the user to
21280 configure XNACK.  The compiled code must match the device mode.
21281 @c The default is @samp{-mxnack=any}.
21282 At present this option is a placeholder for support that is not yet implemented.
21284 @end table
21286 @node ARC Options
21287 @subsection ARC Options
21288 @cindex ARC options
21290 The following options control the architecture variant for which code
21291 is being compiled:
21293 @c architecture variants
21294 @table @gcctabopt
21296 @opindex mbarrel-shifter
21297 @item -mbarrel-shifter
21298 Generate instructions supported by barrel shifter.  This is the default
21299 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
21301 @opindex mjli-always
21302 @item -mjli-always
21303 Force to call a function using jli_s instruction.  This option is
21304 valid only for ARCv2 architecture.
21306 @opindex mcpu
21307 @item -mcpu=@var{cpu}
21308 Set architecture type, register usage, and instruction scheduling
21309 parameters for @var{cpu}.  There are also shortcut alias options
21310 available for backward compatibility and convenience.  Supported
21311 values for @var{cpu} are
21313 @table @samp
21314 @opindex mA6
21315 @opindex mARC600
21316 @item arc600
21317 Compile for ARC600.  Aliases: @option{-mA6}, @option{-mARC600}.
21319 @opindex mARC601
21320 @item arc601
21321 Compile for ARC601.  Alias: @option{-mARC601}.
21323 @opindex mA7
21324 @opindex mARC700
21325 @item arc700
21326 Compile for ARC700.  Aliases: @option{-mA7}, @option{-mARC700}.
21327 This is the default when configured with @option{--with-cpu=arc700}@.
21329 @item arcem
21330 Compile for ARC EM.
21332 @item archs
21333 Compile for ARC HS.
21335 @item em
21336 Compile for ARC EM CPU with no hardware extensions.
21338 @item em4
21339 Compile for ARC EM4 CPU.
21341 @item em4_dmips
21342 Compile for ARC EM4 DMIPS CPU.
21344 @item em4_fpus
21345 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
21346 extension.
21348 @item em4_fpuda
21349 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
21350 double assist instructions.
21352 @item hs
21353 Compile for ARC HS CPU with no hardware extensions except the atomic
21354 instructions.
21356 @item hs34
21357 Compile for ARC HS34 CPU.
21359 @item hs38
21360 Compile for ARC HS38 CPU.
21362 @item hs38_linux
21363 Compile for ARC HS38 CPU with all hardware extensions on.
21365 @item hs4x
21366 Compile for ARC HS4x CPU.
21368 @item hs4xd
21369 Compile for ARC HS4xD CPU.
21371 @item hs4x_rel31
21372 Compile for ARC HS4x CPU release 3.10a.
21374 @item arc600_norm
21375 Compile for ARC 600 CPU with @code{norm} instructions enabled.
21377 @item arc600_mul32x16
21378 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply 
21379 instructions enabled.
21381 @item arc600_mul64
21382 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family 
21383 instructions enabled.
21385 @item arc601_norm
21386 Compile for ARC 601 CPU with @code{norm} instructions enabled.
21388 @item arc601_mul32x16
21389 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
21390 instructions enabled.
21392 @item arc601_mul64
21393 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
21394 instructions enabled.
21396 @item nps400
21397 Compile for ARC 700 on NPS400 chip.
21399 @item em_mini
21400 Compile for ARC EM minimalist configuration featuring reduced register
21401 set.
21403 @end table
21405 @opindex mdpfp
21406 @opindex mdpfp-compact
21407 @item -mdpfp
21408 @itemx -mdpfp-compact
21409 Generate double-precision FPX instructions, tuned for the compact
21410 implementation.
21412 @opindex mdpfp-fast
21413 @item -mdpfp-fast
21414 Generate double-precision FPX instructions, tuned for the fast
21415 implementation.
21417 @opindex mno-dpfp-lrsr
21418 @item -mno-dpfp-lrsr
21419 Disable @code{lr} and @code{sr} instructions from using FPX extension
21420 aux registers.
21422 @opindex mea
21423 @item -mea
21424 Generate extended arithmetic instructions.  Currently only
21425 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
21426 supported.  Only valid for @option{-mcpu=ARC700}.
21428 @opindex mno-mpy
21429 @opindex mmpy
21430 @item -mno-mpy
21431 Do not generate @code{mpy}-family instructions for ARC700.  This option is
21432 deprecated.
21434 @opindex mmul32x16
21435 @item -mmul32x16
21436 Generate 32x16-bit multiply and multiply-accumulate instructions.
21438 @opindex mmul64
21439 @item -mmul64
21440 Generate @code{mul64} and @code{mulu64} instructions.  
21441 Only valid for @option{-mcpu=ARC600}.
21443 @opindex mnorm
21444 @item -mnorm
21445 Generate @code{norm} instructions.  This is the default if @option{-mcpu=ARC700}
21446 is in effect.
21448 @opindex mspfp
21449 @opindex mspfp-compact
21450 @item -mspfp
21451 @itemx -mspfp-compact
21452 Generate single-precision FPX instructions, tuned for the compact
21453 implementation.
21455 @opindex mspfp-fast
21456 @item -mspfp-fast
21457 Generate single-precision FPX instructions, tuned for the fast
21458 implementation.
21460 @opindex msimd
21461 @item -msimd
21462 Enable generation of ARC SIMD instructions via target-specific
21463 builtins.  Only valid for @option{-mcpu=ARC700}.
21465 @opindex msoft-float
21466 @item -msoft-float
21467 This option ignored; it is provided for compatibility purposes only.
21468 Software floating-point code is emitted by default, and this default
21469 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
21470 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
21471 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
21473 @opindex mswap
21474 @item -mswap
21475 Generate @code{swap} instructions.
21477 @opindex matomic
21478 @item -matomic
21479 This enables use of the locked load/store conditional extension to implement
21480 atomic memory built-in functions.  Not available for ARC 6xx or ARC
21481 EM cores.
21483 @opindex mdiv-rem
21484 @item -mdiv-rem
21485 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
21487 @opindex mcode-density
21488 @item -mcode-density
21489 Enable code density instructions for ARC EM.  
21490 This option is on by default for ARC HS.
21492 @opindex mll64
21493 @item -mll64
21494 Enable double load/store operations for ARC HS cores.
21496 @opindex mtp-regno
21497 @item -mtp-regno=@var{regno}
21498 Specify thread pointer register number.
21500 @opindex mmpy-option
21501 @item -mmpy-option=@var{multo}
21502 Compile ARCv2 code with a multiplier design option.  You can specify 
21503 the option using either a string or numeric value for @var{multo}.  
21504 @samp{wlh1} is the default value.  The recognized values are:
21506 @table @samp
21507 @item 0
21508 @itemx none
21509 No multiplier available.
21511 @item 1
21512 @itemx w
21513 16x16 multiplier, fully pipelined.
21514 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
21516 @item 2
21517 @itemx wlh1
21518 32x32 multiplier, fully
21519 pipelined (1 stage).  The following instructions are additionally
21520 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21522 @item 3
21523 @itemx wlh2
21524 32x32 multiplier, fully pipelined
21525 (2 stages).  The following instructions are additionally enabled: @code{mpy},
21526 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21528 @item 4
21529 @itemx wlh3
21530 Two 16x16 multipliers, blocking,
21531 sequential.  The following instructions are additionally enabled: @code{mpy},
21532 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21534 @item 5
21535 @itemx wlh4
21536 One 16x16 multiplier, blocking,
21537 sequential.  The following instructions are additionally enabled: @code{mpy},
21538 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21540 @item 6
21541 @itemx wlh5
21542 One 32x4 multiplier, blocking,
21543 sequential.  The following instructions are additionally enabled: @code{mpy},
21544 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21546 @item 7
21547 @itemx plus_dmpy
21548 ARC HS SIMD support.
21550 @item 8
21551 @itemx plus_macd
21552 ARC HS SIMD support.
21554 @item 9
21555 @itemx plus_qmacw
21556 ARC HS SIMD support.
21558 @end table
21560 This option is only available for ARCv2 cores@.
21562 @opindex mfpu
21563 @item -mfpu=@var{fpu}
21564 Enables support for specific floating-point hardware extensions for ARCv2
21565 cores.  Supported values for @var{fpu} are:
21567 @table @samp
21569 @item fpus
21570 Enables support for single-precision floating-point hardware
21571 extensions@.
21573 @item fpud
21574 Enables support for double-precision floating-point hardware
21575 extensions.  The single-precision floating-point extension is also
21576 enabled.  Not available for ARC EM@.
21578 @item fpuda
21579 Enables support for double-precision floating-point hardware
21580 extensions using double-precision assist instructions.  The single-precision
21581 floating-point extension is also enabled.  This option is
21582 only available for ARC EM@.
21584 @item fpuda_div
21585 Enables support for double-precision floating-point hardware
21586 extensions using double-precision assist instructions.
21587 The single-precision floating-point, square-root, and divide 
21588 extensions are also enabled.  This option is
21589 only available for ARC EM@.
21591 @item fpuda_fma
21592 Enables support for double-precision floating-point hardware
21593 extensions using double-precision assist instructions.
21594 The single-precision floating-point and fused multiply and add 
21595 hardware extensions are also enabled.  This option is
21596 only available for ARC EM@.
21598 @item fpuda_all
21599 Enables support for double-precision floating-point hardware
21600 extensions using double-precision assist instructions.
21601 All single-precision floating-point hardware extensions are also
21602 enabled.  This option is only available for ARC EM@.
21604 @item fpus_div
21605 Enables support for single-precision floating-point, square-root and divide 
21606 hardware extensions@.
21608 @item fpud_div
21609 Enables support for double-precision floating-point, square-root and divide 
21610 hardware extensions.  This option
21611 includes option @samp{fpus_div}. Not available for ARC EM@.
21613 @item fpus_fma
21614 Enables support for single-precision floating-point and 
21615 fused multiply and add hardware extensions@.
21617 @item fpud_fma
21618 Enables support for double-precision floating-point and 
21619 fused multiply and add hardware extensions.  This option
21620 includes option @samp{fpus_fma}.  Not available for ARC EM@.
21622 @item fpus_all
21623 Enables support for all single-precision floating-point hardware
21624 extensions@.
21626 @item fpud_all
21627 Enables support for all single- and double-precision floating-point
21628 hardware extensions.  Not available for ARC EM@.
21630 @end table
21632 @opindex mirq-ctrl-saved
21633 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
21634 Specifies general-purposes registers that the processor automatically
21635 saves/restores on interrupt entry and exit.  @var{register-range} is
21636 specified as two registers separated by a dash.  The register range
21637 always starts with @code{r0}, the upper limit is @code{fp} register.
21638 @var{blink} and @var{lp_count} are optional.  This option is only
21639 valid for ARC EM and ARC HS cores.
21641 @opindex mrgf-banked-regs
21642 @item -mrgf-banked-regs=@var{number}
21643 Specifies the number of registers replicated in second register bank
21644 on entry to fast interrupt.  Fast interrupts are interrupts with the
21645 highest priority level P0.  These interrupts save only PC and STATUS32
21646 registers to avoid memory transactions during interrupt entry and exit
21647 sequences.  Use this option when you are using fast interrupts in an
21648 ARC V2 family processor.  Permitted values are 4, 8, 16, and 32.
21650 @opindex mlpc-width
21651 @item -mlpc-width=@var{width}
21652 Specify the width of the @code{lp_count} register.  Valid values for
21653 @var{width} are 8, 16, 20, 24, 28 and 32 bits.  The default width is
21654 fixed to 32 bits.  If the width is less than 32, the compiler does not
21655 attempt to transform loops in your program to use the zero-delay loop
21656 mechanism unless it is known that the @code{lp_count} register can
21657 hold the required loop-counter value.  Depending on the width
21658 specified, the compiler and run-time library might continue to use the
21659 loop mechanism for various needs.  This option defines macro
21660 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
21662 @opindex mrf16
21663 @item -mrf16
21664 This option instructs the compiler to generate code for a 16-entry
21665 register file.  This option defines the @code{__ARC_RF16__}
21666 preprocessor macro.
21668 @opindex mbranch-index
21669 @item -mbranch-index
21670 Enable use of @code{bi} or @code{bih} instructions to implement jump
21671 tables.
21673 @end table
21675 The following options are passed through to the assembler, and also
21676 define preprocessor macro symbols.
21678 @c Flags used by the assembler, but for which we define preprocessor
21679 @c macro symbols as well.
21680 @table @gcctabopt
21681 @opindex mdsp-packa
21682 @item -mdsp-packa
21683 Passed down to the assembler to enable the DSP Pack A extensions.
21684 Also sets the preprocessor symbol @code{__Xdsp_packa}.  This option is
21685 deprecated.
21687 @opindex mdvbf
21688 @item -mdvbf
21689 Passed down to the assembler to enable the dual Viterbi butterfly
21690 extension.  Also sets the preprocessor symbol @code{__Xdvbf}.  This
21691 option is deprecated.
21693 @c ARC700 4.10 extension instruction
21694 @opindex mlock
21695 @item -mlock
21696 Passed down to the assembler to enable the locked load/store
21697 conditional extension.  Also sets the preprocessor symbol
21698 @code{__Xlock}.
21700 @opindex mmac-d16
21701 @item -mmac-d16
21702 Passed down to the assembler.  Also sets the preprocessor symbol
21703 @code{__Xxmac_d16}.  This option is deprecated.
21705 @opindex mmac-24
21706 @item -mmac-24
21707 Passed down to the assembler.  Also sets the preprocessor symbol
21708 @code{__Xxmac_24}.  This option is deprecated.
21710 @c ARC700 4.10 extension instruction
21711 @opindex mrtsc
21712 @item -mrtsc
21713 Passed down to the assembler to enable the 64-bit time-stamp counter
21714 extension instruction.  Also sets the preprocessor symbol
21715 @code{__Xrtsc}.  This option is deprecated.
21717 @c ARC700 4.10 extension instruction
21718 @opindex mswape
21719 @item -mswape
21720 Passed down to the assembler to enable the swap byte ordering
21721 extension instruction.  Also sets the preprocessor symbol
21722 @code{__Xswape}.
21724 @opindex mtelephony
21725 @item -mtelephony
21726 Passed down to the assembler to enable dual- and single-operand
21727 instructions for telephony.  Also sets the preprocessor symbol
21728 @code{__Xtelephony}.  This option is deprecated.
21730 @opindex mxy
21731 @item -mxy
21732 Passed down to the assembler to enable the XY memory extension.  Also
21733 sets the preprocessor symbol @code{__Xxy}.
21735 @end table
21737 The following options control how the assembly code is annotated:
21739 @c Assembly annotation options
21740 @table @gcctabopt
21741 @opindex misize
21742 @item -misize
21743 Annotate assembler instructions with estimated addresses.
21745 @opindex mannotate-align
21746 @item -mannotate-align
21747 Does nothing.  Preserved for backward compatibility.
21749 @end table
21751 The following options are passed through to the linker:
21753 @c options passed through to the linker
21754 @table @gcctabopt
21755 @opindex marclinux
21756 @item -marclinux
21757 Passed through to the linker, to specify use of the @code{arclinux} emulation.
21758 This option is enabled by default in tool chains built for
21759 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
21760 when profiling is not requested.
21762 @opindex marclinux_prof
21763 @item -marclinux_prof
21764 Passed through to the linker, to specify use of the
21765 @code{arclinux_prof} emulation.  This option is enabled by default in
21766 tool chains built for @w{@code{arc-linux-uclibc}} and
21767 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
21769 @end table
21771 The following options control the semantics of generated code:
21773 @c semantically relevant code generation options
21774 @table @gcctabopt
21775 @opindex mlong-calls
21776 @item -mlong-calls
21777 Generate calls as register indirect calls, thus providing access
21778 to the full 32-bit address range.
21780 @opindex mmedium-calls
21781 @item -mmedium-calls
21782 Don't use less than 25-bit addressing range for calls, which is the
21783 offset available for an unconditional branch-and-link
21784 instruction.  Conditional execution of function calls is suppressed, to
21785 allow use of the 25-bit range, rather than the 21-bit range with
21786 conditional branch-and-link.  This is the default for tool chains built
21787 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
21789 @opindex G
21790 @item -G @var{num}
21791 Put definitions of externally-visible data in a small data section if
21792 that data is no bigger than @var{num} bytes.  The default value of
21793 @var{num} is 4 for any ARC configuration, or 8 when we have double
21794 load/store operations.
21796 @opindex mno-sdata
21797 @opindex msdata
21798 @item -mno-sdata
21799 Do not generate sdata references.  This is the default for tool chains
21800 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
21801 targets.
21803 @opindex mvolatile-cache
21804 @item -mvolatile-cache
21805 Use ordinarily cached memory accesses for volatile references.  This is the
21806 default.
21808 @opindex mno-volatile-cache
21809 @opindex mvolatile-cache
21810 @item -mno-volatile-cache
21811 Enable cache bypass for volatile references.
21813 @end table
21815 The following options fine tune code generation:
21816 @c code generation tuning options
21817 @table @gcctabopt
21818 @opindex malign-call
21819 @item -malign-call
21820 Does nothing.  Preserved for backward compatibility.
21822 @opindex mauto-modify-reg
21823 @item -mauto-modify-reg
21824 Enable the use of pre/post modify with register displacement.
21826 @opindex mbbit-peephole
21827 @item -mbbit-peephole
21828 Does nothing.  Preserved for backward compatibility.
21830 @opindex mno-brcc
21831 @item -mno-brcc
21832 This option disables a target-specific pass in @file{arc_reorg} to
21833 generate compare-and-branch (@code{br@var{cc}}) instructions.  
21834 It has no effect on
21835 generation of these instructions driven by the combiner pass.
21837 @opindex mcase-vector-pcrel
21838 @item -mcase-vector-pcrel
21839 Use PC-relative switch case tables to enable case table shortening.
21840 This is the default for @option{-Os}.
21842 @opindex mcompact-casesi
21843 @item -mcompact-casesi
21844 Enable compact @code{casesi} pattern.  This is the default for @option{-Os},
21845 and only available for ARCv1 cores.  This option is deprecated.
21847 @opindex mno-cond-exec
21848 @item -mno-cond-exec
21849 Disable the ARCompact-specific pass to generate conditional 
21850 execution instructions.
21852 Due to delay slot scheduling and interactions between operand numbers,
21853 literal sizes, instruction lengths, and the support for conditional execution,
21854 the target-independent pass to generate conditional execution is often lacking,
21855 so the ARC port has kept a special pass around that tries to find more
21856 conditional execution generation opportunities after register allocation,
21857 branch shortening, and delay slot scheduling have been done.  This pass
21858 generally, but not always, improves performance and code size, at the cost of
21859 extra compilation time, which is why there is an option to switch it off.
21860 If you have a problem with call instructions exceeding their allowable
21861 offset range because they are conditionalized, you should consider using
21862 @option{-mmedium-calls} instead.
21864 @opindex mearly-cbranchsi
21865 @item -mearly-cbranchsi
21866 Enable pre-reload use of the @code{cbranchsi} pattern.
21868 @opindex mexpand-adddi
21869 @item -mexpand-adddi
21870 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
21871 @code{add.f}, @code{adc} etc.  This option is deprecated.
21873 @opindex mindexed-loads
21874 @item -mindexed-loads
21875 Enable the use of indexed loads.  This can be problematic because some
21876 optimizers then assume that indexed stores exist, which is not
21877 the case.
21879 @opindex mlra
21880 @item -mlra
21881 Enable Local Register Allocation.  This is still experimental for ARC,
21882 so by default the compiler uses standard reload
21883 (i.e.@: @option{-mno-lra}).
21885 @opindex mlra-priority-none
21886 @item -mlra-priority-none
21887 Don't indicate any priority for target registers.
21889 @opindex mlra-priority-compact
21890 @item -mlra-priority-compact
21891 Indicate target register priority for r0..r3 / r12..r15.
21893 @opindex mlra-priority-noncompact
21894 @item -mlra-priority-noncompact
21895 Reduce target register priority for r0..r3 / r12..r15.
21897 @opindex mmillicode
21898 @item -mmillicode
21899 When optimizing for size (using @option{-Os}), prologues and epilogues
21900 that have to save or restore a large number of registers are often
21901 shortened by using call to a special function in libgcc; this is
21902 referred to as a @emph{millicode} call.  As these calls can pose
21903 performance issues, and/or cause linking issues when linking in a
21904 nonstandard way, this option is provided to turn on or off millicode
21905 call generation.
21907 @opindex mcode-density-frame
21908 @item -mcode-density-frame
21909 This option enable the compiler to emit @code{enter} and @code{leave}
21910 instructions.  These instructions are only valid for CPUs with
21911 code-density feature.
21913 @opindex mmixed-code
21914 @item -mmixed-code
21915 Does nothing.  Preserved for backward compatibility.
21917 @opindex mq-class
21918 @item -mq-class
21919 Ths option is deprecated.  Enable @samp{q} instruction alternatives.
21920 This is the default for @option{-Os}.
21922 @opindex mRcq
21923 @item -mRcq
21924 Does nothing.  Preserved for backward compatibility.
21926 @opindex mRcw
21927 @item -mRcw
21928 Does nothing.  Preserved for backward compatibility.
21930 @opindex msize-level
21931 @item -msize-level=@var{level}
21932 Fine-tune size optimization with regards to instruction lengths and alignment.
21933 The recognized values for @var{level} are:
21934 @table @samp
21935 @item 0
21936 No size optimization.  This level is deprecated and treated like @samp{1}.
21938 @item 1
21939 Short instructions are used opportunistically.
21941 @item 2
21942 In addition, alignment of loops and of code after barriers are dropped.
21944 @item 3
21945 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
21947 @end table
21949 This defaults to @samp{3} when @option{-Os} is in effect.  Otherwise,
21950 the behavior when this is not set is equivalent to level @samp{1}.
21952 @opindex mtune
21953 @item -mtune=@var{cpu}
21954 Set instruction scheduling parameters for @var{cpu}, overriding any implied
21955 by @option{-mcpu=}.
21957 Supported values for @var{cpu} are
21959 @table @samp
21960 @item ARC600
21961 Tune for ARC600 CPU.
21963 @item ARC601
21964 Tune for ARC601 CPU.
21966 @item ARC700
21967 Tune for ARC700 CPU with standard multiplier block.
21969 @item ARC700-xmac
21970 Tune for ARC700 CPU with XMAC block.
21972 @item ARC725D
21973 Tune for ARC725D CPU.
21975 @item ARC750D
21976 Tune for ARC750D CPU.
21978 @item core3
21979 Tune for ARCv2 core3 type CPU.  This option enable usage of
21980 @code{dbnz} instruction.
21982 @item release31a
21983 Tune for ARC4x release 3.10a.
21985 @end table
21987 @opindex mmultcost
21988 @item -mmultcost=@var{num}
21989 Cost to assume for a multiply instruction, with @samp{4} being equal to a
21990 normal instruction.
21992 @opindex munalign-prob-threshold
21993 @item -munalign-prob-threshold=@var{probability}
21994 Does nothing.  Preserved for backward compatibility.
21996 @end table
21998 The following options are maintained for backward compatibility, but
21999 are now deprecated and will be removed in a future release:
22001 @c Deprecated options
22002 @table @gcctabopt
22004 @opindex margonaut
22005 @item -margonaut
22006 Obsolete FPX.
22008 @opindex mbig-endian
22009 @opindex EB
22010 @item -mbig-endian
22011 @itemx -EB
22012 Compile code for big-endian targets.  Use of these options is now
22013 deprecated.  Big-endian code is supported by configuring GCC to build
22014 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
22015 for which big endian is the default.
22017 @opindex mlittle-endian
22018 @opindex EL
22019 @item -mlittle-endian
22020 @itemx -EL
22021 Compile code for little-endian targets.  Use of these options is now
22022 deprecated.  Little-endian code is supported by configuring GCC to build 
22023 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
22024 for which little endian is the default.
22026 @opindex mbarrel_shifter
22027 @item -mbarrel_shifter
22028 Replaced by @option{-mbarrel-shifter}.
22030 @opindex mdpfp_compact
22031 @item -mdpfp_compact
22032 Replaced by @option{-mdpfp-compact}.
22034 @opindex mdpfp_fast
22035 @item -mdpfp_fast
22036 Replaced by @option{-mdpfp-fast}.
22038 @opindex mdsp_packa
22039 @item -mdsp_packa
22040 Replaced by @option{-mdsp-packa}.
22042 @opindex mEA
22043 @item -mEA
22044 Replaced by @option{-mea}.
22046 @opindex mmac_24
22047 @item -mmac_24
22048 Replaced by @option{-mmac-24}.
22050 @opindex mmac_d16
22051 @item -mmac_d16
22052 Replaced by @option{-mmac-d16}.
22054 @opindex mspfp_compact
22055 @item -mspfp_compact
22056 Replaced by @option{-mspfp-compact}.
22058 @opindex mspfp_fast
22059 @item -mspfp_fast
22060 Replaced by @option{-mspfp-fast}.
22062 @opindex mtune
22063 @item -mtune=@var{cpu}
22064 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
22065 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
22066 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
22068 @opindex multcost
22069 @item -multcost=@var{num}
22070 Replaced by @option{-mmultcost}.
22072 @end table
22074 @node ARM Options
22075 @subsection ARM Options
22076 @cindex ARM options
22078 These @samp{-m} options are defined for the ARM port:
22080 @table @gcctabopt
22081 @opindex mabi
22082 @item -mabi=@var{name}
22083 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
22084 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
22086 @opindex mapcs-frame
22087 @item -mapcs-frame
22088 Generate a stack frame that is compliant with the ARM Procedure Call
22089 Standard for all functions, even if this is not strictly necessary for
22090 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
22091 with this option causes the stack frames not to be generated for
22092 leaf functions.  The default is @option{-mno-apcs-frame}.
22093 This option is deprecated.
22095 @opindex mapcs
22096 @item -mapcs
22097 This is a synonym for @option{-mapcs-frame} and is deprecated.
22099 @ignore
22100 @c not currently implemented
22101 @opindex mapcs-stack-check
22102 @item -mapcs-stack-check
22103 Generate code to check the amount of stack space available upon entry to
22104 every function (that actually uses some stack space).  If there is
22105 insufficient space available then either the function
22106 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
22107 called, depending upon the amount of stack space required.  The runtime
22108 system is required to provide these functions.  The default is
22109 @option{-mno-apcs-stack-check}, since this produces smaller code.
22111 @c not currently implemented
22112 @opindex mapcs-reentrant
22113 @item -mapcs-reentrant
22114 Generate reentrant, position-independent code.  The default is
22115 @option{-mno-apcs-reentrant}.
22116 @end ignore
22118 @opindex mthumb-interwork
22119 @item -mthumb-interwork
22120 Generate code that supports calling between the ARM and Thumb
22121 instruction sets.  Without this option, on pre-v5 architectures, the
22122 two instruction sets cannot be reliably used inside one program.  The
22123 default is @option{-mno-thumb-interwork}, since slightly larger code
22124 is generated when @option{-mthumb-interwork} is specified.  In AAPCS
22125 configurations this option is meaningless.
22127 @opindex mno-sched-prolog
22128 @opindex msched-prolog
22129 @item -mno-sched-prolog
22130 Prevent the reordering of instructions in the function prologue, or the
22131 merging of those instruction with the instructions in the function's
22132 body.  This means that all functions start with a recognizable set
22133 of instructions (or in fact one of a choice from a small set of
22134 different function prologues), and this information can be used to
22135 locate the start of functions inside an executable piece of code.  The
22136 default is @option{-msched-prolog}.
22138 @opindex mfloat-abi
22139 @item -mfloat-abi=@var{name}
22140 Specifies which floating-point ABI to use.  Permissible values
22141 are: @samp{soft}, @samp{softfp} and @samp{hard}.
22143 Specifying @samp{soft} causes GCC to generate output containing
22144 library calls for floating-point operations.
22145 @samp{softfp} allows the generation of code using hardware floating-point
22146 instructions, but still uses the soft-float calling conventions.
22147 @samp{hard} allows generation of floating-point instructions
22148 and uses FPU-specific calling conventions.
22150 The default depends on the specific target configuration.  Note that
22151 the hard-float and soft-float ABIs are not link-compatible; you must
22152 compile your entire program with the same ABI, and link with a
22153 compatible set of libraries.
22155 @opindex mgeneral-regs-only
22156 @item -mgeneral-regs-only
22157 Generate code which uses only the general-purpose registers.  This will prevent
22158 the compiler from using floating-point and Advanced SIMD registers but will not
22159 impose any restrictions on the assembler.
22161 @opindex mlittle-endian
22162 @item -mlittle-endian
22163 Generate code for a processor running in little-endian mode.  This is
22164 the default for all standard configurations.
22166 @opindex mbig-endian
22167 @item -mbig-endian
22168 Generate code for a processor running in big-endian mode; the default is
22169 to compile code for a little-endian processor.
22171 @opindex mbe8
22172 @item -mbe8
22173 @itemx -mbe32
22174 When linking a big-endian image select between BE8 and BE32 formats.
22175 The option has no effect for little-endian images and is ignored.  The
22176 default is dependent on the selected target architecture.  For ARMv6
22177 and later architectures the default is BE8, for older architectures
22178 the default is BE32.  BE32 format has been deprecated by ARM.
22180 @opindex march
22181 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
22182 This specifies the name of the target ARM architecture.  GCC uses this
22183 name to determine what kind of instructions it can emit when generating
22184 assembly code.  This option can be used in conjunction with or instead
22185 of the @option{-mcpu=} option.
22187 Permissible names are:
22188 @samp{armv4t},
22189 @samp{armv5t}, @samp{armv5te},
22190 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
22191 @samp{armv6z}, @samp{armv6zk},
22192 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve}, 
22193 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
22194 @samp{armv8.4-a},
22195 @samp{armv8.5-a},
22196 @samp{armv8.6-a},
22197 @samp{armv9-a},
22198 @samp{armv7-r},
22199 @samp{armv8-r},
22200 @samp{armv6-m}, @samp{armv6s-m},
22201 @samp{armv7-m}, @samp{armv7e-m},
22202 @samp{armv8-m.base}, @samp{armv8-m.main},
22203 @samp{armv8.1-m.main},
22204 @samp{armv9-a},
22205 @samp{iwmmxt} and @samp{iwmmxt2}.
22207 Additionally, the following architectures, which lack support for the
22208 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
22210 Many of the architectures support extensions.  These can be added by
22211 appending @samp{+@var{extension}} to the architecture name.  Extension
22212 options are processed in order and capabilities accumulate.  An extension
22213 will also enable any necessary base extensions
22214 upon which it depends.  For example, the @samp{+crypto} extension
22215 will always enable the @samp{+simd} extension.  The exception to the
22216 additive construction is for extensions that are prefixed with
22217 @samp{+no@dots{}}: these extensions disable the specified option and
22218 any other extensions that may depend on the presence of that
22219 extension.
22221 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
22222 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
22223 entirely disabled by the @samp{+nofp} option that follows it.
22225 Most extension names are generically named, but have an effect that is
22226 dependent upon the architecture to which it is applied.  For example,
22227 the @samp{+simd} option can be applied to both @samp{armv7-a} and
22228 @samp{armv8-a} architectures, but will enable the original ARMv7-A
22229 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
22230 variant for @samp{armv8-a}.
22232 The table below lists the supported extensions for each architecture.
22233 Architectures not mentioned do not support any extensions.
22235 @table @samp
22236 @item armv5te
22237 @itemx armv6
22238 @itemx armv6j
22239 @itemx armv6k
22240 @itemx armv6kz
22241 @itemx armv6t2
22242 @itemx armv6z
22243 @itemx armv6zk
22244 @table @samp
22245 @item +fp
22246 The VFPv2 floating-point instructions.  The extension @samp{+vfpv2} can be
22247 used as an alias for this extension.
22249 @item +nofp
22250 Disable the floating-point instructions.
22251 @end table
22253 @item armv7
22254 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
22255 @table @samp
22256 @item +fp
22257 The VFPv3 floating-point instructions, with 16 double-precision
22258 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
22259 for this extension.  Note that floating-point is not supported by the
22260 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
22261 ARMv7-R architectures.
22263 @item +nofp
22264 Disable the floating-point instructions.
22265 @end table
22267 @item armv7-a
22268 @table @samp
22269 @item +mp
22270 The multiprocessing extension.
22272 @item +sec
22273 The security extension.
22275 @item +fp
22276 The VFPv3 floating-point instructions, with 16 double-precision
22277 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
22278 for this extension.
22280 @item +simd
22281 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
22282 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
22283 for this extension.
22285 @item +vfpv3
22286 The VFPv3 floating-point instructions, with 32 double-precision
22287 registers.
22289 @item +vfpv3-d16-fp16
22290 The VFPv3 floating-point instructions, with 16 double-precision
22291 registers and the half-precision floating-point conversion operations.
22293 @item +vfpv3-fp16
22294 The VFPv3 floating-point instructions, with 32 double-precision
22295 registers and the half-precision floating-point conversion operations.
22297 @item +vfpv4-d16
22298 The VFPv4 floating-point instructions, with 16 double-precision
22299 registers.
22301 @item +vfpv4
22302 The VFPv4 floating-point instructions, with 32 double-precision
22303 registers.
22305 @item +neon-fp16
22306 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
22307 the half-precision floating-point conversion operations.
22309 @item +neon-vfpv4
22310 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
22312 @item +nosimd
22313 Disable the Advanced SIMD instructions (does not disable floating point).
22315 @item +nofp
22316 Disable the floating-point and Advanced SIMD instructions.
22317 @end table
22319 @item armv7ve
22320 The extended version of the ARMv7-A architecture with support for
22321 virtualization.
22322 @table @samp
22323 @item +fp
22324 The VFPv4 floating-point instructions, with 16 double-precision registers.
22325 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
22327 @item +simd
22328 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.  The
22329 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
22331 @item +vfpv3-d16
22332 The VFPv3 floating-point instructions, with 16 double-precision
22333 registers.
22335 @item +vfpv3
22336 The VFPv3 floating-point instructions, with 32 double-precision
22337 registers.
22339 @item +vfpv3-d16-fp16
22340 The VFPv3 floating-point instructions, with 16 double-precision
22341 registers and the half-precision floating-point conversion operations.
22343 @item +vfpv3-fp16
22344 The VFPv3 floating-point instructions, with 32 double-precision
22345 registers and the half-precision floating-point conversion operations.
22347 @item +vfpv4-d16
22348 The VFPv4 floating-point instructions, with 16 double-precision
22349 registers.
22351 @item +vfpv4
22352 The VFPv4 floating-point instructions, with 32 double-precision
22353 registers.
22355 @item +neon
22356 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
22357 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
22359 @item +neon-fp16
22360 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
22361 the half-precision floating-point conversion operations.
22363 @item +nosimd
22364 Disable the Advanced SIMD instructions (does not disable floating point).
22366 @item +nofp
22367 Disable the floating-point and Advanced SIMD instructions.
22368 @end table
22370 @item armv8-a
22371 @table @samp
22372 @item +crc
22373 The Cyclic Redundancy Check (CRC) instructions.
22374 @item +simd
22375 The ARMv8-A Advanced SIMD and floating-point instructions.
22376 @item +crypto
22377 The cryptographic instructions.
22378 @item +nocrypto
22379 Disable the cryptographic instructions.
22380 @item +nofp
22381 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22382 @item +sb
22383 Speculation Barrier Instruction.
22384 @item +predres
22385 Execution and Data Prediction Restriction Instructions.
22386 @end table
22388 @item armv8.1-a
22389 @table @samp
22390 @item +simd
22391 The ARMv8.1-A Advanced SIMD and floating-point instructions.
22393 @item +crypto
22394 The cryptographic instructions.  This also enables the Advanced SIMD and
22395 floating-point instructions.
22397 @item +nocrypto
22398 Disable the cryptographic instructions.
22400 @item +nofp
22401 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22403 @item +sb
22404 Speculation Barrier Instruction.
22406 @item +predres
22407 Execution and Data Prediction Restriction Instructions.
22408 @end table
22410 @item armv8.2-a
22411 @itemx armv8.3-a
22412 @table @samp
22413 @item +fp16
22414 The half-precision floating-point data processing instructions.
22415 This also enables the Advanced SIMD and floating-point instructions.
22417 @item +fp16fml
22418 The half-precision floating-point fmla extension.  This also enables
22419 the half-precision floating-point extension and Advanced SIMD and
22420 floating-point instructions.
22422 @item +simd
22423 The ARMv8.1-A Advanced SIMD and floating-point instructions.
22425 @item +crypto
22426 The cryptographic instructions.  This also enables the Advanced SIMD and
22427 floating-point instructions.
22429 @item +dotprod
22430 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
22432 @item +nocrypto
22433 Disable the cryptographic extension.
22435 @item +nofp
22436 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22438 @item +sb
22439 Speculation Barrier Instruction.
22441 @item +predres
22442 Execution and Data Prediction Restriction Instructions.
22444 @item +i8mm
22445 8-bit Integer Matrix Multiply instructions.
22446 This also enables Advanced SIMD and floating-point instructions.
22448 @item +bf16
22449 Brain half-precision floating-point instructions.
22450 This also enables Advanced SIMD and floating-point instructions.
22451 @end table
22453 @item armv8.4-a
22454 @table @samp
22455 @item +fp16
22456 The half-precision floating-point data processing instructions.
22457 This also enables the Advanced SIMD and floating-point instructions as well
22458 as the Dot Product extension and the half-precision floating-point fmla
22459 extension.
22461 @item +simd
22462 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22463 Dot Product extension.
22465 @item +crypto
22466 The cryptographic instructions.  This also enables the Advanced SIMD and
22467 floating-point instructions as well as the Dot Product extension.
22469 @item +nocrypto
22470 Disable the cryptographic extension.
22472 @item +nofp
22473 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22475 @item +sb
22476 Speculation Barrier Instruction.
22478 @item +predres
22479 Execution and Data Prediction Restriction Instructions.
22481 @item +i8mm
22482 8-bit Integer Matrix Multiply instructions.
22483 This also enables Advanced SIMD and floating-point instructions.
22485 @item +bf16
22486 Brain half-precision floating-point instructions.
22487 This also enables Advanced SIMD and floating-point instructions.
22488 @end table
22490 @item armv8.5-a
22491 @table @samp
22492 @item +fp16
22493 The half-precision floating-point data processing instructions.
22494 This also enables the Advanced SIMD and floating-point instructions as well
22495 as the Dot Product extension and the half-precision floating-point fmla
22496 extension.
22498 @item +simd
22499 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22500 Dot Product extension.
22502 @item +crypto
22503 The cryptographic instructions.  This also enables the Advanced SIMD and
22504 floating-point instructions as well as the Dot Product extension.
22506 @item +nocrypto
22507 Disable the cryptographic extension.
22509 @item +nofp
22510 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22512 @item +i8mm
22513 8-bit Integer Matrix Multiply instructions.
22514 This also enables Advanced SIMD and floating-point instructions.
22516 @item +bf16
22517 Brain half-precision floating-point instructions.
22518 This also enables Advanced SIMD and floating-point instructions.
22519 @end table
22521 @item armv8.6-a
22522 @table @samp
22523 @item +fp16
22524 The half-precision floating-point data processing instructions.
22525 This also enables the Advanced SIMD and floating-point instructions as well
22526 as the Dot Product extension and the half-precision floating-point fmla
22527 extension.
22529 @item +simd
22530 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22531 Dot Product extension.
22533 @item +crypto
22534 The cryptographic instructions.  This also enables the Advanced SIMD and
22535 floating-point instructions as well as the Dot Product extension.
22537 @item +nocrypto
22538 Disable the cryptographic extension.
22540 @item +nofp
22541 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22543 @item +i8mm
22544 8-bit Integer Matrix Multiply instructions.
22545 This also enables Advanced SIMD and floating-point instructions.
22547 @item +bf16
22548 Brain half-precision floating-point instructions.
22549 This also enables Advanced SIMD and floating-point instructions.
22550 @end table
22552 @item armv7-r
22553 @table @samp
22554 @item +fp.sp
22555 The single-precision VFPv3 floating-point instructions.  The extension
22556 @samp{+vfpv3xd} can be used as an alias for this extension.
22558 @item +fp
22559 The VFPv3 floating-point instructions with 16 double-precision registers.
22560 The extension +vfpv3-d16 can be used as an alias for this extension.
22562 @item +vfpv3xd-d16-fp16
22563 The single-precision VFPv3 floating-point instructions with 16 double-precision
22564 registers and the half-precision floating-point conversion operations.
22566 @item +vfpv3-d16-fp16
22567 The VFPv3 floating-point instructions with 16 double-precision
22568 registers and the half-precision floating-point conversion operations.
22570 @item +nofp
22571 Disable the floating-point extension.
22573 @item +idiv
22574 The ARM-state integer division instructions.
22576 @item +noidiv
22577 Disable the ARM-state integer division extension.
22578 @end table
22580 @item armv7e-m
22581 @table @samp
22582 @item +fp
22583 The single-precision VFPv4 floating-point instructions.
22585 @item +fpv5
22586 The single-precision FPv5 floating-point instructions.
22588 @item +fp.dp
22589 The single- and double-precision FPv5 floating-point instructions.
22591 @item +nofp
22592 Disable the floating-point extensions.
22593 @end table
22595 @item  armv8.1-m.main
22596 @table @samp
22598 @item +dsp
22599 The DSP instructions.
22601 @item +mve
22602 The M-Profile Vector Extension (MVE) integer instructions.
22604 @item +mve.fp
22605 The M-Profile Vector Extension (MVE) integer and single precision
22606 floating-point instructions.
22608 @item +fp
22609 The single-precision floating-point instructions.
22611 @item +fp.dp
22612 The single- and double-precision floating-point instructions.
22614 @item +nofp
22615 Disable the floating-point extension.
22617 @item +cdecp0, +cdecp1, ... , +cdecp7
22618 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22619 to the numbers given in the options in the range 0 to 7.
22621 @item +pacbti
22622 Enable the Pointer Authentication and Branch Target Identification Extension.
22623 @end table
22625 @item  armv8-m.main
22626 @table @samp
22627 @item +dsp
22628 The DSP instructions.
22630 @item +nodsp
22631 Disable the DSP extension.
22633 @item +fp
22634 The single-precision floating-point instructions.
22636 @item +fp.dp
22637 The single- and double-precision floating-point instructions.
22639 @item +nofp
22640 Disable the floating-point extension.
22642 @item +cdecp0, +cdecp1, ... , +cdecp7
22643 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22644 to the numbers given in the options in the range 0 to 7.
22645 @end table
22647 @item armv8-r
22648 @table @samp
22649 @item +crc
22650 The Cyclic Redundancy Check (CRC) instructions.
22651 @item +fp.sp
22652 The single-precision FPv5 floating-point instructions.
22653 @item +simd
22654 The ARMv8-A Advanced SIMD and floating-point instructions.
22655 @item +crypto
22656 The cryptographic instructions.
22657 @item +nocrypto
22658 Disable the cryptographic instructions.
22659 @item +nofp
22660 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22661 @end table
22663 @end table
22665 @option{-march=native} causes the compiler to auto-detect the architecture
22666 of the build computer.  At present, this feature is only supported on
22667 GNU/Linux, and not all architectures are recognized.  If the auto-detect
22668 is unsuccessful the option has no effect.
22670 @opindex mtune
22671 @item -mtune=@var{name}
22672 This option specifies the name of the target ARM processor for
22673 which GCC should tune the performance of the code.
22674 For some ARM implementations better performance can be obtained by using
22675 this option.
22676 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
22677 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
22678 @samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810},
22679 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
22680 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
22681 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
22682 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
22683 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
22684 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
22685 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
22686 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
22687 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
22688 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
22689 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
22690 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, @samp{cortex-a710},
22691 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
22692 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus},
22693 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
22694 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
22695 @samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-m85}, @samp{cortex-x1},
22696 @samp{cortex-x1c}, @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
22697 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
22698 @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
22699 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
22700 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{star-mc1},
22701 @samp{xgene1}.
22703 Additionally, this option can specify that GCC should tune the performance
22704 of the code for a big.LITTLE system.  Permissible names are:
22705 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
22706 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22707 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
22708 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
22710 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
22711 performance for a blend of processors within architecture @var{arch}.
22712 The aim is to generate code that run well on the current most popular
22713 processors, balancing between optimizations that benefit some CPUs in the
22714 range, and avoiding performance pitfalls of other CPUs.  The effects of
22715 this option may change in future GCC versions as CPU models come and go.
22717 @option{-mtune} permits the same extension options as @option{-mcpu}, but
22718 the extension options do not affect the tuning of the generated code.
22720 @option{-mtune=native} causes the compiler to auto-detect the CPU
22721 of the build computer.  At present, this feature is only supported on
22722 GNU/Linux, and not all architectures are recognized.  If the auto-detect is
22723 unsuccessful the option has no effect.
22725 @opindex mcpu
22726 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
22727 This specifies the name of the target ARM processor.  GCC uses this name
22728 to derive the name of the target ARM architecture (as if specified
22729 by @option{-march}) and the ARM processor type for which to tune for
22730 performance (as if specified by @option{-mtune}).  Where this option
22731 is used in conjunction with @option{-march} or @option{-mtune},
22732 those options take precedence over the appropriate part of this option.
22734 Many of the supported CPUs implement optional architectural
22735 extensions.  Where this is so the architectural extensions are
22736 normally enabled by default.  If implementations that lack the
22737 extension exist, then the extension syntax can be used to disable
22738 those extensions that have been omitted.  For floating-point and
22739 Advanced SIMD (Neon) instructions, the settings of the options
22740 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
22741 floating-point and Advanced SIMD instructions will only be used if
22742 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
22743 @option{-mfpu} other than @samp{auto} will override the available
22744 floating-point and SIMD extension instructions.
22746 For example, @samp{cortex-a9} can be found in three major
22747 configurations: integer only, with just a floating-point unit or with
22748 floating-point and Advanced SIMD.  The default is to enable all the
22749 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
22750 be used to disable just the SIMD or both the SIMD and floating-point
22751 instructions respectively.
22753 Permissible names for this option are the same as those for
22754 @option{-mtune}.
22756 The following extension options are common to the listed CPUs:
22758 @table @samp
22759 @item +nodsp
22760 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p},
22761 @samp{cortex-m55} and @samp{cortex-m85}. Also disable the M-Profile Vector
22762 Extension (MVE) integer and single precision floating-point instructions on
22763 @samp{cortex-m55} and @samp{cortex-m85}.
22765 @item +nopacbti
22766 Disable the Pointer Authentication and Branch Target Identification Extension
22767 on @samp{cortex-m85}.
22769 @item +nomve
22770 Disable the M-Profile Vector Extension (MVE) integer and single precision
22771 floating-point instructions on @samp{cortex-m55} and @samp{cortex-m85}.
22773 @item +nomve.fp
22774 Disable the M-Profile Vector Extension (MVE) single precision floating-point
22775 instructions on @samp{cortex-m55} and @samp{cortex-m85}.
22777 @item +cdecp0, +cdecp1, ... , +cdecp7
22778 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22779 to the numbers given in the options in the range 0 to 7 on @samp{cortex-m55}.
22781 @item  +nofp
22782 Disables the floating-point instructions on @samp{arm9e},
22783 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
22784 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
22785 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
22786 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p}
22787 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p},
22788 @samp{cortex-m55} and @samp{cortex-m85}.
22789 Disables the floating-point and SIMD instructions on
22790 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
22791 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
22792 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
22793 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
22794 @samp{cortex-a53} and @samp{cortex-a55}.
22796 @item +nofp.dp
22797 Disables the double-precision component of the floating-point instructions
22798 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
22799 @samp{cortex-r52plus} and @samp{cortex-m7}.
22801 @item +nosimd
22802 Disables the SIMD (but not floating-point) instructions on
22803 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
22804 and @samp{cortex-a9}.
22806 @item +crypto
22807 Enables the cryptographic instructions on @samp{cortex-a32},
22808 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
22809 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
22810 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22811 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
22812 @samp{cortex-a75.cortex-a55}.
22813 @end table
22815 Additionally the @samp{generic-armv7-a} pseudo target defaults to
22816 VFPv3 with 16 double-precision registers.  It supports the following
22817 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
22818 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
22819 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
22820 @samp{neon-fp16}, @samp{neon-vfpv4}.  The meanings are the same as for
22821 the extensions to @option{-march=armv7-a}.
22823 @option{-mcpu=generic-@var{arch}} is also permissible, and is
22824 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
22825 See @option{-mtune} for more information.
22827 @option{-mcpu=native} causes the compiler to auto-detect the CPU
22828 of the build computer.  At present, this feature is only supported on
22829 GNU/Linux, and not all architectures are recognized.  If the auto-detect
22830 is unsuccessful the option has no effect.
22832 @opindex mfpu
22833 @item -mfpu=@var{name}
22834 This specifies what floating-point hardware (or hardware emulation) is
22835 available on the target.  Permissible names are: @samp{auto}, @samp{vfpv2},
22836 @samp{vfpv3},
22837 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
22838 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
22839 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
22840 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
22841 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
22842 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
22843 is an alias for @samp{vfpv2}.
22845 The setting @samp{auto} is the default and is special.  It causes the
22846 compiler to select the floating-point and Advanced SIMD instructions
22847 based on the settings of @option{-mcpu} and @option{-march}.
22849 If the selected floating-point hardware includes the NEON extension
22850 (e.g.@: @option{-mfpu=neon}), note that floating-point
22851 operations are not generated by GCC's auto-vectorization pass unless
22852 @option{-funsafe-math-optimizations} is also specified.  This is
22853 because NEON hardware does not fully implement the IEEE 754 standard for
22854 floating-point arithmetic (in particular denormal values are treated as
22855 zero), so the use of NEON instructions may lead to a loss of precision.
22857 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}).
22859 @opindex mfp16-format
22860 @item -mfp16-format=@var{name}
22861 Specify the format of the @code{__fp16} half-precision floating-point type.
22862 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
22863 the default is @samp{none}, in which case the @code{__fp16} type is not
22864 defined.  @xref{Half-Precision}, for more information.
22866 @opindex mstructure-size-boundary
22867 @item -mstructure-size-boundary=@var{n}
22868 The sizes of all structures and unions are rounded up to a multiple
22869 of the number of bits set by this option.  Permissible values are 8, 32
22870 and 64.  The default value varies for different toolchains.  For the COFF
22871 targeted toolchain the default value is 8.  A value of 64 is only allowed
22872 if the underlying ABI supports it.
22874 Specifying a larger number can produce faster, more efficient code, but
22875 can also increase the size of the program.  Different values are potentially
22876 incompatible.  Code compiled with one value cannot necessarily expect to
22877 work with code or libraries compiled with another value, if they exchange
22878 information using structures or unions.
22880 This option is deprecated.
22882 @opindex mabort-on-noreturn
22883 @item -mabort-on-noreturn
22884 Generate a call to the function @code{abort} at the end of a
22885 @code{noreturn} function.  It is executed if the function tries to
22886 return.
22888 @opindex mlong-calls
22889 @opindex mno-long-calls
22890 @item -mlong-calls
22891 @itemx -mno-long-calls
22892 Tells the compiler to perform function calls by first loading the
22893 address of the function into a register and then performing a subroutine
22894 call on this register.  This switch is needed if the target function
22895 lies outside of the 64-megabyte addressing range of the offset-based
22896 version of subroutine call instruction.
22898 Even if this switch is enabled, not all function calls are turned
22899 into long calls.  The heuristic is that static functions, functions
22900 that have the @code{short_call} attribute, functions that are inside
22901 the scope of a @code{#pragma no_long_calls} directive, and functions whose
22902 definitions have already been compiled within the current compilation
22903 unit are not turned into long calls.  The exceptions to this rule are
22904 that weak function definitions, functions with the @code{long_call}
22905 attribute or the @code{section} attribute, and functions that are within
22906 the scope of a @code{#pragma long_calls} directive are always
22907 turned into long calls.
22909 This feature is not enabled by default.  Specifying
22910 @option{-mno-long-calls} restores the default behavior, as does
22911 placing the function calls within the scope of a @code{#pragma
22912 long_calls_off} directive.  Note these switches have no effect on how
22913 the compiler generates code to handle function calls via function
22914 pointers.
22916 @opindex msingle-pic-base
22917 @item -msingle-pic-base
22918 Treat the register used for PIC addressing as read-only, rather than
22919 loading it in the prologue for each function.  The runtime system is
22920 responsible for initializing this register with an appropriate value
22921 before execution begins.
22923 @opindex mpic-register
22924 @item -mpic-register=@var{reg}
22925 Specify the register to be used for PIC addressing.
22926 For standard PIC base case, the default is any suitable register
22927 determined by compiler.  For single PIC base case, the default is
22928 @samp{R9} if target is EABI based or stack-checking is enabled,
22929 otherwise the default is @samp{R10}.
22931 @opindex mpic-data-is-text-relative
22932 @item -mpic-data-is-text-relative
22933 Assume that the displacement between the text and data segments is fixed
22934 at static link time.  This permits using PC-relative addressing
22935 operations to access data known to be in the data segment.  For
22936 non-VxWorks RTP targets, this option is enabled by default.  When
22937 disabled on such targets, it will enable @option{-msingle-pic-base} by
22938 default.
22940 @opindex mpoke-function-name
22941 @item -mpoke-function-name
22942 Write the name of each function into the text section, directly
22943 preceding the function prologue.  The generated code is similar to this:
22945 @smallexample
22946      t0
22947          .ascii "arm_poke_function_name", 0
22948          .align
22949      t1
22950          .word 0xff000000 + (t1 - t0)
22951      arm_poke_function_name
22952          mov     ip, sp
22953          stmfd   sp!, @{fp, ip, lr, pc@}
22954          sub     fp, ip, #4
22955 @end smallexample
22957 When performing a stack backtrace, code can inspect the value of
22958 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
22959 location @code{pc - 12} and the top 8 bits are set, then we know that
22960 there is a function name embedded immediately preceding this location
22961 and has length @code{((pc[-3]) & 0xff000000)}.
22963 @opindex marm
22964 @opindex mthumb
22965 @item -mthumb
22966 @itemx -marm
22968 Select between generating code that executes in ARM and Thumb
22969 states.  The default for most configurations is to generate code
22970 that executes in ARM state, but the default can be changed by
22971 configuring GCC with the @option{--with-mode=}@var{state}
22972 configure option.
22974 You can also override the ARM and Thumb mode for each function
22975 by using the @code{target("thumb")} and @code{target("arm")} function attributes
22976 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
22978 @opindex mflip-thumb
22979 @item -mflip-thumb 
22980 Switch ARM/Thumb modes on alternating functions.
22981 This option is provided for regression testing of mixed Thumb/ARM code
22982 generation, and is not intended for ordinary use in compiling code.
22984 @opindex mtpcs-frame
22985 @item -mtpcs-frame
22986 Generate a stack frame that is compliant with the Thumb Procedure Call
22987 Standard for all non-leaf functions.  (A leaf function is one that does
22988 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
22990 @opindex mtpcs-leaf-frame
22991 @item -mtpcs-leaf-frame
22992 Generate a stack frame that is compliant with the Thumb Procedure Call
22993 Standard for all leaf functions.  (A leaf function is one that does
22994 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
22996 @opindex mcallee-super-interworking
22997 @item -mcallee-super-interworking
22998 Gives all externally visible functions in the file being compiled an ARM
22999 instruction set header which switches to Thumb mode before executing the
23000 rest of the function.  This allows these functions to be called from
23001 non-interworking code.  This option is not valid in AAPCS configurations
23002 because interworking is enabled by default.
23004 @opindex mcaller-super-interworking
23005 @item -mcaller-super-interworking
23006 Allows calls via function pointers (including virtual functions) to
23007 execute correctly regardless of whether the target code has been
23008 compiled for interworking or not.  There is a small overhead in the cost
23009 of executing a function pointer if this option is enabled.  This option
23010 is not valid in AAPCS configurations because interworking is enabled
23011 by default.
23013 @opindex mtp
23014 @item -mtp=@var{name}
23015 Specify the access model for the thread local storage pointer.  The model
23016 @samp{soft} generates calls to @code{__aeabi_read_tp}.  Other accepted
23017 models are @samp{tpidrurw}, @samp{tpidruro} and @samp{tpidrprw} which fetch
23018 the thread pointer from the corresponding system register directly
23019 (supported from the arm6k architecture and later).  These system registers
23020 are accessed through the CP15 co-processor interface and the argument
23021 @samp{cp15} is also accepted as a convenience alias of @samp{tpidruro}.
23022 The argument @samp{auto} uses the best available method for the selected
23023 processor.  The default setting is @samp{auto}.
23025 @opindex mtls-dialect
23026 @item -mtls-dialect=@var{dialect}
23027 Specify the dialect to use for accessing thread local storage.  Two
23028 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}.  The
23029 @samp{gnu} dialect selects the original GNU scheme for supporting
23030 local and global dynamic TLS models.  The @samp{gnu2} dialect
23031 selects the GNU descriptor scheme, which provides better performance
23032 for shared libraries.  The GNU descriptor scheme is compatible with
23033 the original scheme, but does require new assembler, linker and
23034 library support.  Initial and local exec TLS models are unaffected by
23035 this option and always use the original scheme.
23037 @opindex mword-relocations
23038 @item -mword-relocations
23039 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
23040 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
23041 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
23042 is specified. This option conflicts with @option{-mslow-flash-data}.
23044 @opindex mfix-cortex-m3-ldrd
23045 @item -mfix-cortex-m3-ldrd
23046 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
23047 with overlapping destination and base registers are used.  This option avoids
23048 generating these instructions.  This option is enabled by default when
23049 @option{-mcpu=cortex-m3} is specified.
23051 @item -mfix-cortex-a57-aes-1742098
23052 @itemx -mno-fix-cortex-a57-aes-1742098
23053 @itemx -mfix-cortex-a72-aes-1655431
23054 @itemx -mno-fix-cortex-a72-aes-1655431
23055 Enable (disable) mitigation for an erratum on Cortex-A57 and
23056 Cortex-A72 that affects the AES cryptographic instructions.  This
23057 option is enabled by default when either @option{-mcpu=cortex-a57} or
23058 @option{-mcpu=cortex-a72} is specified.
23060 @opindex munaligned-access
23061 @opindex mno-unaligned-access
23062 @item -munaligned-access
23063 @itemx -mno-unaligned-access
23064 Enables (or disables) reading and writing of 16- and 32- bit values
23065 from addresses that are not 16- or 32- bit aligned.  By default
23066 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
23067 ARMv8-M Baseline architectures, and enabled for all other
23068 architectures.  If unaligned access is not enabled then words in packed
23069 data structures are accessed a byte at a time.
23071 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
23072 generated object file to either true or false, depending upon the
23073 setting of this option.  If unaligned access is enabled then the
23074 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
23075 defined.
23077 @opindex mneon-for-64bits
23078 @item -mneon-for-64bits
23079 This option is deprecated and has no effect.
23081 @opindex mslow-flash-data
23082 @item -mslow-flash-data
23083 Assume loading data from flash is slower than fetching instruction.
23084 Therefore literal load is minimized for better performance.
23085 This option is only supported when compiling for ARMv7 M-profile and
23086 off by default. It conflicts with @option{-mword-relocations}.
23088 @opindex masm-syntax-unified
23089 @item -masm-syntax-unified
23090 Assume inline assembler is using unified asm syntax.  The default is
23091 currently off which implies divided syntax.  This option has no impact
23092 on Thumb2. However, this may change in future releases of GCC.
23093 Divided syntax should be considered deprecated.
23095 @opindex mrestrict-it
23096 @item -mrestrict-it
23097 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
23098 IT blocks can only contain a single 16-bit instruction from a select
23099 set of instructions. This option is on by default for ARMv8-A Thumb mode.
23101 @opindex mprint-tune-info
23102 @item -mprint-tune-info
23103 Print CPU tuning information as comment in assembler file.  This is
23104 an option used only for regression testing of the compiler and not
23105 intended for ordinary use in compiling code.  This option is disabled
23106 by default.
23108 @opindex mverbose-cost-dump
23109 @item -mverbose-cost-dump
23110 Enable verbose cost model dumping in the debug dump files.  This option is
23111 provided for use in debugging the compiler.
23113 @opindex mpure-code
23114 @item -mpure-code
23115 Do not allow constant data to be placed in code sections.
23116 Additionally, when compiling for ELF object format give all text sections the
23117 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}.  This option
23118 is only available when generating non-pic code for M-profile targets.
23120 @opindex mcmse
23121 @item -mcmse
23122 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
23123 Development Tools Engineering Specification", which can be found on
23124 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
23126 @opindex mfix-cmse-cve-2021-35465
23127 @item -mfix-cmse-cve-2021-35465
23128 Mitigate against a potential security issue with the @code{VLLDM} instruction
23129 in some M-profile devices when using CMSE (CVE-2021-365465).  This option is
23130 enabled by default when the option @option{-mcpu=} is used with
23131 @code{cortex-m33}, @code{cortex-m35p}, @code{cortex-m55}, @code{cortex-m85}
23132 or @code{star-mc1}. The option @option{-mno-fix-cmse-cve-2021-35465} can be used
23133 to disable the mitigation.
23135 @opindex mstack-protector-guard
23136 @opindex mstack-protector-guard-offset
23137 @item -mstack-protector-guard=@var{guard}
23138 @itemx -mstack-protector-guard-offset=@var{offset}
23139 Generate stack protection code using canary at @var{guard}.  Supported
23140 locations are @samp{global} for a global canary or @samp{tls} for a
23141 canary accessible via the TLS register. The option
23142 @option{-mstack-protector-guard-offset=} is for use with
23143 @option{-fstack-protector-guard=tls} and not for use in user-land code.
23145 @opindex mfdpic
23146 @opindex mno-fdpic
23147 @item -mfdpic
23148 @itemx -mno-fdpic
23149 Select the FDPIC ABI, which uses 64-bit function descriptors to
23150 represent pointers to functions.  When the compiler is configured for
23151 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
23152 and implies @option{-fPIE} if none of the PIC/PIE-related options is
23153 provided.  On other targets, it only enables the FDPIC-specific code
23154 generation features, and the user should explicitly provide the
23155 PIC/PIE-related options as needed.
23157 Note that static linking is not supported because it would still
23158 involve the dynamic linker when the program self-relocates.  If such
23159 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
23161 The opposite @option{-mno-fdpic} option is useful (and required) to
23162 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
23163 toolchain as the one used to build the userland programs.
23165 @opindex mbranch-protection
23166 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}][+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]]
23167 Enable branch protection features (armv8.1-m.main only).
23168 @samp{none} generate code without branch protection or return address
23169 signing.
23170 @samp{standard[+@var{leaf}]} generate code with all branch protection
23171 features enabled at their standard level.
23172 @samp{pac-ret[+@var{leaf}]} generate code with return address signing
23173 set to its standard level, which is to sign all functions that save
23174 the return address to memory.
23175 @samp{leaf} When return address signing is enabled, also sign leaf
23176 functions even if they do not write the return address to memory.
23177 +@samp{bti} Add landing-pad instructions at the permitted targets of
23178 indirect branch instructions.
23180 If the @samp{+pacbti} architecture extension is not enabled, then all
23181 branch protection and return address signing operations are
23182 constrained to use only the instructions defined in the
23183 architectural-NOP space. The generated code will remain
23184 backwards-compatible with earlier versions of the architecture, but
23185 the additional security can be enabled at run time on processors that
23186 support the @samp{PACBTI} extension.
23188 Branch target enforcement using BTI can only be enabled at runtime if
23189 all code in the application has been compiled with at least
23190 @samp{-mbranch-protection=bti}.
23192 Any setting other than @samp{none} is supported only on armv8-m.main
23193 or later.
23195 The default is to generate code without branch protection or return
23196 address signing.
23198 @end table
23200 @node AVR Options
23201 @subsection AVR Options
23202 @cindex AVR Options
23204 These options are defined for AVR implementations:
23206 @table @gcctabopt
23207 @opindex mmcu
23208 @item -mmcu=@var{mcu}
23209 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
23211 The default for this option is@tie{}@samp{avr2}.
23213 GCC supports the following AVR devices and ISAs:
23215 @include avr-mmcu.texi
23217 @opindex mabsdata
23218 @item -mabsdata
23220 Assume that all data in static storage can be accessed by LDS / STS
23221 instructions.  This option has only an effect on reduced Tiny devices like
23222 ATtiny40.  See also the @code{absdata}
23223 @ref{AVR Variable Attributes,variable attribute}.
23225 @opindex maccumulate-args
23226 @item -maccumulate-args
23227 Accumulate outgoing function arguments and acquire/release the needed
23228 stack space for outgoing function arguments once in function
23229 prologue/epilogue.  Without this option, outgoing arguments are pushed
23230 before calling a function and popped afterwards.
23232 Popping the arguments after the function call can be expensive on
23233 AVR so that accumulating the stack space might lead to smaller
23234 executables because arguments need not be removed from the
23235 stack after such a function call.
23237 This option can lead to reduced code size for functions that perform
23238 several calls to functions that get their arguments on the stack like
23239 calls to printf-like functions.
23241 @opindex mbranch-cost
23242 @item -mbranch-cost=@var{cost}
23243 Set the branch costs for conditional branch instructions to
23244 @var{cost}.  Reasonable values for @var{cost} are small, non-negative
23245 integers. The default branch cost is 0.
23247 @opindex mcall-prologues
23248 @item -mcall-prologues
23249 Functions prologues/epilogues are expanded as calls to appropriate
23250 subroutines.  Code size is smaller.
23252 @opindex mdouble
23253 @opindex mlong-double
23254 @item -mdouble=@var{bits}
23255 @itemx -mlong-double=@var{bits}
23256 Set the size (in bits) of the @code{double} or @code{long double} type,
23257 respectively.  Possible values for @var{bits} are 32 and 64.
23258 Whether or not a specific value for @var{bits} is allowed depends on
23259 the @code{--with-double=} and @code{--with-long-double=}
23260 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
23261 and the same applies for the default values of the options.
23263 @opindex mgas-isr-prologues
23264 @item -mgas-isr-prologues
23265 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
23266 instruction supported by GNU Binutils.
23267 If this option is on, the feature can still be disabled for individual
23268 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
23269 function attribute.  This feature is activated per default
23270 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
23271 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
23273 @opindex mint8
23274 @item -mint8
23275 Assume @code{int} to be 8-bit integer.  This affects the sizes of all types: a
23276 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
23277 and @code{long long} is 4 bytes.  Please note that this option does not
23278 conform to the C standards, but it results in smaller code
23279 size.
23281 @opindex mmain-is-OS_task
23282 @item -mmain-is-OS_task
23283 Do not save registers in @code{main}.  The effect is the same like
23284 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
23285 to @code{main}. It is activated per default if optimization is on.
23287 @opindex mn-flash
23288 @item -mn-flash=@var{num}
23289 Assume that the flash memory has a size of 
23290 @var{num} times 64@tie{}KiB.
23292 @opindex mno-interrupts
23293 @item -mno-interrupts
23294 Generated code is not compatible with hardware interrupts.
23295 Code size is smaller.
23297 @opindex mrelax
23298 @item -mrelax
23299 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
23300 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
23301 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
23302 the assembler's command line and the @option{--relax} option to the
23303 linker's command line.
23305 Jump relaxing is performed by the linker because jump offsets are not
23306 known before code is located. Therefore, the assembler code generated by the
23307 compiler is the same, but the instructions in the executable may
23308 differ from instructions in the assembler code.
23310 Relaxing must be turned on if linker stubs are needed, see the
23311 section on @code{EIND} and linker stubs below.
23313 @opindex mrmw
23314 @item -mrmw
23315 Assume that the device supports the Read-Modify-Write
23316 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
23318 @opindex mshort-calls
23319 @item -mshort-calls
23321 Assume that @code{RJMP} and @code{RCALL} can target the whole
23322 program memory.
23324 This option is used internally for multilib selection.  It is
23325 not an optimization option, and you don't need to set it by hand.
23327 @opindex msp8
23328 @item -msp8
23329 Treat the stack pointer register as an 8-bit register,
23330 i.e.@: assume the high byte of the stack pointer is zero.
23331 In general, you don't need to set this option by hand.
23333 This option is used internally by the compiler to select and
23334 build multilibs for architectures @code{avr2} and @code{avr25}.
23335 These architectures mix devices with and without @code{SPH}.
23336 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
23337 the compiler driver adds or removes this option from the compiler
23338 proper's command line, because the compiler then knows if the device
23339 or architecture has an 8-bit stack pointer and thus no @code{SPH}
23340 register or not.
23342 @opindex mstrict-X
23343 @item -mstrict-X
23344 Use address register @code{X} in a way proposed by the hardware.  This means
23345 that @code{X} is only used in indirect, post-increment or
23346 pre-decrement addressing.
23348 Without this option, the @code{X} register may be used in the same way
23349 as @code{Y} or @code{Z} which then is emulated by additional
23350 instructions.  
23351 For example, loading a value with @code{X+const} addressing with a
23352 small non-negative @code{const < 64} to a register @var{Rn} is
23353 performed as
23355 @example
23356 adiw r26, const   ; X += const
23357 ld   @var{Rn}, X        ; @var{Rn} = *X
23358 sbiw r26, const   ; X -= const
23359 @end example
23361 @opindex mtiny-stack
23362 @item -mtiny-stack
23363 Only change the lower 8@tie{}bits of the stack pointer.
23365 @opindex mfract-convert-truncate
23366 @item -mfract-convert-truncate
23367 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
23369 @opindex nodevicelib
23370 @item -nodevicelib
23371 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
23373 @opindex nodevicespecs
23374 @item -nodevicespecs
23375 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
23376 command line.  The user takes responsibility for supplying the sub-processes
23377 like compiler proper, assembler and linker with appropriate command line
23378 options.  This means that the user has to supply her private device specs
23379 file by means of @option{-specs=@var{path-to-specs-file}}.  There is no
23380 more need for option @option{-mmcu=@var{mcu}}.
23382 This option can also serve as a replacement for the older way of
23383 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
23384 which contains a folder named @code{device-specs} which contains a specs file named
23385 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
23387 @opindex Waddr-space-convert
23388 @opindex Wno-addr-space-convert
23389 @item -Waddr-space-convert
23390 Warn about conversions between address spaces in the case where the
23391 resulting address space is not contained in the incoming address space.
23393 @opindex Wmisspelled-isr
23394 @opindex Wno-misspelled-isr
23395 @item -Wmisspelled-isr
23396 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
23397 Enabled by default.
23398 @end table
23400 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
23401 @cindex @code{EIND}
23402 Pointers in the implementation are 16@tie{}bits wide.
23403 The address of a function or label is represented as word address so
23404 that indirect jumps and calls can target any code address in the
23405 range of 64@tie{}Ki words.
23407 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
23408 bytes of program memory space, there is a special function register called
23409 @code{EIND} that serves as most significant part of the target address
23410 when @code{EICALL} or @code{EIJMP} instructions are used.
23412 Indirect jumps and calls on these devices are handled as follows by
23413 the compiler and are subject to some limitations:
23415 @itemize @bullet
23417 @item
23418 The compiler never sets @code{EIND}.
23420 @item
23421 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
23422 instructions or might read @code{EIND} directly in order to emulate an
23423 indirect call/jump by means of a @code{RET} instruction.
23425 @item
23426 The compiler assumes that @code{EIND} never changes during the startup
23427 code or during the application. In particular, @code{EIND} is not
23428 saved/restored in function or interrupt service routine
23429 prologue/epilogue.
23431 @item
23432 For indirect calls to functions and computed goto, the linker
23433 generates @emph{stubs}. Stubs are jump pads sometimes also called
23434 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
23435 The stub contains a direct jump to the desired address.
23437 @item
23438 Linker relaxation must be turned on so that the linker generates
23439 the stubs correctly in all situations. See the compiler option
23440 @option{-mrelax} and the linker option @option{--relax}.
23441 There are corner cases where the linker is supposed to generate stubs
23442 but aborts without relaxation and without a helpful error message.
23444 @item
23445 The default linker script is arranged for code with @code{EIND = 0}.
23446 If code is supposed to work for a setup with @code{EIND != 0}, a custom
23447 linker script has to be used in order to place the sections whose
23448 name start with @code{.trampolines} into the segment where @code{EIND}
23449 points to.
23451 @item
23452 The startup code from libgcc never sets @code{EIND}.
23453 Notice that startup code is a blend of code from libgcc and AVR-LibC.
23454 For the impact of AVR-LibC on @code{EIND}, see the
23455 @w{@uref{https://www.nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
23457 @item
23458 It is legitimate for user-specific startup code to set up @code{EIND}
23459 early, for example by means of initialization code located in
23460 section @code{.init3}. Such code runs prior to general startup code
23461 that initializes RAM and calls constructors, but after the bit
23462 of startup code from AVR-LibC that sets @code{EIND} to the segment
23463 where the vector table is located.
23464 @example
23465 #include <avr/io.h>
23467 static void
23468 __attribute__((section(".init3"),naked,used,no_instrument_function))
23469 init3_set_eind (void)
23471   __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
23472                   "out %i0,r24" :: "n" (&EIND) : "r24","memory");
23474 @end example
23476 @noindent
23477 The @code{__trampolines_start} symbol is defined in the linker script.
23479 @item
23480 Stubs are generated automatically by the linker if
23481 the following two conditions are met:
23482 @itemize @minus
23484 @item The address of a label is taken by means of the @code{gs} modifier
23485 (short for @emph{generate stubs}) like so:
23486 @example
23487 LDI r24, lo8(gs(@var{func}))
23488 LDI r25, hi8(gs(@var{func}))
23489 @end example
23490 @item The final location of that label is in a code segment
23491 @emph{outside} the segment where the stubs are located.
23492 @end itemize
23494 @item
23495 The compiler emits such @code{gs} modifiers for code labels in the
23496 following situations:
23497 @itemize @minus
23498 @item Taking address of a function or code label.
23499 @item Computed goto.
23500 @item If prologue-save function is used, see @option{-mcall-prologues}
23501 command-line option.
23502 @item Switch/case dispatch tables. If you do not want such dispatch
23503 tables you can specify the @option{-fno-jump-tables} command-line option.
23504 @item C and C++ constructors/destructors called during startup/shutdown.
23505 @item If the tools hit a @code{gs()} modifier explained above.
23506 @end itemize
23508 @item
23509 Jumping to non-symbolic addresses like so is @emph{not} supported:
23511 @example
23512 int main (void)
23514     /* Call function at word address 0x2 */
23515     return ((int(*)(void)) 0x2)();
23517 @end example
23519 Instead, a stub has to be set up, i.e.@: the function has to be called
23520 through a symbol (@code{func_4} in the example):
23522 @example
23523 int main (void)
23525     extern int func_4 (void);
23527     /* Call function at byte address 0x4 */
23528     return func_4();
23530 @end example
23532 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
23533 Alternatively, @code{func_4} can be defined in the linker script.
23534 @end itemize
23536 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
23537 @cindex @code{RAMPD}
23538 @cindex @code{RAMPX}
23539 @cindex @code{RAMPY}
23540 @cindex @code{RAMPZ}
23541 Some AVR devices support memories larger than the 64@tie{}KiB range
23542 that can be accessed with 16-bit pointers.  To access memory locations
23543 outside this 64@tie{}KiB range, the content of a @code{RAMP}
23544 register is used as high part of the address:
23545 The @code{X}, @code{Y}, @code{Z} address register is concatenated
23546 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
23547 register, respectively, to get a wide address. Similarly,
23548 @code{RAMPD} is used together with direct addressing.
23550 @itemize
23551 @item
23552 The startup code initializes the @code{RAMP} special function
23553 registers with zero.
23555 @item
23556 If a @ref{AVR Named Address Spaces,named address space} other than
23557 generic or @code{__flash} is used, then @code{RAMPZ} is set
23558 as needed before the operation.
23560 @item
23561 If the device supports RAM larger than 64@tie{}KiB and the compiler
23562 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
23563 is reset to zero after the operation.
23565 @item
23566 If the device comes with a specific @code{RAMP} register, the ISR
23567 prologue/epilogue saves/restores that SFR and initializes it with
23568 zero in case the ISR code might (implicitly) use it.
23570 @item
23571 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
23572 If you use inline assembler to read from locations outside the
23573 16-bit address range and change one of the @code{RAMP} registers,
23574 you must reset it to zero after the access.
23576 @end itemize
23578 @subsubsection AVR Built-in Macros
23580 GCC defines several built-in macros so that the user code can test
23581 for the presence or absence of features.  Almost any of the following
23582 built-in macros are deduced from device capabilities and thus
23583 triggered by the @option{-mmcu=} command-line option.
23585 For even more AVR-specific built-in macros see
23586 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
23588 @table @code
23590 @item __AVR_ARCH__
23591 Build-in macro that resolves to a decimal number that identifies the
23592 architecture and depends on the @option{-mmcu=@var{mcu}} option.
23593 Possible values are:
23595 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
23596 @code{4}, @code{5}, @code{51}, @code{6}
23598 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
23599 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
23601 respectively and
23603 @code{100},
23604 @code{102}, @code{103}, @code{104},
23605 @code{105}, @code{106}, @code{107}
23607 for @var{mcu}=@code{avrtiny},
23608 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
23609 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
23610 If @var{mcu} specifies a device, this built-in macro is set
23611 accordingly. For example, with @option{-mmcu=atmega8} the macro is
23612 defined to @code{4}.
23614 @item __AVR_@var{Device}__
23615 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
23616 the device's name. For example, @option{-mmcu=atmega8} defines the
23617 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
23618 @code{__AVR_ATtiny261A__}, etc.
23620 The built-in macros' names follow
23621 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
23622 the device name as from the AVR user manual. The difference between
23623 @var{Device} in the built-in macro and @var{device} in
23624 @option{-mmcu=@var{device}} is that the latter is always lowercase.
23626 If @var{device} is not a device but only a core architecture like
23627 @samp{avr51}, this macro is not defined.
23629 @item __AVR_DEVICE_NAME__
23630 Setting @option{-mmcu=@var{device}} defines this built-in macro to
23631 the device's name. For example, with @option{-mmcu=atmega8} the macro
23632 is defined to @code{atmega8}.
23634 If @var{device} is not a device but only a core architecture like
23635 @samp{avr51}, this macro is not defined.
23637 @item __AVR_XMEGA__
23638 The device / architecture belongs to the XMEGA family of devices.
23640 @item __AVR_HAVE_ELPM__
23641 The device has the @code{ELPM} instruction.
23643 @item __AVR_HAVE_ELPMX__
23644 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
23645 R@var{n},Z+} instructions.
23647 @item __AVR_HAVE_MOVW__
23648 The device has the @code{MOVW} instruction to perform 16-bit
23649 register-register moves.
23651 @item __AVR_HAVE_LPMX__
23652 The device has the @code{LPM R@var{n},Z} and
23653 @code{LPM R@var{n},Z+} instructions.
23655 @item __AVR_HAVE_MUL__
23656 The device has a hardware multiplier. 
23658 @item __AVR_HAVE_JMP_CALL__
23659 The device has the @code{JMP} and @code{CALL} instructions.
23660 This is the case for devices with more than 8@tie{}KiB of program
23661 memory.
23663 @item __AVR_HAVE_EIJMP_EICALL__
23664 @itemx __AVR_3_BYTE_PC__
23665 The device has the @code{EIJMP} and @code{EICALL} instructions.
23666 This is the case for devices with more than 128@tie{}KiB of program memory.
23667 This also means that the program counter
23668 (PC) is 3@tie{}bytes wide.
23670 @item __AVR_2_BYTE_PC__
23671 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
23672 with up to 128@tie{}KiB of program memory.
23674 @item __AVR_HAVE_8BIT_SP__
23675 @itemx __AVR_HAVE_16BIT_SP__
23676 The stack pointer (SP) register is treated as 8-bit respectively
23677 16-bit register by the compiler.
23678 The definition of these macros is affected by @option{-mtiny-stack}.
23680 @item __AVR_HAVE_SPH__
23681 @itemx __AVR_SP8__
23682 The device has the SPH (high part of stack pointer) special function
23683 register or has an 8-bit stack pointer, respectively.
23684 The definition of these macros is affected by @option{-mmcu=} and
23685 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
23686 by @option{-msp8}.
23688 @item __AVR_HAVE_RAMPD__
23689 @itemx __AVR_HAVE_RAMPX__
23690 @itemx __AVR_HAVE_RAMPY__
23691 @itemx __AVR_HAVE_RAMPZ__
23692 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
23693 @code{RAMPZ} special function register, respectively.
23695 @item __NO_INTERRUPTS__
23696 This macro reflects the @option{-mno-interrupts} command-line option.
23698 @item __AVR_ERRATA_SKIP__
23699 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
23700 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
23701 instructions because of a hardware erratum.  Skip instructions are
23702 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
23703 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
23704 set.
23706 @item __AVR_ISA_RMW__
23707 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
23709 @item __AVR_SFR_OFFSET__=@var{offset}
23710 Instructions that can address I/O special function registers directly
23711 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
23712 address as if addressed by an instruction to access RAM like @code{LD}
23713 or @code{STS}. This offset depends on the device architecture and has
23714 to be subtracted from the RAM address in order to get the
23715 respective I/O@tie{}address.
23717 @item __AVR_SHORT_CALLS__
23718 The @option{-mshort-calls} command line option is set.
23720 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
23721 Some devices support reading from flash memory by means of @code{LD*}
23722 instructions.  The flash memory is seen in the data address space
23723 at an offset of @code{__AVR_PM_BASE_ADDRESS__}.  If this macro
23724 is not defined, this feature is not available.  If defined,
23725 the address space is linear and there is no need to put
23726 @code{.rodata} into RAM.  This is handled by the default linker
23727 description file, and is currently available for
23728 @code{avrtiny} and @code{avrxmega3}.  Even more convenient,
23729 there is no need to use address spaces like @code{__flash} or
23730 features like attribute @code{progmem} and @code{pgm_read_*}.
23732 @item __WITH_AVRLIBC__
23733 The compiler is configured to be used together with AVR-Libc.
23734 See the @option{--with-avrlibc} configure option.
23736 @item __HAVE_DOUBLE_MULTILIB__
23737 Defined if @option{-mdouble=} acts as a multilib option.
23739 @item __HAVE_DOUBLE32__
23740 @itemx __HAVE_DOUBLE64__
23741 Defined if the compiler supports 32-bit double resp. 64-bit double.
23742 The actual layout is specified by option @option{-mdouble=}.
23744 @item __DEFAULT_DOUBLE__
23745 The size in bits of @code{double} if @option{-mdouble=} is not set.
23746 To test the layout of @code{double} in a program, use the built-in
23747 macro @code{__SIZEOF_DOUBLE__}.
23749 @item __HAVE_LONG_DOUBLE32__
23750 @itemx __HAVE_LONG_DOUBLE64__
23751 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
23752 @itemx __DEFAULT_LONG_DOUBLE__
23753 Same as above, but for @code{long double} instead of @code{double}.
23755 @item __WITH_DOUBLE_COMPARISON__
23756 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
23757 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
23758 and is defined to @code{2} or @code{3}.
23760 @item __WITH_LIBF7_LIBGCC__
23761 @itemx __WITH_LIBF7_MATH__
23762 @itemx __WITH_LIBF7_MATH_SYMBOLS__
23763 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
23764 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
23766 @end table
23768 @node Blackfin Options
23769 @subsection Blackfin Options
23770 @cindex Blackfin Options
23772 @table @gcctabopt
23773 @opindex mcpu=
23774 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
23775 Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
23776 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
23777 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
23778 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
23779 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
23780 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
23781 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
23782 @samp{bf561}, @samp{bf592}.
23784 The optional @var{sirevision} specifies the silicon revision of the target
23785 Blackfin processor.  Any workarounds available for the targeted silicon revision
23786 are enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
23787 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
23788 are enabled.  The @code{__SILICON_REVISION__} macro is defined to two
23789 hexadecimal digits representing the major and minor numbers in the silicon
23790 revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
23791 is not defined.  If @var{sirevision} is @samp{any}, the
23792 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
23793 If this optional @var{sirevision} is not used, GCC assumes the latest known
23794 silicon revision of the targeted Blackfin processor.
23796 GCC defines a preprocessor macro for the specified @var{cpu}.
23797 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
23798 provided by libgloss to be linked in if @option{-msim} is not given.
23800 Without this option, @samp{bf532} is used as the processor by default.
23802 Note that support for @samp{bf561} is incomplete.  For @samp{bf561},
23803 only the preprocessor macro is defined.
23805 @opindex msim
23806 @item -msim
23807 Specifies that the program will be run on the simulator.  This causes
23808 the simulator BSP provided by libgloss to be linked in.  This option
23809 has effect only for @samp{bfin-elf} toolchain.
23810 Certain other options, such as @option{-mid-shared-library} and
23811 @option{-mfdpic}, imply @option{-msim}.
23813 @opindex momit-leaf-frame-pointer
23814 @item -momit-leaf-frame-pointer
23815 Don't keep the frame pointer in a register for leaf functions.  This
23816 avoids the instructions to save, set up and restore frame pointers and
23817 makes an extra register available in leaf functions.
23819 @opindex mspecld-anomaly
23820 @item -mspecld-anomaly
23821 When enabled, the compiler ensures that the generated code does not
23822 contain speculative loads after jump instructions. If this option is used,
23823 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
23825 @opindex mno-specld-anomaly
23826 @opindex mspecld-anomaly
23827 @item -mno-specld-anomaly
23828 Don't generate extra code to prevent speculative loads from occurring.
23830 @opindex mcsync-anomaly
23831 @item -mcsync-anomaly
23832 When enabled, the compiler ensures that the generated code does not
23833 contain CSYNC or SSYNC instructions too soon after conditional branches.
23834 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
23836 @opindex mno-csync-anomaly
23837 @opindex mcsync-anomaly
23838 @item -mno-csync-anomaly
23839 Don't generate extra code to prevent CSYNC or SSYNC instructions from
23840 occurring too soon after a conditional branch.
23842 @opindex mlow64k
23843 @item -mlow64k
23844 When enabled, the compiler is free to take advantage of the knowledge that
23845 the entire program fits into the low 64k of memory.
23847 @opindex mno-low64k
23848 @item -mno-low64k
23849 Assume that the program is arbitrarily large.  This is the default.
23851 @opindex mstack-check-l1
23852 @item -mstack-check-l1
23853 Do stack checking using information placed into L1 scratchpad memory by the
23854 uClinux kernel.
23856 @opindex mid-shared-library
23857 @item -mid-shared-library
23858 Generate code that supports shared libraries via the library ID method.
23859 This allows for execute in place and shared libraries in an environment
23860 without virtual memory management.  This option implies @option{-fPIC}.
23861 With a @samp{bfin-elf} target, this option implies @option{-msim}.
23863 @opindex mno-id-shared-library
23864 @opindex mid-shared-library
23865 @item -mno-id-shared-library
23866 Generate code that doesn't assume ID-based shared libraries are being used.
23867 This is the default.
23869 @opindex mleaf-id-shared-library
23870 @item -mleaf-id-shared-library
23871 Generate code that supports shared libraries via the library ID method,
23872 but assumes that this library or executable won't link against any other
23873 ID shared libraries.  That allows the compiler to use faster code for jumps
23874 and calls.
23876 @opindex mno-leaf-id-shared-library
23877 @opindex mleaf-id-shared-library
23878 @item -mno-leaf-id-shared-library
23879 Do not assume that the code being compiled won't link against any ID shared
23880 libraries.  Slower code is generated for jump and call insns.
23882 @opindex mshared-library-id
23883 @item -mshared-library-id=n
23884 Specifies the identification number of the ID-based shared library being
23885 compiled.  Specifying a value of 0 generates more compact code; specifying
23886 other values forces the allocation of that number to the current
23887 library but is no more space- or time-efficient than omitting this option.
23889 @opindex msep-data
23890 @item -msep-data
23891 Generate code that allows the data segment to be located in a different
23892 area of memory from the text segment.  This allows for execute in place in
23893 an environment without virtual memory management by eliminating relocations
23894 against the text section.
23896 @opindex mno-sep-data
23897 @opindex msep-data
23898 @item -mno-sep-data
23899 Generate code that assumes that the data segment follows the text segment.
23900 This is the default.
23902 @opindex mlong-calls
23903 @opindex mno-long-calls
23904 @item -mlong-calls
23905 @itemx -mno-long-calls
23906 Tells the compiler to perform function calls by first loading the
23907 address of the function into a register and then performing a subroutine
23908 call on this register.  This switch is needed if the target function
23909 lies outside of the 24-bit addressing range of the offset-based
23910 version of subroutine call instruction.
23912 This feature is not enabled by default.  Specifying
23913 @option{-mno-long-calls} restores the default behavior.  Note these
23914 switches have no effect on how the compiler generates code to handle
23915 function calls via function pointers.
23917 @opindex mfast-fp
23918 @item -mfast-fp
23919 Link with the fast floating-point library. This library relaxes some of
23920 the IEEE floating-point standard's rules for checking inputs against
23921 Not-a-Number (NAN), in the interest of performance.
23923 @opindex minline-plt
23924 @item -minline-plt
23925 Enable inlining of PLT entries in function calls to functions that are
23926 not known to bind locally.  It has no effect without @option{-mfdpic}.
23928 @opindex mmulticore
23929 @item -mmulticore
23930 Build a standalone application for multicore Blackfin processors. 
23931 This option causes proper start files and link scripts supporting 
23932 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 
23933 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 
23935 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
23936 selects the one-application-per-core programming model.  Without
23937 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
23938 programming model is used. In this model, the main function of Core B
23939 should be named as @code{coreb_main}.
23941 If this option is not used, the single-core application programming
23942 model is used.
23944 @opindex mcorea
23945 @item -mcorea
23946 Build a standalone application for Core A of BF561 when using
23947 the one-application-per-core programming model. Proper start files
23948 and link scripts are used to support Core A, and the macro
23949 @code{__BFIN_COREA} is defined.
23950 This option can only be used in conjunction with @option{-mmulticore}.
23952 @opindex mcoreb
23953 @item -mcoreb
23954 Build a standalone application for Core B of BF561 when using
23955 the one-application-per-core programming model. Proper start files
23956 and link scripts are used to support Core B, and the macro
23957 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
23958 should be used instead of @code{main}. 
23959 This option can only be used in conjunction with @option{-mmulticore}.
23961 @opindex msdram
23962 @item -msdram
23963 Build a standalone application for SDRAM. Proper start files and
23964 link scripts are used to put the application into SDRAM, and the macro
23965 @code{__BFIN_SDRAM} is defined.
23966 The loader should initialize SDRAM before loading the application.
23968 @opindex micplb
23969 @item -micplb
23970 Assume that ICPLBs are enabled at run time.  This has an effect on certain
23971 anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
23972 are enabled; for standalone applications the default is off.
23973 @end table
23975 @node C6X Options
23976 @subsection C6X Options
23977 @cindex C6X Options
23979 @table @gcctabopt
23980 @opindex march
23981 @item -march=@var{name}
23982 This specifies the name of the target architecture.  GCC uses this
23983 name to determine what kind of instructions it can emit when generating
23984 assembly code.  Permissible names are: @samp{c62x},
23985 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
23987 @opindex mbig-endian
23988 @item -mbig-endian
23989 Generate code for a big-endian target.
23991 @opindex mlittle-endian
23992 @item -mlittle-endian
23993 Generate code for a little-endian target.  This is the default.
23995 @opindex msim
23996 @item -msim
23997 Choose startup files and linker script suitable for the simulator.
23999 @opindex msdata=default
24000 @item -msdata=default
24001 Put small global and static data in the @code{.neardata} section,
24002 which is pointed to by register @code{B14}.  Put small uninitialized
24003 global and static data in the @code{.bss} section, which is adjacent
24004 to the @code{.neardata} section.  Put small read-only data into the
24005 @code{.rodata} section.  The corresponding sections used for large
24006 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
24008 @opindex msdata=all
24009 @item -msdata=all
24010 Put all data, not just small objects, into the sections reserved for
24011 small data, and use addressing relative to the @code{B14} register to
24012 access them.
24014 @opindex msdata=none
24015 @item -msdata=none
24016 Make no use of the sections reserved for small data, and use absolute
24017 addresses to access all data.  Put all initialized global and static
24018 data in the @code{.fardata} section, and all uninitialized data in the
24019 @code{.far} section.  Put all constant data into the @code{.const}
24020 section.
24021 @end table
24023 @node CRIS Options
24024 @subsection CRIS Options
24025 @cindex CRIS Options
24027 These options are defined specifically for the CRIS ports.
24029 @table @gcctabopt
24030 @opindex march
24031 @opindex mcpu
24032 @item -march=@var{architecture-type}
24033 @itemx -mcpu=@var{architecture-type}
24034 Generate code for the specified architecture.  The choices for
24035 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
24036 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
24037 Default is @samp{v0}.
24039 @opindex mtune
24040 @item -mtune=@var{architecture-type}
24041 Tune to @var{architecture-type} everything applicable about the generated
24042 code, except for the ABI and the set of available instructions.  The
24043 choices for @var{architecture-type} are the same as for
24044 @option{-march=@var{architecture-type}}.
24046 @opindex mmax-stack-frame
24047 @item -mmax-stack-frame=@var{n}
24048 Warn when the stack frame of a function exceeds @var{n} bytes.
24050 @opindex metrax4
24051 @opindex metrax100
24052 @item -metrax4
24053 @itemx -metrax100
24054 The options @option{-metrax4} and @option{-metrax100} are synonyms for
24055 @option{-march=v3} and @option{-march=v8} respectively.
24057 @opindex mmul-bug-workaround
24058 @opindex mno-mul-bug-workaround
24059 @item -mmul-bug-workaround
24060 @itemx -mno-mul-bug-workaround
24061 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
24062 models where it applies.  This option is disabled by default.
24064 @opindex mpdebug
24065 @item -mpdebug
24066 Enable CRIS-specific verbose debug-related information in the assembly
24067 code.  This option also has the effect of turning off the @samp{#NO_APP}
24068 formatted-code indicator to the assembler at the beginning of the
24069 assembly file.
24071 @opindex mcc-init
24072 @item -mcc-init
24073 Do not use condition-code results from previous instruction; always emit
24074 compare and test instructions before use of condition codes.
24076 @opindex mno-side-effects
24077 @opindex mside-effects
24078 @item -mno-side-effects
24079 Do not emit instructions with side effects in addressing modes other than
24080 post-increment.
24082 @opindex mstack-align
24083 @opindex mno-stack-align
24084 @opindex mdata-align
24085 @opindex mno-data-align
24086 @opindex mconst-align
24087 @opindex mno-const-align
24088 @item -mstack-align
24089 @itemx -mno-stack-align
24090 @itemx -mdata-align
24091 @itemx -mno-data-align
24092 @itemx -mconst-align
24093 @itemx -mno-const-align
24094 These options (@samp{no-} options) arrange (eliminate arrangements) for the
24095 stack frame, individual data and constants to be aligned for the maximum
24096 single data access size for the chosen CPU model.  The default is to
24097 arrange for 32-bit alignment.  ABI details such as structure layout are
24098 not affected by these options.
24100 @opindex m32-bit
24101 @opindex m16-bit
24102 @opindex m8-bit
24103 @item -m32-bit
24104 @itemx -m16-bit
24105 @itemx -m8-bit
24106 Similar to the stack- data- and const-align options above, these options
24107 arrange for stack frame, writable data and constants to all be 32-bit,
24108 16-bit or 8-bit aligned.  The default is 32-bit alignment.
24110 @opindex mno-prologue-epilogue
24111 @opindex mprologue-epilogue
24112 @item -mno-prologue-epilogue
24113 @itemx -mprologue-epilogue
24114 With @option{-mno-prologue-epilogue}, the normal function prologue and
24115 epilogue which set up the stack frame are omitted and no return
24116 instructions or return sequences are generated in the code.  Use this
24117 option only together with visual inspection of the compiled code: no
24118 warnings or errors are generated when call-saved registers must be saved,
24119 or storage for local variables needs to be allocated.
24121 @opindex melf
24122 @item -melf
24123 Legacy no-op option.
24125 @opindex sim
24126 @item -sim
24127 This option arranges
24128 to link with input-output functions from a simulator library.  Code,
24129 initialized data and zero-initialized data are allocated consecutively.
24131 @opindex sim2
24132 @item -sim2
24133 Like @option{-sim}, but pass linker options to locate initialized data at
24134 0x40000000 and zero-initialized data at 0x80000000.
24135 @end table
24137 @node C-SKY Options
24138 @subsection C-SKY Options
24139 @cindex C-SKY Options
24141 GCC supports these options when compiling for C-SKY V2 processors.
24143 @table @gcctabopt
24145 @opindex march=
24146 @item -march=@var{arch}
24147 Specify the C-SKY target architecture.  Valid values for @var{arch} are:
24148 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
24149 The default is @samp{ck810}.
24151 @opindex mcpu=
24152 @item -mcpu=@var{cpu}
24153 Specify the C-SKY target processor.  Valid values for @var{cpu} are:
24154 @samp{ck801}, @samp{ck801t},
24155 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
24156 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
24157 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
24158 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
24159 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
24160 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
24161 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
24162 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
24163 @samp{ck803eftr1}, @samp{ck803efhtr1},
24164 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
24165 @samp{ck803sef}, @samp{ck803seft},
24166 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
24167 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
24168 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
24169 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
24171 @opindex mbig-endian
24172 @opindex EB
24173 @opindex mlittle-endian
24174 @opindex EL
24175 @item -mbig-endian
24176 @itemx -EB
24177 @itemx -mlittle-endian
24178 @itemx -EL
24180 Select big- or little-endian code.  The default is little-endian.
24182 @opindex mfloat-abi
24183 @item -mfloat-abi=@var{name}
24184 Specifies which floating-point ABI to use.  Permissible values
24185 are: @samp{soft}, @samp{softfp} and @samp{hard}.
24187 Specifying @samp{soft} causes GCC to generate output containing
24188 library calls for floating-point operations.
24189 @samp{softfp} allows the generation of code using hardware floating-point
24190 instructions, but still uses the soft-float calling conventions.
24191 @samp{hard} allows generation of floating-point instructions
24192 and uses FPU-specific calling conventions.
24194 The default depends on the specific target configuration.  Note that
24195 the hard-float and soft-float ABIs are not link-compatible; you must
24196 compile your entire program with the same ABI, and link with a
24197 compatible set of libraries.
24199 @opindex mhard-float
24200 @opindex msoft-float
24201 @item -mhard-float
24202 @itemx -msoft-float
24204 Select hardware or software floating-point implementations.
24205 The default is soft float.
24207 @opindex mdouble-float
24208 @item -mdouble-float
24209 @itemx -mno-double-float
24210 When @option{-mhard-float} is in effect, enable generation of
24211 double-precision float instructions.  This is the default except
24212 when compiling for CK803.
24214 @opindex mfdivdu
24215 @item -mfdivdu
24216 @itemx -mno-fdivdu
24217 When @option{-mhard-float} is in effect, enable generation of
24218 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
24219 This is the default except when compiling for CK803.
24221 @opindex mfpu=
24222 @item -mfpu=@var{fpu}
24223 Select the floating-point processor.  This option can only be used with
24224 @option{-mhard-float}.
24225 Values for @var{fpu} are
24226 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
24227 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
24228 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
24230 @opindex melrw
24231 @item -melrw
24232 @itemx -mno-elrw
24233 Enable the extended @code{lrw} instruction.  This option defaults to on
24234 for CK801 and off otherwise.
24236 @opindex mistack
24237 @item -mistack
24238 @itemx -mno-istack
24239 Enable interrupt stack instructions; the default is off.
24241 The @option{-mistack} option is required to handle the
24242 @code{interrupt} and @code{isr} function attributes
24243 (@pxref{C-SKY Function Attributes}).
24245 @opindex mmp
24246 @item -mmp
24247 Enable multiprocessor instructions; the default is off.
24249 @opindex mcp
24250 @item -mcp
24251 Enable coprocessor instructions; the default is off.
24253 @opindex mcache
24254 @item -mcache
24255 Enable coprocessor instructions; the default is off.
24257 @opindex msecurity
24258 @item -msecurity
24259 Enable C-SKY security instructions; the default is off.
24261 @opindex mtrust
24262 @item -mtrust
24263 Enable C-SKY trust instructions; the default is off.
24265 @opindex mdsp
24266 @opindex medsp
24267 @opindex mvdsp
24268 @item -mdsp
24269 @itemx -medsp
24270 @itemx -mvdsp
24271 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
24272 All of these options default to off.
24274 @opindex mdiv
24275 @item -mdiv
24276 @itemx -mno-div
24277 Generate divide instructions.  Default is off.
24279 @opindex msmart
24280 @item -msmart
24281 @itemx -mno-smart
24282 Generate code for Smart Mode, using only registers numbered 0-7 to allow
24283 use of 16-bit instructions.  This option is ignored for CK801 where this
24284 is the required behavior, and it defaults to on for CK802.
24285 For other targets, the default is off.
24287 @opindex mhigh-registers
24288 @item -mhigh-registers
24289 @itemx -mno-high-registers
24290 Generate code using the high registers numbered 16-31.  This option
24291 is not supported on CK801, CK802, or CK803, and is enabled by default
24292 for other processors.
24294 @opindex manchor
24295 @item -manchor
24296 @itemx -mno-anchor
24297 Generate code using global anchor symbol addresses.
24299 @opindex mpushpop
24300 @item -mpushpop
24301 @itemx -mno-pushpop
24302 Generate code using @code{push} and @code{pop} instructions.  This option
24303 defaults to on.
24305 @opindex mmultiple-stld
24306 @item -mmultiple-stld
24307 @itemx -mstm
24308 @itemx -mno-multiple-stld
24309 @itemx -mno-stm
24310 Generate code using @code{stm} and @code{ldm} instructions.  This option
24311 isn't supported on CK801 but is enabled by default on other processors.
24313 @opindex mconstpool
24314 @item -mconstpool
24315 @itemx -mno-constpool
24316 Create constant pools in the compiler instead of deferring it to the
24317 assembler.  This option is the default and required for correct code
24318 generation on CK801 and CK802, and is optional on other processors.
24320 @opindex mstack-size
24321 @item -mstack-size
24322 @item -mno-stack-size
24323 Emit @code{.stack_size} directives for each function in the assembly
24324 output.  This option defaults to off.
24326 @opindex mccrt
24327 @item -mccrt
24328 @itemx -mno-ccrt
24329 Generate code for the C-SKY compiler runtime instead of libgcc.  This
24330 option defaults to off.
24332 @opindex mbranch-cost=
24333 @item -mbranch-cost=@var{n}
24334 Set the branch costs to roughly @code{n} instructions.  The default is 1.
24336 @opindex msched-prolog
24337 @item -msched-prolog
24338 @itemx -mno-sched-prolog
24339 Permit scheduling of function prologue and epilogue sequences.  Using
24340 this option can result in code that is not compliant with the C-SKY V2 ABI
24341 prologue requirements and that cannot be debugged or backtraced.
24342 It is disabled by default.
24344 @opindex msim
24345 @item -msim
24346 Links the library libsemi.a which is in compatible with simulator. Applicable
24347 to ELF compiler only.
24349 @end table
24351 @node Darwin Options
24352 @subsection Darwin Options
24353 @cindex Darwin options
24355 These options are defined for all architectures running the Darwin operating
24356 system.
24358 FSF GCC on Darwin does not create ``fat'' object files; it creates
24359 an object file for the single architecture that GCC was built to
24360 target.  Apple's GCC on Darwin does create ``fat'' files if multiple
24361 @option{-arch} options are used; it does so by running the compiler or
24362 linker multiple times and joining the results together with
24363 @file{lipo}.
24365 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
24366 @samp{i686}) is determined by the flags that specify the ISA
24367 that GCC is targeting, like @option{-mcpu} or @option{-march}.  The
24368 @option{-force_cpusubtype_ALL} option can be used to override this.
24370 The Darwin tools vary in their behavior when presented with an ISA
24371 mismatch.  The assembler, @file{as}, only permits instructions to
24372 be used that are valid for the subtype of the file it is generating,
24373 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
24374 The linker for shared libraries, @file{/usr/bin/libtool}, fails
24375 and prints an error if asked to create a shared library with a less
24376 restrictive subtype than its input files (for instance, trying to put
24377 a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
24378 for executables, @command{ld}, quietly gives the executable the most
24379 restrictive subtype of any of its input files.
24381 @table @gcctabopt
24382 @opindex F
24383 @item -F@var{dir}
24384 Add the framework directory @var{dir} to the head of the list of
24385 directories to be searched for header files.  These directories are
24386 interleaved with those specified by @option{-I} options and are
24387 scanned in a left-to-right order.
24389 A framework directory is a directory with frameworks in it.  A
24390 framework is a directory with a @file{Headers} and/or
24391 @file{PrivateHeaders} directory contained directly in it that ends
24392 in @file{.framework}.  The name of a framework is the name of this
24393 directory excluding the @file{.framework}.  Headers associated with
24394 the framework are found in one of those two directories, with
24395 @file{Headers} being searched first.  A subframework is a framework
24396 directory that is in a framework's @file{Frameworks} directory.
24397 Includes of subframework headers can only appear in a header of a
24398 framework that contains the subframework, or in a sibling subframework
24399 header.  Two subframeworks are siblings if they occur in the same
24400 framework.  A subframework should not have the same name as a
24401 framework; a warning is issued if this is violated.  Currently a
24402 subframework cannot have subframeworks; in the future, the mechanism
24403 may be extended to support this.  The standard frameworks can be found
24404 in @file{/System/Library/Frameworks} and
24405 @file{/Library/Frameworks}.  An example include looks like
24406 @code{#include <Framework/header.h>}, where @file{Framework} denotes
24407 the name of the framework and @file{header.h} is found in the
24408 @file{PrivateHeaders} or @file{Headers} directory.
24410 @opindex iframework
24411 @item -iframework@var{dir}
24412 Like @option{-F} except the directory is a treated as a system
24413 directory.  The main difference between this @option{-iframework} and
24414 @option{-F} is that with @option{-iframework} the compiler does not
24415 warn about constructs contained within header files found via
24416 @var{dir}.  This option is valid only for the C family of languages.
24418 @opindex gused
24419 @item -gused
24420 Emit debugging information for symbols that are used.  For stabs
24421 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
24422 This is by default ON@.
24424 @opindex gfull
24425 @item -gfull
24426 Emit debugging information for all symbols and types.
24428 @opindex fconstant-cfstrings
24429 @item -fconstant-cfstrings
24430 The @option{-fconstant-cfstrings} is an alias for @option{-mconstant-cfstrings}.
24432 @opindex mconstant-cfstrings
24433 @item -mconstant-cfstrings
24434 When the NeXT runtime is being used (the default on these systems), override
24435 any @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"}
24436 literals to be laid out as constant CoreFoundation strings.
24438 @opindex mmacosx-version-min
24439 @item -mmacosx-version-min=@var{version}
24440 The earliest version of MacOS X that this executable will run on is
24441 @var{version}.  Typical values supported for @var{version} include @code{12},
24442 @code{10.12}, and @code{10.5.8}.
24444 If the compiler was built to use the system's headers by default,
24445 then the default for this option is the system version on which the
24446 compiler is running, otherwise the default is to make choices that
24447 are compatible with as many systems and code bases as possible.
24449 @opindex mkernel
24450 @item -mkernel
24451 Enable kernel development mode.  The @option{-mkernel} option sets
24452 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
24453 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
24454 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
24455 applicable.  This mode also sets @option{-mno-altivec},
24456 @option{-msoft-float}, @option{-fno-builtin} and
24457 @option{-mlong-branch} for PowerPC targets.
24459 @opindex mone-byte-bool
24460 @item -mone-byte-bool
24461 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
24462 By default @code{sizeof(bool)} is @code{4} when compiling for
24463 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
24464 option has no effect on x86.
24466 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
24467 to generate code that is not binary compatible with code generated
24468 without that switch.  Using this switch may require recompiling all
24469 other modules in a program, including system libraries.  Use this
24470 switch to conform to a non-default data model.
24472 @opindex mfix-and-continue
24473 @opindex ffix-and-continue
24474 @opindex findirect-data
24475 @item -mfix-and-continue
24476 @itemx -ffix-and-continue
24477 @itemx -findirect-data
24478 Generate code suitable for fast turnaround development, such as to
24479 allow GDB to dynamically load @file{.o} files into already-running
24480 programs.  @option{-findirect-data} and @option{-ffix-and-continue}
24481 are provided for backwards compatibility.
24483 @opindex all_load
24484 @item -all_load
24485 Loads all members of static archive libraries.
24486 See man ld(1) for more information.
24488 @opindex arch_errors_fatal
24489 @item -arch_errors_fatal
24490 Cause the errors having to do with files that have the wrong architecture
24491 to be fatal.
24493 @opindex bind_at_load
24494 @item -bind_at_load
24495 Causes the output file to be marked such that the dynamic linker will
24496 bind all undefined references when the file is loaded or launched.
24498 @opindex bundle
24499 @item -bundle
24500 Produce a Mach-o bundle format file.
24501 See man ld(1) for more information.
24503 @opindex bundle_loader
24504 @item -bundle_loader @var{executable}
24505 This option specifies the @var{executable} that will load the build
24506 output file being linked.  See man ld(1) for more information.
24508 @opindex dynamiclib
24509 @item -dynamiclib
24510 When passed this option, GCC produces a dynamic library instead of
24511 an executable when linking, using the Darwin @file{libtool} command.
24513 @opindex force_cpusubtype_ALL
24514 @item -force_cpusubtype_ALL
24515 This causes GCC's output file to have the @samp{ALL} subtype, instead of
24516 one controlled by the @option{-mcpu} or @option{-march} option.
24518 @opindex nodefaultrpaths
24519 @item -nodefaultrpaths
24520 Do not add default run paths for the compiler library directories to
24521 executables, modules or dynamic libraries. On macOS 10.5 and later,
24522 the embedded runpath is added by default unless the user adds
24523 @option{-nodefaultrpaths} to the link line. Run paths are needed
24524 (and therefore enforced) to build on macOS version 10.11 or later.
24526 @item -allowable_client  @var{client_name}
24527 @itemx -client_name
24528 @itemx -compatibility_version
24529 @itemx -current_version
24530 @itemx -dead_strip
24531 @itemx -dependency-file
24532 @itemx -dylib_file
24533 @itemx -dylinker_install_name
24534 @itemx -dynamic
24535 @itemx -exported_symbols_list
24536 @itemx -filelist
24537 @need 800
24538 @itemx -flat_namespace
24539 @itemx -force_flat_namespace
24540 @itemx -headerpad_max_install_names
24541 @itemx -image_base
24542 @itemx -init
24543 @itemx -install_name
24544 @itemx -keep_private_externs
24545 @itemx -multi_module
24546 @itemx -multiply_defined
24547 @itemx -multiply_defined_unused
24548 @need 800
24549 @itemx -noall_load
24550 @itemx -no_dead_strip_inits_and_terms
24551 @itemx -nofixprebinding
24552 @itemx -nomultidefs
24553 @itemx -noprebind
24554 @itemx -noseglinkedit
24555 @itemx -pagezero_size
24556 @itemx -prebind
24557 @itemx -prebind_all_twolevel_modules
24558 @itemx -private_bundle
24559 @need 800
24560 @itemx -read_only_relocs
24561 @itemx -sectalign
24562 @itemx -sectobjectsymbols
24563 @itemx -whyload
24564 @itemx -seg1addr
24565 @itemx -sectcreate
24566 @itemx -sectobjectsymbols
24567 @itemx -sectorder
24568 @itemx -segaddr
24569 @itemx -segs_read_only_addr
24570 @need 800
24571 @itemx -segs_read_write_addr
24572 @itemx -seg_addr_table
24573 @itemx -seg_addr_table_filename
24574 @itemx -seglinkedit
24575 @itemx -segprot
24576 @itemx -segs_read_only_addr
24577 @itemx -segs_read_write_addr
24578 @itemx -single_module
24579 @itemx -static
24580 @itemx -sub_library
24581 @need 800
24582 @opindex allowable_client
24583 @opindex client_name
24584 @opindex compatibility_version
24585 @opindex current_version
24586 @opindex dead_strip
24587 @opindex dependency-file
24588 @opindex dylib_file
24589 @opindex dylinker_install_name
24590 @opindex dynamic
24591 @opindex exported_symbols_list
24592 @opindex filelist
24593 @opindex flat_namespace
24594 @opindex force_flat_namespace
24595 @opindex headerpad_max_install_names
24596 @opindex image_base
24597 @opindex init
24598 @opindex install_name
24599 @opindex keep_private_externs
24600 @opindex multi_module
24601 @opindex multiply_defined
24602 @opindex multiply_defined_unused
24603 @opindex noall_load
24604 @opindex no_dead_strip_inits_and_terms
24605 @opindex nofixprebinding
24606 @opindex nomultidefs
24607 @opindex noprebind
24608 @opindex noseglinkedit
24609 @opindex pagezero_size
24610 @opindex prebind
24611 @opindex prebind_all_twolevel_modules
24612 @opindex private_bundle
24613 @opindex read_only_relocs
24614 @opindex sectalign
24615 @opindex sectobjectsymbols
24616 @opindex whyload
24617 @opindex seg1addr
24618 @opindex sectcreate
24619 @opindex sectobjectsymbols
24620 @opindex sectorder
24621 @opindex segaddr
24622 @opindex segs_read_only_addr
24623 @opindex segs_read_write_addr
24624 @opindex seg_addr_table
24625 @opindex seg_addr_table_filename
24626 @opindex seglinkedit
24627 @opindex segprot
24628 @opindex segs_read_only_addr
24629 @opindex segs_read_write_addr
24630 @opindex single_module
24631 @opindex static
24632 @opindex sub_library
24633 @opindex sub_umbrella
24634 @opindex twolevel_namespace
24635 @opindex umbrella
24636 @opindex undefined
24637 @opindex unexported_symbols_list
24638 @opindex weak_reference_mismatches
24639 @opindex whatsloaded
24640 @itemx -sub_umbrella
24641 @itemx -twolevel_namespace
24642 @itemx -umbrella
24643 @itemx -undefined
24644 @itemx -unexported_symbols_list
24645 @itemx -weak_reference_mismatches
24646 @itemx -whatsloaded
24647 These options are passed to the Darwin linker.  The Darwin linker man page
24648 describes them in detail.
24649 @end table
24651 @node DEC Alpha Options
24652 @subsection DEC Alpha Options
24654 These @samp{-m} options are defined for the DEC Alpha implementations:
24656 @table @gcctabopt
24657 @opindex mno-soft-float
24658 @opindex msoft-float
24659 @item -mno-soft-float
24660 @itemx -msoft-float
24661 Use (do not use) the hardware floating-point instructions for
24662 floating-point operations.  When @option{-msoft-float} is specified,
24663 functions in @file{libgcc.a} are used to perform floating-point
24664 operations.  Unless they are replaced by routines that emulate the
24665 floating-point operations, or compiled in such a way as to call such
24666 emulations routines, these routines issue floating-point
24667 operations.   If you are compiling for an Alpha without floating-point
24668 operations, you must ensure that the library is built so as not to call
24669 them.
24671 Note that Alpha implementations without floating-point operations are
24672 required to have floating-point registers.
24674 @opindex mfp-reg
24675 @opindex mno-fp-regs
24676 @item -mfp-reg
24677 @itemx -mno-fp-regs
24678 Generate code that uses (does not use) the floating-point register set.
24679 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
24680 register set is not used, floating-point operands are passed in integer
24681 registers as if they were integers and floating-point results are passed
24682 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
24683 so any function with a floating-point argument or return value called by code
24684 compiled with @option{-mno-fp-regs} must also be compiled with that
24685 option.
24687 A typical use of this option is building a kernel that does not use,
24688 and hence need not save and restore, any floating-point registers.
24690 @opindex mieee
24691 @item -mieee
24692 The Alpha architecture implements floating-point hardware optimized for
24693 maximum performance.  It is mostly compliant with the IEEE floating-point
24694 standard.  However, for full compliance, software assistance is
24695 required.  This option generates code fully IEEE-compliant code
24696 @emph{except} that the @var{inexact-flag} is not maintained (see below).
24697 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
24698 defined during compilation.  The resulting code is less efficient but is
24699 able to correctly support denormalized numbers and exceptional IEEE
24700 values such as not-a-number and plus/minus infinity.  Other Alpha
24701 compilers call this option @option{-ieee_with_no_inexact}.
24703 @opindex mieee-with-inexact
24704 @item -mieee-with-inexact
24705 This is like @option{-mieee} except the generated code also maintains
24706 the IEEE @var{inexact-flag}.  Turning on this option causes the
24707 generated code to implement fully-compliant IEEE math.  In addition to
24708 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
24709 macro.  On some Alpha implementations the resulting code may execute
24710 significantly slower than the code generated by default.  Since there is
24711 very little code that depends on the @var{inexact-flag}, you should
24712 normally not specify this option.  Other Alpha compilers call this
24713 option @option{-ieee_with_inexact}.
24715 @opindex mfp-trap-mode
24716 @item -mfp-trap-mode=@var{trap-mode}
24717 This option controls what floating-point related traps are enabled.
24718 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
24719 The trap mode can be set to one of four values:
24721 @table @samp
24722 @item n
24723 This is the default (normal) setting.  The only traps that are enabled
24724 are the ones that cannot be disabled in software (e.g., division by zero
24725 trap).
24727 @item u
24728 In addition to the traps enabled by @samp{n}, underflow traps are enabled
24729 as well.
24731 @item su
24732 Like @samp{u}, but the instructions are marked to be safe for software
24733 completion (see Alpha architecture manual for details).
24735 @item sui
24736 Like @samp{su}, but inexact traps are enabled as well.
24737 @end table
24739 @opindex mfp-rounding-mode
24740 @item -mfp-rounding-mode=@var{rounding-mode}
24741 Selects the IEEE rounding mode.  Other Alpha compilers call this option
24742 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
24745 @table @samp
24746 @item n
24747 Normal IEEE rounding mode.  Floating-point numbers are rounded towards
24748 the nearest machine number or towards the even machine number in case
24749 of a tie.
24751 @item m
24752 Round towards minus infinity.
24754 @item c
24755 Chopped rounding mode.  Floating-point numbers are rounded towards zero.
24757 @item d
24758 Dynamic rounding mode.  A field in the floating-point control register
24759 (@var{fpcr}, see Alpha architecture reference manual) controls the
24760 rounding mode in effect.  The C library initializes this register for
24761 rounding towards plus infinity.  Thus, unless your program modifies the
24762 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
24763 @end table
24765 @opindex mtrap-precision
24766 @item -mtrap-precision=@var{trap-precision}
24767 In the Alpha architecture, floating-point traps are imprecise.  This
24768 means without software assistance it is impossible to recover from a
24769 floating trap and program execution normally needs to be terminated.
24770 GCC can generate code that can assist operating system trap handlers
24771 in determining the exact location that caused a floating-point trap.
24772 Depending on the requirements of an application, different levels of
24773 precisions can be selected:
24775 @table @samp
24776 @item p
24777 Program precision.  This option is the default and means a trap handler
24778 can only identify which program caused a floating-point exception.
24780 @item f
24781 Function precision.  The trap handler can determine the function that
24782 caused a floating-point exception.
24784 @item i
24785 Instruction precision.  The trap handler can determine the exact
24786 instruction that caused a floating-point exception.
24787 @end table
24789 Other Alpha compilers provide the equivalent options called
24790 @option{-scope_safe} and @option{-resumption_safe}.
24792 @opindex mieee-conformant
24793 @item -mieee-conformant
24794 This option marks the generated code as IEEE conformant.  You must not
24795 use this option unless you also specify @option{-mtrap-precision=i} and either
24796 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
24797 is to emit the line @samp{.eflag 48} in the function prologue of the
24798 generated assembly file.
24800 @opindex mbuild-constants
24801 @item -mbuild-constants
24802 Normally GCC examines a 32- or 64-bit integer constant to
24803 see if it can construct it from smaller constants in two or three
24804 instructions.  If it cannot, it outputs the constant as a literal and
24805 generates code to load it from the data segment at run time.
24807 Use this option to require GCC to construct @emph{all} integer constants
24808 using code, even if it takes more instructions (the maximum is six).
24810 You typically use this option to build a shared library dynamic
24811 loader.  Itself a shared library, it must relocate itself in memory
24812 before it can find the variables and constants in its own data segment.
24814 @opindex mbwx
24815 @opindex mno-bwx
24816 @opindex mcix
24817 @opindex mno-cix
24818 @opindex mfix
24819 @opindex mno-fix
24820 @opindex mmax
24821 @opindex mno-max
24822 @item -mbwx
24823 @itemx -mno-bwx
24824 @itemx -mcix
24825 @itemx -mno-cix
24826 @itemx -mfix
24827 @itemx -mno-fix
24828 @itemx -mmax
24829 @itemx -mno-max
24830 Indicate whether GCC should generate code to use the optional BWX,
24831 CIX, FIX and MAX instruction sets.  The default is to use the instruction
24832 sets supported by the CPU type specified via @option{-mcpu=} option or that
24833 of the CPU on which GCC was built if none is specified.
24835 @opindex mfloat-vax
24836 @opindex mfloat-ieee
24837 @item -mfloat-vax
24838 @itemx -mfloat-ieee
24839 Generate code that uses (does not use) VAX F and G floating-point
24840 arithmetic instead of IEEE single and double precision.
24842 @opindex mexplicit-relocs
24843 @opindex mno-explicit-relocs
24844 @item -mexplicit-relocs
24845 @itemx -mno-explicit-relocs
24846 Older Alpha assemblers provided no way to generate symbol relocations
24847 except via assembler macros.  Use of these macros does not allow
24848 optimal instruction scheduling.  GNU binutils as of version 2.12
24849 supports a new syntax that allows the compiler to explicitly mark
24850 which relocations should apply to which instructions.  This option
24851 is mostly useful for debugging, as GCC detects the capabilities of
24852 the assembler when it is built and sets the default accordingly.
24854 @opindex msmall-data
24855 @opindex mlarge-data
24856 @item -msmall-data
24857 @itemx -mlarge-data
24858 When @option{-mexplicit-relocs} is in effect, static data is
24859 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
24860 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
24861 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
24862 16-bit relocations off of the @code{$gp} register.  This limits the
24863 size of the small data area to 64KB, but allows the variables to be
24864 directly accessed via a single instruction.
24866 The default is @option{-mlarge-data}.  With this option the data area
24867 is limited to just below 2GB@.  Programs that require more than 2GB of
24868 data must use @code{malloc} or @code{mmap} to allocate the data in the
24869 heap instead of in the program's data segment.
24871 When generating code for shared libraries, @option{-fpic} implies
24872 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
24874 @opindex msmall-text
24875 @opindex mlarge-text
24876 @item -msmall-text
24877 @itemx -mlarge-text
24878 When @option{-msmall-text} is used, the compiler assumes that the
24879 code of the entire program (or shared library) fits in 4MB, and is
24880 thus reachable with a branch instruction.  When @option{-msmall-data}
24881 is used, the compiler can assume that all local symbols share the
24882 same @code{$gp} value, and thus reduce the number of instructions
24883 required for a function call from 4 to 1.
24885 The default is @option{-mlarge-text}.
24887 @opindex mcpu
24888 @item -mcpu=@var{cpu_type}
24889 Set the instruction set and instruction scheduling parameters for
24890 machine type @var{cpu_type}.  You can specify either the @samp{EV}
24891 style name or the corresponding chip number.  GCC supports scheduling
24892 parameters for the EV4, EV5 and EV6 family of processors and
24893 chooses the default values for the instruction set from the processor
24894 you specify.  If you do not specify a processor type, GCC defaults
24895 to the processor on which the compiler was built.
24897 Supported values for @var{cpu_type} are
24899 @table @samp
24900 @item ev4
24901 @itemx ev45
24902 @itemx 21064
24903 Schedules as an EV4 and has no instruction set extensions.
24905 @item ev5
24906 @itemx 21164
24907 Schedules as an EV5 and has no instruction set extensions.
24909 @item ev56
24910 @itemx 21164a
24911 Schedules as an EV5 and supports the BWX extension.
24913 @item pca56
24914 @itemx 21164pc
24915 @itemx 21164PC
24916 Schedules as an EV5 and supports the BWX and MAX extensions.
24918 @item ev6
24919 @itemx 21264
24920 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
24922 @item ev67
24923 @itemx 21264a
24924 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
24925 @end table
24927 Native toolchains also support the value @samp{native},
24928 which selects the best architecture option for the host processor.
24929 @option{-mcpu=native} has no effect if GCC does not recognize
24930 the processor.
24932 @opindex mtune
24933 @item -mtune=@var{cpu_type}
24934 Set only the instruction scheduling parameters for machine type
24935 @var{cpu_type}.  The instruction set is not changed.
24937 Native toolchains also support the value @samp{native},
24938 which selects the best architecture option for the host processor.
24939 @option{-mtune=native} has no effect if GCC does not recognize
24940 the processor.
24942 @opindex mmemory-latency
24943 @item -mmemory-latency=@var{time}
24944 Sets the latency the scheduler should assume for typical memory
24945 references as seen by the application.  This number is highly
24946 dependent on the memory access patterns used by the application
24947 and the size of the external cache on the machine.
24949 Valid options for @var{time} are
24951 @table @samp
24952 @item @var{number}
24953 A decimal number representing clock cycles.
24955 @item L1
24956 @itemx L2
24957 @itemx L3
24958 @itemx main
24959 The compiler contains estimates of the number of clock cycles for
24960 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
24961 (also called Dcache, Scache, and Bcache), as well as to main memory.
24962 Note that L3 is only valid for EV5.
24964 @end table
24965 @end table
24967 @node eBPF Options
24968 @subsection eBPF Options
24969 @cindex eBPF Options
24971 @table @gcctabopt
24972 @item -mframe-limit=@var{bytes}
24973 This specifies the hard limit for frame sizes, in bytes.  Currently,
24974 the value that can be specified should be less than or equal to
24975 @samp{32767}.  Defaults to whatever limit is imposed by the version of
24976 the Linux kernel targeted.
24978 @opindex mbig-endian
24979 @item -mbig-endian
24980 Generate code for a big-endian target.
24982 @opindex mlittle-endian
24983 @item -mlittle-endian
24984 Generate code for a little-endian target.  This is the default.
24986 @opindex mjmpext
24987 @item -mjmpext
24988 @itemx -mno-jmpext
24989 Enable or disable generation of extra conditional-branch instructions.
24990 Enabled for CPU v2 and above.
24992 @opindex mjmp32
24993 @item -mjmp32
24994 @itemx -mno-jmp32
24995 Enable or disable generation of 32-bit jump instructions.
24996 Enabled for CPU v3 and above.
24998 @opindex malu32
24999 @item -malu32
25000 @itemx -mno-alu32
25001 Enable or disable generation of 32-bit ALU instructions.
25002 Enabled for CPU v3 and above.
25004 @opindex mv3-atomics
25005 @item -mv3-atomics
25006 @itemx -mno-v3-atomics
25007 Enable or disable instructions for general atomic operations introduced
25008 in CPU v3.  Enabled for CPU v3 and above.
25010 @opindex mbswap
25011 @item -mbswap
25012 @itemx -mno-bswap
25013 Enable or disable byte swap instructions.  Enabled for CPU v4 and above.
25015 @opindex msdiv
25016 @item -msdiv
25017 @itemx -mno-sdiv
25018 Enable or disable signed division and modulus instructions.  Enabled for
25019 CPU v4 and above.
25021 @opindex msmov
25022 @item -msmov
25023 @itemx -mno-smov
25024 Enable or disable sign-extending move and memory load instructions.
25025 Enabled for CPU v4 and above.
25027 @opindex mcpu
25028 @item -mcpu=@var{version}
25029 This specifies which version of the eBPF ISA to target. Newer versions
25030 may not be supported by all kernels. The default is @samp{v4}.
25032 Supported values for @var{version} are:
25034 @table @samp
25035 @item v1
25036 The first stable eBPF ISA with no special features or extensions.
25038 @item v2
25039 Supports the jump extensions, as in @option{-mjmpext}.
25041 @item v3
25042 All features of v2, plus:
25043 @itemize @minus
25044 @item 32-bit jump operations, as in @option{-mjmp32}
25045 @item 32-bit ALU operations, as in @option{-malu32}
25046 @item general atomic operations, as in @option{-mv3-atomics}
25047 @end itemize
25049 @item v4
25050 All features of v3, plus:
25051 @itemize @minus
25052 @item Byte swap instructions, as in @option{-mbswap}
25053 @item Signed division and modulus instructions, as in @option{-msdiv}
25054 @item Sign-extending move and memory load instructions, as in @option{-msmov}
25055 @end itemize
25056 @end table
25058 @opindex mco-re
25059 @item -mco-re
25060 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and
25061 is implied by @option{-gbtf}.
25063 @opindex mno-co-re
25064 @item -mno-co-re
25065 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE
25066 support is enabled by default when generating BTF debug information for
25067 the BPF target.
25069 @item -mxbpf
25070 Generate code for an expanded version of BPF, which relaxes some of
25071 the restrictions imposed by the BPF architecture:
25072 @itemize @minus
25073 @item Save and restore callee-saved registers at function entry and
25074 exit, respectively.
25075 @end itemize
25077 @opindex masm=@var{dialect}
25078 @item -masm=@var{dialect}
25079 Outputs assembly instructions using eBPF selected @var{dialect}.  The default
25080 is @samp{normal}.
25082 Supported values for @var{dialect} are:
25084 @table @samp
25085 @item normal
25086 Outputs normal assembly dialect.
25088 @item pseudoc
25089 Outputs pseudo-c assembly dialect.
25091 @end table
25093 @end table
25095 @node FR30 Options
25096 @subsection FR30 Options
25097 @cindex FR30 Options
25099 These options are defined specifically for the FR30 port.
25101 @table @gcctabopt
25103 @opindex msmall-model
25104 @item -msmall-model
25105 Use the small address space model.  This can produce smaller code, but
25106 it does assume that all symbolic values and addresses fit into a
25107 20-bit range.
25109 @opindex mno-lsim
25110 @item -mno-lsim
25111 Assume that runtime support has been provided and so there is no need
25112 to include the simulator library (@file{libsim.a}) on the linker
25113 command line.
25115 @end table
25117 @node FT32 Options
25118 @subsection FT32 Options
25119 @cindex FT32 Options
25121 These options are defined specifically for the FT32 port.
25123 @table @gcctabopt
25125 @opindex msim
25126 @item -msim
25127 Specifies that the program will be run on the simulator.  This causes
25128 an alternate runtime startup and library to be linked.
25129 You must not use this option when generating programs that will run on
25130 real hardware; you must provide your own runtime library for whatever
25131 I/O functions are needed.
25133 @opindex mlra
25134 @item -mlra
25135 Enable Local Register Allocation.  This is still experimental for FT32,
25136 so by default the compiler uses standard reload.
25138 @opindex mnodiv
25139 @item -mnodiv
25140 Do not use div and mod instructions.
25142 @opindex mft32b
25143 @item -mft32b
25144 Enable use of the extended instructions of the FT32B processor.
25146 @opindex mcompress
25147 @item -mcompress
25148 Compress all code using the Ft32B code compression scheme.
25150 @opindex  mnopm
25151 @item -mnopm
25152 Do not generate code that reads program memory.
25154 @end table
25156 @node FRV Options
25157 @subsection FRV Options
25158 @cindex FRV Options
25160 @table @gcctabopt
25161 @opindex mgpr-32
25162 @item -mgpr-32
25164 Only use the first 32 general-purpose registers.
25166 @opindex mgpr-64
25167 @item -mgpr-64
25169 Use all 64 general-purpose registers.
25171 @opindex mfpr-32
25172 @item -mfpr-32
25174 Use only the first 32 floating-point registers.
25176 @opindex mfpr-64
25177 @item -mfpr-64
25179 Use all 64 floating-point registers.
25181 @opindex mhard-float
25182 @item -mhard-float
25184 Use hardware instructions for floating-point operations.
25186 @opindex msoft-float
25187 @item -msoft-float
25189 Use library routines for floating-point operations.
25191 @opindex malloc-cc
25192 @item -malloc-cc
25194 Dynamically allocate condition code registers.
25196 @opindex mfixed-cc
25197 @item -mfixed-cc
25199 Do not try to dynamically allocate condition code registers, only
25200 use @code{icc0} and @code{fcc0}.
25202 @opindex mdword
25203 @item -mdword
25205 Change ABI to use double word insns.
25207 @opindex mno-dword
25208 @opindex mdword
25209 @item -mno-dword
25211 Do not use double word instructions.
25213 @opindex mdouble
25214 @item -mdouble
25216 Use floating-point double instructions.
25218 @opindex mno-double
25219 @item -mno-double
25221 Do not use floating-point double instructions.
25223 @opindex mmedia
25224 @item -mmedia
25226 Use media instructions.
25228 @opindex mno-media
25229 @item -mno-media
25231 Do not use media instructions.
25233 @opindex mmuladd
25234 @item -mmuladd
25236 Use multiply and add/subtract instructions.
25238 @opindex mno-muladd
25239 @item -mno-muladd
25241 Do not use multiply and add/subtract instructions.
25243 @opindex mfdpic
25244 @item -mfdpic
25246 Select the FDPIC ABI, which uses function descriptors to represent
25247 pointers to functions.  Without any PIC/PIE-related options, it
25248 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
25249 assumes GOT entries and small data are within a 12-bit range from the
25250 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
25251 are computed with 32 bits.
25252 With a @samp{bfin-elf} target, this option implies @option{-msim}.
25254 @opindex minline-plt
25255 @item -minline-plt
25257 Enable inlining of PLT entries in function calls to functions that are
25258 not known to bind locally.  It has no effect without @option{-mfdpic}.
25259 It's enabled by default if optimizing for speed and compiling for
25260 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
25261 optimization option such as @option{-O3} or above is present in the
25262 command line.
25264 @opindex mTLS
25265 @item -mTLS
25267 Assume a large TLS segment when generating thread-local code.
25269 @opindex mtls
25270 @item -mtls
25272 Do not assume a large TLS segment when generating thread-local code.
25274 @opindex mgprel-ro
25275 @item -mgprel-ro
25277 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
25278 that is known to be in read-only sections.  It's enabled by default,
25279 except for @option{-fpic} or @option{-fpie}: even though it may help
25280 make the global offset table smaller, it trades 1 instruction for 4.
25281 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
25282 one of which may be shared by multiple symbols, and it avoids the need
25283 for a GOT entry for the referenced symbol, so it's more likely to be a
25284 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
25286 @opindex multilib-library-pic
25287 @item -multilib-library-pic
25289 Link with the (library, not FD) pic libraries.  It's implied by
25290 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
25291 @option{-fpic} without @option{-mfdpic}.  You should never have to use
25292 it explicitly.
25294 @opindex mlinked-fp
25295 @item -mlinked-fp
25297 Follow the EABI requirement of always creating a frame pointer whenever
25298 a stack frame is allocated.  This option is enabled by default and can
25299 be disabled with @option{-mno-linked-fp}.
25301 @opindex mlong-calls
25302 @item -mlong-calls
25304 Use indirect addressing to call functions outside the current
25305 compilation unit.  This allows the functions to be placed anywhere
25306 within the 32-bit address space.
25308 @opindex malign-labels
25309 @item -malign-labels
25311 Try to align labels to an 8-byte boundary by inserting NOPs into the
25312 previous packet.  This option only has an effect when VLIW packing
25313 is enabled.  It doesn't create new packets; it merely adds NOPs to
25314 existing ones.
25316 @opindex mlibrary-pic
25317 @item -mlibrary-pic
25319 Generate position-independent EABI code.
25321 @opindex macc-4
25322 @item -macc-4
25324 Use only the first four media accumulator registers.
25326 @opindex macc-8
25327 @item -macc-8
25329 Use all eight media accumulator registers.
25331 @opindex mpack
25332 @item -mpack
25334 Pack VLIW instructions.
25336 @opindex mno-pack
25337 @item -mno-pack
25339 Do not pack VLIW instructions.
25341 @opindex mno-eflags
25342 @item -mno-eflags
25344 Do not mark ABI switches in e_flags.
25346 @opindex mcond-move
25347 @item -mcond-move
25349 Enable the use of conditional-move instructions (default).
25351 This switch is mainly for debugging the compiler and will likely be removed
25352 in a future version.
25354 @opindex mno-cond-move
25355 @item -mno-cond-move
25357 Disable the use of conditional-move instructions.
25359 This switch is mainly for debugging the compiler and will likely be removed
25360 in a future version.
25362 @opindex mscc
25363 @item -mscc
25365 Enable the use of conditional set instructions (default).
25367 This switch is mainly for debugging the compiler and will likely be removed
25368 in a future version.
25370 @opindex mno-scc
25371 @item -mno-scc
25373 Disable the use of conditional set instructions.
25375 This switch is mainly for debugging the compiler and will likely be removed
25376 in a future version.
25378 @opindex mcond-exec
25379 @item -mcond-exec
25381 Enable the use of conditional execution (default).
25383 This switch is mainly for debugging the compiler and will likely be removed
25384 in a future version.
25386 @opindex mno-cond-exec
25387 @item -mno-cond-exec
25389 Disable the use of conditional execution.
25391 This switch is mainly for debugging the compiler and will likely be removed
25392 in a future version.
25394 @opindex mvliw-branch
25395 @item -mvliw-branch
25397 Run a pass to pack branches into VLIW instructions (default).
25399 This switch is mainly for debugging the compiler and will likely be removed
25400 in a future version.
25402 @opindex mno-vliw-branch
25403 @item -mno-vliw-branch
25405 Do not run a pass to pack branches into VLIW instructions.
25407 This switch is mainly for debugging the compiler and will likely be removed
25408 in a future version.
25410 @opindex mmulti-cond-exec
25411 @item -mmulti-cond-exec
25413 Enable optimization of @code{&&} and @code{||} in conditional execution
25414 (default).
25416 This switch is mainly for debugging the compiler and will likely be removed
25417 in a future version.
25419 @opindex mno-multi-cond-exec
25420 @item -mno-multi-cond-exec
25422 Disable optimization of @code{&&} and @code{||} in conditional execution.
25424 This switch is mainly for debugging the compiler and will likely be removed
25425 in a future version.
25427 @opindex mnested-cond-exec
25428 @item -mnested-cond-exec
25430 Enable nested conditional execution optimizations (default).
25432 This switch is mainly for debugging the compiler and will likely be removed
25433 in a future version.
25435 @opindex mno-nested-cond-exec
25436 @item -mno-nested-cond-exec
25438 Disable nested conditional execution optimizations.
25440 This switch is mainly for debugging the compiler and will likely be removed
25441 in a future version.
25443 @opindex moptimize-membar
25444 @item -moptimize-membar
25446 This switch removes redundant @code{membar} instructions from the
25447 compiler-generated code.  It is enabled by default.
25449 @opindex mno-optimize-membar
25450 @opindex moptimize-membar
25451 @item -mno-optimize-membar
25453 This switch disables the automatic removal of redundant @code{membar}
25454 instructions from the generated code.
25456 @opindex mtomcat-stats
25457 @item -mtomcat-stats
25459 Cause gas to print out tomcat statistics.
25461 @opindex mcpu
25462 @item -mcpu=@var{cpu}
25464 Select the processor type for which to generate code.  Possible values are
25465 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
25466 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
25468 @end table
25470 @node GNU/Linux Options
25471 @subsection GNU/Linux Options
25473 These @samp{-m} options are defined for GNU/Linux targets:
25475 @table @gcctabopt
25476 @opindex mglibc
25477 @item -mglibc
25478 Use the GNU C library.  This is the default except
25479 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
25480 @samp{*-*-linux-*android*} targets.
25482 @opindex muclibc
25483 @item -muclibc
25484 Use uClibc C library.  This is the default on
25485 @samp{*-*-linux-*uclibc*} targets.
25487 @opindex mmusl
25488 @item -mmusl
25489 Use the musl C library.  This is the default on
25490 @samp{*-*-linux-*musl*} targets.
25492 @opindex mbionic
25493 @item -mbionic
25494 Use Bionic C library.  This is the default on
25495 @samp{*-*-linux-*android*} targets.
25497 @opindex mandroid
25498 @item -mandroid
25499 Compile code compatible with Android platform.  This is the default on
25500 @samp{*-*-linux-*android*} targets.
25502 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
25503 @option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
25504 this option makes the GCC driver pass Android-specific options to the linker.
25505 Finally, this option causes the preprocessor macro @code{__ANDROID__}
25506 to be defined.
25508 @opindex tno-android-cc
25509 @item -tno-android-cc
25510 Disable compilation effects of @option{-mandroid}, i.e., do not enable
25511 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
25512 @option{-fno-rtti} by default.
25514 @opindex tno-android-ld
25515 @item -tno-android-ld
25516 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
25517 linking options to the linker.
25519 @end table
25521 @node H8/300 Options
25522 @subsection H8/300 Options
25524 These @samp{-m} options are defined for the H8/300 implementations:
25526 @table @gcctabopt
25527 @opindex mrelax
25528 @item -mrelax
25529 Shorten some address references at link time, when possible; uses the
25530 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
25531 ld, Using ld}, for a fuller description.
25533 @opindex mh
25534 @item -mh
25535 Generate code for the H8/300H@.
25537 @opindex ms
25538 @item -ms
25539 Generate code for the H8S@.
25541 @opindex mn
25542 @item -mn
25543 Generate code for the H8S and H8/300H in the normal mode.  This switch
25544 must be used either with @option{-mh} or @option{-ms}.
25546 @opindex ms2600
25547 @item -ms2600
25548 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
25550 @opindex mexr
25551 @item -mexr
25552 Extended registers are stored on stack before execution of function
25553 with monitor attribute. Default option is @option{-mexr}.
25554 This option is valid only for H8S targets.
25556 @opindex mno-exr
25557 @opindex mexr
25558 @item -mno-exr
25559 Extended registers are not stored on stack before execution of function 
25560 with monitor attribute. Default option is @option{-mno-exr}. 
25561 This option is valid only for H8S targets.
25563 @opindex mint32
25564 @item -mint32
25565 Make @code{int} data 32 bits by default.
25567 @opindex malign-300
25568 @item -malign-300
25569 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
25570 The default for the H8/300H and H8S is to align longs and floats on
25571 4-byte boundaries.
25572 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
25573 This option has no effect on the H8/300.
25574 @end table
25576 @node HPPA Options
25577 @subsection HPPA Options
25578 @cindex HPPA Options
25580 These @samp{-m} options are defined for the HPPA family of computers:
25582 @table @gcctabopt
25583 @opindex march
25584 @item -march=@var{architecture-type}
25585 Generate code for the specified architecture.  The choices for
25586 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
25587 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
25588 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
25589 architecture option for your machine.  Code compiled for lower numbered
25590 architectures runs on higher numbered architectures, but not the
25591 other way around.
25593 @opindex mpa-risc-1-0
25594 @opindex mpa-risc-1-1
25595 @opindex mpa-risc-2-0
25596 @item -mpa-risc-1-0
25597 @itemx -mpa-risc-1-1
25598 @itemx -mpa-risc-2-0
25599 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
25601 @opindex matomic-libcalls
25602 @opindex mno-atomic-libcalls
25603 @item -matomic-libcalls
25604 Generate libcalls for atomic loads and stores when sync libcalls are disabled.
25605 This option is enabled by default.  It only affects the generation of
25606 atomic libcalls by the HPPA backend.
25608 Both the sync and @file{libatomic} libcall implementations use locking.
25609 As a result, processor stores are not atomic with respect to other
25610 atomic operations.  Processor loads up to DImode are atomic with
25611 respect to other atomic operations provided they are implemented as
25612 a single access.
25614 The PA-RISC architecture does not support any atomic operations in
25615 hardware except for the @code{ldcw} instruction.  Thus, all atomic
25616 support is implemented using sync and atomic libcalls.  Sync libcall
25617 support is in @file{libgcc.a}.  Atomic libcall support is in
25618 @file{libatomic}.
25620 This option generates @code{__atomic_exchange} calls for atomic stores.
25621 It also provides special handling for atomic DImode accesses on 32-bit
25622 targets.
25624 @opindex mbig-switch
25625 @item -mbig-switch
25626 Does nothing.  Preserved for backward compatibility.
25628 @opindex mcaller-copies
25629 @item -mcaller-copies
25630 The caller copies function arguments passed by hidden reference.  This
25631 option should be used with care as it is not compatible with the default
25632 32-bit runtime.  However, only aggregates larger than eight bytes are
25633 passed by hidden reference and the option provides better compatibility
25634 with OpenMP.
25636 @opindex mcoherent-ldcw
25637 @item -mcoherent-ldcw
25638 Use ldcw/ldcd coherent cache-control hint.
25640 @opindex mdisable-fpregs
25641 @item -mdisable-fpregs
25642 Disable floating-point registers.  Equivalent to @code{-msoft-float}.
25644 @opindex mdisable-indexing
25645 @item -mdisable-indexing
25646 Prevent the compiler from using indexing address modes.  This avoids some
25647 rather obscure problems when compiling MIG generated code under MACH@.
25649 @opindex mfast-indirect-calls
25650 @item -mfast-indirect-calls
25651 Generate code that assumes calls never cross space boundaries.  This
25652 allows GCC to emit code that performs faster indirect calls.
25654 This option does not work in the presence of shared libraries or nested
25655 functions.
25657 @opindex mfixed-range
25658 @item -mfixed-range=@var{register-range}
25659 Generate code treating the given register range as fixed registers.
25660 A fixed register is one that the register allocator cannot use.  This is
25661 useful when compiling kernel code.  A register range is specified as
25662 two registers separated by a dash.  Multiple register ranges can be
25663 specified separated by a comma.
25665 @opindex mgas
25666 @item -mgas
25667 Enable the use of assembler directives only GAS understands.
25669 @opindex mgnu-ld
25670 @item -mgnu-ld
25671 Use options specific to GNU @command{ld}.
25672 This passes @option{-shared} to @command{ld} when
25673 building a shared library.  It is the default when GCC is configured,
25674 explicitly or implicitly, with the GNU linker.  This option does not
25675 affect which @command{ld} is called; it only changes what parameters
25676 are passed to that @command{ld}.
25677 The @command{ld} that is called is determined by the
25678 @option{--with-ld} configure option, GCC's program search path, and
25679 finally by the user's @env{PATH}.  The linker used by GCC can be printed
25680 using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
25681 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
25683 @opindex mhp-ld
25684 @item -mhp-ld
25685 Use options specific to HP @command{ld}.
25686 This passes @option{-b} to @command{ld} when building
25687 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
25688 links.  It is the default when GCC is configured, explicitly or
25689 implicitly, with the HP linker.  This option does not affect
25690 which @command{ld} is called; it only changes what parameters are passed to that
25691 @command{ld}.
25692 The @command{ld} that is called is determined by the @option{--with-ld}
25693 configure option, GCC's program search path, and finally by the user's
25694 @env{PATH}.  The linker used by GCC can be printed using @samp{which
25695 `gcc -print-prog-name=ld`}.  This option is only available on the 64-bit
25696 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
25698 @opindex mlinker-opt
25699 @item -mlinker-opt
25700 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
25701 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
25702 linkers in which they give bogus error messages when linking some programs.
25704 @opindex mno-long-calls
25705 @opindex mlong-calls
25706 @item -mlong-calls
25707 Generate code that uses long call sequences.  This ensures that a call
25708 is always able to reach linker generated stubs.  The default is to generate
25709 long calls only when the distance from the call site to the beginning
25710 of the function or translation unit, as the case may be, exceeds a
25711 predefined limit set by the branch type being used.  The limits for
25712 normal calls are 7,600,000 and 240,000 bytes, respectively for the
25713 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
25714 240,000 bytes.
25716 Distances are measured from the beginning of functions when using the
25717 @option{-ffunction-sections} option, or when using the @option{-mgas}
25718 and @option{-mno-portable-runtime} options together under HP-UX with
25719 the SOM linker.
25721 It is normally not desirable to use this option as it degrades
25722 performance.  However, it may be useful in large applications,
25723 particularly when partial linking is used to build the application.
25725 The types of long calls used depends on the capabilities of the
25726 assembler and linker, and the type of code being generated.  The
25727 impact on systems that support long absolute calls, and long pic
25728 symbol-difference or pc-relative calls should be relatively small.
25729 However, an indirect call is used on 32-bit ELF systems in pic code
25730 and it is quite long.
25732 @opindex mlong-load-store
25733 @item -mlong-load-store
25734 Generate 3-instruction load and store sequences as sometimes required by
25735 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
25736 the HP compilers.
25738 @opindex mjump-in-delay
25739 @item -mjump-in-delay
25740 This option is ignored and provided for compatibility purposes only.
25742 @opindex mno-space-regs
25743 @opindex mspace-regs
25744 @item -mno-space-regs
25745 Generate code that assumes the target has no space registers.  This allows
25746 GCC to generate faster indirect calls and use unscaled index address modes.
25748 Such code is suitable for level 0 PA systems and kernels.
25750 @opindex mordered
25751 @item -mordered
25752 Assume memory references are ordered and barriers are not needed.
25754 @opindex mportable-runtime
25755 @item -mportable-runtime
25756 Use the portable calling conventions proposed by HP for ELF systems.
25758 @opindex mschedule
25759 @item -mschedule=@var{cpu-type}
25760 Schedule code according to the constraints for the machine type
25761 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
25762 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
25763 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
25764 proper scheduling option for your machine.  The default scheduling is
25765 @samp{8000}.
25767 @opindex msio
25768 @item -msio
25769 Generate the predefine, @code{_SIO}, for server IO@.  The default is
25770 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
25771 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
25772 options are available under HP-UX and HI-UX@.
25774 @opindex msoft-float
25775 @item -msoft-float
25776 Generate output containing library calls for floating point.
25777 @strong{Warning:} the requisite libraries are not available for all HPPA
25778 targets.  Normally the facilities of the machine's usual C compiler are
25779 used, but this cannot be done directly in cross-compilation.  You must make
25780 your own arrangements to provide suitable library functions for
25781 cross-compilation.
25783 @option{-msoft-float} changes the calling convention in the output file;
25784 therefore, it is only useful if you compile @emph{all} of a program with
25785 this option.  In particular, you need to compile @file{libgcc.a}, the
25786 library that comes with GCC, with @option{-msoft-float} in order for
25787 this to work.
25789 @opindex msoft-mult
25790 @item -msoft-mult
25791 Use software integer multiplication.
25793 This disables the use of the @code{xmpyu} instruction.
25795 @opindex march
25796 @item -munix=@var{unix-std}
25797 Generate compiler predefines and select a startfile for the specified
25798 UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
25799 and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
25800 is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
25801 11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
25802 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
25803 and later.
25805 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
25806 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
25807 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
25808 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
25809 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
25810 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
25812 It is @emph{important} to note that this option changes the interfaces
25813 for various library routines.  It also affects the operational behavior
25814 of the C library.  Thus, @emph{extreme} care is needed in using this
25815 option.
25817 Library code that is intended to operate with more than one UNIX
25818 standard must test, set and restore the variable @code{__xpg4_extended_mask}
25819 as appropriate.  Most GNU software doesn't provide this capability.
25821 @opindex nolibdld
25822 @item -nolibdld
25823 Suppress the generation of link options to search libdld.sl when the
25824 @option{-static} option is specified on HP-UX 10 and later.
25826 @opindex static
25827 @item -static
25828 The HP-UX implementation of setlocale in libc has a dependency on
25829 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
25830 when the @option{-static} option is specified, special link options
25831 are needed to resolve this dependency.
25833 On HP-UX 10 and later, the GCC driver adds the necessary options to
25834 link with libdld.sl when the @option{-static} option is specified.
25835 This causes the resulting binary to be dynamic.  On the 64-bit port,
25836 the linkers generate dynamic binaries by default in any case.  The
25837 @option{-nolibdld} option can be used to prevent the GCC driver from
25838 adding these link options.
25840 @opindex threads
25841 @item -threads
25842 Add support for multithreading with the @dfn{dce thread} library
25843 under HP-UX@.  This option sets flags for both the preprocessor and
25844 linker.
25845 @end table
25847 @node IA-64 Options
25848 @subsection IA-64 Options
25849 @cindex IA-64 Options
25851 These are the @samp{-m} options defined for the Intel IA-64 architecture.
25853 @table @gcctabopt
25854 @opindex mbig-endian
25855 @item -mbig-endian
25856 Generate code for a big-endian target.  This is the default for HP-UX@.
25858 @opindex mlittle-endian
25859 @item -mlittle-endian
25860 Generate code for a little-endian target.  This is the default for AIX5
25861 and GNU/Linux.
25863 @opindex mgnu-as
25864 @opindex mno-gnu-as
25865 @item -mgnu-as
25866 @itemx -mno-gnu-as
25867 Generate (or don't) code for the GNU assembler.  This is the default.
25868 @c Also, this is the default if the configure option @option{--with-gnu-as}
25869 @c is used.
25871 @opindex mgnu-ld
25872 @opindex mno-gnu-ld
25873 @item -mgnu-ld
25874 @itemx -mno-gnu-ld
25875 Generate (or don't) code for the GNU linker.  This is the default.
25876 @c Also, this is the default if the configure option @option{--with-gnu-ld}
25877 @c is used.
25879 @opindex mno-pic
25880 @item -mno-pic
25881 Generate code that does not use a global pointer register.  The result
25882 is not position independent code, and violates the IA-64 ABI@.
25884 @opindex mvolatile-asm-stop
25885 @opindex mno-volatile-asm-stop
25886 @item -mvolatile-asm-stop
25887 @itemx -mno-volatile-asm-stop
25888 Generate (or don't) a stop bit immediately before and after volatile asm
25889 statements.
25891 @opindex mregister-names
25892 @opindex mno-register-names
25893 @item -mregister-names
25894 @itemx -mno-register-names
25895 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
25896 the stacked registers.  This may make assembler output more readable.
25898 @opindex mno-sdata
25899 @opindex msdata
25900 @item -mno-sdata
25901 @itemx -msdata
25902 Disable (or enable) optimizations that use the small data section.  This may
25903 be useful for working around optimizer bugs.
25905 @opindex mconstant-gp
25906 @item -mconstant-gp
25907 Generate code that uses a single constant global pointer value.  This is
25908 useful when compiling kernel code.
25910 @opindex mauto-pic
25911 @item -mauto-pic
25912 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
25913 This is useful when compiling firmware code.
25915 @opindex minline-float-divide-min-latency
25916 @item -minline-float-divide-min-latency
25917 Generate code for inline divides of floating-point values
25918 using the minimum latency algorithm.
25920 @opindex minline-float-divide-max-throughput
25921 @item -minline-float-divide-max-throughput
25922 Generate code for inline divides of floating-point values
25923 using the maximum throughput algorithm.
25925 @opindex mno-inline-float-divide
25926 @item -mno-inline-float-divide
25927 Do not generate inline code for divides of floating-point values.
25929 @opindex minline-int-divide-min-latency
25930 @item -minline-int-divide-min-latency
25931 Generate code for inline divides of integer values
25932 using the minimum latency algorithm.
25934 @opindex minline-int-divide-max-throughput
25935 @item -minline-int-divide-max-throughput
25936 Generate code for inline divides of integer values
25937 using the maximum throughput algorithm.
25939 @opindex mno-inline-int-divide
25940 @opindex minline-int-divide
25941 @item -mno-inline-int-divide
25942 Do not generate inline code for divides of integer values.
25944 @opindex minline-sqrt-min-latency
25945 @item -minline-sqrt-min-latency
25946 Generate code for inline square roots
25947 using the minimum latency algorithm.
25949 @opindex minline-sqrt-max-throughput
25950 @item -minline-sqrt-max-throughput
25951 Generate code for inline square roots
25952 using the maximum throughput algorithm.
25954 @opindex mno-inline-sqrt
25955 @item -mno-inline-sqrt
25956 Do not generate inline code for @code{sqrt}.
25958 @opindex mfused-madd
25959 @opindex mno-fused-madd
25960 @item -mfused-madd
25961 @itemx -mno-fused-madd
25962 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
25963 instructions.  The default is to use these instructions.
25965 @opindex mno-dwarf2-asm
25966 @opindex mdwarf2-asm
25967 @item -mno-dwarf2-asm
25968 @itemx -mdwarf2-asm
25969 Don't (or do) generate assembler code for the DWARF line number debugging
25970 info.  This may be useful when not using the GNU assembler.
25972 @opindex mearly-stop-bits
25973 @opindex mno-early-stop-bits
25974 @item -mearly-stop-bits
25975 @itemx -mno-early-stop-bits
25976 Allow stop bits to be placed earlier than immediately preceding the
25977 instruction that triggered the stop bit.  This can improve instruction
25978 scheduling, but does not always do so.
25980 @opindex mfixed-range
25981 @item -mfixed-range=@var{register-range}
25982 Generate code treating the given register range as fixed registers.
25983 A fixed register is one that the register allocator cannot use.  This is
25984 useful when compiling kernel code.  A register range is specified as
25985 two registers separated by a dash.  Multiple register ranges can be
25986 specified separated by a comma.
25988 @opindex mtls-size
25989 @item -mtls-size=@var{tls-size}
25990 Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
25993 @opindex mtune
25994 @item -mtune=@var{cpu-type}
25995 Tune the instruction scheduling for a particular CPU, Valid values are
25996 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
25997 and @samp{mckinley}.
25999 @opindex milp32
26000 @opindex mlp64
26001 @item -milp32
26002 @itemx -mlp64
26003 Generate code for a 32-bit or 64-bit environment.
26004 The 32-bit environment sets int, long and pointer to 32 bits.
26005 The 64-bit environment sets int to 32 bits and long and pointer
26006 to 64 bits.  These are HP-UX specific flags.
26008 @opindex mno-sched-br-data-spec
26009 @opindex msched-br-data-spec
26010 @item -mno-sched-br-data-spec
26011 @itemx -msched-br-data-spec
26012 (Dis/En)able data speculative scheduling before reload.
26013 This results in generation of @code{ld.a} instructions and
26014 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
26015 The default setting is disabled.
26017 @opindex msched-ar-data-spec
26018 @opindex mno-sched-ar-data-spec
26019 @item -msched-ar-data-spec
26020 @itemx -mno-sched-ar-data-spec
26021 (En/Dis)able data speculative scheduling after reload.
26022 This results in generation of @code{ld.a} instructions and
26023 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
26024 The default setting is enabled.
26026 @opindex mno-sched-control-spec
26027 @opindex msched-control-spec
26028 @item -mno-sched-control-spec
26029 @itemx -msched-control-spec
26030 (Dis/En)able control speculative scheduling.  This feature is
26031 available only during region scheduling (i.e.@: before reload).
26032 This results in generation of the @code{ld.s} instructions and
26033 the corresponding check instructions @code{chk.s}.
26034 The default setting is disabled.
26036 @opindex msched-br-in-data-spec
26037 @opindex mno-sched-br-in-data-spec
26038 @item -msched-br-in-data-spec
26039 @itemx -mno-sched-br-in-data-spec
26040 (En/Dis)able speculative scheduling of the instructions that
26041 are dependent on the data speculative loads before reload.
26042 This is effective only with @option{-msched-br-data-spec} enabled.
26043 The default setting is enabled.
26045 @opindex msched-ar-in-data-spec
26046 @opindex mno-sched-ar-in-data-spec
26047 @item -msched-ar-in-data-spec
26048 @itemx -mno-sched-ar-in-data-spec
26049 (En/Dis)able speculative scheduling of the instructions that
26050 are dependent on the data speculative loads after reload.
26051 This is effective only with @option{-msched-ar-data-spec} enabled.
26052 The default setting is enabled.
26054 @opindex msched-in-control-spec
26055 @opindex mno-sched-in-control-spec
26056 @item -msched-in-control-spec
26057 @itemx -mno-sched-in-control-spec
26058 (En/Dis)able speculative scheduling of the instructions that
26059 are dependent on the control speculative loads.
26060 This is effective only with @option{-msched-control-spec} enabled.
26061 The default setting is enabled.
26063 @opindex mno-sched-prefer-non-data-spec-insns
26064 @opindex msched-prefer-non-data-spec-insns
26065 @item -mno-sched-prefer-non-data-spec-insns
26066 @itemx -msched-prefer-non-data-spec-insns
26067 If enabled, data-speculative instructions are chosen for schedule
26068 only if there are no other choices at the moment.  This makes
26069 the use of the data speculation much more conservative.
26070 The default setting is disabled.
26072 @opindex mno-sched-prefer-non-control-spec-insns
26073 @opindex msched-prefer-non-control-spec-insns
26074 @item -mno-sched-prefer-non-control-spec-insns
26075 @itemx -msched-prefer-non-control-spec-insns
26076 If enabled, control-speculative instructions are chosen for schedule
26077 only if there are no other choices at the moment.  This makes
26078 the use of the control speculation much more conservative.
26079 The default setting is disabled.
26081 @opindex mno-sched-count-spec-in-critical-path
26082 @opindex msched-count-spec-in-critical-path
26083 @item -mno-sched-count-spec-in-critical-path
26084 @itemx -msched-count-spec-in-critical-path
26085 If enabled, speculative dependencies are considered during
26086 computation of the instructions priorities.  This makes the use of the
26087 speculation a bit more conservative.
26088 The default setting is disabled.
26090 @opindex msched-spec-ldc
26091 @item -msched-spec-ldc
26092 Use a simple data speculation check.  This option is on by default.
26094 @opindex msched-spec-ldc
26095 @item -msched-control-spec-ldc
26096 Use a simple check for control speculation.  This option is on by default.
26098 @opindex msched-stop-bits-after-every-cycle
26099 @item -msched-stop-bits-after-every-cycle
26100 Place a stop bit after every cycle when scheduling.  This option is on
26101 by default.
26103 @opindex msched-fp-mem-deps-zero-cost
26104 @item -msched-fp-mem-deps-zero-cost
26105 Assume that floating-point stores and loads are not likely to cause a conflict
26106 when placed into the same instruction group.  This option is disabled by
26107 default.
26109 @opindex msel-sched-dont-check-control-spec
26110 @item -msel-sched-dont-check-control-spec
26111 Generate checks for control speculation in selective scheduling.
26112 This flag is disabled by default.
26114 @opindex msched-max-memory-insns
26115 @item -msched-max-memory-insns=@var{max-insns}
26116 Limit on the number of memory insns per instruction group, giving lower
26117 priority to subsequent memory insns attempting to schedule in the same
26118 instruction group. Frequently useful to prevent cache bank conflicts.
26119 The default value is 1.
26121 @opindex msched-max-memory-insns-hard-limit
26122 @item -msched-max-memory-insns-hard-limit
26123 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
26124 disallowing more than that number in an instruction group.
26125 Otherwise, the limit is ``soft'', meaning that non-memory operations
26126 are preferred when the limit is reached, but memory operations may still
26127 be scheduled.
26129 @end table
26131 @node LM32 Options
26132 @subsection LM32 Options
26133 @cindex LM32 options
26135 These @option{-m} options are defined for the LatticeMico32 architecture:
26137 @table @gcctabopt
26138 @opindex mbarrel-shift-enabled
26139 @item -mbarrel-shift-enabled
26140 Enable barrel-shift instructions.
26142 @opindex mdivide-enabled
26143 @item -mdivide-enabled
26144 Enable divide and modulus instructions.
26146 @opindex multiply-enabled
26147 @item -mmultiply-enabled
26148 Enable multiply instructions.
26150 @opindex msign-extend-enabled
26151 @item -msign-extend-enabled
26152 Enable sign extend instructions.
26154 @opindex muser-enabled
26155 @item -muser-enabled
26156 Enable user-defined instructions.
26158 @end table
26160 @node LoongArch Options
26161 @subsection LoongArch Options
26162 @cindex LoongArch Options
26164 These command-line options are defined for LoongArch targets:
26166 @table @gcctabopt
26167 @opindex march
26168 @item -march=@var{cpu-type}
26169 Generate instructions for the machine type @var{cpu-type}.  In contrast to
26170 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
26171 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
26172 to generate code that may not run at all on processors other than the one
26173 indicated.  Specifying @option{-march=@var{cpu-type}} implies
26174 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
26176 The choices for @var{cpu-type} are:
26178 @table @samp
26179 @item native
26180 This selects the CPU to generate code for at compilation time by determining
26181 the processor type of the compiling machine.  Using @option{-march=native}
26182 enables all instruction subsets supported by the local machine (hence
26183 the result might not run on different machines).  Using @option{-mtune=native}
26184 produces code optimized for the local machine under the constraints
26185 of the selected instruction set.
26186 @item loongarch64
26187 A generic CPU with 64-bit extensions.
26188 @item la464
26189 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
26190 @end table
26192 @opindex mtune
26193 @item -mtune=@var{cpu-type}
26194 Optimize the output for the given processor, specified by microarchitecture
26195 name.
26197 @opindex mabi
26198 @item -mabi=@var{base-abi-type}
26199 Generate code for the specified calling convention.
26200 @var{base-abi-type} can be one of:
26201 @table @samp
26202 @item lp64d
26203 Uses 64-bit general purpose registers and 32/64-bit floating-point
26204 registers for parameter passing.  Data model is LP64, where @samp{int}
26205 is 32 bits, while @samp{long int} and pointers are 64 bits.
26206 @item lp64f
26207 Uses 64-bit general purpose registers and 32-bit floating-point
26208 registers for parameter passing.  Data model is LP64, where @samp{int}
26209 is 32 bits, while @samp{long int} and pointers are 64 bits.
26210 @item lp64s
26211 Uses 64-bit general purpose registers and no floating-point
26212 registers for parameter passing.  Data model is LP64, where @samp{int}
26213 is 32 bits, while @samp{long int} and pointers are 64 bits.
26214 @end table
26216 @opindex mfpu
26217 @item -mfpu=@var{fpu-type}
26218 Generate code for the specified FPU type, which can be one of:
26219 @table @samp
26220 @item 64
26221 Allow the use of hardware floating-point instructions for 32-bit
26222 and 64-bit operations.
26223 @item 32
26224 Allow the use of hardware floating-point instructions for 32-bit
26225 operations.
26226 @item none
26227 @item 0
26228 Prevent the use of hardware floating-point instructions.
26229 @end table
26231 @opindex msimd
26232 @item -msimd=@var{simd-type}
26233 Enable generation of LoongArch SIMD instructions for vectorization
26234 and via builtin functions.  The value can be one of:
26235 @table @samp
26236 @item lasx
26237 Enable generating instructions from the 256-bit LoongArch Advanced
26238 SIMD Extension (LASX) and the 128-bit LoongArch SIMD Extension (LSX).
26239 @item lsx
26240 Enable generating instructions from the 128-bit LoongArch SIMD
26241 Extension (LSX).
26242 @item none
26243 No LoongArch SIMD instruction may be generated.
26244 @end table
26246 @opindex msoft-float
26247 @item -msoft-float
26248 Force @option{-mfpu=none} and prevents the use of floating-point
26249 registers for parameter passing.  This option may change the target
26250 ABI.
26252 @opindex msingle-float
26253 @item -msingle-float
26254 Force @option{-mfpu=32} and allow the use of 32-bit floating-point
26255 registers for parameter passing.  This option may change the target
26256 ABI.
26258 @opindex mdouble-float
26259 @item -mdouble-float
26260 Force @option{-mfpu=64} and allow the use of 32/64-bit floating-point
26261 registers for parameter passing.  This option may change the target
26262 ABI.
26264 @opindex ml[a]sx
26265 @item -mlasx
26266 @itemx -mno-lasx
26267 @item -mlsx
26268 @itemx -mno-lsx
26269 Incrementally adjust the scope of the SIMD extensions (none / LSX / LASX)
26270 that can be used by the compiler for code generation.  Enabling LASX with
26271 @option{mlasx} automatically enables LSX, and diabling LSX with @option{mno-lsx}
26272 automatically disables LASX.  These driver-only options act upon the final
26273 @option{msimd} configuration state and make incremental chagnes in the order
26274 they appear on the GCC driver's command line, deriving the final / canonicalized
26275 @option{msimd} option that is passed to the compiler proper.
26277 @opindex mbranch-cost
26278 @item -mbranch-cost=@var{n}
26279 Set the cost of branches to roughly @var{n} instructions.
26281 @opindex mcheck-zero-division
26282 @item -mcheck-zero-division
26283 @itemx -mno-check-zero-divison
26284 Trap (do not trap) on integer division by zero.  The default is
26285 @option{-mcheck-zero-division} for @option{-O0} or @option{-Og}, and
26286 @option{-mno-check-zero-division} for other optimization levels.
26288 @opindex mcond-move-int
26289 @item -mcond-move-int
26290 @itemx -mno-cond-move-int
26291 Conditional moves for integral data in general-purpose registers
26292 are enabled (disabled).  The default is @option{-mcond-move-int}.
26294 @opindex mcond-move-float
26295 @item -mcond-move-float
26296 @itemx -mno-cond-move-float
26297 Conditional moves for floating-point registers are enabled (disabled).
26298 The default is @option{-mcond-move-float}.
26300 @opindex mmemcpy
26301 @item -mmemcpy
26302 @itemx -mno-memcpy
26303 Force (do not force) the use of @code{memcpy} for non-trivial block moves.
26304 The default is @option{-mno-memcpy}, which allows GCC to inline most
26305 constant-sized copies.  Setting optimization level to @option{-Os} also
26306 forces the use of @code{memcpy}, but @option{-mno-memcpy} may override this
26307 behavior if explicitly specified, regardless of the order these options on
26308 the command line.
26310 @opindex mstrict-align
26311 @item -mstrict-align
26312 @itemx -mno-strict-align
26313 Avoid or allow generating memory accesses that may not be aligned on a natural
26314 object boundary as described in the architecture specification. The default is
26315 @option{-mno-strict-align}.
26317 @opindex msmall-data-limit
26318 @item -msmall-data-limit=@var{number}
26319 Put global and static data smaller than @var{number} bytes into a special
26320 section (on some targets).  The default value is 0.
26322 @opindex mmax-inline-memcpy-size
26323 @item -mmax-inline-memcpy-size=@var{n}
26324 Inline all block moves (such as calls to @code{memcpy} or structure copies)
26325 less than or equal to @var{n} bytes.  The default value of @var{n} is 1024.
26327 @item -mcmodel=@var{code-model}
26328 Set the code model to one of:
26329 @table @samp
26330 @item tiny-static (Not implemented yet)
26331 @item tiny (Not implemented yet)
26333 @item normal
26334 The text segment must be within 128MB addressing space.  The data segment must
26335 be within 2GB addressing space.
26337 @item medium
26338 The text segment and data segment must be within 2GB addressing space.
26340 @item large (Not implemented yet)
26342 @item extreme
26343 This mode does not limit the size of the code segment and data segment.
26344 The @option{-mcmodel=extreme} option is incompatible with @option{-fplt},
26345 and it requires @option{-mexplicit-relocs=always}.
26346 @end table
26347 The default code model is @code{normal}.
26349 @item -mexplicit-relocs=@var{style}
26350 Set when to use assembler relocation operators when dealing with symbolic
26351 addresses.  The alternative is to use assembler macros instead, which may
26352 limit instruction scheduling but allow linker relaxation.
26353 with @option{-mexplicit-relocs=none} the assembler macros are always used,
26354 with @option{-mexplicit-relocs=always} the assembler relocation operators
26355 are always used, with @option{-mexplicit-relocs=auto} the compiler will
26356 use the relocation operators where the linker relaxation is impossible to
26357 improve the code quality, and macros elsewhere.  The default
26358 value for the option is determined during GCC build-time by detecting
26359 corresponding assembler support:
26360 @option{-mexplicit-relocs=none} if the assembler does not support
26361 relocation operators at all,
26362 @option{-mexplicit-relocs=always} if the assembler supports relocation
26363 operators but does not support relaxation,
26364 @option{-mexplicit-relocs=auto} if the assembler supports both relocation
26365 operators and relaxation.  This option is mostly useful for
26366 debugging, or interoperation with assemblers different from the build-time
26367 one.
26369 @opindex mexplicit-relocs
26370 @item -mexplicit-relocs
26371 An alias of @option{-mexplicit-relocs=always} for backward compatibility.
26373 @opindex mno-explicit-relocs
26374 @item -mno-explicit-relocs
26375 An alias of @option{-mexplicit-relocs=none} for backward compatibility.
26377 @opindex mdirect-extern-access
26378 @item -mdirect-extern-access
26379 @itemx -mno-direct-extern-access
26380 Do not use or use GOT to access external symbols.  The default is
26381 @option{-mno-direct-extern-access}: GOT is used for external symbols with
26382 default visibility, but not used for other external symbols.
26384 With @option{-mdirect-extern-access}, GOT is not used and all external
26385 symbols are PC-relatively addressed.  It is @strong{only} suitable for
26386 environments where no dynamic link is performed, like firmwares, OS
26387 kernels, executables linked with @option{-static} or @option{-static-pie}.
26388 @option{-mdirect-extern-access} is not compatible with @option{-fPIC} or
26389 @option{-fpic}.
26391 @item loongarch-vect-unroll-limit
26392 The vectorizer will use available tuning information to determine whether it
26393 would be beneficial to unroll the main vectorized loop and by how much.  This
26394 parameter set's the upper bound of how much the vectorizer will unroll the main
26395 loop.  The default value is six.
26397 @end table
26400 @node M32C Options
26401 @subsection M32C Options
26402 @cindex M32C options
26404 @table @gcctabopt
26405 @opindex mcpu=
26406 @item -mcpu=@var{name}
26407 Select the CPU for which code is generated.  @var{name} may be one of
26408 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
26409 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
26410 the M32C/80 series.
26412 @opindex msim
26413 @item -msim
26414 Specifies that the program will be run on the simulator.  This causes
26415 an alternate runtime library to be linked in which supports, for
26416 example, file I/O@.  You must not use this option when generating
26417 programs that will run on real hardware; you must provide your own
26418 runtime library for whatever I/O functions are needed.
26420 @opindex memregs=
26421 @item -memregs=@var{number}
26422 Specifies the number of memory-based pseudo-registers GCC uses
26423 during code generation.  These pseudo-registers are used like real
26424 registers, so there is a tradeoff between GCC's ability to fit the
26425 code into available registers, and the performance penalty of using
26426 memory instead of registers.  Note that all modules in a program must
26427 be compiled with the same value for this option.  Because of that, you
26428 must not use this option with GCC's default runtime libraries.
26430 @end table
26432 @node M32R/D Options
26433 @subsection M32R/D Options
26434 @cindex M32R/D options
26436 These @option{-m} options are defined for Renesas M32R/D architectures:
26438 @table @gcctabopt
26439 @opindex m32r2
26440 @item -m32r2
26441 Generate code for the M32R/2@.
26443 @opindex m32rx
26444 @item -m32rx
26445 Generate code for the M32R/X@.
26447 @opindex m32r
26448 @item -m32r
26449 Generate code for the M32R@.  This is the default.
26451 @opindex mmodel=small
26452 @item -mmodel=small
26453 Assume all objects live in the lower 16MB of memory (so that their addresses
26454 can be loaded with the @code{ld24} instruction), and assume all subroutines
26455 are reachable with the @code{bl} instruction.
26456 This is the default.
26458 The addressability of a particular object can be set with the
26459 @code{model} attribute.
26461 @opindex mmodel=medium
26462 @item -mmodel=medium
26463 Assume objects may be anywhere in the 32-bit address space (the compiler
26464 generates @code{seth/add3} instructions to load their addresses), and
26465 assume all subroutines are reachable with the @code{bl} instruction.
26467 @opindex mmodel=large
26468 @item -mmodel=large
26469 Assume objects may be anywhere in the 32-bit address space (the compiler
26470 generates @code{seth/add3} instructions to load their addresses), and
26471 assume subroutines may not be reachable with the @code{bl} instruction
26472 (the compiler generates the much slower @code{seth/add3/jl}
26473 instruction sequence).
26475 @opindex msdata=none
26476 @item -msdata=none
26477 Disable use of the small data area.  Variables are put into
26478 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
26479 @code{section} attribute has been specified).
26480 This is the default.
26482 The small data area consists of sections @code{.sdata} and @code{.sbss}.
26483 Objects may be explicitly put in the small data area with the
26484 @code{section} attribute using one of these sections.
26486 @opindex msdata=sdata
26487 @item -msdata=sdata
26488 Put small global and static data in the small data area, but do not
26489 generate special code to reference them.
26491 @opindex msdata=use
26492 @item -msdata=use
26493 Put small global and static data in the small data area, and generate
26494 special instructions to reference them.
26496 @opindex G
26497 @cindex smaller data references
26498 @item -G @var{num}
26499 Put global and static objects less than or equal to @var{num} bytes
26500 into the small data or BSS sections instead of the normal data or BSS
26501 sections.  The default value of @var{num} is 8.
26502 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
26503 for this option to have any effect.
26505 All modules should be compiled with the same @option{-G @var{num}} value.
26506 Compiling with different values of @var{num} may or may not work; if it
26507 doesn't the linker gives an error message---incorrect code is not
26508 generated.
26510 @opindex mdebug
26511 @item -mdebug
26512 Makes the M32R-specific code in the compiler display some statistics
26513 that might help in debugging programs.
26515 @opindex malign-loops
26516 @item -malign-loops
26517 Align all loops to a 32-byte boundary.
26519 @opindex mno-align-loops
26520 @item -mno-align-loops
26521 Do not enforce a 32-byte alignment for loops.  This is the default.
26523 @opindex missue-rate=@var{number}
26524 @item -missue-rate=@var{number}
26525 Issue @var{number} instructions per cycle.  @var{number} can only be 1
26526 or 2.
26528 @opindex mbranch-cost=@var{number}
26529 @item -mbranch-cost=@var{number}
26530 @var{number} can only be 1 or 2.  If it is 1 then branches are
26531 preferred over conditional code, if it is 2, then the opposite applies.
26533 @opindex mflush-trap=@var{number}
26534 @item -mflush-trap=@var{number}
26535 Specifies the trap number to use to flush the cache.  The default is
26536 12.  Valid numbers are between 0 and 15 inclusive.
26538 @opindex mno-flush-trap
26539 @item -mno-flush-trap
26540 Specifies that the cache cannot be flushed by using a trap.
26542 @opindex mflush-func=@var{name}
26543 @item -mflush-func=@var{name}
26544 Specifies the name of the operating system function to call to flush
26545 the cache.  The default is @samp{_flush_cache}, but a function call
26546 is only used if a trap is not available.
26548 @opindex mno-flush-func
26549 @item -mno-flush-func
26550 Indicates that there is no OS function for flushing the cache.
26552 @end table
26554 @node M680x0 Options
26555 @subsection M680x0 Options
26556 @cindex M680x0 options
26558 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
26559 The default settings depend on which architecture was selected when
26560 the compiler was configured; the defaults for the most common choices
26561 are given below.
26563 @table @gcctabopt
26564 @opindex march
26565 @item -march=@var{arch}
26566 Generate code for a specific M680x0 or ColdFire instruction set
26567 architecture.  Permissible values of @var{arch} for M680x0
26568 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
26569 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
26570 architectures are selected according to Freescale's ISA classification
26571 and the permissible values are: @samp{isaa}, @samp{isaaplus},
26572 @samp{isab} and @samp{isac}.
26574 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
26575 code for a ColdFire target.  The @var{arch} in this macro is one of the
26576 @option{-march} arguments given above.
26578 When used together, @option{-march} and @option{-mtune} select code
26579 that runs on a family of similar processors but that is optimized
26580 for a particular microarchitecture.
26582 @opindex mcpu
26583 @item -mcpu=@var{cpu}
26584 Generate code for a specific M680x0 or ColdFire processor.
26585 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
26586 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
26587 and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
26588 below, which also classifies the CPUs into families:
26590 @multitable @columnfractions 0.20 0.80
26591 @headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments}
26592 @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}
26593 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
26594 @item @samp{5206e} @tab @samp{5206e}
26595 @item @samp{5208} @tab @samp{5207} @samp{5208}
26596 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
26597 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
26598 @item @samp{5216} @tab @samp{5214} @samp{5216}
26599 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
26600 @item @samp{5225} @tab @samp{5224} @samp{5225}
26601 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
26602 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
26603 @item @samp{5249} @tab @samp{5249}
26604 @item @samp{5250} @tab @samp{5250}
26605 @item @samp{5271} @tab @samp{5270} @samp{5271}
26606 @item @samp{5272} @tab @samp{5272}
26607 @item @samp{5275} @tab @samp{5274} @samp{5275}
26608 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
26609 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
26610 @item @samp{5307} @tab @samp{5307}
26611 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
26612 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
26613 @item @samp{5407} @tab @samp{5407}
26614 @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}
26615 @end multitable
26617 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
26618 @var{arch} is compatible with @var{cpu}.  Other combinations of
26619 @option{-mcpu} and @option{-march} are rejected.
26621 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
26622 @var{cpu} is selected.  It also defines @code{__mcf_family_@var{family}},
26623 where the value of @var{family} is given by the table above.
26625 @opindex mtune
26626 @item -mtune=@var{tune}
26627 Tune the code for a particular microarchitecture within the
26628 constraints set by @option{-march} and @option{-mcpu}.
26629 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
26630 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
26631 and @samp{cpu32}.  The ColdFire microarchitectures
26632 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
26634 You can also use @option{-mtune=68020-40} for code that needs
26635 to run relatively well on 68020, 68030 and 68040 targets.
26636 @option{-mtune=68020-60} is similar but includes 68060 targets
26637 as well.  These two options select the same tuning decisions as
26638 @option{-m68020-40} and @option{-m68020-60} respectively.
26640 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
26641 when tuning for 680x0 architecture @var{arch}.  It also defines
26642 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
26643 option is used.  If GCC is tuning for a range of architectures,
26644 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
26645 it defines the macros for every architecture in the range.
26647 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
26648 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
26649 of the arguments given above.
26651 @opindex m68000
26652 @opindex mc68000
26653 @item -m68000
26654 @itemx -mc68000
26655 Generate output for a 68000.  This is the default
26656 when the compiler is configured for 68000-based systems.
26657 It is equivalent to @option{-march=68000}.
26659 Use this option for microcontrollers with a 68000 or EC000 core,
26660 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
26662 @opindex m68010
26663 @item -m68010
26664 Generate output for a 68010.  This is the default
26665 when the compiler is configured for 68010-based systems.
26666 It is equivalent to @option{-march=68010}.
26668 @opindex m68020
26669 @opindex mc68020
26670 @item -m68020
26671 @itemx -mc68020
26672 Generate output for a 68020.  This is the default
26673 when the compiler is configured for 68020-based systems.
26674 It is equivalent to @option{-march=68020}.
26676 @opindex m68030
26677 @item -m68030
26678 Generate output for a 68030.  This is the default when the compiler is
26679 configured for 68030-based systems.  It is equivalent to
26680 @option{-march=68030}.
26682 @opindex m68040
26683 @item -m68040
26684 Generate output for a 68040.  This is the default when the compiler is
26685 configured for 68040-based systems.  It is equivalent to
26686 @option{-march=68040}.
26688 This option inhibits the use of 68881/68882 instructions that have to be
26689 emulated by software on the 68040.  Use this option if your 68040 does not
26690 have code to emulate those instructions.
26692 @opindex m68060
26693 @item -m68060
26694 Generate output for a 68060.  This is the default when the compiler is
26695 configured for 68060-based systems.  It is equivalent to
26696 @option{-march=68060}.
26698 This option inhibits the use of 68020 and 68881/68882 instructions that
26699 have to be emulated by software on the 68060.  Use this option if your 68060
26700 does not have code to emulate those instructions.
26702 @opindex mcpu32
26703 @item -mcpu32
26704 Generate output for a CPU32.  This is the default
26705 when the compiler is configured for CPU32-based systems.
26706 It is equivalent to @option{-march=cpu32}.
26708 Use this option for microcontrollers with a
26709 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
26710 68336, 68340, 68341, 68349 and 68360.
26712 @opindex m5200
26713 @item -m5200
26714 Generate output for a 520X ColdFire CPU@.  This is the default
26715 when the compiler is configured for 520X-based systems.
26716 It is equivalent to @option{-mcpu=5206}, and is now deprecated
26717 in favor of that option.
26719 Use this option for microcontroller with a 5200 core, including
26720 the MCF5202, MCF5203, MCF5204 and MCF5206.
26722 @opindex m5206e
26723 @item -m5206e
26724 Generate output for a 5206e ColdFire CPU@.  The option is now
26725 deprecated in favor of the equivalent @option{-mcpu=5206e}.
26727 @opindex m528x
26728 @item -m528x
26729 Generate output for a member of the ColdFire 528X family.
26730 The option is now deprecated in favor of the equivalent
26731 @option{-mcpu=528x}.
26733 @opindex m5307
26734 @item -m5307
26735 Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
26736 in favor of the equivalent @option{-mcpu=5307}.
26738 @opindex m5407
26739 @item -m5407
26740 Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
26741 in favor of the equivalent @option{-mcpu=5407}.
26743 @opindex mcfv4e
26744 @item -mcfv4e
26745 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
26746 This includes use of hardware floating-point instructions.
26747 The option is equivalent to @option{-mcpu=547x}, and is now
26748 deprecated in favor of that option.
26750 @opindex m68020-40
26751 @item -m68020-40
26752 Generate output for a 68040, without using any of the new instructions.
26753 This results in code that can run relatively efficiently on either a
26754 68020/68881 or a 68030 or a 68040.  The generated code does use the
26755 68881 instructions that are emulated on the 68040.
26757 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
26759 @opindex m68020-60
26760 @item -m68020-60
26761 Generate output for a 68060, without using any of the new instructions.
26762 This results in code that can run relatively efficiently on either a
26763 68020/68881 or a 68030 or a 68040.  The generated code does use the
26764 68881 instructions that are emulated on the 68060.
26766 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
26768 @opindex mhard-float
26769 @opindex m68881
26770 @item -mhard-float
26771 @itemx -m68881
26772 Generate floating-point instructions.  This is the default for 68020
26773 and above, and for ColdFire devices that have an FPU@.  It defines the
26774 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
26775 on ColdFire targets.
26777 @opindex msoft-float
26778 @item -msoft-float
26779 Do not generate floating-point instructions; use library calls instead.
26780 This is the default for 68000, 68010, and 68832 targets.  It is also
26781 the default for ColdFire devices that have no FPU.
26783 @opindex mdiv
26784 @opindex mno-div
26785 @item -mdiv
26786 @itemx -mno-div
26787 Generate (do not generate) ColdFire hardware divide and remainder
26788 instructions.  If @option{-march} is used without @option{-mcpu},
26789 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
26790 architectures.  Otherwise, the default is taken from the target CPU
26791 (either the default CPU, or the one specified by @option{-mcpu}).  For
26792 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
26793 @option{-mcpu=5206e}.
26795 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
26797 @opindex mshort
26798 @item -mshort
26799 Consider type @code{int} to be 16 bits wide, like @code{short int}.
26800 Additionally, parameters passed on the stack are also aligned to a
26801 16-bit boundary even on targets whose API mandates promotion to 32-bit.
26803 @opindex mno-short
26804 @item -mno-short
26805 Do not consider type @code{int} to be 16 bits wide.  This is the default.
26807 @opindex mnobitfield
26808 @opindex mno-bitfield
26809 @item -mnobitfield
26810 @itemx -mno-bitfield
26811 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
26812 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
26814 @opindex mbitfield
26815 @item -mbitfield
26816 Do use the bit-field instructions.  The @option{-m68020} option implies
26817 @option{-mbitfield}.  This is the default if you use a configuration
26818 designed for a 68020.
26820 @opindex mrtd
26821 @item -mrtd
26822 Use a different function-calling convention, in which functions
26823 that take a fixed number of arguments return with the @code{rtd}
26824 instruction, which pops their arguments while returning.  This
26825 saves one instruction in the caller since there is no need to pop
26826 the arguments there.
26828 This calling convention is incompatible with the one normally
26829 used on Unix, so you cannot use it if you need to call libraries
26830 compiled with the Unix compiler.
26832 Also, you must provide function prototypes for all functions that
26833 take variable numbers of arguments (including @code{printf});
26834 otherwise incorrect code is generated for calls to those
26835 functions.
26837 In addition, seriously incorrect code results if you call a
26838 function with too many arguments.  (Normally, extra arguments are
26839 harmlessly ignored.)
26841 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
26842 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
26844 The default is @option{-mno-rtd}.
26846 @opindex malign-int
26847 @opindex mno-align-int
26848 @item -malign-int
26849 @itemx -mno-align-int
26850 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
26851 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
26852 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
26853 Aligning variables on 32-bit boundaries produces code that runs somewhat
26854 faster on processors with 32-bit busses at the expense of more memory.
26856 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
26857 aligns structures containing the above types differently than
26858 most published application binary interface specifications for the m68k.
26860 @opindex mpcrel
26861 Use the pc-relative addressing mode of the 68000 directly, instead of
26862 using a global offset table.  At present, this option implies @option{-fpic},
26863 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
26864 not presently supported with @option{-mpcrel}, though this could be supported for
26865 68020 and higher processors.
26867 @opindex mno-strict-align
26868 @opindex mstrict-align
26869 @item -mno-strict-align
26870 @itemx -mstrict-align
26871 Do not (do) assume that unaligned memory references are handled by
26872 the system.
26874 @item -msep-data
26875 Generate code that allows the data segment to be located in a different
26876 area of memory from the text segment.  This allows for execute-in-place in
26877 an environment without virtual memory management.  This option implies
26878 @option{-fPIC}.
26880 @item -mno-sep-data
26881 Generate code that assumes that the data segment follows the text segment.
26882 This is the default.
26884 @item -mid-shared-library
26885 Generate code that supports shared libraries via the library ID method.
26886 This allows for execute-in-place and shared libraries in an environment
26887 without virtual memory management.  This option implies @option{-fPIC}.
26889 @item -mno-id-shared-library
26890 Generate code that doesn't assume ID-based shared libraries are being used.
26891 This is the default.
26893 @item -mshared-library-id=n
26894 Specifies the identification number of the ID-based shared library being
26895 compiled.  Specifying a value of 0 generates more compact code; specifying
26896 other values forces the allocation of that number to the current
26897 library, but is no more space- or time-efficient than omitting this option.
26899 @opindex mxgot
26900 @opindex mno-xgot
26901 @item -mxgot
26902 @itemx -mno-xgot
26903 When generating position-independent code for ColdFire, generate code
26904 that works if the GOT has more than 8192 entries.  This code is
26905 larger and slower than code generated without this option.  On M680x0
26906 processors, this option is not needed; @option{-fPIC} suffices.
26908 GCC normally uses a single instruction to load values from the GOT@.
26909 While this is relatively efficient, it only works if the GOT
26910 is smaller than about 64k.  Anything larger causes the linker
26911 to report an error such as:
26913 @cindex relocation truncated to fit (ColdFire)
26914 @smallexample
26915 relocation truncated to fit: R_68K_GOT16O foobar
26916 @end smallexample
26918 If this happens, you should recompile your code with @option{-mxgot}.
26919 It should then work with very large GOTs.  However, code generated with
26920 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
26921 the value of a global symbol.
26923 Note that some linkers, including newer versions of the GNU linker,
26924 can create multiple GOTs and sort GOT entries.  If you have such a linker,
26925 you should only need to use @option{-mxgot} when compiling a single
26926 object file that accesses more than 8192 GOT entries.  Very few do.
26928 These options have no effect unless GCC is generating
26929 position-independent code.
26931 @opindex mlong-jump-table-offsets
26932 @item -mlong-jump-table-offsets
26933 Use 32-bit offsets in @code{switch} tables.  The default is to use
26934 16-bit offsets.
26936 @end table
26938 @node MCore Options
26939 @subsection MCore Options
26940 @cindex MCore options
26942 These are the @samp{-m} options defined for the Motorola M*Core
26943 processors.
26945 @table @gcctabopt
26947 @opindex mhardlit
26948 @opindex mno-hardlit
26949 @item -mhardlit
26950 @itemx -mno-hardlit
26951 Inline constants into the code stream if it can be done in two
26952 instructions or less.
26954 @opindex mdiv
26955 @opindex mno-div
26956 @item -mdiv
26957 @itemx -mno-div
26958 Use the divide instruction.  (Enabled by default).
26960 @opindex mrelax-immediate
26961 @opindex mno-relax-immediate
26962 @item -mrelax-immediate
26963 @itemx -mno-relax-immediate
26964 Allow arbitrary-sized immediates in bit operations.
26966 @opindex mwide-bitfields
26967 @opindex mno-wide-bitfields
26968 @item -mwide-bitfields
26969 @itemx -mno-wide-bitfields
26970 Always treat bit-fields as @code{int}-sized.
26972 @opindex m4byte-functions
26973 @opindex mno-4byte-functions
26974 @item -m4byte-functions
26975 @itemx -mno-4byte-functions
26976 Force all functions to be aligned to a 4-byte boundary.
26978 @opindex mcallgraph-data
26979 @opindex mno-callgraph-data
26980 @item -mcallgraph-data
26981 @itemx -mno-callgraph-data
26982 Emit callgraph information.
26984 @opindex mslow-bytes
26985 @opindex mno-slow-bytes
26986 @item -mslow-bytes
26987 @itemx -mno-slow-bytes
26988 Prefer word access when reading byte quantities.
26990 @opindex mlittle-endian
26991 @opindex mbig-endian
26992 @item -mlittle-endian
26993 @itemx -mbig-endian
26994 Generate code for a little-endian target.
26996 @opindex m210
26997 @opindex m340
26998 @item -m210
26999 @itemx -m340
27000 Generate code for the 210 processor.
27002 @opindex mno-lsim
27003 @item -mno-lsim
27004 Assume that runtime support has been provided and so omit the
27005 simulator library (@file{libsim.a)} from the linker command line.
27007 @opindex mstack-increment
27008 @item -mstack-increment=@var{size}
27009 Set the maximum amount for a single stack increment operation.  Large
27010 values can increase the speed of programs that contain functions
27011 that need a large amount of stack space, but they can also trigger a
27012 segmentation fault if the stack is extended too much.  The default
27013 value is 0x1000.
27015 @end table
27017 @node MicroBlaze Options
27018 @subsection MicroBlaze Options
27019 @cindex MicroBlaze Options
27021 @table @gcctabopt
27023 @opindex msoft-float
27024 @item -msoft-float
27025 Use software emulation for floating point (default).
27027 @opindex mhard-float
27028 @item -mhard-float
27029 Use hardware floating-point instructions.
27031 @opindex mmemcpy
27032 @item -mmemcpy
27033 Do not optimize block moves, use @code{memcpy}.
27035 @opindex mno-clearbss
27036 @item -mno-clearbss
27037 This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
27039 @opindex mcpu=
27040 @item -mcpu=@var{cpu-type}
27041 Use features of, and schedule code for, the given CPU.
27042 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
27043 where @var{X} is a major version, @var{YY} is the minor version, and
27044 @var{Z} is compatibility code.  Example values are @samp{v3.00.a},
27045 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
27047 @opindex mxl-soft-mul
27048 @item -mxl-soft-mul
27049 Use software multiply emulation (default).
27051 @opindex mxl-soft-div
27052 @item -mxl-soft-div
27053 Use software emulation for divides (default).
27055 @opindex mxl-barrel-shift
27056 @item -mxl-barrel-shift
27057 Use the hardware barrel shifter.
27059 @opindex mxl-pattern-compare
27060 @item -mxl-pattern-compare
27061 Use pattern compare instructions.
27063 @opindex msmall-divides
27064 @item -msmall-divides
27065 Use table lookup optimization for small signed integer divisions.
27067 @opindex mxl-stack-check
27068 @item -mxl-stack-check
27069 This option is deprecated.  Use @option{-fstack-check} instead.
27071 @opindex mxl-gp-opt
27072 @item -mxl-gp-opt
27073 Use GP-relative @code{.sdata}/@code{.sbss} sections.
27075 @opindex mxl-multiply-high
27076 @item -mxl-multiply-high
27077 Use multiply high instructions for high part of 32x32 multiply.
27079 @opindex mxl-float-convert
27080 @item -mxl-float-convert
27081 Use hardware floating-point conversion instructions.
27083 @opindex mxl-float-sqrt
27084 @item -mxl-float-sqrt
27085 Use hardware floating-point square root instruction.
27087 @opindex mbig-endian
27088 @item -mbig-endian
27089 Generate code for a big-endian target.
27091 @opindex mlittle-endian
27092 @item -mlittle-endian
27093 Generate code for a little-endian target.
27095 @opindex mxl-reorder
27096 @item -mxl-reorder
27097 Use reorder instructions (swap and byte reversed load/store).
27099 @item -mxl-mode-@var{app-model}
27100 Select application model @var{app-model}.  Valid models are
27101 @table @samp
27102 @item executable
27103 normal executable (default), uses startup code @file{crt0.o}.
27105 @item xmdstub
27106 for use with Xilinx Microprocessor Debugger (XMD) based
27107 software intrusive debug agent called xmdstub. This uses startup file
27108 @file{crt1.o} and sets the start address of the program to 0x800.
27110 @item bootstrap
27111 for applications that are loaded using a bootloader.
27112 This model uses startup file @file{crt2.o} which does not contain a processor
27113 reset vector handler. This is suitable for transferring control on a
27114 processor reset to the bootloader rather than the application.
27116 @item novectors
27117 for applications that do not require any of the
27118 MicroBlaze vectors. This option may be useful for applications running
27119 within a monitoring application. This model uses @file{crt3.o} as a startup file.
27120 @end table
27122 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
27123 @option{-mxl-mode-@var{app-model}}.
27125 @opindex mpic-data-is-text-relative
27126 @item -mpic-data-is-text-relative
27127 Assume that the displacement between the text and data segments is fixed
27128 at static link time.  This allows data to be referenced by offset from start of
27129 text address instead of GOT since PC-relative addressing is not supported.
27131 @end table
27133 @node MIPS Options
27134 @subsection MIPS Options
27135 @cindex MIPS options
27137 @table @gcctabopt
27139 @opindex EB
27140 @item -EB
27141 Generate big-endian code.
27143 @opindex EL
27144 @item -EL
27145 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
27146 configurations.
27148 @opindex march
27149 @item -march=@var{arch}
27150 Generate code that runs on @var{arch}, which can be the name of a
27151 generic MIPS ISA, or the name of a particular processor.
27152 The ISA names are:
27153 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
27154 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
27155 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
27156 @samp{mips64r5} and @samp{mips64r6}.
27157 The processor names are:
27158 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
27159 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
27160 @samp{5kc}, @samp{5kf},
27161 @samp{20kc},
27162 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
27163 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
27164 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
27165 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
27166 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
27167 @samp{i6400}, @samp{i6500},
27168 @samp{interaptiv},
27169 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
27170 @samp{gs464e}, @samp{gs264e},
27171 @samp{m4k},
27172 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
27173 @samp{m5100}, @samp{m5101},
27174 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
27175 @samp{orion},
27176 @samp{p5600}, @samp{p6600},
27177 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
27178 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
27179 @samp{r6000}, @samp{r8000},
27180 @samp{rm7000}, @samp{rm9000},
27181 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
27182 @samp{sb1},
27183 @samp{sr71000},
27184 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
27185 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
27186 @samp{xlr} and @samp{xlp}.
27187 The special value @samp{from-abi} selects the
27188 most compatible architecture for the selected ABI (that is,
27189 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
27191 The native Linux/GNU toolchain also supports the value @samp{native},
27192 which selects the best architecture option for the host processor.
27193 @option{-march=native} has no effect if GCC does not recognize
27194 the processor.
27196 In processor names, a final @samp{000} can be abbreviated as @samp{k}
27197 (for example, @option{-march=r2k}).  Prefixes are optional, and
27198 @samp{vr} may be written @samp{r}.
27200 Names of the form @samp{@var{n}f2_1} refer to processors with
27201 FPUs clocked at half the rate of the core, names of the form
27202 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
27203 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
27204 processors with FPUs clocked a ratio of 3:2 with respect to the core.
27205 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
27206 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
27207 accepted as synonyms for @samp{@var{n}f1_1}.
27209 GCC defines two macros based on the value of this option.  The first
27210 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
27211 a string.  The second has the form @code{_MIPS_ARCH_@var{foo}},
27212 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
27213 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
27214 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
27216 Note that the @code{_MIPS_ARCH} macro uses the processor names given
27217 above.  In other words, it has the full prefix and does not
27218 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
27219 the macro names the resolved architecture (either @code{"mips1"} or
27220 @code{"mips3"}).  It names the default architecture when no
27221 @option{-march} option is given.
27223 @opindex mtune
27224 @item -mtune=@var{arch}
27225 Optimize for @var{arch}.  Among other things, this option controls
27226 the way instructions are scheduled, and the perceived cost of arithmetic
27227 operations.  The list of @var{arch} values is the same as for
27228 @option{-march}.
27230 When this option is not used, GCC optimizes for the processor
27231 specified by @option{-march}.  By using @option{-march} and
27232 @option{-mtune} together, it is possible to generate code that
27233 runs on a family of processors, but optimize the code for one
27234 particular member of that family.
27236 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
27237 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
27238 @option{-march} ones described above.
27240 @opindex mips1
27241 @item -mips1
27242 Equivalent to @option{-march=mips1}.
27244 @opindex mips2
27245 @item -mips2
27246 Equivalent to @option{-march=mips2}.
27248 @opindex mips3
27249 @item -mips3
27250 Equivalent to @option{-march=mips3}.
27252 @opindex mips4
27253 @item -mips4
27254 Equivalent to @option{-march=mips4}.
27256 @opindex mips32
27257 @item -mips32
27258 Equivalent to @option{-march=mips32}.
27260 @opindex mips32r3
27261 @item -mips32r3
27262 Equivalent to @option{-march=mips32r3}.
27264 @opindex mips32r5
27265 @item -mips32r5
27266 Equivalent to @option{-march=mips32r5}.
27268 @opindex mips32r6
27269 @item -mips32r6
27270 Equivalent to @option{-march=mips32r6}.
27272 @opindex mips64
27273 @item -mips64
27274 Equivalent to @option{-march=mips64}.
27276 @opindex mips64r2
27277 @item -mips64r2
27278 Equivalent to @option{-march=mips64r2}.
27280 @opindex mips64r3
27281 @item -mips64r3
27282 Equivalent to @option{-march=mips64r3}.
27284 @opindex mips64r5
27285 @item -mips64r5
27286 Equivalent to @option{-march=mips64r5}.
27288 @opindex mips64r6
27289 @item -mips64r6
27290 Equivalent to @option{-march=mips64r6}.
27292 @opindex mips16
27293 @opindex mno-mips16
27294 @item -mips16
27295 @itemx -mno-mips16
27296 Generate (do not generate) MIPS16 code.  If GCC is targeting a
27297 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
27299 MIPS16 code generation can also be controlled on a per-function basis
27300 by means of @code{mips16} and @code{nomips16} attributes.
27301 @xref{Function Attributes}, for more information.
27303 @opindex mmips16e2
27304 @opindex mno-mips16e2
27305 @item -mmips16e2
27306 @itemx -mno-mips16e2
27307 Use (do not use) the MIPS16e2 ASE.  This option modifies the behavior
27308 of the @option{-mips16} option such that it targets the MIPS16e2 ASE@.
27310 @opindex mflip-mips16
27311 @item -mflip-mips16
27312 Generate MIPS16 code on alternating functions.  This option is provided
27313 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
27314 not intended for ordinary use in compiling user code.
27316 @opindex minterlink-compressed
27317 @opindex mno-interlink-compressed
27318 @item -minterlink-compressed
27319 @itemx -mno-interlink-compressed
27320 Require (do not require) that code using the standard (uncompressed) MIPS ISA
27321 be link-compatible with MIPS16 and microMIPS code, and vice versa.
27323 For example, code using the standard ISA encoding cannot jump directly
27324 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
27325 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
27326 knows that the target of the jump is not compressed.
27328 @opindex minterlink-mips16
27329 @opindex mno-interlink-mips16
27330 @item -minterlink-mips16
27331 @itemx -mno-interlink-mips16
27332 Aliases of @option{-minterlink-compressed} and
27333 @option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
27334 and are retained for backwards compatibility.
27336 @opindex mabi=32
27337 @opindex mabi=o64
27338 @opindex mabi=n32
27339 @opindex mabi=64
27340 @opindex mabi=eabi
27341 @item -mabi=32
27342 @itemx -mabi=o64
27343 @itemx -mabi=n32
27344 @itemx -mabi=64
27345 @itemx -mabi=eabi
27346 Generate code for the given ABI@.
27348 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
27349 generates 64-bit code when you select a 64-bit architecture, but you
27350 can use @option{-mgp32} to get 32-bit code instead.
27352 For information about the O64 ABI, see
27353 @uref{https://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
27355 GCC supports a variant of the o32 ABI in which floating-point registers
27356 are 64 rather than 32 bits wide.  You can select this combination with
27357 @option{-mabi=32} @option{-mfp64}.  This ABI relies on the @code{mthc1}
27358 and @code{mfhc1} instructions and is therefore only supported for
27359 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
27361 The register assignments for arguments and return values remain the
27362 same, but each scalar value is passed in a single 64-bit register
27363 rather than a pair of 32-bit registers.  For example, scalar
27364 floating-point values are returned in @samp{$f0} only, not a
27365 @samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
27366 remains the same in that the even-numbered double-precision registers
27367 are saved.
27369 Two additional variants of the o32 ABI are supported to enable
27370 a transition from 32-bit to 64-bit registers.  These are FPXX
27371 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
27372 The FPXX extension mandates that all code must execute correctly
27373 when run using 32-bit or 64-bit registers.  The code can be interlinked
27374 with either FP32 or FP64, but not both.
27375 The FP64A extension is similar to the FP64 extension but forbids the
27376 use of odd-numbered single-precision registers.  This can be used
27377 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
27378 processors and allows both FP32 and FP64A code to interlink and
27379 run in the same process without changing FPU modes.
27381 @opindex mabicalls
27382 @opindex mno-abicalls
27383 @item -mabicalls
27384 @itemx -mno-abicalls
27385 Generate (do not generate) code that is suitable for SVR4-style
27386 dynamic objects.  @option{-mabicalls} is the default for SVR4-based
27387 systems.
27389 @item -mshared
27390 @itemx -mno-shared
27391 Generate (do not generate) code that is fully position-independent,
27392 and that can therefore be linked into shared libraries.  This option
27393 only affects @option{-mabicalls}.
27395 All @option{-mabicalls} code has traditionally been position-independent,
27396 regardless of options like @option{-fPIC} and @option{-fpic}.  However,
27397 as an extension, the GNU toolchain allows executables to use absolute
27398 accesses for locally-binding symbols.  It can also use shorter GP
27399 initialization sequences and generate direct calls to locally-defined
27400 functions.  This mode is selected by @option{-mno-shared}.
27402 @option{-mno-shared} depends on binutils 2.16 or higher and generates
27403 objects that can only be linked by the GNU linker.  However, the option
27404 does not affect the ABI of the final executable; it only affects the ABI
27405 of relocatable objects.  Using @option{-mno-shared} generally makes
27406 executables both smaller and quicker.
27408 @option{-mshared} is the default.
27410 @opindex mplt
27411 @opindex mno-plt
27412 @item -mplt
27413 @itemx -mno-plt
27414 Assume (do not assume) that the static and dynamic linkers
27415 support PLTs and copy relocations.  This option only affects
27416 @option{-mno-shared -mabicalls}.  For the n64 ABI, this option
27417 has no effect without @option{-msym32}.
27419 You can make @option{-mplt} the default by configuring
27420 GCC with @option{--with-mips-plt}.  The default is
27421 @option{-mno-plt} otherwise.
27423 @opindex mxgot
27424 @opindex mno-xgot
27425 @item -mxgot
27426 @itemx -mno-xgot
27427 Lift (do not lift) the usual restrictions on the size of the global
27428 offset table.
27430 GCC normally uses a single instruction to load values from the GOT@.
27431 While this is relatively efficient, it only works if the GOT
27432 is smaller than about 64k.  Anything larger causes the linker
27433 to report an error such as:
27435 @cindex relocation truncated to fit (MIPS)
27436 @smallexample
27437 relocation truncated to fit: R_MIPS_GOT16 foobar
27438 @end smallexample
27440 If this happens, you should recompile your code with @option{-mxgot}.
27441 This works with very large GOTs, although the code is also
27442 less efficient, since it takes three instructions to fetch the
27443 value of a global symbol.
27445 Note that some linkers can create multiple GOTs.  If you have such a
27446 linker, you should only need to use @option{-mxgot} when a single object
27447 file accesses more than 64k's worth of GOT entries.  Very few do.
27449 These options have no effect unless GCC is generating position
27450 independent code.
27452 @opindex mgp32
27453 @item -mgp32
27454 Assume that general-purpose registers are 32 bits wide.
27456 @opindex mgp64
27457 @item -mgp64
27458 Assume that general-purpose registers are 64 bits wide.
27460 @opindex mfp32
27461 @item -mfp32
27462 Assume that floating-point registers are 32 bits wide.
27464 @opindex mfp64
27465 @item -mfp64
27466 Assume that floating-point registers are 64 bits wide.
27468 @opindex mfpxx
27469 @item -mfpxx
27470 Do not assume the width of floating-point registers.
27472 @opindex mhard-float
27473 @item -mhard-float
27474 Use floating-point coprocessor instructions.
27476 @opindex msoft-float
27477 @item -msoft-float
27478 Do not use floating-point coprocessor instructions.  Implement
27479 floating-point calculations using library calls instead.
27481 @opindex mno-float
27482 @item -mno-float
27483 Equivalent to @option{-msoft-float}, but additionally asserts that the
27484 program being compiled does not perform any floating-point operations.
27485 This option is presently supported only by some bare-metal MIPS
27486 configurations, where it may select a special set of libraries
27487 that lack all floating-point support (including, for example, the
27488 floating-point @code{printf} formats).  
27489 If code compiled with @option{-mno-float} accidentally contains
27490 floating-point operations, it is likely to suffer a link-time
27491 or run-time failure.
27493 @opindex msingle-float
27494 @item -msingle-float
27495 Assume that the floating-point coprocessor only supports single-precision
27496 operations.
27498 @opindex mdouble-float
27499 @item -mdouble-float
27500 Assume that the floating-point coprocessor supports double-precision
27501 operations.  This is the default.
27503 @opindex modd-spreg
27504 @opindex mno-odd-spreg
27505 @item -modd-spreg
27506 @itemx -mno-odd-spreg
27507 Enable the use of odd-numbered single-precision floating-point registers
27508 for the o32 ABI.  This is the default for processors that are known to
27509 support these registers.  When using the o32 FPXX ABI, @option{-mno-odd-spreg}
27510 is set by default.
27512 @opindex mabs=2008
27513 @opindex mabs=legacy
27514 @item -mabs=2008
27515 @itemx -mabs=legacy
27516 These options control the treatment of the special not-a-number (NaN)
27517 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
27518 @code{neg.@i{fmt}} machine instructions.
27520 By default or when @option{-mabs=legacy} is used the legacy
27521 treatment is selected.  In this case these instructions are considered
27522 arithmetic and avoided where correct operation is required and the
27523 input operand might be a NaN.  A longer sequence of instructions that
27524 manipulate the sign bit of floating-point datum manually is used
27525 instead unless the @option{-ffinite-math-only} option has also been
27526 specified.
27528 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment.  In
27529 this case these instructions are considered non-arithmetic and therefore
27530 operating correctly in all cases, including in particular where the
27531 input operand is a NaN.  These instructions are therefore always used
27532 for the respective operations.
27534 @opindex mnan=2008
27535 @opindex mnan=legacy
27536 @item -mnan=2008
27537 @itemx -mnan=legacy
27538 These options control the encoding of the special not-a-number (NaN)
27539 IEEE 754 floating-point data.
27541 The @option{-mnan=legacy} option selects the legacy encoding.  In this
27542 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
27543 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
27544 by the first bit of their trailing significand field being 1.
27546 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding.  In
27547 this case qNaNs are denoted by the first bit of their trailing
27548 significand field being 1, whereas sNaNs are denoted by the first bit of
27549 their trailing significand field being 0.
27551 The default is @option{-mnan=legacy} unless GCC has been configured with
27552 @option{--with-nan=2008}.
27554 @opindex mllsc
27555 @opindex mno-llsc
27556 @item -mllsc
27557 @itemx -mno-llsc
27558 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
27559 implement atomic memory built-in functions.  When neither option is
27560 specified, GCC uses the instructions if the target architecture
27561 supports them.
27563 @option{-mllsc} is useful if the runtime environment can emulate the
27564 instructions and @option{-mno-llsc} can be useful when compiling for
27565 nonstandard ISAs.  You can make either option the default by
27566 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
27567 respectively.  @option{--with-llsc} is the default for some
27568 configurations; see the installation documentation for details.
27570 @opindex mdsp
27571 @opindex mno-dsp
27572 @item -mdsp
27573 @itemx -mno-dsp
27574 Use (do not use) revision 1 of the MIPS DSP ASE@.
27575 @xref{MIPS DSP Built-in Functions}.  This option defines the
27576 preprocessor macro @code{__mips_dsp}.  It also defines
27577 @code{__mips_dsp_rev} to 1.
27579 @opindex mdspr2
27580 @opindex mno-dspr2
27581 @item -mdspr2
27582 @itemx -mno-dspr2
27583 Use (do not use) revision 2 of the MIPS DSP ASE@.
27584 @xref{MIPS DSP Built-in Functions}.  This option defines the
27585 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
27586 It also defines @code{__mips_dsp_rev} to 2.
27588 @opindex msmartmips
27589 @opindex mno-smartmips
27590 @item -msmartmips
27591 @itemx -mno-smartmips
27592 Use (do not use) the MIPS SmartMIPS ASE.
27594 @opindex mpaired-single
27595 @opindex mno-paired-single
27596 @item -mpaired-single
27597 @itemx -mno-paired-single
27598 Use (do not use) paired-single floating-point instructions.
27599 @xref{MIPS Paired-Single Support}.  This option requires
27600 hardware floating-point support to be enabled.
27602 @opindex mdmx
27603 @opindex mno-mdmx
27604 @item -mdmx
27605 @itemx -mno-mdmx
27606 Use (do not use) MIPS Digital Media Extension instructions.
27607 This option can only be used when generating 64-bit code and requires
27608 hardware floating-point support to be enabled.
27610 @opindex mips3d
27611 @opindex mno-mips3d
27612 @item -mips3d
27613 @itemx -mno-mips3d
27614 Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
27615 The option @option{-mips3d} implies @option{-mpaired-single}.
27617 @opindex mmicromips
27618 @opindex mno-mmicromips
27619 @item -mmicromips
27620 @itemx -mno-micromips
27621 Generate (do not generate) microMIPS code.
27623 MicroMIPS code generation can also be controlled on a per-function basis
27624 by means of @code{micromips} and @code{nomicromips} attributes.
27625 @xref{Function Attributes}, for more information.
27627 @opindex mmt
27628 @opindex mno-mt
27629 @item -mmt
27630 @itemx -mno-mt
27631 Use (do not use) MT Multithreading instructions.
27633 @opindex mmcu
27634 @opindex mno-mcu
27635 @item -mmcu
27636 @itemx -mno-mcu
27637 Use (do not use) the MIPS MCU ASE instructions.
27639 @opindex meva
27640 @opindex mno-eva
27641 @item -meva
27642 @itemx -mno-eva
27643 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
27645 @opindex mvirt
27646 @opindex mno-virt
27647 @item -mvirt
27648 @itemx -mno-virt
27649 Use (do not use) the MIPS Virtualization (VZ) instructions.
27651 @opindex mxpa
27652 @opindex mno-xpa
27653 @item -mxpa
27654 @itemx -mno-xpa
27655 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
27657 @opindex mcrc
27658 @opindex mno-crc
27659 @item -mcrc
27660 @itemx -mno-crc
27661 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
27663 @opindex mginv
27664 @opindex mno-ginv
27665 @item -mginv
27666 @itemx -mno-ginv
27667 Use (do not use) the MIPS Global INValidate (GINV) instructions.
27669 @opindex mloongson-mmi
27670 @opindex mno-loongson-mmi
27671 @item -mloongson-mmi
27672 @itemx -mno-loongson-mmi
27673 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
27675 @opindex mloongson-ext
27676 @opindex mno-loongson-ext
27677 @item -mloongson-ext
27678 @itemx -mno-loongson-ext
27679 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
27681 @opindex mloongson-ext2
27682 @opindex mno-loongson-ext2
27683 @item -mloongson-ext2
27684 @itemx -mno-loongson-ext2
27685 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
27687 @opindex mlong64
27688 @item -mlong64
27689 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
27690 an explanation of the default and the way that the pointer size is
27691 determined.
27693 @opindex mlong32
27694 @item -mlong32
27695 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
27697 The default size of @code{int}s, @code{long}s and pointers depends on
27698 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
27699 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
27700 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
27701 or the same size as integer registers, whichever is smaller.
27703 @opindex msym32
27704 @opindex mno-sym32
27705 @item -msym32
27706 @itemx -mno-sym32
27707 Assume (do not assume) that all symbols have 32-bit values, regardless
27708 of the selected ABI@.  This option is useful in combination with
27709 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
27710 to generate shorter and faster references to symbolic addresses.
27712 @opindex G
27713 @item -G @var{num}
27714 Put definitions of externally-visible data in a small data section
27715 if that data is no bigger than @var{num} bytes.  GCC can then generate
27716 more efficient accesses to the data; see @option{-mgpopt} for details.
27718 The default @option{-G} option depends on the configuration.
27720 @opindex mlocal-sdata
27721 @opindex mno-local-sdata
27722 @item -mlocal-sdata
27723 @itemx -mno-local-sdata
27724 Extend (do not extend) the @option{-G} behavior to local data too,
27725 such as to static variables in C@.  @option{-mlocal-sdata} is the
27726 default for all configurations.
27728 If the linker complains that an application is using too much small data,
27729 you might want to try rebuilding the less performance-critical parts with
27730 @option{-mno-local-sdata}.  You might also want to build large
27731 libraries with @option{-mno-local-sdata}, so that the libraries leave
27732 more room for the main program.
27734 @opindex mextern-sdata
27735 @opindex mno-extern-sdata
27736 @item -mextern-sdata
27737 @itemx -mno-extern-sdata
27738 Assume (do not assume) that externally-defined data is in
27739 a small data section if the size of that data is within the @option{-G} limit.
27740 @option{-mextern-sdata} is the default for all configurations.
27742 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
27743 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
27744 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
27745 is placed in a small data section.  If @var{Var} is defined by another
27746 module, you must either compile that module with a high-enough
27747 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
27748 definition.  If @var{Var} is common, you must link the application
27749 with a high-enough @option{-G} setting.
27751 The easiest way of satisfying these restrictions is to compile
27752 and link every module with the same @option{-G} option.  However,
27753 you may wish to build a library that supports several different
27754 small data limits.  You can do this by compiling the library with
27755 the highest supported @option{-G} setting and additionally using
27756 @option{-mno-extern-sdata} to stop the library from making assumptions
27757 about externally-defined data.
27759 @opindex mgpopt
27760 @opindex mno-gpopt
27761 @item -mgpopt
27762 @itemx -mno-gpopt
27763 Use (do not use) GP-relative accesses for symbols that are known to be
27764 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
27765 @option{-mextern-sdata}.  @option{-mgpopt} is the default for all
27766 configurations.
27768 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
27769 might not hold the value of @code{_gp}.  For example, if the code is
27770 part of a library that might be used in a boot monitor, programs that
27771 call boot monitor routines pass an unknown value in @code{$gp}.
27772 (In such situations, the boot monitor itself is usually compiled
27773 with @option{-G0}.)
27775 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
27776 @option{-mno-extern-sdata}.
27778 @opindex membedded-data
27779 @opindex mno-embedded-data
27780 @item -membedded-data
27781 @itemx -mno-embedded-data
27782 Allocate variables to the read-only data section first if possible, then
27783 next in the small data section if possible, otherwise in data.  This gives
27784 slightly slower code than the default, but reduces the amount of RAM required
27785 when executing, and thus may be preferred for some embedded systems.
27787 @opindex muninit-const-in-rodata
27788 @opindex mno-uninit-const-in-rodata
27789 @item -muninit-const-in-rodata
27790 @itemx -mno-uninit-const-in-rodata
27791 Put uninitialized @code{const} variables in the read-only data section.
27792 This option is only meaningful in conjunction with @option{-membedded-data}.
27794 @opindex mcode-readable
27795 @item -mcode-readable=@var{setting}
27796 Specify whether GCC may generate code that reads from executable sections.
27797 There are three possible settings:
27799 @table @gcctabopt
27800 @item -mcode-readable=yes
27801 Instructions may freely access executable sections.  This is the
27802 default setting.
27804 @item -mcode-readable=pcrel
27805 MIPS16 PC-relative load instructions can access executable sections,
27806 but other instructions must not do so.  This option is useful on 4KSc
27807 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
27808 It is also useful on processors that can be configured to have a dual
27809 instruction/data SRAM interface and that, like the M4K, automatically
27810 redirect PC-relative loads to the instruction RAM.
27812 @item -mcode-readable=no
27813 Instructions must not access executable sections.  This option can be
27814 useful on targets that are configured to have a dual instruction/data
27815 SRAM interface but that (unlike the M4K) do not automatically redirect
27816 PC-relative loads to the instruction RAM.
27817 @end table
27819 @opindex msplit-addresses
27820 @opindex mno-split-addresses
27821 @item -msplit-addresses
27822 @itemx -mno-split-addresses
27823 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
27824 relocation operators.  This option has been superseded by
27825 @option{-mexplicit-relocs} but is retained for backwards compatibility.
27827 @opindex mexplicit-relocs
27828 @opindex mno-explicit-relocs
27829 @item -mexplicit-relocs
27830 @itemx -mno-explicit-relocs
27831 Use (do not use) assembler relocation operators when dealing with symbolic
27832 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
27833 is to use assembler macros instead.
27835 @option{-mexplicit-relocs} is the default if GCC was configured
27836 to use an assembler that supports relocation operators.
27838 @opindex mcheck-zero-division
27839 @opindex mno-check-zero-division
27840 @item -mcheck-zero-division
27841 @itemx -mno-check-zero-division
27842 Trap (do not trap) on integer division by zero.
27844 The default is @option{-mcheck-zero-division}.
27846 @opindex mdivide-traps
27847 @opindex mdivide-breaks
27848 @item -mdivide-traps
27849 @itemx -mdivide-breaks
27850 MIPS systems check for division by zero by generating either a
27851 conditional trap or a break instruction.  Using traps results in
27852 smaller code, but is only supported on MIPS II and later.  Also, some
27853 versions of the Linux kernel have a bug that prevents trap from
27854 generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
27855 allow conditional traps on architectures that support them and
27856 @option{-mdivide-breaks} to force the use of breaks.
27858 The default is usually @option{-mdivide-traps}, but this can be
27859 overridden at configure time using @option{--with-divide=breaks}.
27860 Divide-by-zero checks can be completely disabled using
27861 @option{-mno-check-zero-division}.
27863 @opindex mload-store-pairs
27864 @opindex mno-load-store-pairs
27865 @item -mload-store-pairs
27866 @itemx -mno-load-store-pairs
27867 Enable (disable) an optimization that pairs consecutive load or store
27868 instructions to enable load/store bonding.  This option is enabled by
27869 default but only takes effect when the selected architecture is known
27870 to support bonding.
27872 @opindex munaligned-access
27873 @opindex mno-unaligned-access
27874 @item -munaligned-access
27875 @itemx -mno-unaligned-access
27876 Enable (disable) direct unaligned access for MIPS Release 6.
27877 MIPSr6 requires load/store unaligned-access support,
27878 by hardware or trap&emulate.
27879 So @option{-mno-unaligned-access} may be needed by kernel.
27881 @opindex mmemcpy
27882 @opindex mno-memcpy
27883 @item -mmemcpy
27884 @itemx -mno-memcpy
27885 Force (do not force) the use of @code{memcpy} for non-trivial block
27886 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
27887 most constant-sized copies.
27889 @opindex mlong-calls
27890 @opindex mno-long-calls
27891 @item -mlong-calls
27892 @itemx -mno-long-calls
27893 Disable (do not disable) use of the @code{jal} instruction.  Calling
27894 functions using @code{jal} is more efficient but requires the caller
27895 and callee to be in the same 256 megabyte segment.
27897 This option has no effect on abicalls code.  The default is
27898 @option{-mno-long-calls}.
27900 @opindex mmad
27901 @opindex mno-mad
27902 @item -mmad
27903 @itemx -mno-mad
27904 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
27905 instructions, as provided by the R4650 ISA@.
27907 @opindex mimadd
27908 @opindex mno-imadd
27909 @item -mimadd
27910 @itemx -mno-imadd
27911 Enable (disable) use of the @code{madd} and @code{msub} integer
27912 instructions.  The default is @option{-mimadd} on architectures
27913 that support @code{madd} and @code{msub} except for the 74k 
27914 architecture where it was found to generate slower code.
27916 @opindex mfused-madd
27917 @opindex mno-fused-madd
27918 @item -mfused-madd
27919 @itemx -mno-fused-madd
27920 Enable (disable) use of the floating-point multiply-accumulate
27921 instructions, when they are available.  The default is
27922 @option{-mfused-madd}.
27924 On the R8000 CPU when multiply-accumulate instructions are used,
27925 the intermediate product is calculated to infinite precision
27926 and is not subject to the FCSR Flush to Zero bit.  This may be
27927 undesirable in some circumstances.  On other processors the result
27928 is numerically identical to the equivalent computation using
27929 separate multiply, add, subtract and negate instructions.
27931 @opindex nocpp
27932 @item -nocpp
27933 Tell the MIPS assembler to not run its preprocessor over user
27934 assembler files (with a @samp{.s} suffix) when assembling them.
27936 @opindex mfix-24k
27937 @opindex mno-fix-24k
27938 @item -mfix-24k
27939 @itemx -mno-fix-24k
27940 Work around the 24K E48 (lost data on stores during refill) errata.
27941 The workarounds are implemented by the assembler rather than by GCC@.
27943 @opindex mfix-r4000
27944 @opindex mno-fix-r4000
27945 @item -mfix-r4000
27946 @itemx -mno-fix-r4000
27947 Work around certain R4000 CPU errata:
27948 @itemize @minus
27949 @item
27950 A double-word or a variable shift may give an incorrect result if executed
27951 immediately after starting an integer division.
27952 @item
27953 A double-word or a variable shift may give an incorrect result if executed
27954 while an integer multiplication is in progress.
27955 @item
27956 An integer division may give an incorrect result if started in a delay slot
27957 of a taken branch or a jump.
27958 @end itemize
27960 @opindex mfix-r4400
27961 @opindex mno-fix-r4400
27962 @item -mfix-r4400
27963 @itemx -mno-fix-r4400
27964 Work around certain R4400 CPU errata:
27965 @itemize @minus
27966 @item
27967 A double-word or a variable shift may give an incorrect result if executed
27968 immediately after starting an integer division.
27969 @end itemize
27971 @opindex mfix-r10000
27972 @opindex mno-fix-r10000
27973 @item -mfix-r10000
27974 @itemx -mno-fix-r10000
27975 Work around certain R10000 errata:
27976 @itemize @minus
27977 @item
27978 @code{ll}/@code{sc} sequences may not behave atomically on revisions
27979 prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
27980 @end itemize
27982 This option can only be used if the target architecture supports
27983 branch-likely instructions.  @option{-mfix-r10000} is the default when
27984 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
27985 otherwise.
27987 @opindex mfix-r5900
27988 @item -mfix-r5900
27989 @itemx -mno-fix-r5900
27990 Do not attempt to schedule the preceding instruction into the delay slot
27991 of a branch instruction placed at the end of a short loop of six
27992 instructions or fewer and always schedule a @code{nop} instruction there
27993 instead.  The short loop bug under certain conditions causes loops to
27994 execute only once or twice, due to a hardware bug in the R5900 chip.  The
27995 workaround is implemented by the assembler rather than by GCC@.
27997 @opindex mfix-rm7000
27998 @item -mfix-rm7000
27999 @itemx -mno-fix-rm7000
28000 Work around the RM7000 @code{dmult}/@code{dmultu} errata.  The
28001 workarounds are implemented by the assembler rather than by GCC@.
28003 @opindex mfix-vr4120
28004 @item -mfix-vr4120
28005 @itemx -mno-fix-vr4120
28006 Work around certain VR4120 errata:
28007 @itemize @minus
28008 @item
28009 @code{dmultu} does not always produce the correct result.
28010 @item
28011 @code{div} and @code{ddiv} do not always produce the correct result if one
28012 of the operands is negative.
28013 @end itemize
28014 The workarounds for the division errata rely on special functions in
28015 @file{libgcc.a}.  At present, these functions are only provided by
28016 the @code{mips64vr*-elf} configurations.
28018 Other VR4120 errata require a NOP to be inserted between certain pairs of
28019 instructions.  These errata are handled by the assembler, not by GCC itself.
28021 @opindex mfix-vr4130
28022 @item -mfix-vr4130
28023 Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
28024 workarounds are implemented by the assembler rather than by GCC,
28025 although GCC avoids using @code{mflo} and @code{mfhi} if the
28026 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
28027 instructions are available instead.
28029 @opindex mfix-sb1
28030 @item -mfix-sb1
28031 @itemx -mno-fix-sb1
28032 Work around certain SB-1 CPU core errata.
28033 (This flag currently works around the SB-1 revision 2
28034 ``F1'' and ``F2'' floating-point errata.)
28036 @opindex mr10k-cache-barrier
28037 @item -mr10k-cache-barrier=@var{setting}
28038 Specify whether GCC should insert cache barriers to avoid the
28039 side effects of speculation on R10K processors.
28041 In common with many processors, the R10K tries to predict the outcome
28042 of a conditional branch and speculatively executes instructions from
28043 the ``taken'' branch.  It later aborts these instructions if the
28044 predicted outcome is wrong.  However, on the R10K, even aborted
28045 instructions can have side effects.
28047 This problem only affects kernel stores and, depending on the system,
28048 kernel loads.  As an example, a speculatively-executed store may load
28049 the target memory into cache and mark the cache line as dirty, even if
28050 the store itself is later aborted.  If a DMA operation writes to the
28051 same area of memory before the ``dirty'' line is flushed, the cached
28052 data overwrites the DMA-ed data.  See the R10K processor manual
28053 for a full description, including other potential problems.
28055 One workaround is to insert cache barrier instructions before every memory
28056 access that might be speculatively executed and that might have side
28057 effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
28058 controls GCC's implementation of this workaround.  It assumes that
28059 aborted accesses to any byte in the following regions does not have
28060 side effects:
28062 @enumerate
28063 @item
28064 the memory occupied by the current function's stack frame;
28066 @item
28067 the memory occupied by an incoming stack argument;
28069 @item
28070 the memory occupied by an object with a link-time-constant address.
28071 @end enumerate
28073 It is the kernel's responsibility to ensure that speculative
28074 accesses to these regions are indeed safe.
28076 If the input program contains a function declaration such as:
28078 @smallexample
28079 void foo (void);
28080 @end smallexample
28082 then the implementation of @code{foo} must allow @code{j foo} and
28083 @code{jal foo} to be executed speculatively.  GCC honors this
28084 restriction for functions it compiles itself.  It expects non-GCC
28085 functions (such as hand-written assembly code) to do the same.
28087 The option has three forms:
28089 @table @gcctabopt
28090 @item -mr10k-cache-barrier=load-store
28091 Insert a cache barrier before a load or store that might be
28092 speculatively executed and that might have side effects even
28093 if aborted.
28095 @item -mr10k-cache-barrier=store
28096 Insert a cache barrier before a store that might be speculatively
28097 executed and that might have side effects even if aborted.
28099 @item -mr10k-cache-barrier=none
28100 Disable the insertion of cache barriers.  This is the default setting.
28101 @end table
28103 @opindex mflush-func
28104 @item -mflush-func=@var{func}
28105 @itemx -mno-flush-func
28106 Specifies the function to call to flush the I and D caches, or to not
28107 call any such function.  If called, the function must take the same
28108 arguments as the common @code{_flush_func}, that is, the address of the
28109 memory range for which the cache is being flushed, the size of the
28110 memory range, and the number 3 (to flush both caches).  The default
28111 depends on the target GCC was configured for, but commonly is either
28112 @code{_flush_func} or @code{__cpu_flush}.
28114 @opindex mbranch-cost
28115 @item mbranch-cost=@var{num}
28116 Set the cost of branches to roughly @var{num} ``simple'' instructions.
28117 This cost is only a heuristic and is not guaranteed to produce
28118 consistent results across releases.  A zero cost redundantly selects
28119 the default, which is based on the @option{-mtune} setting.
28121 @opindex mbranch-likely
28122 @opindex mno-branch-likely
28123 @item -mbranch-likely
28124 @itemx -mno-branch-likely
28125 Enable or disable use of Branch Likely instructions, regardless of the
28126 default for the selected architecture.  By default, Branch Likely
28127 instructions may be generated if they are supported by the selected
28128 architecture.  An exception is for the MIPS32 and MIPS64 architectures
28129 and processors that implement those architectures; for those, Branch
28130 Likely instructions are not be generated by default because the MIPS32
28131 and MIPS64 architectures specifically deprecate their use.
28133 @opindex mcompact-branches=never
28134 @opindex mcompact-branches=optimal
28135 @opindex mcompact-branches=always
28136 @item -mcompact-branches=never
28137 @itemx -mcompact-branches=optimal
28138 @itemx -mcompact-branches=always
28139 These options control which form of branches will be generated.  The
28140 default is @option{-mcompact-branches=optimal}.
28142 The @option{-mcompact-branches=never} option ensures that compact branch
28143 instructions will never be generated.
28145 The @option{-mcompact-branches=always} option ensures that a compact
28146 branch instruction will be generated if available for MIPS Release 6 onwards.
28147 If a compact branch instruction is not available (or pre-R6),
28148 a delay slot form of the branch will be used instead.
28150 If it is used for MIPS16/microMIPS targets, it will be just ignored now.
28151 The behaviour for MIPS16/microMIPS may change in future,
28152 since they do have some compact branch instructions.
28154 The @option{-mcompact-branches=optimal} option will cause a delay slot
28155 branch to be used if one is available in the current ISA and the delay
28156 slot is successfully filled.  If the delay slot is not filled, a compact
28157 branch will be chosen if one is available.
28159 @opindex mfp-exceptions
28160 @item -mfp-exceptions
28161 @itemx -mno-fp-exceptions
28162 Specifies whether FP exceptions are enabled.  This affects how
28163 FP instructions are scheduled for some processors.
28164 The default is that FP exceptions are
28165 enabled.
28167 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
28168 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
28169 FP pipe.
28171 @opindex mvr4130-align
28172 @item -mvr4130-align
28173 @itemx -mno-vr4130-align
28174 The VR4130 pipeline is two-way superscalar, but can only issue two
28175 instructions together if the first one is 8-byte aligned.  When this
28176 option is enabled, GCC aligns pairs of instructions that it
28177 thinks should execute in parallel.
28179 This option only has an effect when optimizing for the VR4130.
28180 It normally makes code faster, but at the expense of making it bigger.
28181 It is enabled by default at optimization level @option{-O3}.
28183 @opindex msynci
28184 @item -msynci
28185 @itemx -mno-synci
28186 Enable (disable) generation of @code{synci} instructions on
28187 architectures that support it.  The @code{synci} instructions (if
28188 enabled) are generated when @code{__builtin___clear_cache} is
28189 compiled.
28191 This option defaults to @option{-mno-synci}, but the default can be
28192 overridden by configuring GCC with @option{--with-synci}.
28194 When compiling code for single processor systems, it is generally safe
28195 to use @code{synci}.  However, on many multi-core (SMP) systems, it
28196 does not invalidate the instruction caches on all cores and may lead
28197 to undefined behavior.
28199 @opindex mrelax-pic-calls
28200 @item -mrelax-pic-calls
28201 @itemx -mno-relax-pic-calls
28202 Try to turn PIC calls that are normally dispatched via register
28203 @code{$25} into direct calls.  This is only possible if the linker can
28204 resolve the destination at link time and if the destination is within
28205 range for a direct call.
28207 @option{-mrelax-pic-calls} is the default if GCC was configured to use
28208 an assembler and a linker that support the @code{.reloc} assembly
28209 directive and @option{-mexplicit-relocs} is in effect.  With
28210 @option{-mno-explicit-relocs}, this optimization can be performed by the
28211 assembler and the linker alone without help from the compiler.
28213 @opindex mmcount-ra-address
28214 @opindex mno-mcount-ra-address
28215 @item -mmcount-ra-address
28216 @itemx -mno-mcount-ra-address
28217 Emit (do not emit) code that allows @code{_mcount} to modify the
28218 calling function's return address.  When enabled, this option extends
28219 the usual @code{_mcount} interface with a new @var{ra-address}
28220 parameter, which has type @code{intptr_t *} and is passed in register
28221 @code{$12}.  @code{_mcount} can then modify the return address by
28222 doing both of the following:
28223 @itemize
28224 @item
28225 Returning the new address in register @code{$31}.
28226 @item
28227 Storing the new address in @code{*@var{ra-address}},
28228 if @var{ra-address} is nonnull.
28229 @end itemize
28231 The default is @option{-mno-mcount-ra-address}.
28233 @opindex mframe-header-opt
28234 @item -mframe-header-opt
28235 @itemx -mno-frame-header-opt
28236 Enable (disable) frame header optimization in the o32 ABI.  When using the
28237 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
28238 function to write out register arguments.  When enabled, this optimization
28239 will suppress the allocation of the frame header if it can be determined that
28240 it is unused.
28242 This optimization is off by default at all optimization levels.
28244 @opindex mlxc1-sxc1
28245 @item -mlxc1-sxc1
28246 @itemx -mno-lxc1-sxc1
28247 When applicable, enable (disable) the generation of @code{lwxc1},
28248 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions.  Enabled by default.
28250 @opindex mmadd4
28251 @item -mmadd4
28252 @itemx -mno-madd4
28253 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
28254 @code{madd.d} and related instructions.  Enabled by default.
28256 @end table
28258 @node MMIX Options
28259 @subsection MMIX Options
28260 @cindex MMIX Options
28262 These options are defined for the MMIX:
28264 @table @gcctabopt
28265 @opindex mlibfuncs
28266 @opindex mno-libfuncs
28267 @item -mlibfuncs
28268 @itemx -mno-libfuncs
28269 Specify that intrinsic library functions are being compiled, passing all
28270 values in registers, no matter the size.
28272 @opindex mepsilon
28273 @opindex mno-epsilon
28274 @item -mepsilon
28275 @itemx -mno-epsilon
28276 Generate floating-point comparison instructions that compare with respect
28277 to the @code{rE} epsilon register.
28279 @opindex mabi=mmixware
28280 @opindex mabi=gnu
28281 @item -mabi=mmixware
28282 @itemx -mabi=gnu
28283 Generate code that passes function parameters and return values that (in
28284 the called function) are seen as registers @code{$0} and up, as opposed to
28285 the GNU ABI which uses global registers @code{$231} and up.
28287 @opindex mzero-extend
28288 @opindex mno-zero-extend
28289 @item -mzero-extend
28290 @itemx -mno-zero-extend
28291 When reading data from memory in sizes shorter than 64 bits, use (do not
28292 use) zero-extending load instructions by default, rather than
28293 sign-extending ones.
28295 @opindex mknuthdiv
28296 @opindex mno-knuthdiv
28297 @item -mknuthdiv
28298 @itemx -mno-knuthdiv
28299 Make the result of a division yielding a remainder have the same sign as
28300 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
28301 remainder follows the sign of the dividend.  Both methods are
28302 arithmetically valid, the latter being almost exclusively used.
28304 @opindex mtoplevel-symbols
28305 @opindex mno-toplevel-symbols
28306 @item -mtoplevel-symbols
28307 @itemx -mno-toplevel-symbols
28308 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
28309 code can be used with the @code{PREFIX} assembly directive.
28311 @opindex melf
28312 @item -melf
28313 Generate an executable in the ELF format, rather than the default
28314 @samp{mmo} format used by the @command{mmix} simulator.
28316 @opindex mbranch-predict
28317 @opindex mno-branch-predict
28318 @item -mbranch-predict
28319 @itemx -mno-branch-predict
28320 Use (do not use) the probable-branch instructions, when static branch
28321 prediction indicates a probable branch.
28323 @opindex mbase-addresses
28324 @opindex mno-base-addresses
28325 @item -mbase-addresses
28326 @itemx -mno-base-addresses
28327 Generate (do not generate) code that uses @emph{base addresses}.  Using a
28328 base address automatically generates a request (handled by the assembler
28329 and the linker) for a constant to be set up in a global register.  The
28330 register is used for one or more base address requests within the range 0
28331 to 255 from the value held in the register.  The generally leads to short
28332 and fast code, but the number of different data items that can be
28333 addressed is limited.  This means that a program that uses lots of static
28334 data may require @option{-mno-base-addresses}.
28336 @opindex msingle-exit
28337 @opindex mno-single-exit
28338 @item -msingle-exit
28339 @itemx -mno-single-exit
28340 Force (do not force) generated code to have a single exit point in each
28341 function.
28342 @end table
28344 @node MN10300 Options
28345 @subsection MN10300 Options
28346 @cindex MN10300 options
28348 These @option{-m} options are defined for Matsushita MN10300 architectures:
28350 @table @gcctabopt
28351 @opindex mmult-bug
28352 @item -mmult-bug
28353 Generate code to avoid bugs in the multiply instructions for the MN10300
28354 processors.  This is the default.
28356 @opindex mno-mult-bug
28357 @item -mno-mult-bug
28358 Do not generate code to avoid bugs in the multiply instructions for the
28359 MN10300 processors.
28361 @opindex mam33
28362 @item -mam33
28363 Generate code using features specific to the AM33 processor.
28365 @opindex mno-am33
28366 @item -mno-am33
28367 Do not generate code using features specific to the AM33 processor.  This
28368 is the default.
28370 @opindex mam33-2
28371 @item -mam33-2
28372 Generate code using features specific to the AM33/2.0 processor.
28374 @opindex mam34
28375 @item -mam34
28376 Generate code using features specific to the AM34 processor.
28378 @opindex mtune
28379 @item -mtune=@var{cpu-type}
28380 Use the timing characteristics of the indicated CPU type when
28381 scheduling instructions.  This does not change the targeted processor
28382 type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
28383 @samp{am33-2} or @samp{am34}.
28385 @opindex mreturn-pointer-on-d0
28386 @item -mreturn-pointer-on-d0
28387 When generating a function that returns a pointer, return the pointer
28388 in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
28389 only in @code{a0}, and attempts to call such functions without a prototype
28390 result in errors.  Note that this option is on by default; use
28391 @option{-mno-return-pointer-on-d0} to disable it.
28393 @opindex mno-crt0
28394 @item -mno-crt0
28395 Do not link in the C run-time initialization object file.
28397 @opindex mrelax
28398 @item -mrelax
28399 Indicate to the linker that it should perform a relaxation optimization pass
28400 to shorten branches, calls and absolute memory addresses.  This option only
28401 has an effect when used on the command line for the final link step.
28403 This option makes symbolic debugging impossible.
28405 @opindex mliw
28406 @item -mliw
28407 Allow the compiler to generate @emph{Long Instruction Word}
28408 instructions if the target is the @samp{AM33} or later.  This is the
28409 default.  This option defines the preprocessor macro @code{__LIW__}.
28411 @opindex mno-liw
28412 @item -mno-liw
28413 Do not allow the compiler to generate @emph{Long Instruction Word}
28414 instructions.  This option defines the preprocessor macro
28415 @code{__NO_LIW__}.
28417 @opindex msetlb
28418 @item -msetlb
28419 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
28420 instructions if the target is the @samp{AM33} or later.  This is the
28421 default.  This option defines the preprocessor macro @code{__SETLB__}.
28423 @opindex mno-setlb
28424 @item -mno-setlb
28425 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
28426 instructions.  This option defines the preprocessor macro
28427 @code{__NO_SETLB__}.
28429 @end table
28431 @node Moxie Options
28432 @subsection Moxie Options
28433 @cindex Moxie Options
28435 @table @gcctabopt
28437 @opindex meb
28438 @item -meb
28439 Generate big-endian code.  This is the default for @samp{moxie-*-*}
28440 configurations.
28442 @opindex mel
28443 @item -mel
28444 Generate little-endian code.
28446 @opindex mmul.x
28447 @item -mmul.x
28448 Generate mul.x and umul.x instructions.  This is the default for
28449 @samp{moxiebox-*-*} configurations.
28451 @opindex mno-crt0
28452 @item -mno-crt0
28453 Do not link in the C run-time initialization object file.
28455 @end table
28457 @node MSP430 Options
28458 @subsection MSP430 Options
28459 @cindex MSP430 Options
28461 These options are defined for the MSP430:
28463 @table @gcctabopt
28465 @opindex masm-hex
28466 @item -masm-hex
28467 Force assembly output to always use hex constants.  Normally such
28468 constants are signed decimals, but this option is available for
28469 testsuite and/or aesthetic purposes.
28471 @opindex mmcu=
28472 @item -mmcu=
28473 Select the MCU to target.  This is used to create a C preprocessor
28474 symbol based upon the MCU name, converted to upper case and pre- and
28475 post-fixed with @samp{__}.  This in turn is used by the
28476 @file{msp430.h} header file to select an MCU-specific supplementary
28477 header file.
28479 The option also sets the ISA to use.  If the MCU name is one that is
28480 known to only support the 430 ISA then that is selected, otherwise the
28481 430X ISA is selected.  A generic MCU name of @samp{msp430} can also be
28482 used to select the 430 ISA.  Similarly the generic @samp{msp430x} MCU
28483 name selects the 430X ISA.
28485 In addition an MCU-specific linker script is added to the linker
28486 command line.  The script's name is the name of the MCU with
28487 @file{.ld} appended.  Thus specifying @option{-mmcu=xxx} on the @command{gcc}
28488 command line defines the C preprocessor symbol @code{__XXX__} and
28489 cause the linker to search for a script called @file{xxx.ld}.
28491 The ISA and hardware multiply supported for the different MCUs is hard-coded
28492 into GCC.  However, an external @samp{devices.csv} file can be used to
28493 extend device support beyond those that have been hard-coded.
28495 GCC searches for the @samp{devices.csv} file using the following methods in the
28496 given precedence order, where the first method takes precendence over the
28497 second which takes precedence over the third.
28499 @table @asis
28500 @item Include path specified with @code{-I} and @code{-L}
28501 @samp{devices.csv} will be searched for in each of the directories specified by
28502 include paths and linker library search paths.
28503 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
28504 Define the value of the global environment variable
28505 @samp{MSP430_GCC_INCLUDE_DIR}
28506 to the full path to the directory containing devices.csv, and GCC will search
28507 this directory for devices.csv.  If devices.csv is found, this directory will
28508 also be registered as an include path, and linker library path.  Header files
28509 and linker scripts in this directory can therefore be used without manually
28510 specifying @code{-I} and @code{-L} on the command line.
28511 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
28512 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
28513 toolchain root directory.  This directory does not exist in a default
28514 installation, but if the user has created it and copied @samp{devices.csv}
28515 there, then the MCU data will be read.  As above, this directory will
28516 also be registered as an include path, and linker library path.
28518 @end table
28519 If none of the above search methods find @samp{devices.csv}, then the
28520 hard-coded MCU data is used.
28523 @opindex mwarn-mcu
28524 @opindex mno-warn-mcu
28525 @item -mwarn-mcu
28526 @itemx -mno-warn-mcu
28527 This option enables or disables warnings about conflicts between the
28528 MCU name specified by the @option{-mmcu} option and the ISA set by the
28529 @option{-mcpu} option and/or the hardware multiply support set by the
28530 @option{-mhwmult} option.  It also toggles warnings about unrecognized
28531 MCU names.  This option is on by default.
28533 @opindex mcpu=
28534 @item -mcpu=
28535 Specifies the ISA to use.  Accepted values are @samp{msp430},
28536 @samp{msp430x} and @samp{msp430xv2}.  This option is deprecated.  The
28537 @option{-mmcu=} option should be used to select the ISA.
28539 @opindex msim
28540 @item -msim
28541 Link to the simulator runtime libraries and linker script.  Overrides
28542 any scripts that would be selected by the @option{-mmcu=} option.
28544 @opindex mlarge
28545 @item -mlarge
28546 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
28548 @opindex msmall
28549 @item -msmall
28550 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
28552 @opindex mrelax
28553 @item -mrelax
28554 This option is passed to the assembler and linker, and allows the
28555 linker to perform certain optimizations that cannot be done until
28556 the final link.
28558 @opindex mhwmult=
28559 @item mhwmult=
28560 Describes the type of hardware multiply supported by the target.
28561 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
28562 for the original 16-bit-only multiply supported by early MCUs.
28563 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
28564 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
28565 A value of @samp{auto} can also be given.  This tells GCC to deduce
28566 the hardware multiply support based upon the MCU name provided by the
28567 @option{-mmcu} option.  If no @option{-mmcu} option is specified or if
28568 the MCU name is not recognized then no hardware multiply support is
28569 assumed.  @code{auto} is the default setting.
28571 Hardware multiplies are normally performed by calling a library
28572 routine.  This saves space in the generated code.  When compiling at
28573 @option{-O3} or higher however the hardware multiplier is invoked
28574 inline.  This makes for bigger, but faster code.
28576 The hardware multiply routines disable interrupts whilst running and
28577 restore the previous interrupt state when they finish.  This makes
28578 them safe to use inside interrupt handlers as well as in normal code.
28580 @opindex minrt
28581 @item -minrt
28582 Enable the use of a minimum runtime environment - no static
28583 initializers or constructors.  This is intended for memory-constrained
28584 devices.  The compiler includes special symbols in some objects
28585 that tell the linker and runtime which code fragments are required.
28587 @opindex mtiny-printf
28588 @item -mtiny-printf
28589 Enable reduced code size @code{printf} and @code{puts} library functions.
28590 The @samp{tiny} implementations of these functions are not reentrant, so
28591 must be used with caution in multi-threaded applications.
28593 Support for streams has been removed and the string to be printed will
28594 always be sent to stdout via the @code{write} syscall.  The string is not
28595 buffered before it is sent to write.
28597 This option requires Newlib Nano IO, so GCC must be configured with
28598 @samp{--enable-newlib-nano-formatted-io}.
28600 @opindex mmax-inline-shift=
28601 @item -mmax-inline-shift=
28602 This option takes an integer between 0 and 64 inclusive, and sets
28603 the maximum number of inline shift instructions which should be emitted to
28604 perform a shift operation by a constant amount.  When this value needs to be
28605 exceeded, an mspabi helper function is used instead.  The default value is 4.
28607 This only affects cases where a shift by multiple positions cannot be
28608 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
28610 Shifts of a 32-bit value are at least twice as costly, so the value passed for
28611 this option is divided by 2 and the resulting value used instead.
28613 @opindex mcode-region
28614 @opindex mdata-region
28615 @item -mcode-region=
28616 @itemx -mdata-region=
28617 These options tell the compiler where to place functions and data that
28618 do not have one of the @code{lower}, @code{upper}, @code{either} or
28619 @code{section} attributes.  Possible values are @code{lower},
28620 @code{upper}, @code{either} or @code{any}.  The first three behave
28621 like the corresponding attribute.  The fourth possible value -
28622 @code{any} - is the default.  It leaves placement entirely up to the
28623 linker script and how it assigns the standard sections
28624 (@code{.text}, @code{.data}, etc) to the memory regions.
28626 @opindex msilicon-errata
28627 @item -msilicon-errata=
28628 This option passes on a request to assembler to enable the fixes for
28629 the named silicon errata.
28631 @opindex msilicon-errata-warn
28632 @item -msilicon-errata-warn=
28633 This option passes on a request to the assembler to enable warning
28634 messages when a silicon errata might need to be applied.
28636 @opindex mwarn-devices-csv
28637 @opindex mno-warn-devices-csv
28638 @item -mwarn-devices-csv
28639 @itemx -mno-warn-devices-csv
28640 Warn if @samp{devices.csv} is not found or there are problem parsing it
28641 (default: on).
28643 @end table
28645 @node NDS32 Options
28646 @subsection NDS32 Options
28647 @cindex NDS32 Options
28649 These options are defined for NDS32 implementations:
28651 @table @gcctabopt
28653 @opindex mbig-endian
28654 @item -mbig-endian
28655 Generate code in big-endian mode.
28657 @opindex mlittle-endian
28658 @item -mlittle-endian
28659 Generate code in little-endian mode.
28661 @opindex mreduced-regs
28662 @item -mreduced-regs
28663 Use reduced-set registers for register allocation.
28665 @opindex mfull-regs
28666 @item -mfull-regs
28667 Use full-set registers for register allocation.
28669 @opindex mcmov
28670 @item -mcmov
28671 Generate conditional move instructions.
28673 @opindex mno-cmov
28674 @item -mno-cmov
28675 Do not generate conditional move instructions.
28677 @opindex mext-perf
28678 @item -mext-perf
28679 Generate performance extension instructions.
28681 @opindex mno-ext-perf
28682 @item -mno-ext-perf
28683 Do not generate performance extension instructions.
28685 @opindex mext-perf2
28686 @item -mext-perf2
28687 Generate performance extension 2 instructions.
28689 @opindex mno-ext-perf2
28690 @item -mno-ext-perf2
28691 Do not generate performance extension 2 instructions.
28693 @opindex mext-string
28694 @item -mext-string
28695 Generate string extension instructions.
28697 @opindex mno-ext-string
28698 @item -mno-ext-string
28699 Do not generate string extension instructions.
28701 @opindex mv3push
28702 @item -mv3push
28703 Generate v3 push25/pop25 instructions.
28705 @opindex mno-v3push
28706 @item -mno-v3push
28707 Do not generate v3 push25/pop25 instructions.
28709 @opindex m16-bit
28710 @item -m16-bit
28711 Generate 16-bit instructions.
28713 @opindex mno-16-bit
28714 @item -mno-16-bit
28715 Do not generate 16-bit instructions.
28717 @opindex misr-vector-size
28718 @item -misr-vector-size=@var{num}
28719 Specify the size of each interrupt vector, which must be 4 or 16.
28721 @opindex mcache-block-size
28722 @item -mcache-block-size=@var{num}
28723 Specify the size of each cache block,
28724 which must be a power of 2 between 4 and 512.
28726 @opindex march
28727 @item -march=@var{arch}
28728 Specify the name of the target architecture.
28730 @opindex mcmodel
28731 @item -mcmodel=@var{code-model}
28732 Set the code model to one of
28733 @table @asis
28734 @item @samp{small}
28735 All the data and read-only data segments must be within 512KB addressing space.
28736 The text segment must be within 16MB addressing space.
28737 @item @samp{medium}
28738 The data segment must be within 512KB while the read-only data segment can be
28739 within 4GB addressing space.  The text segment should be still within 16MB
28740 addressing space.
28741 @item @samp{large}
28742 All the text and data segments can be within 4GB addressing space.
28743 @end table
28745 @opindex mctor-dtor
28746 @item -mctor-dtor
28747 Enable constructor/destructor feature.
28749 @opindex mrelax
28750 @item -mrelax
28751 Guide linker to relax instructions.
28753 @end table
28755 @node Nios II Options
28756 @subsection Nios II Options
28757 @cindex Nios II options
28758 @cindex Altera Nios II options
28760 These are the options defined for the Altera Nios II processor.
28762 @table @gcctabopt
28764 @opindex G
28765 @cindex smaller data references
28766 @item -G @var{num}
28767 Put global and static objects less than or equal to @var{num} bytes
28768 into the small data or BSS sections instead of the normal data or BSS
28769 sections.  The default value of @var{num} is 8.
28771 @opindex mgpopt
28772 @opindex mno-gpopt
28773 @item -mgpopt=@var{option}
28774 @itemx -mgpopt
28775 @itemx -mno-gpopt
28776 Generate (do not generate) GP-relative accesses.  The following 
28777 @var{option} names are recognized:
28779 @table @samp
28781 @item none
28782 Do not generate GP-relative accesses.
28784 @item local
28785 Generate GP-relative accesses for small data objects that are not 
28786 external, weak, or uninitialized common symbols.  
28787 Also use GP-relative addressing for objects that
28788 have been explicitly placed in a small data section via a @code{section}
28789 attribute.
28791 @item global
28792 As for @samp{local}, but also generate GP-relative accesses for
28793 small data objects that are external, weak, or common.  If you use this option,
28794 you must ensure that all parts of your program (including libraries) are
28795 compiled with the same @option{-G} setting.
28797 @item data
28798 Generate GP-relative accesses for all data objects in the program.  If you
28799 use this option, the entire data and BSS segments
28800 of your program must fit in 64K of memory and you must use an appropriate
28801 linker script to allocate them within the addressable range of the
28802 global pointer.
28804 @item all
28805 Generate GP-relative addresses for function pointers as well as data
28806 pointers.  If you use this option, the entire text, data, and BSS segments
28807 of your program must fit in 64K of memory and you must use an appropriate
28808 linker script to allocate them within the addressable range of the
28809 global pointer.
28811 @end table
28813 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
28814 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
28816 The default is @option{-mgpopt} except when @option{-fpic} or
28817 @option{-fPIC} is specified to generate position-independent code.
28818 Note that the Nios II ABI does not permit GP-relative accesses from
28819 shared libraries.
28821 You may need to specify @option{-mno-gpopt} explicitly when building
28822 programs that include large amounts of small data, including large
28823 GOT data sections.  In this case, the 16-bit offset for GP-relative
28824 addressing may not be large enough to allow access to the entire 
28825 small data section.
28827 @opindex mgprel-sec
28828 @item -mgprel-sec=@var{regexp}
28829 This option specifies additional section names that can be accessed via
28830 GP-relative addressing.  It is most useful in conjunction with 
28831 @code{section} attributes on variable declarations 
28832 (@pxref{Common Variable Attributes}) and a custom linker script.  
28833 The @var{regexp} is a POSIX Extended Regular Expression.
28835 This option does not affect the behavior of the @option{-G} option, and 
28836 the specified sections are in addition to the standard @code{.sdata}
28837 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
28839 @opindex mr0rel-sec
28840 @item -mr0rel-sec=@var{regexp}
28841 This option specifies names of sections that can be accessed via a 
28842 16-bit offset from @code{r0}; that is, in the low 32K or high 32K 
28843 of the 32-bit address space.  It is most useful in conjunction with 
28844 @code{section} attributes on variable declarations 
28845 (@pxref{Common Variable Attributes}) and a custom linker script.  
28846 The @var{regexp} is a POSIX Extended Regular Expression.
28848 In contrast to the use of GP-relative addressing for small data, 
28849 zero-based addressing is never generated by default and there are no 
28850 conventional section names used in standard linker scripts for sections
28851 in the low or high areas of memory.
28853 @opindex mel
28854 @opindex meb
28855 @item -mel
28856 @itemx -meb
28857 Generate little-endian (default) or big-endian (experimental) code,
28858 respectively.
28860 @opindex march
28861 @item -march=@var{arch}
28862 This specifies the name of the target Nios II architecture.  GCC uses this
28863 name to determine what kind of instructions it can emit when generating
28864 assembly code.  Permissible names are: @samp{r1}, @samp{r2}.
28866 The preprocessor macro @code{__nios2_arch__} is available to programs,
28867 with value 1 or 2, indicating the targeted ISA level.
28869 @opindex mno-bypass-cache
28870 @opindex mbypass-cache
28871 @item -mbypass-cache
28872 @itemx -mno-bypass-cache
28873 Force all load and store instructions to always bypass cache by 
28874 using I/O variants of the instructions. The default is not to
28875 bypass the cache.
28877 @opindex mcache-volatile 
28878 @opindex mno-cache-volatile
28879 @item -mno-cache-volatile 
28880 @itemx -mcache-volatile       
28881 Volatile memory access bypass the cache using the I/O variants of 
28882 the load and store instructions. The default is not to bypass the cache.
28884 @opindex mno-fast-sw-div
28885 @opindex mfast-sw-div
28886 @item -mno-fast-sw-div
28887 @itemx -mfast-sw-div
28888 Do not use table-based fast divide for small numbers. The default 
28889 is to use the fast divide at @option{-O3} and above.
28891 @opindex mno-hw-mul
28892 @opindex mhw-mul
28893 @opindex mno-hw-mulx
28894 @opindex mhw-mulx
28895 @opindex mno-hw-div
28896 @opindex mhw-div
28897 @item -mno-hw-mul
28898 @itemx -mhw-mul
28899 @itemx -mno-hw-mulx
28900 @itemx -mhw-mulx
28901 @itemx -mno-hw-div
28902 @itemx -mhw-div
28903 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 
28904 instructions by the compiler. The default is to emit @code{mul}
28905 and not emit @code{div} and @code{mulx}.
28907 @item -mbmx
28908 @itemx -mno-bmx
28909 @itemx -mcdx
28910 @itemx -mno-cdx
28911 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
28912 CDX (code density) instructions.  Enabling these instructions also
28913 requires @option{-march=r2}.  Since these instructions are optional
28914 extensions to the R2 architecture, the default is not to emit them.
28916 @opindex mcustom-@var{insn}
28917 @opindex mno-custom-@var{insn}
28918 @item -mcustom-@var{insn}=@var{N}
28919 @itemx -mno-custom-@var{insn}
28920 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
28921 custom instruction with encoding @var{N} when generating code that uses 
28922 @var{insn}.  For example, @option{-mcustom-fadds=253} generates custom
28923 instruction 253 for single-precision floating-point add operations instead
28924 of the default behavior of using a library call.
28926 The following values of @var{insn} are supported.  Except as otherwise
28927 noted, floating-point operations are expected to be implemented with
28928 normal IEEE 754 semantics and correspond directly to the C operators or the
28929 equivalent GCC built-in functions (@pxref{Other Builtins}).
28931 Single-precision floating point:
28932 @table @asis
28934 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
28935 Binary arithmetic operations.
28937 @item @samp{fnegs}
28938 Unary negation.
28940 @item @samp{fabss}
28941 Unary absolute value.
28943 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
28944 Comparison operations.
28946 @item @samp{fmins}, @samp{fmaxs}
28947 Floating-point minimum and maximum.  These instructions are only
28948 generated if @option{-ffinite-math-only} is specified.
28950 @item @samp{fsqrts}
28951 Unary square root operation.
28953 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
28954 Floating-point trigonometric and exponential functions.  These instructions
28955 are only generated if @option{-funsafe-math-optimizations} is also specified.
28957 @end table
28959 Double-precision floating point:
28960 @table @asis
28962 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
28963 Binary arithmetic operations.
28965 @item @samp{fnegd}
28966 Unary negation.
28968 @item @samp{fabsd}
28969 Unary absolute value.
28971 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
28972 Comparison operations.
28974 @item @samp{fmind}, @samp{fmaxd}
28975 Double-precision minimum and maximum.  These instructions are only
28976 generated if @option{-ffinite-math-only} is specified.
28978 @item @samp{fsqrtd}
28979 Unary square root operation.
28981 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
28982 Double-precision trigonometric and exponential functions.  These instructions
28983 are only generated if @option{-funsafe-math-optimizations} is also specified.
28985 @end table
28987 Conversions:
28988 @table @asis
28989 @item @samp{fextsd}
28990 Conversion from single precision to double precision.
28992 @item @samp{ftruncds}
28993 Conversion from double precision to single precision.
28995 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
28996 Conversion from floating point to signed or unsigned integer types, with
28997 truncation towards zero.
28999 @item @samp{round}
29000 Conversion from single-precision floating point to signed integer,
29001 rounding to the nearest integer and ties away from zero.
29002 This corresponds to the @code{__builtin_lroundf} function when
29003 @option{-fno-math-errno} is used.
29005 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
29006 Conversion from signed or unsigned integer types to floating-point types.
29008 @end table
29010 In addition, all of the following transfer instructions for internal
29011 registers X and Y must be provided to use any of the double-precision
29012 floating-point instructions.  Custom instructions taking two
29013 double-precision source operands expect the first operand in the
29014 64-bit register X.  The other operand (or only operand of a unary
29015 operation) is given to the custom arithmetic instruction with the
29016 least significant half in source register @var{src1} and the most
29017 significant half in @var{src2}.  A custom instruction that returns a
29018 double-precision result returns the most significant 32 bits in the
29019 destination register and the other half in 32-bit register Y.  
29020 GCC automatically generates the necessary code sequences to write
29021 register X and/or read register Y when double-precision floating-point
29022 instructions are used.
29024 @table @asis
29026 @item @samp{fwrx}
29027 Write @var{src1} into the least significant half of X and @var{src2} into
29028 the most significant half of X.
29030 @item @samp{fwry}
29031 Write @var{src1} into Y.
29033 @item @samp{frdxhi}, @samp{frdxlo}
29034 Read the most or least (respectively) significant half of X and store it in
29035 @var{dest}.
29037 @item @samp{frdy}
29038 Read the value of Y and store it into @var{dest}.
29039 @end table
29041 Note that you can gain more local control over generation of Nios II custom
29042 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
29043 and @code{target("no-custom-@var{insn}")} function attributes
29044 (@pxref{Function Attributes})
29045 or pragmas (@pxref{Function Specific Option Pragmas}).
29047 @opindex mcustom-fpu-cfg
29048 @item -mcustom-fpu-cfg=@var{name}
29050 This option enables a predefined, named set of custom instruction encodings
29051 (see @option{-mcustom-@var{insn}} above).  
29052 Currently, the following sets are defined:
29054 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
29055 @gccoptlist{-mcustom-fmuls=252
29056 -mcustom-fadds=253
29057 -mcustom-fsubs=254
29058 -fsingle-precision-constant}
29060 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
29061 @gccoptlist{-mcustom-fmuls=252
29062 -mcustom-fadds=253
29063 -mcustom-fsubs=254
29064 -mcustom-fdivs=255
29065 -fsingle-precision-constant}
29067 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
29068 @gccoptlist{-mcustom-floatus=243
29069 -mcustom-fixsi=244
29070 -mcustom-floatis=245
29071 -mcustom-fcmpgts=246
29072 -mcustom-fcmples=249
29073 -mcustom-fcmpeqs=250
29074 -mcustom-fcmpnes=251
29075 -mcustom-fmuls=252
29076 -mcustom-fadds=253
29077 -mcustom-fsubs=254
29078 -mcustom-fdivs=255
29079 -fsingle-precision-constant}
29081 @option{-mcustom-fpu-cfg=fph2} is equivalent to:
29082 @gccoptlist{-mcustom-fabss=224
29083 -mcustom-fnegs=225
29084 -mcustom-fcmpnes=226
29085 -mcustom-fcmpeqs=227
29086 -mcustom-fcmpges=228
29087 -mcustom-fcmpgts=229
29088 -mcustom-fcmples=230
29089 -mcustom-fcmplts=231
29090 -mcustom-fmaxs=232
29091 -mcustom-fmins=233
29092 -mcustom-round=248
29093 -mcustom-fixsi=249
29094 -mcustom-floatis=250
29095 -mcustom-fsqrts=251
29096 -mcustom-fmuls=252
29097 -mcustom-fadds=253
29098 -mcustom-fsubs=254
29099 -mcustom-fdivs=255}
29101 Custom instruction assignments given by individual
29102 @option{-mcustom-@var{insn}=} options override those given by
29103 @option{-mcustom-fpu-cfg=}, regardless of the
29104 order of the options on the command line.
29106 Note that you can gain more local control over selection of a FPU
29107 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
29108 function attribute (@pxref{Function Attributes})
29109 or pragma (@pxref{Function Specific Option Pragmas}).
29111 The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
29112 Hardware 2 Component}.  Please note that the custom instructions enabled by
29113 @option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
29114 if @option{-ffinite-math-only} is specified.  The custom instruction enabled by
29115 @option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
29116 specified.  In contrast to the other configurations,
29117 @option{-fsingle-precision-constant} is not set.
29119 @end table
29121 These additional @samp{-m} options are available for the Altera Nios II
29122 ELF (bare-metal) target:
29124 @table @gcctabopt
29126 @opindex mhal
29127 @item -mhal
29128 Link with HAL BSP.  This suppresses linking with the GCC-provided C runtime
29129 startup and termination code, and is typically used in conjunction with
29130 @option{-msys-crt0=} to specify the location of the alternate startup code
29131 provided by the HAL BSP.
29133 @opindex msmallc
29134 @item -msmallc
29135 Link with a limited version of the C library, @option{-lsmallc}, rather than
29136 Newlib.
29138 @opindex msys-crt0
29139 @item -msys-crt0=@var{startfile}
29140 @var{startfile} is the file name of the startfile (crt0) to use 
29141 when linking.  This option is only useful in conjunction with @option{-mhal}.
29143 @opindex msys-lib
29144 @item -msys-lib=@var{systemlib}
29145 @var{systemlib} is the library name of the library that provides
29146 low-level system calls required by the C library,
29147 e.g.@: @code{read} and @code{write}.
29148 This option is typically used to link with a library provided by a HAL BSP.
29150 @end table
29152 @node Nvidia PTX Options
29153 @subsection Nvidia PTX Options
29154 @cindex Nvidia PTX options
29155 @cindex nvptx options
29157 These options are defined for Nvidia PTX:
29159 @table @gcctabopt
29161 @opindex m64
29162 @item -m64
29163 Ignored, but preserved for backward compatibility.  Only 64-bit ABI is
29164 supported.
29166 @opindex march
29167 @item -march=@var{architecture-string}
29168 Generate code for the specified PTX ISA target architecture
29169 (e.g.@: @samp{sm_35}).  Valid architecture strings are @samp{sm_30},
29170 @samp{sm_35}, @samp{sm_53}, @samp{sm_70}, @samp{sm_75} and
29171 @samp{sm_80}.
29172 The default depends on how the compiler has been configured, see
29173 @option{--with-arch}.
29175 This option sets the value of the preprocessor macro
29176 @code{__PTX_SM__}; for instance, for @samp{sm_35}, it has the value
29177 @samp{350}.
29179 @opindex misa
29180 @item -misa=@var{architecture-string}
29181 Alias of @option{-march=}.
29183 @opindex march
29184 @item -march-map=@var{architecture-string}
29185 Select the closest available @option{-march=} value that is not more
29186 capable.  For instance, for @option{-march-map=sm_50} select
29187 @option{-march=sm_35}, and for @option{-march-map=sm_53} select
29188 @option{-march=sm_53}.
29190 @opindex mptx
29191 @item -mptx=@var{version-string}
29192 Generate code for the specified PTX ISA version (e.g.@: @samp{7.0}).
29193 Valid version strings include @samp{3.1}, @samp{6.0}, @samp{6.3}, and
29194 @samp{7.0}.  The default PTX ISA version is 6.0, unless a higher
29195 version is required for specified PTX ISA target architecture via
29196 option @option{-march=}.
29198 This option sets the values of the preprocessor macros
29199 @code{__PTX_ISA_VERSION_MAJOR__} and @code{__PTX_ISA_VERSION_MINOR__};
29200 for instance, for @samp{3.1} the macros have the values @samp{3} and
29201 @samp{1}, respectively.
29203 @opindex mmainkernel
29204 @item -mmainkernel
29205 Link in code for a __main kernel.  This is for stand-alone instead of
29206 offloading execution.
29208 @opindex moptimize
29209 @item -moptimize
29210 Apply partitioned execution optimizations.  This is the default when any
29211 level of optimization is selected.
29213 @opindex msoft-stack
29214 @item -msoft-stack
29215 Generate code that does not use @code{.local} memory
29216 directly for stack storage. Instead, a per-warp stack pointer is
29217 maintained explicitly. This enables variable-length stack allocation (with
29218 variable-length arrays or @code{alloca}), and when global memory is used for
29219 underlying storage, makes it possible to access automatic variables from other
29220 threads, or with atomic instructions. This code generation variant is used
29221 for OpenMP offloading, but the option is exposed on its own for the purpose
29222 of testing the compiler; to generate code suitable for linking into programs
29223 using OpenMP offloading, use option @option{-mgomp}.
29225 @opindex muniform-simt
29226 @item -muniform-simt
29227 Switch to code generation variant that allows to execute all threads in each
29228 warp, while maintaining memory state and side effects as if only one thread
29229 in each warp was active outside of OpenMP SIMD regions.  All atomic operations
29230 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
29231 current lane index equals the master lane index), and the register being
29232 assigned is copied via a shuffle instruction from the master lane.  Outside of
29233 SIMD regions lane 0 is the master; inside, each thread sees itself as the
29234 master.  Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
29235 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
29236 regions).  Each thread can bitwise-and the bitmask at position @code{tid.y}
29237 with current lane index to compute the master lane index.
29239 @opindex mgomp
29240 @item -mgomp
29241 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
29242 @option{-muniform-simt} options, and selects corresponding multilib variant.
29244 @end table
29246 @node OpenRISC Options
29247 @subsection OpenRISC Options
29248 @cindex OpenRISC Options
29250 These options are defined for OpenRISC:
29252 @table @gcctabopt
29254 @opindex mboard
29255 @item -mboard=@var{name}
29256 Configure a board specific runtime.  This will be passed to the linker for
29257 newlib board library linking.  The default is @code{or1ksim}.
29259 @opindex mnewlib
29260 @item -mnewlib
29261 This option is ignored; it is for compatibility purposes only.  This used to
29262 select linker and preprocessor options for use with newlib.
29264 @opindex msoft-div
29265 @opindex mhard-div
29266 @item -msoft-div
29267 @itemx -mhard-div
29268 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
29269 This default is hardware divide.
29271 @opindex msoft-mul
29272 @opindex mhard-mul
29273 @item -msoft-mul
29274 @itemx -mhard-mul
29275 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
29276 This default is hardware multiply.
29278 @opindex msoft-float
29279 @opindex mhard-float
29280 @item -msoft-float
29281 @itemx -mhard-float
29282 Select software or hardware for floating point operations.
29283 The default is software.
29285 @opindex mdouble-float
29286 @item -mdouble-float
29287 When @option{-mhard-float} is selected, enables generation of double-precision
29288 floating point instructions.  By default functions from @file{libgcc} are used
29289 to perform double-precision floating point operations.
29291 @opindex munordered-float
29292 @item -munordered-float
29293 When @option{-mhard-float} is selected, enables generation of unordered
29294 floating point compare and set flag (@code{lf.sfun*}) instructions.  By default
29295 functions from @file{libgcc} are used to perform unordered floating point
29296 compare and set flag operations.
29298 @opindex mcmov
29299 @item -mcmov
29300 Enable generation of conditional move (@code{l.cmov}) instructions.  By
29301 default the equivalent will be generated using set and branch.
29303 @opindex mror
29304 @item -mror
29305 Enable generation of rotate right (@code{l.ror}) instructions.  By default
29306 functions from @file{libgcc} are used to perform rotate right operations.
29308 @opindex mrori
29309 @item -mrori
29310 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
29311 By default functions from @file{libgcc} are used to perform rotate right with
29312 immediate operations.
29314 @opindex msext
29315 @item -msext
29316 Enable generation of sign extension (@code{l.ext*}) instructions.  By default
29317 memory loads are used to perform sign extension.
29319 @opindex msfimm
29320 @item -msfimm
29321 Enable generation of compare and set flag with immediate (@code{l.sf*i})
29322 instructions.  By default extra instructions will be generated to store the
29323 immediate to a register first.
29325 @opindex mshftimm
29326 @item -mshftimm
29327 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
29328 @code{l.slli}) instructions.  By default extra instructions will be generated
29329 to store the immediate to a register first.
29331 @opindex mcmodel=small
29332 @item -mcmodel=small
29333 Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
29334 the default model.
29336 @opindex mcmodel=large
29337 @item -mcmodel=large
29338 Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
29341 @end table
29343 @node PDP-11 Options
29344 @subsection PDP-11 Options
29345 @cindex PDP-11 Options
29347 These options are defined for the PDP-11:
29349 @table @gcctabopt
29350 @opindex mfpu
29351 @item -mfpu
29352 Use hardware FPP floating point.  This is the default.  (FIS floating
29353 point on the PDP-11/40 is not supported.)  Implies -m45.
29355 @opindex msoft-float
29356 @item -msoft-float
29357 Do not use hardware floating point.
29359 @opindex mac0
29360 @item -mac0
29361 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
29363 @opindex mno-ac0
29364 @item -mno-ac0
29365 Return floating-point results in memory.  This is the default.
29367 @opindex m40
29368 @item -m40
29369 Generate code for a PDP-11/40.  Implies -msoft-float -mno-split.
29371 @opindex m45
29372 @item -m45
29373 Generate code for a PDP-11/45.  This is the default.
29375 @opindex m10
29376 @item -m10
29377 Generate code for a PDP-11/10.  Implies -msoft-float -mno-split.
29379 @opindex mint16
29380 @opindex mno-int32
29381 @item -mint16
29382 @itemx -mno-int32
29383 Use 16-bit @code{int}.  This is the default.
29385 @opindex mint32
29386 @opindex mno-int16
29387 @item -mint32
29388 @itemx -mno-int16
29389 Use 32-bit @code{int}.
29391 @opindex msplit
29392 @item -msplit
29393 Target has split instruction and data space.  Implies -m45.
29395 @opindex munix-asm
29396 @item -munix-asm
29397 Use Unix assembler syntax.
29399 @opindex mdec-asm
29400 @item -mdec-asm
29401 Use DEC assembler syntax.
29403 @opindex mgnu-asm
29404 @item -mgnu-asm
29405 Use GNU assembler syntax.  This is the default.
29407 @opindex mlra
29408 @item -mlra
29409 Use the new LRA register allocator.  By default, the old ``reload''
29410 allocator is used.
29411 @end table
29413 @node PowerPC Options
29414 @subsection PowerPC Options
29415 @cindex PowerPC options
29417 These are listed under @xref{RS/6000 and PowerPC Options}.
29419 @node PRU Options
29420 @subsection PRU Options
29421 @cindex PRU Options
29423 These command-line options are defined for PRU target:
29425 @table @gcctabopt
29426 @opindex minrt
29427 @item -minrt
29428 Link with a minimum runtime environment, with no support for static
29429 initializers and constructors.  Using this option can significantly reduce
29430 the size of the final ELF binary.  Beware that the compiler could still
29431 generate code with static initializers and constructors.  It is up to the
29432 programmer to ensure that the source program will not use those features.
29434 @opindex mmcu
29435 @item -mmcu=@var{mcu}
29436 Specify the PRU MCU variant to use.  Check Newlib for the exact list of
29437 supported MCUs.
29439 @opindex mno-relax
29440 @item -mno-relax
29441 Make GCC pass the @option{--no-relax} command-line option to the linker
29442 instead of the @option{--relax} option.
29444 @opindex mloop
29445 @item -mloop
29446 Allow (or do not allow) GCC to use the LOOP instruction.
29448 @opindex mabi
29449 @item -mabi=@var{variant}
29450 Specify the ABI variant to output code for.  @option{-mabi=ti} selects the
29451 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
29452 more naturally with certain GCC assumptions.  These are the differences:
29454 @table @samp
29455 @item Function Pointer Size
29456 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
29457 supports only 32-bit data and code pointers.
29459 @item Optional Return Value Pointer
29460 Function return values larger than 64 bits are passed by using a hidden
29461 pointer as the first argument of the function.  TI ABI, though, mandates that
29462 the pointer can be NULL in case the caller is not using the returned value.
29463 GNU always passes and expects a valid return value pointer.
29465 @end table
29467 The current @option{-mabi=ti} implementation simply raises a compile error
29468 when any of the above code constructs is detected.  As a consequence
29469 the standard C library cannot be built and it is omitted when linking with
29470 @option{-mabi=ti}.
29472 Relaxation is a GNU feature and for safety reasons is disabled when using
29473 @option{-mabi=ti}.  The TI toolchain does not emit relocations for QBBx
29474 instructions, so the GNU linker cannot adjust them when shortening adjacent
29475 LDI32 pseudo instructions.
29477 @end table
29479 @node RISC-V Options
29480 @subsection RISC-V Options
29481 @cindex RISC-V Options
29483 These command-line options are defined for RISC-V targets:
29485 @table @gcctabopt
29486 @opindex mbranch-cost
29487 @item -mbranch-cost=@var{n}
29488 Set the cost of branches to roughly @var{n} instructions.
29490 @opindex plt
29491 @item -mplt
29492 @itemx -mno-plt
29493 When generating PIC code, do or don't allow the use of PLTs. Ignored for
29494 non-PIC.  The default is @option{-mplt}.
29496 @opindex mabi
29497 @item -mabi=@var{ABI-string}
29498 Specify integer and floating-point calling convention.  @var{ABI-string}
29499 contains two parts: the size of integer types and the registers used for
29500 floating-point types.  For example @samp{-march=rv64ifd -mabi=lp64d} means that
29501 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
29502 32-bit), and that floating-point values up to 64 bits wide are passed in F
29503 registers.  Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
29504 allows the compiler to generate code that uses the F and D extensions but only
29505 allows floating-point values up to 32 bits long to be passed in registers; or
29506 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
29507 passed in registers.
29509 The default for this argument is system dependent, users who want a specific
29510 calling convention should specify one explicitly.  The valid calling
29511 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
29512 @samp{lp64f}, and @samp{lp64d}.  Some calling conventions are impossible to
29513 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
29514 invalid because the ABI requires 64-bit values be passed in F registers, but F
29515 registers are only 32 bits wide.  There is also the @samp{ilp32e} ABI that can
29516 only be used with the @samp{rv32e} architecture.  This ABI is not well
29517 specified at present, and is subject to change.
29519 @opindex mfdiv
29520 @item -mfdiv
29521 @itemx -mno-fdiv
29522 Do or don't use hardware floating-point divide and square root instructions.
29523 This requires the F or D extensions for floating-point registers.  The default
29524 is to use them if the specified architecture has these instructions.
29526 @opindex mdiv
29527 @item -mdiv
29528 @itemx -mno-div
29529 Do or don't use hardware instructions for integer division.  This requires the
29530 M extension.  The default is to use them if the specified architecture has
29531 these instructions.
29533 @opindex misa-spec
29534 @item -misa-spec=@var{ISA-spec-string}
29535 Specify the version of the RISC-V Unprivileged (formerly User-Level)
29536 ISA specification to produce code conforming to.  The possibilities
29537 for @var{ISA-spec-string} are:
29538 @table @code
29539 @item 2.2
29540 Produce code conforming to version 2.2.
29541 @item 20190608
29542 Produce code conforming to version 20190608.
29543 @item 20191213
29544 Produce code conforming to version 20191213.
29545 @end table
29546 The default is @option{-misa-spec=20191213} unless GCC has been configured
29547 with @option{--with-isa-spec=} specifying a different default version.
29549 @opindex march
29550 @item -march=@var{ISA-string}
29551 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}).  ISA strings must be
29552 lower-case.  Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
29553 @samp{rv32imaf}.
29555 When @option{-march=} is not specified, use the setting from @option{-mcpu}.
29557 If both @option{-march} and @option{-mcpu=} are not specified, the default for
29558 this argument is system dependent, users who want a specific architecture
29559 extensions should specify one explicitly.
29561 @opindex mcpu
29562 @item -mcpu=@var{processor-string}
29563 Use architecture of and optimize the output for the given processor, specified
29564 by particular CPU name.
29565 Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
29566 @samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
29567 @samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
29568 @samp{sifive-u54}, and @samp{sifive-u74}.
29570 @opindex mtune
29571 @item -mtune=@var{processor-string}
29572 Optimize the output for the given processor, specified by microarchitecture or
29573 particular CPU name.  Permissible values for this option are: @samp{rocket},
29574 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
29575 @samp{thead-c906}, @samp{size}, and all valid options for @option{-mcpu=}.
29577 When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
29578 the default is @samp{rocket} if both are not specified.
29580 The @samp{size} choice is not intended for use by end-users.  This is used
29581 when @option{-Os} is specified.  It overrides the instruction cost info
29582 provided by @option{-mtune=}, but does not override the pipeline info.  This
29583 helps reduce code size while still giving good performance.
29585 @opindex mpreferred-stack-boundary
29586 @item -mpreferred-stack-boundary=@var{num}
29587 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
29588 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
29589 the default is 4 (16 bytes or 128-bits).
29591 @strong{Warning:} If you use this switch, then you must build all modules with
29592 the same value, including any libraries.  This includes the system libraries
29593 and startup modules.
29595 @opindex msmall-data-limit
29596 @item -msmall-data-limit=@var{n}
29597 Put global and static data smaller than @var{n} bytes into a special section
29598 (on some targets).
29600 @opindex msave-restore
29601 @item -msave-restore
29602 @itemx -mno-save-restore
29603 Do or don't use smaller but slower prologue and epilogue code that uses
29604 library function calls.  The default is to use fast inline prologues and
29605 epilogues.
29607 @opindex minline-atomics
29608 @item -minline-atomics
29609 @itemx -mno-inline-atomics
29610 Do or don't use smaller but slower subword atomic emulation code that uses
29611 libatomic function calls.  The default is to use fast inline subword atomics
29612 that do not require libatomic.
29614 @opindex minline-strlen
29615 @item -minline-strlen
29616 @itemx -mno-inline-strlen
29617 Do or do not attempt to inline strlen calls if possible.
29618 Inlining will only be done if the string is properly aligned
29619 and instructions for accelerated processing are available.
29620 The default is to not inline strlen calls.
29622 @opindex minline-strcmp
29623 @item -minline-strcmp
29624 @itemx -mno-inline-strcmp
29625 Do or do not attempt to inline strcmp calls if possible.
29626 Inlining will only be done if the strings are properly aligned
29627 and instructions for accelerated processing are available.
29628 The default is to not inline strcmp calls.
29630 @opindex minline-strncmp
29631 @item -minline-strncmp
29632 @itemx -mno-inline-strncmp
29633 Do or do not attempt to inline strncmp calls if possible.
29634 Inlining will only be done if the strings are properly aligned
29635 and instructions for accelerated processing are available.
29636 The default is to not inline strncmp calls.
29638 @opindex mshorten-memrefs
29639 @item -mshorten-memrefs
29640 @itemx -mno-shorten-memrefs
29641 Do or do not attempt to make more use of compressed load/store instructions by
29642 replacing a load/store of 'base register + large offset' with a new load/store
29643 of 'new base + small offset'.  If the new base gets stored in a compressed
29644 register, then the new load/store can be compressed.  Currently targets 32-bit
29645 integer load/stores only.
29647 @opindex mstrict-align
29648 @item -mstrict-align
29649 @itemx -mno-strict-align
29650 Do not or do generate unaligned memory accesses.  The default is set depending
29651 on whether the processor we are optimizing for supports fast unaligned access
29652 or not.
29654 @opindex mcmodel=medlow
29655 @item -mcmodel=medlow
29656 Generate code for the medium-low code model. The program and its statically
29657 defined symbols must lie within a single 2 GiB address range and must lie
29658 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
29659 statically or dynamically linked. This is the default code model.
29661 @opindex mcmodel=medany
29662 @item -mcmodel=medany
29663 Generate code for the medium-any code model. The program and its statically
29664 defined symbols must be within any single 2 GiB address range. Programs can be
29665 statically or dynamically linked.
29667 The code generated by the medium-any code model is position-independent, but is
29668 not guaranteed to function correctly when linked into position-independent
29669 executables or libraries.
29671 @item -mexplicit-relocs
29672 @itemx -mno-exlicit-relocs
29673 Use or do not use assembler relocation operators when dealing with symbolic
29674 addresses.  The alternative is to use assembler macros instead, which may
29675 limit optimization.
29677 @opindex mrelax
29678 @item -mrelax
29679 @itemx -mno-relax
29680 Take advantage of linker relaxations to reduce the number of instructions
29681 required to materialize symbol addresses. The default is to take advantage of
29682 linker relaxations.
29684 @opindex mriscv-attribute
29685 @item -mriscv-attribute
29686 @itemx -mno-riscv-attribute
29687 Emit (do not emit) RISC-V attribute to record extra information into ELF
29688 objects.  This feature requires at least binutils 2.32.
29690 @opindex mcsr-check
29691 @item -mcsr-check
29692 @itemx -mno-csr-check
29693 Enables or disables the CSR checking.
29695 @opindex malign-data
29696 @item -malign-data=@var{type}
29697 Control how GCC aligns variables and constants of array, structure, or union
29698 types.  Supported values for @var{type} are @samp{xlen} which uses x register
29699 width as the alignment value, and @samp{natural} which uses natural alignment.
29700 @samp{xlen} is the default.
29702 @opindex mbig-endian
29703 @item -mbig-endian
29704 Generate big-endian code.  This is the default when GCC is configured for a
29705 @samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
29707 @opindex mlittle-endian
29708 @item -mlittle-endian
29709 Generate little-endian code.  This is the default when GCC is configured for a
29710 @samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
29711 @samp{riscv32be-*-*} target.
29713 @opindex mstack-protector-guard
29714 @opindex mstack-protector-guard-reg
29715 @opindex mstack-protector-guard-offset
29716 @item -mstack-protector-guard=@var{guard}
29717 @itemx -mstack-protector-guard-reg=@var{reg}
29718 @itemx -mstack-protector-guard-offset=@var{offset}
29719 Generate stack protection code using canary at @var{guard}.  Supported
29720 locations are @samp{global} for a global canary or @samp{tls} for per-thread
29721 canary in the TLS block.
29723 With the latter choice the options
29724 @option{-mstack-protector-guard-reg=@var{reg}} and
29725 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
29726 which register to use as base register for reading the canary,
29727 and from what offset from that base register. There is no default
29728 register or offset as this is entirely for use within the Linux
29729 kernel.
29730 @end table
29732 @node RL78 Options
29733 @subsection RL78 Options
29734 @cindex RL78 Options
29736 @table @gcctabopt
29738 @opindex msim
29739 @item -msim
29740 Links in additional target libraries to support operation within a
29741 simulator.
29743 @opindex mmul
29744 @item -mmul=none
29745 @itemx -mmul=g10
29746 @itemx -mmul=g13
29747 @itemx -mmul=g14
29748 @itemx -mmul=rl78
29749 Specifies the type of hardware multiplication and division support to
29750 be used.  The simplest is @code{none}, which uses software for both
29751 multiplication and division.  This is the default.  The @code{g13}
29752 value is for the hardware multiply/divide peripheral found on the
29753 RL78/G13 (S2 core) targets.  The @code{g14} value selects the use of
29754 the multiplication and division instructions supported by the RL78/G14
29755 (S3 core) parts.  The value @code{rl78} is an alias for @code{g14} and
29756 the value @code{mg10} is an alias for @code{none}.
29758 In addition a C preprocessor macro is defined, based upon the setting
29759 of this option.  Possible values are: @code{__RL78_MUL_NONE__},
29760 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
29762 @opindex mcpu
29763 @item -mcpu=g10
29764 @itemx -mcpu=g13
29765 @itemx -mcpu=g14
29766 @itemx -mcpu=rl78
29767 Specifies the RL78 core to target.  The default is the G14 core, also
29768 known as an S3 core or just RL78.  The G13 or S2 core does not have
29769 multiply or divide instructions, instead it uses a hardware peripheral
29770 for these operations.  The G10 or S1 core does not have register
29771 banks, so it uses a different calling convention.
29773 If this option is set it also selects the type of hardware multiply
29774 support to use, unless this is overridden by an explicit
29775 @option{-mmul=none} option on the command line.  Thus specifying
29776 @option{-mcpu=g13} enables the use of the G13 hardware multiply
29777 peripheral and specifying @option{-mcpu=g10} disables the use of
29778 hardware multiplications altogether.
29780 Note, although the RL78/G14 core is the default target, specifying
29781 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
29782 change the behavior of the toolchain since it also enables G14
29783 hardware multiply support.  If these options are not specified on the
29784 command line then software multiplication routines will be used even
29785 though the code targets the RL78 core.  This is for backwards
29786 compatibility with older toolchains which did not have hardware
29787 multiply and divide support.
29789 In addition a C preprocessor macro is defined, based upon the setting
29790 of this option.  Possible values are: @code{__RL78_G10__},
29791 @code{__RL78_G13__} or @code{__RL78_G14__}.
29793 @opindex mg10
29794 @opindex mg13
29795 @opindex mg14
29796 @opindex mrl78
29797 @item -mg10
29798 @itemx -mg13
29799 @itemx -mg14
29800 @itemx -mrl78
29801 These are aliases for the corresponding @option{-mcpu=} option.  They
29802 are provided for backwards compatibility.
29804 @opindex mallregs
29805 @item -mallregs
29806 Allow the compiler to use all of the available registers.  By default
29807 registers @code{r24..r31} are reserved for use in interrupt handlers.
29808 With this option enabled these registers can be used in ordinary
29809 functions as well.
29811 @opindex m64bit-doubles
29812 @opindex m32bit-doubles
29813 @item -m64bit-doubles
29814 @itemx -m32bit-doubles
29815 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
29816 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
29817 @option{-m32bit-doubles}.
29819 @opindex msave-mduc-in-interrupts
29820 @opindex mno-save-mduc-in-interrupts
29821 @item -msave-mduc-in-interrupts
29822 @itemx -mno-save-mduc-in-interrupts
29823 Specifies that interrupt handler functions should preserve the
29824 MDUC registers.  This is only necessary if normal code might use
29825 the MDUC registers, for example because it performs multiplication
29826 and division operations.  The default is to ignore the MDUC registers
29827 as this makes the interrupt handlers faster.  The target option -mg13
29828 needs to be passed for this to work as this feature is only available
29829 on the G13 target (S2 core).  The MDUC registers will only be saved
29830 if the interrupt handler performs a multiplication or division
29831 operation or it calls another function.
29833 @end table
29835 @node RS/6000 and PowerPC Options
29836 @subsection IBM RS/6000 and PowerPC Options
29837 @cindex RS/6000 and PowerPC Options
29838 @cindex IBM RS/6000 and PowerPC Options
29840 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
29841 @table @gcctabopt
29842 @item -mpowerpc-gpopt
29843 @itemx -mno-powerpc-gpopt
29844 @itemx -mpowerpc-gfxopt
29845 @itemx -mno-powerpc-gfxopt
29846 @need 800
29847 @itemx -mpowerpc64
29848 @itemx -mno-powerpc64
29849 @itemx -mmfcrf
29850 @itemx -mno-mfcrf
29851 @itemx -mpopcntb
29852 @itemx -mno-popcntb
29853 @itemx -mpopcntd
29854 @itemx -mno-popcntd
29855 @itemx -mfprnd
29856 @itemx -mno-fprnd
29857 @need 800
29858 @opindex mpowerpc-gpopt
29859 @opindex mno-powerpc-gpopt
29860 @opindex mpowerpc-gfxopt
29861 @opindex mno-powerpc-gfxopt
29862 @opindex mpowerpc64
29863 @opindex mno-powerpc64
29864 @opindex mmfcrf
29865 @opindex mno-mfcrf
29866 @opindex mpopcntb
29867 @opindex mno-popcntb
29868 @opindex mpopcntd
29869 @opindex mno-popcntd
29870 @opindex mfprnd
29871 @opindex mno-fprnd
29872 @opindex mcmpb
29873 @opindex mno-cmpb
29874 @opindex mhard-dfp
29875 @opindex mno-hard-dfp
29876 @itemx -mcmpb
29877 @itemx -mno-cmpb
29878 @itemx -mhard-dfp
29879 @itemx -mno-hard-dfp
29880 You use these options to specify which instructions are available on the
29881 processor you are using.  The default value of these options is
29882 determined when configuring GCC@.  Specifying the
29883 @option{-mcpu=@var{cpu_type}} overrides the specification of these
29884 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
29885 rather than the options listed above.
29887 Specifying @option{-mpowerpc-gpopt} allows
29888 GCC to use the optional PowerPC architecture instructions in the
29889 General Purpose group, including floating-point square root.  Specifying
29890 @option{-mpowerpc-gfxopt} allows GCC to
29891 use the optional PowerPC architecture instructions in the Graphics
29892 group, including floating-point select.
29894 The @option{-mmfcrf} option allows GCC to generate the move from
29895 condition register field instruction implemented on the POWER4
29896 processor and other processors that support the PowerPC V2.01
29897 architecture.
29898 The @option{-mpopcntb} option allows GCC to generate the popcount and
29899 double-precision FP reciprocal estimate instruction implemented on the
29900 POWER5 processor and other processors that support the PowerPC V2.02
29901 architecture.
29902 The @option{-mpopcntd} option allows GCC to generate the popcount
29903 instruction implemented on the POWER7 processor and other processors
29904 that support the PowerPC V2.06 architecture.
29905 The @option{-mfprnd} option allows GCC to generate the FP round to
29906 integer instructions implemented on the POWER5+ processor and other
29907 processors that support the PowerPC V2.03 architecture.
29908 The @option{-mcmpb} option allows GCC to generate the compare bytes
29909 instruction implemented on the POWER6 processor and other processors
29910 that support the PowerPC V2.05 architecture.
29911 The @option{-mhard-dfp} option allows GCC to generate the decimal
29912 floating-point instructions implemented on some POWER processors.
29914 The @option{-mpowerpc64} option allows GCC to generate the additional
29915 64-bit instructions that are found in the full PowerPC64 architecture
29916 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
29917 @option{-mno-powerpc64}.
29919 @opindex mcpu
29920 @item -mcpu=@var{cpu_type}
29921 Set architecture type, register usage, and
29922 instruction scheduling parameters for machine type @var{cpu_type}.
29923 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
29924 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
29925 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
29926 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
29927 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
29928 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
29929 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
29930 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
29931 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
29932 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
29933 @samp{power9}, @samp{power10}, @samp{powerpc}, @samp{powerpc64},
29934 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
29936 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
29937 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
29938 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
29939 architecture machine types, with an appropriate, generic processor
29940 model assumed for scheduling purposes.
29942 Specifying @samp{native} as cpu type detects and selects the
29943 architecture option that corresponds to the host processor of the
29944 system performing the compilation.
29945 @option{-mcpu=native} has no effect if GCC does not recognize the
29946 processor.
29948 The other options specify a specific processor.  Code generated under
29949 those options runs best on that processor, and may not run at all on
29950 others.
29952 The @option{-mcpu} options automatically enable or disable the
29953 following options:
29955 @gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple
29956 -mpopcntb  -mpopcntd  -mpowerpc64
29957 -mpowerpc-gpopt  -mpowerpc-gfxopt
29958 -mmulhw  -mdlmzb  -mmfpgpr  -mvsx
29959 -mcrypto  -mhtm  -mpower8-fusion  -mpower8-vector
29960 -mquad-memory  -mquad-memory-atomic  -mfloat128
29961 -mfloat128-hardware -mprefixed -mpcrel -mmma
29962 -mrop-protect}
29964 The particular options set for any particular CPU varies between
29965 compiler versions, depending on what setting seems to produce optimal
29966 code for that CPU; it doesn't necessarily reflect the actual hardware's
29967 capabilities.  If you wish to set an individual option to a particular
29968 value, you may specify it after the @option{-mcpu} option, like
29969 @option{-mcpu=970 -mno-altivec}.
29971 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
29972 not enabled or disabled by the @option{-mcpu} option at present because
29973 AIX does not have full support for these options.  You may still
29974 enable or disable them individually if you're sure it'll work in your
29975 environment.
29977 @opindex mtune
29978 @item -mtune=@var{cpu_type}
29979 Set the instruction scheduling parameters for machine type
29980 @var{cpu_type}, but do not set the architecture type or register usage,
29981 as @option{-mcpu=@var{cpu_type}} does.  The same
29982 values for @var{cpu_type} are used for @option{-mtune} as for
29983 @option{-mcpu}.  If both are specified, the code generated uses the
29984 architecture and registers set by @option{-mcpu}, but the
29985 scheduling parameters set by @option{-mtune}.
29987 @opindex mcmodel=small
29988 @item -mcmodel=small
29989 Generate PowerPC64 code for the small model: The TOC is limited to
29990 64k.
29992 @opindex mcmodel=medium
29993 @item -mcmodel=medium
29994 Generate PowerPC64 code for the medium model: The TOC and other static
29995 data may be up to a total of 4G in size.  This is the default for 64-bit
29996 Linux.
29998 @opindex mcmodel=large
29999 @item -mcmodel=large
30000 Generate PowerPC64 code for the large model: The TOC may be up to 4G
30001 in size.  Other data and code is only limited by the 64-bit address
30002 space.
30004 @opindex maltivec
30005 @opindex mno-altivec
30006 @item -maltivec
30007 @itemx -mno-altivec
30008 Generate code that uses (does not use) AltiVec instructions, and also
30009 enable the use of built-in functions that allow more direct access to
30010 the AltiVec instruction set.  You may also need to set
30011 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
30012 enhancements.
30014 When @option{-maltivec} is used, the element order for AltiVec intrinsics
30015 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 
30016 match array element order corresponding to the endianness of the
30017 target.  That is, element zero identifies the leftmost element in a
30018 vector register when targeting a big-endian platform, and identifies
30019 the rightmost element in a vector register when targeting a
30020 little-endian platform.
30022 @opindex mvrsave
30023 @opindex mno-vrsave
30024 @item -mvrsave
30025 @itemx -mno-vrsave
30026 Generate VRSAVE instructions when generating AltiVec code.
30028 @opindex msecure-plt
30029 @item -msecure-plt
30030 Generate code that allows @command{ld} and @command{ld.so}
30031 to build executables and shared
30032 libraries with non-executable @code{.plt} and @code{.got} sections.
30033 This is a PowerPC
30034 32-bit SYSV ABI option.
30036 @opindex mbss-plt
30037 @item -mbss-plt
30038 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
30039 fills in, and
30040 requires @code{.plt} and @code{.got}
30041 sections that are both writable and executable.
30042 This is a PowerPC 32-bit SYSV ABI option.
30044 @opindex misel
30045 @opindex mno-isel
30046 @item -misel
30047 @itemx -mno-isel
30048 This switch enables or disables the generation of ISEL instructions.
30050 @opindex mvsx
30051 @opindex mno-vsx
30052 @item -mvsx
30053 @itemx -mno-vsx
30054 Generate code that uses (does not use) vector/scalar (VSX)
30055 instructions, and also enable the use of built-in functions that allow
30056 more direct access to the VSX instruction set.
30058 @opindex mcrypto
30059 @opindex mno-crypto
30060 @item -mcrypto
30061 @itemx -mno-crypto
30062 Enable the use (disable) of the built-in functions that allow direct
30063 access to the cryptographic instructions that were added in version
30064 2.07 of the PowerPC ISA.
30066 @opindex mhtm
30067 @opindex mno-htm
30068 @item -mhtm
30069 @itemx -mno-htm
30070 Enable (disable) the use of the built-in functions that allow direct
30071 access to the Hardware Transactional Memory (HTM) instructions that
30072 were added in version 2.07 of the PowerPC ISA.
30074 @opindex mpower8-fusion
30075 @opindex mno-power8-fusion
30076 @item -mpower8-fusion
30077 @itemx -mno-power8-fusion
30078 Generate code that keeps (does not keeps) some integer operations
30079 adjacent so that the instructions can be fused together on power8 and
30080 later processors.
30082 @opindex mpower8-vector
30083 @opindex mno-power8-vector
30084 @item -mpower8-vector
30085 @itemx -mno-power8-vector
30086 Generate code that uses (does not use) the vector and scalar
30087 instructions that were added in version 2.07 of the PowerPC ISA.  Also
30088 enable the use of built-in functions that allow more direct access to
30089 the vector instructions.
30091 @opindex mquad-memory
30092 @opindex mno-quad-memory
30093 @item -mquad-memory
30094 @itemx -mno-quad-memory
30095 Generate code that uses (does not use) the non-atomic quad word memory
30096 instructions.  The @option{-mquad-memory} option requires use of
30097 64-bit mode.
30099 @opindex mquad-memory-atomic
30100 @opindex mno-quad-memory-atomic
30101 @item -mquad-memory-atomic
30102 @itemx -mno-quad-memory-atomic
30103 Generate code that uses (does not use) the atomic quad word memory
30104 instructions.  The @option{-mquad-memory-atomic} option requires use of
30105 64-bit mode.
30107 @opindex mfloat128
30108 @opindex mno-float128
30109 @item -mfloat128
30110 @itemx -mno-float128
30111 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
30112 and use either software emulation for IEEE 128-bit floating point or
30113 hardware instructions.
30115 The VSX instruction set (@option{-mvsx}) must be enabled to use the IEEE
30116 128-bit floating point support.  The IEEE 128-bit floating point is only
30117 supported on Linux.
30119 The default for @option{-mfloat128} is enabled on PowerPC Linux
30120 systems using the VSX instruction set, and disabled on other systems.
30122 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
30123 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
30124 point support will also enable the generation of ISA 3.0 IEEE 128-bit
30125 floating point instructions.  Otherwise, if you do not specify to
30126 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
30127 system, IEEE 128-bit floating point will be done with software
30128 emulation.
30130 @opindex mfloat128-hardware
30131 @opindex mno-float128-hardware
30132 @item -mfloat128-hardware
30133 @itemx -mno-float128-hardware
30134 Enable/disable using ISA 3.0 hardware instructions to support the
30135 @var{__float128} data type.
30137 The default for @option{-mfloat128-hardware} is enabled on PowerPC
30138 Linux systems using the ISA 3.0 instruction set, and disabled on other
30139 systems.
30141 @opindex m32
30142 @opindex m64
30143 @item -m32
30144 @itemx -m64
30145 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
30146 targets (including GNU/Linux).  The 32-bit environment sets int, long
30147 and pointer to 32 bits and generates code that runs on any PowerPC
30148 variant.  The 64-bit environment sets int to 32 bits and long and
30149 pointer to 64 bits, and generates code for PowerPC64, as for
30150 @option{-mpowerpc64}.
30152 @opindex mfull-toc
30153 @opindex mno-fp-in-toc
30154 @opindex mno-sum-in-toc
30155 @opindex mminimal-toc
30156 @item -mfull-toc
30157 @itemx -mno-fp-in-toc
30158 @itemx -mno-sum-in-toc
30159 @itemx -mminimal-toc
30160 Modify generation of the TOC (Table Of Contents), which is created for
30161 every executable file.  The @option{-mfull-toc} option is selected by
30162 default.  In that case, GCC allocates at least one TOC entry for
30163 each unique non-automatic variable reference in your program.  GCC
30164 also places floating-point constants in the TOC@.  However, only
30165 16,384 entries are available in the TOC@.
30167 If you receive a linker error message that saying you have overflowed
30168 the available TOC space, you can reduce the amount of TOC space used
30169 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
30170 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
30171 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
30172 generate code to calculate the sum of an address and a constant at
30173 run time instead of putting that sum into the TOC@.  You may specify one
30174 or both of these options.  Each causes GCC to produce very slightly
30175 slower and larger code at the expense of conserving TOC space.
30177 If you still run out of space in the TOC even when you specify both of
30178 these options, specify @option{-mminimal-toc} instead.  This option causes
30179 GCC to make only one TOC entry for every file.  When you specify this
30180 option, GCC produces code that is slower and larger but which
30181 uses extremely little TOC space.  You may wish to use this option
30182 only on files that contain less frequently-executed code.
30184 @opindex maix64
30185 @opindex maix32
30186 @item -maix64
30187 @itemx -maix32
30188 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
30189 @code{long} type, and the infrastructure needed to support them.
30190 Specifying @option{-maix64} implies @option{-mpowerpc64},
30191 while @option{-maix32} disables the 64-bit ABI and
30192 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
30194 @opindex mxl-compat
30195 @opindex mno-xl-compat
30196 @item -mxl-compat
30197 @itemx -mno-xl-compat
30198 Produce code that conforms more closely to IBM XL compiler semantics
30199 when using AIX-compatible ABI@.  Pass floating-point arguments to
30200 prototyped functions beyond the register save area (RSA) on the stack
30201 in addition to argument FPRs.  Do not assume that most significant
30202 double in 128-bit long double value is properly rounded when comparing
30203 values and converting to double.  Use XL symbol names for long double
30204 support routines.
30206 The AIX calling convention was extended but not initially documented to
30207 handle an obscure K&R C case of calling a function that takes the
30208 address of its arguments with fewer arguments than declared.  IBM XL
30209 compilers access floating-point arguments that do not fit in the
30210 RSA from the stack when a subroutine is compiled without
30211 optimization.  Because always storing floating-point arguments on the
30212 stack is inefficient and rarely needed, this option is not enabled by
30213 default and only is necessary when calling subroutines compiled by IBM
30214 XL compilers without optimization.
30216 @opindex mpe
30217 @item -mpe
30218 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
30219 application written to use message passing with special startup code to
30220 enable the application to run.  The system must have PE installed in the
30221 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
30222 must be overridden with the @option{-specs=} option to specify the
30223 appropriate directory location.  The Parallel Environment does not
30224 support threads, so the @option{-mpe} option and the @option{-pthread}
30225 option are incompatible.
30227 @opindex malign-natural
30228 @opindex malign-power
30229 @item -malign-natural
30230 @itemx -malign-power
30231 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
30232 @option{-malign-natural} overrides the ABI-defined alignment of larger
30233 types, such as floating-point doubles, on their natural size-based boundary.
30234 The option @option{-malign-power} instructs GCC to follow the ABI-specified
30235 alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
30237 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
30238 is not supported.
30240 @opindex msoft-float
30241 @opindex mhard-float
30242 @item -msoft-float
30243 @itemx -mhard-float
30244 Generate code that does not use (uses) the floating-point register set.
30245 Software floating-point emulation is provided if you use the
30246 @option{-msoft-float} option, and pass the option to GCC when linking.
30248 @opindex mmultiple
30249 @opindex mno-multiple
30250 @item -mmultiple
30251 @itemx -mno-multiple
30252 Generate code that uses (does not use) the load multiple word
30253 instructions and the store multiple word instructions.  These
30254 instructions are generated by default on POWER systems, and not
30255 generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
30256 PowerPC systems, since those instructions do not work when the
30257 processor is in little-endian mode.  The exceptions are PPC740 and
30258 PPC750 which permit these instructions in little-endian mode.
30260 @opindex mupdate
30261 @opindex mno-update
30262 @item -mupdate
30263 @itemx -mno-update
30264 Generate code that uses (does not use) the load or store instructions
30265 that update the base register to the address of the calculated memory
30266 location.  These instructions are generated by default.  If you use
30267 @option{-mno-update}, there is a small window between the time that the
30268 stack pointer is updated and the address of the previous frame is
30269 stored, which means code that walks the stack frame across interrupts or
30270 signals may get corrupted data.
30272 @opindex mavoid-indexed-addresses
30273 @opindex mno-avoid-indexed-addresses
30274 @item -mavoid-indexed-addresses
30275 @itemx -mno-avoid-indexed-addresses
30276 Generate code that tries to avoid (not avoid) the use of indexed load
30277 or store instructions. These instructions can incur a performance
30278 penalty on Power6 processors in certain situations, such as when
30279 stepping through large arrays that cross a 16M boundary.  This option
30280 is enabled by default when targeting Power6 and disabled otherwise.
30282 @opindex mfused-madd
30283 @opindex mno-fused-madd
30284 @item -mfused-madd
30285 @itemx -mno-fused-madd
30286 Generate code that uses (does not use) the floating-point multiply and
30287 accumulate instructions.  These instructions are generated by default
30288 if hardware floating point is used.  The machine-dependent
30289 @option{-mfused-madd} option is now mapped to the machine-independent
30290 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
30291 mapped to @option{-ffp-contract=off}.
30293 @opindex mmulhw
30294 @opindex mno-mulhw
30295 @item -mmulhw
30296 @itemx -mno-mulhw
30297 Generate code that uses (does not use) the half-word multiply and
30298 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
30299 These instructions are generated by default when targeting those
30300 processors.
30302 @opindex mdlmzb
30303 @opindex mno-dlmzb
30304 @item -mdlmzb
30305 @itemx -mno-dlmzb
30306 Generate code that uses (does not use) the string-search @samp{dlmzb}
30307 instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
30308 generated by default when targeting those processors.
30310 @opindex mno-bit-align
30311 @opindex mbit-align
30312 @item -mno-bit-align
30313 @itemx -mbit-align
30314 On System V.4 and embedded PowerPC systems do not (do) force structures
30315 and unions that contain bit-fields to be aligned to the base type of the
30316 bit-field.
30318 For example, by default a structure containing nothing but 8
30319 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
30320 boundary and has a size of 4 bytes.  By using @option{-mno-bit-align},
30321 the structure is aligned to a 1-byte boundary and is 1 byte in
30322 size.
30324 @opindex mno-strict-align
30325 @opindex mstrict-align
30326 @item -mno-strict-align
30327 @itemx -mstrict-align
30328 On System V.4 and embedded PowerPC systems do not (do) assume that
30329 unaligned memory references are handled by the system.
30331 @opindex mrelocatable
30332 @opindex mno-relocatable
30333 @item -mrelocatable
30334 @itemx -mno-relocatable
30335 Generate code that allows (does not allow) a static executable to be
30336 relocated to a different address at run time.  A simple embedded
30337 PowerPC system loader should relocate the entire contents of
30338 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
30339 a table of 32-bit addresses generated by this option.  For this to
30340 work, all objects linked together must be compiled with
30341 @option{-mrelocatable} or @option{-mrelocatable-lib}.
30342 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
30344 @opindex mrelocatable-lib
30345 @opindex mno-relocatable-lib
30346 @item -mrelocatable-lib
30347 @itemx -mno-relocatable-lib
30348 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
30349 @code{.fixup} section to allow static executables to be relocated at
30350 run time, but @option{-mrelocatable-lib} does not use the smaller stack
30351 alignment of @option{-mrelocatable}.  Objects compiled with
30352 @option{-mrelocatable-lib} may be linked with objects compiled with
30353 any combination of the @option{-mrelocatable} options.
30355 @opindex mno-toc
30356 @opindex mtoc
30357 @item -mno-toc
30358 @itemx -mtoc
30359 On System V.4 and embedded PowerPC systems do not (do) assume that
30360 register 2 contains a pointer to a global area pointing to the addresses
30361 used in the program.
30363 @opindex mlittle
30364 @opindex mlittle-endian
30365 @item -mlittle
30366 @itemx -mlittle-endian
30367 On System V.4 and embedded PowerPC systems compile code for the
30368 processor in little-endian mode.  The @option{-mlittle-endian} option is
30369 the same as @option{-mlittle}.
30371 @opindex mbig
30372 @opindex mbig-endian
30373 @item -mbig
30374 @itemx -mbig-endian
30375 On System V.4 and embedded PowerPC systems compile code for the
30376 processor in big-endian mode.  The @option{-mbig-endian} option is
30377 the same as @option{-mbig}.
30379 @opindex mdynamic-no-pic
30380 @item -mdynamic-no-pic
30381 On Darwin / macOS systems, compile code so that it is not
30382 relocatable, but that its external references are relocatable.  The
30383 resulting code is suitable for applications, but not shared
30384 libraries.
30386 @opindex msingle-pic-base
30387 @item -msingle-pic-base
30388 Treat the register used for PIC addressing as read-only, rather than
30389 loading it in the prologue for each function.  The runtime system is
30390 responsible for initializing this register with an appropriate value
30391 before execution begins.
30393 @opindex mprioritize-restricted-insns
30394 @item -mprioritize-restricted-insns=@var{priority}
30395 This option controls the priority that is assigned to
30396 dispatch-slot restricted instructions during the second scheduling
30397 pass.  The argument @var{priority} takes the value @samp{0}, @samp{1},
30398 or @samp{2} to assign no, highest, or second-highest (respectively) 
30399 priority to dispatch-slot restricted
30400 instructions.
30402 @opindex msched-costly-dep
30403 @item -msched-costly-dep=@var{dependence_type}
30404 This option controls which dependences are considered costly
30405 by the target during instruction scheduling.  The argument
30406 @var{dependence_type} takes one of the following values:
30408 @table @asis
30409 @item @samp{no}
30410 No dependence is costly.
30412 @item @samp{all}
30413 All dependences are costly.
30415 @item @samp{true_store_to_load}
30416 A true dependence from store to load is costly.
30418 @item @samp{store_to_load}
30419 Any dependence from store to load is costly.
30421 @item @var{number}
30422 Any dependence for which the latency is greater than or equal to 
30423 @var{number} is costly.
30424 @end table
30426 @opindex minsert-sched-nops
30427 @item -minsert-sched-nops=@var{scheme}
30428 This option controls which NOP insertion scheme is used during
30429 the second scheduling pass.  The argument @var{scheme} takes one of the
30430 following values:
30432 @table @asis
30433 @item @samp{no}
30434 Don't insert NOPs.
30436 @item @samp{pad}
30437 Pad with NOPs any dispatch group that has vacant issue slots,
30438 according to the scheduler's grouping.
30440 @item @samp{regroup_exact}
30441 Insert NOPs to force costly dependent insns into
30442 separate groups.  Insert exactly as many NOPs as needed to force an insn
30443 to a new group, according to the estimated processor grouping.
30445 @item @var{number}
30446 Insert NOPs to force costly dependent insns into
30447 separate groups.  Insert @var{number} NOPs to force an insn to a new group.
30448 @end table
30450 @opindex mcall-sysv
30451 @item -mcall-sysv
30452 On System V.4 and embedded PowerPC systems compile code using calling
30453 conventions that adhere to the March 1995 draft of the System V
30454 Application Binary Interface, PowerPC processor supplement.  This is the
30455 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
30457 @opindex mcall-sysv-eabi
30458 @opindex mcall-eabi
30459 @item -mcall-sysv-eabi
30460 @itemx -mcall-eabi
30461 Specify both @option{-mcall-sysv} and @option{-meabi} options.
30463 @opindex mcall-sysv-noeabi
30464 @item -mcall-sysv-noeabi
30465 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
30467 @opindex mcall-aixdesc
30468 @item -mcall-aixdesc
30469 On System V.4 and embedded PowerPC systems compile code for the AIX
30470 operating system.
30472 @opindex mcall-linux
30473 @item -mcall-linux
30474 On System V.4 and embedded PowerPC systems compile code for the
30475 Linux-based GNU system.
30477 @opindex mcall-freebsd
30478 @item -mcall-freebsd
30479 On System V.4 and embedded PowerPC systems compile code for the
30480 FreeBSD operating system.
30482 @opindex mcall-netbsd
30483 @item -mcall-netbsd
30484 On System V.4 and embedded PowerPC systems compile code for the
30485 NetBSD operating system.
30487 @opindex mcall-openbsd
30488 @item -mcall-openbsd
30489 On System V.4 and embedded PowerPC systems compile code for the
30490 OpenBSD operating system.
30492 @opindex mtraceback
30493 @item -mtraceback=@var{traceback_type}
30494 Select the type of traceback table. Valid values for @var{traceback_type}
30495 are @samp{full}, @samp{part}, and @samp{no}.
30497 @opindex maix-struct-return
30498 @item -maix-struct-return
30499 Return all structures in memory (as specified by the AIX ABI)@.
30501 @opindex msvr4-struct-return
30502 @item -msvr4-struct-return
30503 Return structures smaller than 8 bytes in registers (as specified by the
30504 SVR4 ABI)@.
30506 @opindex mabi
30507 @item -mabi=@var{abi-type}
30508 Extend the current ABI with a particular extension, or remove such extension.
30509 Valid values are: @samp{altivec}, @samp{no-altivec},
30510 @samp{ibmlongdouble}, @samp{ieeelongdouble},
30511 @samp{elfv1}, @samp{elfv2},
30512 and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
30514 @opindex mabi=ibmlongdouble
30515 @item -mabi=ibmlongdouble
30516 Change the current ABI to use IBM extended-precision long double.
30517 This is not likely to work if your system defaults to using IEEE
30518 extended-precision long double.  If you change the long double type
30519 from IEEE extended-precision, the compiler will issue a warning unless
30520 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
30521 to be enabled.
30523 @opindex mabi=ieeelongdouble
30524 @item -mabi=ieeelongdouble
30525 Change the current ABI to use IEEE extended-precision long double.
30526 This is not likely to work if your system defaults to using IBM
30527 extended-precision long double.  If you change the long double type
30528 from IBM extended-precision, the compiler will issue a warning unless
30529 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
30530 to be enabled.
30532 @opindex mabi=elfv1
30533 @item -mabi=elfv1
30534 Change the current ABI to use the ELFv1 ABI.
30535 This is the default ABI for big-endian PowerPC 64-bit Linux.
30536 Overriding the default ABI requires special system support and is
30537 likely to fail in spectacular ways.
30539 @opindex mabi=elfv2
30540 @item -mabi=elfv2
30541 Change the current ABI to use the ELFv2 ABI.
30542 This is the default ABI for little-endian PowerPC 64-bit Linux.
30543 Overriding the default ABI requires special system support and is
30544 likely to fail in spectacular ways.
30546 @opindex mgnu-attribute
30547 @opindex mno-gnu-attribute
30548 @item -mgnu-attribute
30549 @itemx -mno-gnu-attribute
30550 Emit .gnu_attribute assembly directives to set tag/value pairs in a
30551 .gnu.attributes section that specify ABI variations in function
30552 parameters or return values.
30554 @opindex mprototype
30555 @opindex mno-prototype
30556 @item -mprototype
30557 @itemx -mno-prototype
30558 On System V.4 and embedded PowerPC systems assume that all calls to
30559 variable argument functions are properly prototyped.  Otherwise, the
30560 compiler must insert an instruction before every non-prototyped call to
30561 set or clear bit 6 of the condition code register (@code{CR}) to
30562 indicate whether floating-point values are passed in the floating-point
30563 registers in case the function takes variable arguments.  With
30564 @option{-mprototype}, only calls to prototyped variable argument functions
30565 set or clear the bit.
30567 @opindex msim
30568 @item -msim
30569 On embedded PowerPC systems, assume that the startup module is called
30570 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
30571 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
30572 configurations.
30574 @opindex mmvme
30575 @item -mmvme
30576 On embedded PowerPC systems, assume that the startup module is called
30577 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
30578 @file{libc.a}.
30580 @opindex mads
30581 @item -mads
30582 On embedded PowerPC systems, assume that the startup module is called
30583 @file{crt0.o} and the standard C libraries are @file{libads.a} and
30584 @file{libc.a}.
30586 @opindex myellowknife
30587 @item -myellowknife
30588 On embedded PowerPC systems, assume that the startup module is called
30589 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
30590 @file{libc.a}.
30592 @opindex mvxworks
30593 @item -mvxworks
30594 On System V.4 and embedded PowerPC systems, specify that you are
30595 compiling for a VxWorks system.
30597 @opindex memb
30598 @item -memb
30599 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
30600 header to indicate that @samp{eabi} extended relocations are used.
30602 @opindex meabi
30603 @opindex mno-eabi
30604 @item -meabi
30605 @itemx -mno-eabi
30606 On System V.4 and embedded PowerPC systems do (do not) adhere to the
30607 Embedded Applications Binary Interface (EABI), which is a set of
30608 modifications to the System V.4 specifications.  Selecting @option{-meabi}
30609 means that the stack is aligned to an 8-byte boundary, a function
30610 @code{__eabi} is called from @code{main} to set up the EABI
30611 environment, and the @option{-msdata} option can use both @code{r2} and
30612 @code{r13} to point to two separate small data areas.  Selecting
30613 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
30614 no EABI initialization function is called from @code{main}, and the
30615 @option{-msdata} option only uses @code{r13} to point to a single
30616 small data area.  The @option{-meabi} option is on by default if you
30617 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
30619 @opindex msdata=eabi
30620 @item -msdata=eabi
30621 On System V.4 and embedded PowerPC systems, put small initialized
30622 @code{const} global and static data in the @code{.sdata2} section, which
30623 is pointed to by register @code{r2}.  Put small initialized
30624 non-@code{const} global and static data in the @code{.sdata} section,
30625 which is pointed to by register @code{r13}.  Put small uninitialized
30626 global and static data in the @code{.sbss} section, which is adjacent to
30627 the @code{.sdata} section.  The @option{-msdata=eabi} option is
30628 incompatible with the @option{-mrelocatable} option.  The
30629 @option{-msdata=eabi} option also sets the @option{-memb} option.
30631 @opindex msdata=sysv
30632 @item -msdata=sysv
30633 On System V.4 and embedded PowerPC systems, put small global and static
30634 data in the @code{.sdata} section, which is pointed to by register
30635 @code{r13}.  Put small uninitialized global and static data in the
30636 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
30637 The @option{-msdata=sysv} option is incompatible with the
30638 @option{-mrelocatable} option.
30640 @opindex msdata=default
30641 @opindex msdata
30642 @item -msdata=default
30643 @itemx -msdata
30644 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
30645 compile code the same as @option{-msdata=eabi}, otherwise compile code the
30646 same as @option{-msdata=sysv}.
30648 @opindex msdata=data
30649 @item -msdata=data
30650 On System V.4 and embedded PowerPC systems, put small global
30651 data in the @code{.sdata} section.  Put small uninitialized global
30652 data in the @code{.sbss} section.  Do not use register @code{r13}
30653 to address small data however.  This is the default behavior unless
30654 other @option{-msdata} options are used.
30656 @opindex msdata=none
30657 @opindex mno-sdata
30658 @item -msdata=none
30659 @itemx -mno-sdata
30660 On embedded PowerPC systems, put all initialized global and static data
30661 in the @code{.data} section, and all uninitialized data in the
30662 @code{.bss} section.
30664 @opindex mreadonly-in-sdata
30665 @opindex mno-readonly-in-sdata
30666 @item -mreadonly-in-sdata
30667 Put read-only objects in the @code{.sdata} section as well.  This is the
30668 default.
30670 @opindex mblock-move-inline-limit
30671 @item -mblock-move-inline-limit=@var{num}
30672 Inline all block moves (such as calls to @code{memcpy} or structure
30673 copies) less than or equal to @var{num} bytes.  The minimum value for
30674 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
30675 targets.  The default value is target-specific.
30677 @opindex mblock-compare-inline-limit
30678 @item -mblock-compare-inline-limit=@var{num}
30679 Generate non-looping inline code for all block compares (such as calls
30680 to @code{memcmp} or structure compares) less than or equal to @var{num}
30681 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
30682 block compare is disabled. The default value is target-specific.
30684 @opindex mblock-compare-inline-loop-limit
30685 @item -mblock-compare-inline-loop-limit=@var{num}
30686 Generate an inline expansion using loop code for all block compares that
30687 are less than or equal to @var{num} bytes, but greater than the limit
30688 for non-loop inline block compare expansion. If the block length is not
30689 constant, at most @var{num} bytes will be compared before @code{memcmp}
30690 is called to compare the remainder of the block. The default value is
30691 target-specific.
30693 @opindex mstring-compare-inline-limit
30694 @item -mstring-compare-inline-limit=@var{num}
30695 Compare at most @var{num} string bytes with inline code.
30696 If the difference or end of string is not found at the
30697 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
30698 take care of the rest of the comparison. The default is 64 bytes.
30700 @opindex G
30701 @cindex smaller data references (PowerPC)
30702 @cindex .sdata/.sdata2 references (PowerPC)
30703 @item -G @var{num}
30704 On embedded PowerPC systems, put global and static items less than or
30705 equal to @var{num} bytes into the small data or BSS sections instead of
30706 the normal data or BSS section.  By default, @var{num} is 8.  The
30707 @option{-G @var{num}} switch is also passed to the linker.
30708 All modules should be compiled with the same @option{-G @var{num}} value.
30710 @opindex mregnames
30711 @opindex mno-regnames
30712 @item -mregnames
30713 @itemx -mno-regnames
30714 On System V.4 and embedded PowerPC systems do (do not) emit register
30715 names in the assembly language output using symbolic forms.
30717 @opindex mlongcall
30718 @opindex mno-longcall
30719 @item -mlongcall
30720 @itemx -mno-longcall
30721 By default assume that all calls are far away so that a longer and more
30722 expensive calling sequence is required.  This is required for calls
30723 farther than 32 megabytes (33,554,432 bytes) from the current location.
30724 A short call is generated if the compiler knows
30725 the call cannot be that far away.  This setting can be overridden by
30726 the @code{shortcall} function attribute, or by @code{#pragma
30727 longcall(0)}.
30729 Some linkers are capable of detecting out-of-range calls and generating
30730 glue code on the fly.  On these systems, long calls are unnecessary and
30731 generate slower code.  As of this writing, the AIX linker can do this,
30732 as can the GNU linker for PowerPC/64.  It is planned to add this feature
30733 to the GNU linker for 32-bit PowerPC systems as well.
30735 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
30736 GCC can generate long calls using an inline PLT call sequence (see
30737 @option{-mpltseq}).  PowerPC with @option{-mbss-plt} and PowerPC64
30738 ELFv1 (big-endian) do not support inline PLT calls.
30740 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
30741 callee, L42}, plus a @dfn{branch island} (glue code).  The two target
30742 addresses represent the callee and the branch island.  The
30743 Darwin/PPC linker prefers the first address and generates a @code{bl
30744 callee} if the PPC @code{bl} instruction reaches the callee directly;
30745 otherwise, the linker generates @code{bl L42} to call the branch
30746 island.  The branch island is appended to the body of the
30747 calling function; it computes the full 32-bit address of the callee
30748 and jumps to it.
30750 On Mach-O (Darwin) systems, this option directs the compiler emit to
30751 the glue for every direct call, and the Darwin linker decides whether
30752 to use or discard it.
30754 In the future, GCC may ignore all longcall specifications
30755 when the linker is known to generate glue.
30757 @opindex mpltseq
30758 @opindex mno-pltseq
30759 @item -mpltseq
30760 @itemx -mno-pltseq
30761 Implement (do not implement) -fno-plt and long calls using an inline
30762 PLT call sequence that supports lazy linking and long calls to
30763 functions in dlopen'd shared libraries.  Inline PLT calls are only
30764 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
30765 linkers, and are enabled by default if the support is detected when
30766 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
30767 configured with @option{--enable-secureplt}.  @option{-mpltseq} code
30768 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
30769 linked together.
30771 @opindex mtls-markers
30772 @opindex mno-tls-markers
30773 @item -mtls-markers
30774 @itemx -mno-tls-markers
30775 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
30776 specifying the function argument.  The relocation allows the linker to
30777 reliably associate function call with argument setup instructions for
30778 TLS optimization, which in turn allows GCC to better schedule the
30779 sequence.
30781 @opindex mrecip
30782 @item -mrecip
30783 @itemx -mno-recip
30784 This option enables use of the reciprocal estimate and
30785 reciprocal square root estimate instructions with additional
30786 Newton-Raphson steps to increase precision instead of doing a divide or
30787 square root and divide for floating-point arguments.  You should use
30788 the @option{-ffast-math} option when using @option{-mrecip} (or at
30789 least @option{-funsafe-math-optimizations},
30790 @option{-ffinite-math-only}, @option{-freciprocal-math} and
30791 @option{-fno-trapping-math}).  Note that while the throughput of the
30792 sequence is generally higher than the throughput of the non-reciprocal
30793 instruction, the precision of the sequence can be decreased by up to 2
30794 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
30795 roots.
30797 @opindex mrecip=opt
30798 @item -mrecip=@var{opt}
30799 This option controls which reciprocal estimate instructions
30800 may be used.  @var{opt} is a comma-separated list of options, which may
30801 be preceded by a @code{!} to invert the option:
30803 @table @samp
30805 @item all
30806 Enable all estimate instructions.
30808 @item default 
30809 Enable the default instructions, equivalent to @option{-mrecip}.
30811 @item none 
30812 Disable all estimate instructions, equivalent to @option{-mno-recip}.
30814 @item div 
30815 Enable the reciprocal approximation instructions for both 
30816 single and double precision.
30818 @item divf 
30819 Enable the single-precision reciprocal approximation instructions.
30821 @item divd 
30822 Enable the double-precision reciprocal approximation instructions.
30824 @item rsqrt 
30825 Enable the reciprocal square root approximation instructions for both
30826 single and double precision.
30828 @item rsqrtf 
30829 Enable the single-precision reciprocal square root approximation instructions.
30831 @item rsqrtd 
30832 Enable the double-precision reciprocal square root approximation instructions.
30834 @end table
30836 So, for example, @option{-mrecip=all,!rsqrtd} enables
30837 all of the reciprocal estimate instructions, except for the
30838 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
30839 which handle the double-precision reciprocal square root calculations.
30841 @opindex mrecip-precision
30842 @item -mrecip-precision
30843 @itemx -mno-recip-precision
30844 Assume (do not assume) that the reciprocal estimate instructions
30845 provide higher-precision estimates than is mandated by the PowerPC
30846 ABI.  Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
30847 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
30848 The double-precision square root estimate instructions are not generated by
30849 default on low-precision machines, since they do not provide an
30850 estimate that converges after three steps.
30852 @opindex mveclibabi
30853 @item -mveclibabi=@var{type}
30854 Specifies the ABI type to use for vectorizing intrinsics using an
30855 external library.  The only type supported at present is @samp{mass},
30856 which specifies to use IBM's Mathematical Acceleration Subsystem
30857 (MASS) libraries for vectorizing intrinsics using external libraries.
30858 GCC currently emits calls to @code{acosd2}, @code{acosf4},
30859 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
30860 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
30861 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
30862 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
30863 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
30864 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
30865 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
30866 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
30867 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
30868 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
30869 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
30870 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
30871 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
30872 for power7.  Both @option{-ftree-vectorize} and
30873 @option{-funsafe-math-optimizations} must also be enabled.  The MASS
30874 libraries must be specified at link time.
30876 @opindex mfriz
30877 @item -mfriz
30878 @itemx -mno-friz
30879 Generate (do not generate) the @code{friz} instruction when the
30880 @option{-funsafe-math-optimizations} option is used to optimize
30881 rounding of floating-point values to 64-bit integer and back to floating
30882 point.  The @code{friz} instruction does not return the same value if
30883 the floating-point number is too large to fit in an integer.
30885 @opindex mpointers-to-nested-functions
30886 @item -mpointers-to-nested-functions
30887 @itemx -mno-pointers-to-nested-functions
30888 Generate (do not generate) code to load up the static chain register
30889 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
30890 systems where a function pointer points to a 3-word descriptor giving
30891 the function address, TOC value to be loaded in register @code{r2}, and
30892 static chain value to be loaded in register @code{r11}.  The
30893 @option{-mpointers-to-nested-functions} is on by default.  You cannot
30894 call through pointers to nested functions or pointers
30895 to functions compiled in other languages that use the static chain if
30896 you use @option{-mno-pointers-to-nested-functions}.
30898 @opindex msave-toc-indirect
30899 @item -msave-toc-indirect
30900 @itemx -mno-save-toc-indirect
30901 Generate (do not generate) code to save the TOC value in the reserved
30902 stack location in the function prologue if the function calls through
30903 a pointer on AIX and 64-bit Linux systems.  If the TOC value is not
30904 saved in the prologue, it is saved just before the call through the
30905 pointer.  The @option{-mno-save-toc-indirect} option is the default.
30907 @opindex mcompat-align-parm
30908 @item -mcompat-align-parm
30909 @itemx -mno-compat-align-parm
30910 Generate (do not generate) code to pass structure parameters with a
30911 maximum alignment of 64 bits, for compatibility with older versions
30912 of GCC.
30914 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
30915 structure parameter on a 128-bit boundary when that structure contained
30916 a member requiring 128-bit alignment.  This is corrected in more
30917 recent versions of GCC.  This option may be used to generate code
30918 that is compatible with functions compiled with older versions of
30919 GCC.
30921 The @option{-mno-compat-align-parm} option is the default.
30923 @opindex mstack-protector-guard
30924 @opindex mstack-protector-guard-reg
30925 @opindex mstack-protector-guard-offset
30926 @opindex mstack-protector-guard-symbol
30927 @item -mstack-protector-guard=@var{guard}
30928 @itemx -mstack-protector-guard-reg=@var{reg}
30929 @itemx -mstack-protector-guard-offset=@var{offset}
30930 @itemx -mstack-protector-guard-symbol=@var{symbol}
30931 Generate stack protection code using canary at @var{guard}.  Supported
30932 locations are @samp{global} for global canary or @samp{tls} for per-thread
30933 canary in the TLS block (the default with GNU libc version 2.4 or later).
30935 With the latter choice the options
30936 @option{-mstack-protector-guard-reg=@var{reg}} and
30937 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
30938 which register to use as base register for reading the canary, and from what
30939 offset from that base register. The default for those is as specified in the
30940 relevant ABI.  @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
30941 the offset with a symbol reference to a canary in the TLS block.
30943 @opindex mpcrel
30944 @opindex mno-pcrel
30945 @item -mpcrel
30946 @itemx -mno-pcrel
30947 Generate (do not generate) pc-relative addressing.  The @option{-mpcrel}
30948 option requires that the medium code model (@option{-mcmodel=medium})
30949 and prefixed addressing (@option{-mprefixed}) options are enabled.
30951 @opindex mprefixed
30952 @opindex mno-prefixed
30953 @item -mprefixed
30954 @itemx -mno-prefixed
30955 Generate (do not generate) addressing modes using prefixed load and
30956 store instructions.  The @option{-mprefixed} option requires that
30957 the option @option{-mcpu=power10} (or later) is enabled.
30959 @opindex mmma
30960 @opindex mno-mma
30961 @item -mmma
30962 @itemx -mno-mma
30963 Generate (do not generate) the MMA instructions.  The @option{-mma}
30964 option requires that the option @option{-mcpu=power10} (or later)
30965 is enabled.
30967 @opindex mrop-protect
30968 @opindex mno-rop-protect
30969 @item -mrop-protect
30970 @itemx -mno-rop-protect
30971 Generate (do not generate) ROP protection instructions when the target
30972 processor supports them.  Currently this option disables the shrink-wrap
30973 optimization (@option{-fshrink-wrap}).
30975 @opindex mprivileged
30976 @opindex mno-privileged
30977 @item -mprivileged
30978 @itemx -mno-privileged
30979 Generate (do not generate) code that will run in privileged state.
30981 @opindex block-ops-unaligned-vsx
30982 @opindex no-block-ops-unaligned-vsx
30983 @item -mblock-ops-unaligned-vsx
30984 @itemx -mno-block-ops-unaligned-vsx
30985 Generate (do not generate) unaligned vsx loads and stores for
30986 inline expansion of @code{memcpy} and @code{memmove}.
30988 @item --param rs6000-vect-unroll-limit=
30989 The vectorizer will check with target information to determine whether it
30990 would be beneficial to unroll the main vectorized loop and by how much.  This
30991 parameter sets the upper bound of how much the vectorizer will unroll the main
30992 loop.  The default value is four.
30994 @end table
30996 @node RX Options
30997 @subsection RX Options
30998 @cindex RX Options
31000 These command-line options are defined for RX targets:
31002 @table @gcctabopt
31003 @opindex m64bit-doubles
31004 @opindex m32bit-doubles
31005 @item -m64bit-doubles
31006 @itemx -m32bit-doubles
31007 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
31008 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
31009 @option{-m32bit-doubles}.  @emph{Note} RX floating-point hardware only
31010 works on 32-bit values, which is why the default is
31011 @option{-m32bit-doubles}.
31013 @opindex fpu
31014 @opindex nofpu
31015 @item -fpu
31016 @itemx -nofpu
31017 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
31018 floating-point hardware.  The default is enabled for the RX600
31019 series and disabled for the RX200 series.
31021 Floating-point instructions are only generated for 32-bit floating-point 
31022 values, however, so the FPU hardware is not used for doubles if the
31023 @option{-m64bit-doubles} option is used.
31025 @emph{Note} If the @option{-fpu} option is enabled then
31026 @option{-funsafe-math-optimizations} is also enabled automatically.
31027 This is because the RX FPU instructions are themselves unsafe.
31029 @opindex mcpu
31030 @item -mcpu=@var{name}
31031 Selects the type of RX CPU to be targeted.  Currently three types are
31032 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
31033 the specific @samp{RX610} CPU.  The default is @samp{RX600}.
31035 The only difference between @samp{RX600} and @samp{RX610} is that the
31036 @samp{RX610} does not support the @code{MVTIPL} instruction.
31038 The @samp{RX200} series does not have a hardware floating-point unit
31039 and so @option{-nofpu} is enabled by default when this type is
31040 selected.
31042 @opindex mbig-endian-data
31043 @opindex mlittle-endian-data
31044 @item -mbig-endian-data
31045 @itemx -mlittle-endian-data
31046 Store data (but not code) in the big-endian format.  The default is
31047 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
31048 format.
31050 @opindex msmall-data-limit
31051 @item -msmall-data-limit=@var{N}
31052 Specifies the maximum size in bytes of global and static variables
31053 which can be placed into the small data area.  Using the small data
31054 area can lead to smaller and faster code, but the size of area is
31055 limited and it is up to the programmer to ensure that the area does
31056 not overflow.  Also when the small data area is used one of the RX's
31057 registers (usually @code{r13}) is reserved for use pointing to this
31058 area, so it is no longer available for use by the compiler.  This
31059 could result in slower and/or larger code if variables are pushed onto
31060 the stack instead of being held in this register.
31062 Note, common variables (variables that have not been initialized) and
31063 constants are not placed into the small data area as they are assigned
31064 to other sections in the output executable.
31066 The default value is zero, which disables this feature.  Note, this
31067 feature is not enabled by default with higher optimization levels
31068 (@option{-O2} etc) because of the potentially detrimental effects of
31069 reserving a register.  It is up to the programmer to experiment and
31070 discover whether this feature is of benefit to their program.  See the
31071 description of the @option{-mpid} option for a description of how the
31072 actual register to hold the small data area pointer is chosen.
31074 @opindex msim
31075 @opindex mno-sim
31076 @item -msim
31077 @itemx -mno-sim
31078 Use the simulator runtime.  The default is to use the libgloss
31079 board-specific runtime.
31081 @opindex mas100-syntax
31082 @opindex mno-as100-syntax
31083 @item -mas100-syntax
31084 @itemx -mno-as100-syntax
31085 When generating assembler output use a syntax that is compatible with
31086 Renesas's AS100 assembler.  This syntax can also be handled by the GAS
31087 assembler, but it has some restrictions so it is not generated by default.
31089 @opindex mmax-constant-size
31090 @item -mmax-constant-size=@var{N}
31091 Specifies the maximum size, in bytes, of a constant that can be used as
31092 an operand in a RX instruction.  Although the RX instruction set does
31093 allow constants of up to 4 bytes in length to be used in instructions,
31094 a longer value equates to a longer instruction.  Thus in some
31095 circumstances it can be beneficial to restrict the size of constants
31096 that are used in instructions.  Constants that are too big are instead
31097 placed into a constant pool and referenced via register indirection.
31099 The value @var{N} can be between 0 and 4.  A value of 0 (the default)
31100 or 4 means that constants of any size are allowed.
31102 @opindex mrelax
31103 @item -mrelax
31104 Enable linker relaxation.  Linker relaxation is a process whereby the
31105 linker attempts to reduce the size of a program by finding shorter
31106 versions of various instructions.  Disabled by default.
31108 @opindex mint-register
31109 @item -mint-register=@var{N}
31110 Specify the number of registers to reserve for fast interrupt handler
31111 functions.  The value @var{N} can be between 0 and 4.  A value of 1
31112 means that register @code{r13} is reserved for the exclusive use
31113 of fast interrupt handlers.  A value of 2 reserves @code{r13} and
31114 @code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
31115 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
31116 A value of 0, the default, does not reserve any registers.
31118 @opindex msave-acc-in-interrupts
31119 @item -msave-acc-in-interrupts
31120 Specifies that interrupt handler functions should preserve the
31121 accumulator register.  This is only necessary if normal code might use
31122 the accumulator register, for example because it performs 64-bit
31123 multiplications.  The default is to ignore the accumulator as this
31124 makes the interrupt handlers faster.
31126 @opindex mpid
31127 @opindex mno-pid
31128 @item -mpid
31129 @itemx -mno-pid
31130 Enables the generation of position independent data.  When enabled any
31131 access to constant data is done via an offset from a base address
31132 held in a register.  This allows the location of constant data to be
31133 determined at run time without requiring the executable to be
31134 relocated, which is a benefit to embedded applications with tight
31135 memory constraints.  Data that can be modified is not affected by this
31136 option.
31138 Note, using this feature reserves a register, usually @code{r13}, for
31139 the constant data base address.  This can result in slower and/or
31140 larger code, especially in complicated functions.
31142 The actual register chosen to hold the constant data base address
31143 depends upon whether the @option{-msmall-data-limit} and/or the
31144 @option{-mint-register} command-line options are enabled.  Starting
31145 with register @code{r13} and proceeding downwards, registers are
31146 allocated first to satisfy the requirements of @option{-mint-register},
31147 then @option{-mpid} and finally @option{-msmall-data-limit}.  Thus it
31148 is possible for the small data area register to be @code{r8} if both
31149 @option{-mint-register=4} and @option{-mpid} are specified on the
31150 command line.
31152 By default this feature is not enabled.  The default can be restored
31153 via the @option{-mno-pid} command-line option.
31155 @opindex mno-warn-multiple-fast-interrupts
31156 @opindex mwarn-multiple-fast-interrupts
31157 @item -mno-warn-multiple-fast-interrupts
31158 @itemx -mwarn-multiple-fast-interrupts
31159 Prevents GCC from issuing a warning message if it finds more than one
31160 fast interrupt handler when it is compiling a file.  The default is to
31161 issue a warning for each extra fast interrupt handler found, as the RX
31162 only supports one such interrupt.
31164 @opindex mallow-string-insns
31165 @opindex mno-allow-string-insns
31166 @item -mallow-string-insns
31167 @itemx -mno-allow-string-insns
31168 Enables or disables the use of the string manipulation instructions
31169 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
31170 @code{SWHILE} and also the @code{RMPA} instruction.  These
31171 instructions may prefetch data, which is not safe to do if accessing
31172 an I/O register.  (See section 12.2.7 of the RX62N Group User's Manual
31173 for more information).
31175 The default is to allow these instructions, but it is not possible for
31176 GCC to reliably detect all circumstances where a string instruction
31177 might be used to access an I/O register, so their use cannot be
31178 disabled automatically.  Instead it is reliant upon the programmer to
31179 use the @option{-mno-allow-string-insns} option if their program
31180 accesses I/O space.
31182 When the instructions are enabled GCC defines the C preprocessor
31183 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
31184 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
31186 @opindex mjsr
31187 @opindex mno-jsr
31188 @item -mjsr
31189 @itemx -mno-jsr
31190 Use only (or not only) @code{JSR} instructions to access functions.
31191 This option can be used when code size exceeds the range of @code{BSR}
31192 instructions.  Note that @option{-mno-jsr} does not mean to not use
31193 @code{JSR} but instead means that any type of branch may be used.
31194 @end table
31196 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
31197 has special significance to the RX port when used with the
31198 @code{interrupt} function attribute.  This attribute indicates a
31199 function intended to process fast interrupts.  GCC ensures
31200 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
31201 and/or @code{r13} and only provided that the normal use of the
31202 corresponding registers have been restricted via the
31203 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
31204 options.
31206 @node S/390 and zSeries Options
31207 @subsection S/390 and zSeries Options
31208 @cindex S/390 and zSeries Options
31210 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
31212 @table @gcctabopt
31213 @opindex mhard-float
31214 @opindex msoft-float
31215 @item -mhard-float
31216 @itemx -msoft-float
31217 Use (do not use) the hardware floating-point instructions and registers
31218 for floating-point operations.  When @option{-msoft-float} is specified,
31219 functions in @file{libgcc.a} are used to perform floating-point
31220 operations.  When @option{-mhard-float} is specified, the compiler
31221 generates IEEE floating-point instructions.  This is the default.
31223 @opindex mhard-dfp
31224 @opindex mno-hard-dfp
31225 @item -mhard-dfp
31226 @itemx -mno-hard-dfp
31227 Use (do not use) the hardware decimal-floating-point instructions for
31228 decimal-floating-point operations.  When @option{-mno-hard-dfp} is
31229 specified, functions in @file{libgcc.a} are used to perform
31230 decimal-floating-point operations.  When @option{-mhard-dfp} is
31231 specified, the compiler generates decimal-floating-point hardware
31232 instructions.  This is the default for @option{-march=z9-ec} or higher.
31234 @opindex mlong-double-64
31235 @opindex mlong-double-128
31236 @item -mlong-double-64
31237 @itemx -mlong-double-128
31238 These switches control the size of @code{long double} type. A size
31239 of 64 bits makes the @code{long double} type equivalent to the @code{double}
31240 type. This is the default.
31242 @opindex mbackchain
31243 @opindex mno-backchain
31244 @item -mbackchain
31245 @itemx -mno-backchain
31246 Store (do not store) the address of the caller's frame as backchain pointer
31247 into the callee's stack frame.
31248 A backchain may be needed to allow debugging using tools that do not understand
31249 DWARF call frame information.
31250 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
31251 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
31252 the backchain is placed into the topmost word of the 96/160 byte register
31253 save area.
31255 In general, code compiled with @option{-mbackchain} is call-compatible with
31256 code compiled with @option{-mno-backchain}; however, use of the backchain
31257 for debugging purposes usually requires that the whole binary is built with
31258 @option{-mbackchain}.  Note that the combination of @option{-mbackchain},
31259 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
31260 to build a linux kernel use @option{-msoft-float}.
31262 The default is to not maintain the backchain.
31264 @opindex mpacked-stack
31265 @opindex mno-packed-stack
31266 @item -mpacked-stack
31267 @itemx -mno-packed-stack
31268 Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
31269 specified, the compiler uses the all fields of the 96/160 byte register save
31270 area only for their default purpose; unused fields still take up stack space.
31271 When @option{-mpacked-stack} is specified, register save slots are densely
31272 packed at the top of the register save area; unused space is reused for other
31273 purposes, allowing for more efficient use of the available stack space.
31274 However, when @option{-mbackchain} is also in effect, the topmost word of
31275 the save area is always used to store the backchain, and the return address
31276 register is always saved two words below the backchain.
31278 As long as the stack frame backchain is not used, code generated with
31279 @option{-mpacked-stack} is call-compatible with code generated with
31280 @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
31281 S/390 or zSeries generated code that uses the stack frame backchain at run
31282 time, not just for debugging purposes.  Such code is not call-compatible
31283 with code compiled with @option{-mpacked-stack}.  Also, note that the
31284 combination of @option{-mbackchain},
31285 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
31286 to build a linux kernel use @option{-msoft-float}.
31288 The default is to not use the packed stack layout.
31290 @opindex msmall-exec
31291 @opindex mno-small-exec
31292 @item -msmall-exec
31293 @itemx -mno-small-exec
31294 Generate (or do not generate) code using the @code{bras} instruction
31295 to do subroutine calls.
31296 This only works reliably if the total executable size does not
31297 exceed 64k.  The default is to use the @code{basr} instruction instead,
31298 which does not have this limitation.
31300 @opindex m64
31301 @opindex m31
31302 @item -m64
31303 @itemx -m31
31304 When @option{-m31} is specified, generate code compliant to the
31305 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
31306 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
31307 particular to generate 64-bit instructions.  For the @samp{s390}
31308 targets, the default is @option{-m31}, while the @samp{s390x}
31309 targets default to @option{-m64}.
31311 @opindex mzarch
31312 @opindex mesa
31313 @item -mzarch
31314 @itemx -mesa
31315 When @option{-mzarch} is specified, generate code using the
31316 instructions available on z/Architecture.
31317 When @option{-mesa} is specified, generate code using the
31318 instructions available on ESA/390.  Note that @option{-mesa} is
31319 not possible with @option{-m64}.
31320 When generating code compliant to the GNU/Linux for S/390 ABI,
31321 the default is @option{-mesa}.  When generating code compliant
31322 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
31324 @opindex mhtm
31325 @opindex mno-htm
31326 @item -mhtm
31327 @itemx -mno-htm
31328 The @option{-mhtm} option enables a set of builtins making use of
31329 instructions available with the transactional execution facility
31330 introduced with the IBM zEnterprise EC12 machine generation
31331 @ref{S/390 System z Built-in Functions}.
31332 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
31334 @opindex mvx
31335 @opindex mno-vx
31336 @item -mvx
31337 @itemx -mno-vx
31338 When @option{-mvx} is specified, generate code using the instructions
31339 available with the vector extension facility introduced with the IBM
31340 z13 machine generation.
31341 This option changes the ABI for some vector type values with regard to
31342 alignment and calling conventions.  In case vector type values are
31343 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
31344 command will be added to mark the resulting binary with the ABI used.
31345 @option{-mvx} is enabled by default when using @option{-march=z13}.
31347 @opindex mzvector
31348 @opindex mno-zvector
31349 @item -mzvector
31350 @itemx -mno-zvector
31351 The @option{-mzvector} option enables vector language extensions and
31352 builtins using instructions available with the vector extension
31353 facility introduced with the IBM z13 machine generation.
31354 This option adds support for @samp{vector} to be used as a keyword to
31355 define vector type variables and arguments.  @samp{vector} is only
31356 available when GNU extensions are enabled.  It will not be expanded
31357 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
31358 In addition to the GCC low-level builtins @option{-mzvector} enables
31359 a set of builtins added for compatibility with AltiVec-style
31360 implementations like Power and Cell.  In order to make use of these
31361 builtins the header file @file{vecintrin.h} needs to be included.
31362 @option{-mzvector} is disabled by default.
31364 @opindex mmvcle
31365 @opindex mno-mvcle
31366 @item -mmvcle
31367 @itemx -mno-mvcle
31368 Generate (or do not generate) code using the @code{mvcle} instruction
31369 to perform block moves.  When @option{-mno-mvcle} is specified,
31370 use a @code{mvc} loop instead.  This is the default unless optimizing for
31371 size.
31373 @opindex mdebug
31374 @opindex mno-debug
31375 @item -mdebug
31376 @itemx -mno-debug
31377 Print (or do not print) additional debug information when compiling.
31378 The default is to not print debug information.
31380 @opindex march
31381 @item -march=@var{cpu-type}
31382 Generate code that runs on @var{cpu-type}, which is the name of a
31383 system representing a certain processor type.  Possible values for
31384 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
31385 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
31386 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
31387 @samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13},
31388 @samp{z16}/@samp{arch14}, and @samp{native}.
31390 The default is @option{-march=z900}.
31392 Specifying @samp{native} as cpu type can be used to select the best
31393 architecture option for the host processor.
31394 @option{-march=native} has no effect if GCC does not recognize the
31395 processor.
31397 @opindex mtune
31398 @item -mtune=@var{cpu-type}
31399 Tune to @var{cpu-type} everything applicable about the generated code,
31400 except for the ABI and the set of available instructions.
31401 The list of @var{cpu-type} values is the same as for @option{-march}.
31402 The default is the value used for @option{-march}.
31404 @opindex mtpf-trace
31405 @opindex mno-tpf-trace
31406 @item -mtpf-trace
31407 @itemx -mno-tpf-trace
31408 Generate code that adds (does not add) in TPF OS specific branches to trace
31409 routines in the operating system.  This option is off by default, even
31410 when compiling for the TPF OS@.
31412 @opindex mtpf-trace-skip
31413 @opindex mno-tpf-trace-skip
31414 @item -mtpf-trace-skip
31415 @itemx -mno-tpf-trace-skip
31416 Generate code that changes (does not change) the default branch
31417 targets enabled by @option{-mtpf-trace} to point to specialized trace
31418 routines providing the ability of selectively skipping function trace
31419 entries for the TPF OS.  This option is off by default, even when
31420 compiling for the TPF OS and specifying @option{-mtpf-trace}.
31422 @opindex mfused-madd
31423 @opindex mno-fused-madd
31424 @item -mfused-madd
31425 @itemx -mno-fused-madd
31426 Generate code that uses (does not use) the floating-point multiply and
31427 accumulate instructions.  These instructions are generated by default if
31428 hardware floating point is used.
31430 @opindex mwarn-framesize
31431 @item -mwarn-framesize=@var{framesize}
31432 Emit a warning if the current function exceeds the given frame size.  Because
31433 this is a compile-time check it doesn't need to be a real problem when the program
31434 runs.  It is intended to identify functions that most probably cause
31435 a stack overflow.  It is useful to be used in an environment with limited stack
31436 size e.g.@: the linux kernel.
31438 @opindex mwarn-dynamicstack
31439 @item -mwarn-dynamicstack
31440 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
31441 arrays.  This is generally a bad idea with a limited stack size.
31443 @opindex mstack-guard
31444 @opindex mstack-size
31445 @item -mstack-guard=@var{stack-guard}
31446 @itemx -mstack-size=@var{stack-size}
31447 If these options are provided the S/390 back end emits additional instructions in
31448 the function prologue that trigger a trap if the stack size is @var{stack-guard}
31449 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
31450 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
31451 the frame size of the compiled function is chosen.
31452 These options are intended to be used to help debugging stack overflow problems.
31453 The additionally emitted code causes only little overhead and hence can also be
31454 used in production-like systems without greater performance degradation.  The given
31455 values have to be exact powers of 2 and @var{stack-size} has to be greater than
31456 @var{stack-guard} without exceeding 64k.
31457 In order to be efficient the extra code makes the assumption that the stack starts
31458 at an address aligned to the value given by @var{stack-size}.
31459 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
31461 @opindex mhotpatch
31462 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
31463 If the hotpatch option is enabled, a ``hot-patching'' function
31464 prologue is generated for all functions in the compilation unit.
31465 The funtion label is prepended with the given number of two-byte
31466 NOP instructions (@var{pre-halfwords}, maximum 1000000).  After
31467 the label, 2 * @var{post-halfwords} bytes are appended, using the
31468 largest NOP like instructions the architecture allows (maximum
31469 1000000).
31471 If both arguments are zero, hotpatching is disabled.
31473 This option can be overridden for individual functions with the
31474 @code{hotpatch} attribute.
31475 @end table
31477 @node SH Options
31478 @subsection SH Options
31480 These @samp{-m} options are defined for the SH implementations:
31482 @table @gcctabopt
31483 @opindex m1
31484 @item -m1
31485 Generate code for the SH1.
31487 @opindex m2
31488 @item -m2
31489 Generate code for the SH2.
31491 @item -m2e
31492 Generate code for the SH2e.
31494 @opindex m2a-nofpu
31495 @item -m2a-nofpu
31496 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
31497 that the floating-point unit is not used.
31499 @opindex m2a-single-only
31500 @item -m2a-single-only
31501 Generate code for the SH2a-FPU, in such a way that no double-precision
31502 floating-point operations are used.
31504 @opindex m2a-single
31505 @item -m2a-single
31506 Generate code for the SH2a-FPU assuming the floating-point unit is in
31507 single-precision mode by default.
31509 @opindex m2a
31510 @item -m2a
31511 Generate code for the SH2a-FPU assuming the floating-point unit is in
31512 double-precision mode by default.
31514 @opindex m3
31515 @item -m3
31516 Generate code for the SH3.
31518 @opindex m3e
31519 @item -m3e
31520 Generate code for the SH3e.
31522 @opindex m4-nofpu
31523 @item -m4-nofpu
31524 Generate code for the SH4 without a floating-point unit.
31526 @opindex m4-single-only
31527 @item -m4-single-only
31528 Generate code for the SH4 with a floating-point unit that only
31529 supports single-precision arithmetic.
31531 @opindex m4-single
31532 @item -m4-single
31533 Generate code for the SH4 assuming the floating-point unit is in
31534 single-precision mode by default.
31536 @opindex m4
31537 @item -m4
31538 Generate code for the SH4.
31540 @opindex m4-100
31541 @item -m4-100
31542 Generate code for SH4-100.
31544 @opindex m4-100-nofpu
31545 @item -m4-100-nofpu
31546 Generate code for SH4-100 in such a way that the
31547 floating-point unit is not used.
31549 @opindex m4-100-single
31550 @item -m4-100-single
31551 Generate code for SH4-100 assuming the floating-point unit is in
31552 single-precision mode by default.
31554 @opindex m4-100-single-only
31555 @item -m4-100-single-only
31556 Generate code for SH4-100 in such a way that no double-precision
31557 floating-point operations are used.
31559 @opindex m4-200
31560 @item -m4-200
31561 Generate code for SH4-200.
31563 @opindex m4-200-nofpu
31564 @item -m4-200-nofpu
31565 Generate code for SH4-200 without in such a way that the
31566 floating-point unit is not used.
31568 @opindex m4-200-single
31569 @item -m4-200-single
31570 Generate code for SH4-200 assuming the floating-point unit is in
31571 single-precision mode by default.
31573 @opindex m4-200-single-only
31574 @item -m4-200-single-only
31575 Generate code for SH4-200 in such a way that no double-precision
31576 floating-point operations are used.
31578 @opindex m4-300
31579 @item -m4-300
31580 Generate code for SH4-300.
31582 @opindex m4-300-nofpu
31583 @item -m4-300-nofpu
31584 Generate code for SH4-300 without in such a way that the
31585 floating-point unit is not used.
31587 @opindex m4-300-single
31588 @item -m4-300-single
31589 Generate code for SH4-300 in such a way that no double-precision
31590 floating-point operations are used.
31592 @opindex m4-300-single-only
31593 @item -m4-300-single-only
31594 Generate code for SH4-300 in such a way that no double-precision
31595 floating-point operations are used.
31597 @opindex m4-340
31598 @item -m4-340
31599 Generate code for SH4-340 (no MMU, no FPU).
31601 @opindex m4-500
31602 @item -m4-500
31603 Generate code for SH4-500 (no FPU).  Passes @option{-isa=sh4-nofpu} to the
31604 assembler.
31606 @opindex m4a-nofpu
31607 @item -m4a-nofpu
31608 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
31609 floating-point unit is not used.
31611 @opindex m4a-single-only
31612 @item -m4a-single-only
31613 Generate code for the SH4a, in such a way that no double-precision
31614 floating-point operations are used.
31616 @opindex m4a-single
31617 @item -m4a-single
31618 Generate code for the SH4a assuming the floating-point unit is in
31619 single-precision mode by default.
31621 @opindex m4a
31622 @item -m4a
31623 Generate code for the SH4a.
31625 @opindex m4al
31626 @item -m4al
31627 Same as @option{-m4a-nofpu}, except that it implicitly passes
31628 @option{-dsp} to the assembler.  GCC doesn't generate any DSP
31629 instructions at the moment.
31631 @opindex mb
31632 @item -mb
31633 Compile code for the processor in big-endian mode.
31635 @opindex ml
31636 @item -ml
31637 Compile code for the processor in little-endian mode.
31639 @opindex mdalign
31640 @item -mdalign
31641 Align doubles at 64-bit boundaries.  Note that this changes the calling
31642 conventions, and thus some functions from the standard C library do
31643 not work unless you recompile it first with @option{-mdalign}.
31645 @opindex mrelax
31646 @item -mrelax
31647 Shorten some address references at link time, when possible; uses the
31648 linker option @option{-relax}.
31650 @opindex mbigtable
31651 @item -mbigtable
31652 Use 32-bit offsets in @code{switch} tables.  The default is to use
31653 16-bit offsets.
31655 @opindex mbitops
31656 @item -mbitops
31657 Enable the use of bit manipulation instructions on SH2A.
31659 @opindex mfmovd
31660 @item -mfmovd
31661 Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
31662 alignment constraints.
31664 @opindex mrenesas
31665 @item -mrenesas
31666 Comply with the calling conventions defined by Renesas.
31668 @opindex mno-renesas
31669 @item -mno-renesas
31670 Comply with the calling conventions defined for GCC before the Renesas
31671 conventions were available.  This option is the default for all
31672 targets of the SH toolchain.
31674 @opindex mnomacsave
31675 @item -mnomacsave
31676 Mark the @code{MAC} register as call-clobbered, even if
31677 @option{-mrenesas} is given.
31679 @opindex mieee
31680 @opindex mno-ieee
31681 @item -mieee
31682 @itemx -mno-ieee
31683 Control the IEEE compliance of floating-point comparisons, which affects the
31684 handling of cases where the result of a comparison is unordered.  By default
31685 @option{-mieee} is implicitly enabled.  If @option{-ffinite-math-only} is
31686 enabled @option{-mno-ieee} is implicitly set, which results in faster
31687 floating-point greater-equal and less-equal comparisons.  The implicit settings
31688 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
31690 @opindex minline-ic_invalidate
31691 @item -minline-ic_invalidate
31692 Inline code to invalidate instruction cache entries after setting up
31693 nested function trampolines.
31694 This option has no effect if @option{-musermode} is in effect and the selected
31695 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
31696 instruction.
31697 If the selected code generation option does not allow the use of the @code{icbi}
31698 instruction, and @option{-musermode} is not in effect, the inlined code
31699 manipulates the instruction cache address array directly with an associative
31700 write.  This not only requires privileged mode at run time, but it also
31701 fails if the cache line had been mapped via the TLB and has become unmapped.
31703 @opindex misize
31704 @item -misize
31705 Dump instruction size and location in the assembly code.
31707 @opindex mpadstruct
31708 @item -mpadstruct
31709 This option is deprecated.  It pads structures to multiple of 4 bytes,
31710 which is incompatible with the SH ABI@.
31712 @opindex matomic-model=@var{model}
31713 @item -matomic-model=@var{model}
31714 Sets the model of atomic operations and additional parameters as a comma
31715 separated list.  For details on the atomic built-in functions see
31716 @ref{__atomic Builtins}.  The following models and parameters are supported:
31718 @table @samp
31720 @item none
31721 Disable compiler generated atomic sequences and emit library calls for atomic
31722 operations.  This is the default if the target is not @code{sh*-*-linux*}.
31724 @item soft-gusa
31725 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
31726 built-in functions.  The generated atomic sequences require additional support
31727 from the interrupt/exception handling code of the system and are only suitable
31728 for SH3* and SH4* single-core systems.  This option is enabled by default when
31729 the target is @code{sh*-*-linux*} and SH3* or SH4*.  When the target is SH4A,
31730 this option also partially utilizes the hardware atomic instructions
31731 @code{movli.l} and @code{movco.l} to create more efficient code, unless
31732 @samp{strict} is specified.  
31734 @item soft-tcb
31735 Generate software atomic sequences that use a variable in the thread control
31736 block.  This is a variation of the gUSA sequences which can also be used on
31737 SH1* and SH2* targets.  The generated atomic sequences require additional
31738 support from the interrupt/exception handling code of the system and are only
31739 suitable for single-core systems.  When using this model, the @samp{gbr-offset=}
31740 parameter has to be specified as well.
31742 @item soft-imask
31743 Generate software atomic sequences that temporarily disable interrupts by
31744 setting @code{SR.IMASK = 1111}.  This model works only when the program runs
31745 in privileged mode and is only suitable for single-core systems.  Additional
31746 support from the interrupt/exception handling code of the system is not
31747 required.  This model is enabled by default when the target is
31748 @code{sh*-*-linux*} and SH1* or SH2*.
31750 @item hard-llcs
31751 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
31752 instructions only.  This is only available on SH4A and is suitable for
31753 multi-core systems.  Since the hardware instructions support only 32 bit atomic
31754 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
31755 Code compiled with this option is also compatible with other software
31756 atomic model interrupt/exception handling systems if executed on an SH4A
31757 system.  Additional support from the interrupt/exception handling code of the
31758 system is not required for this model.
31760 @item gbr-offset=
31761 This parameter specifies the offset in bytes of the variable in the thread
31762 control block structure that should be used by the generated atomic sequences
31763 when the @samp{soft-tcb} model has been selected.  For other models this
31764 parameter is ignored.  The specified value must be an integer multiple of four
31765 and in the range 0-1020.
31767 @item strict
31768 This parameter prevents mixed usage of multiple atomic models, even if they
31769 are compatible, and makes the compiler generate atomic sequences of the
31770 specified model only.
31772 @end table
31774 @opindex mtas
31775 @item -mtas
31776 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
31777 Notice that depending on the particular hardware and software configuration
31778 this can degrade overall performance due to the operand cache line flushes
31779 that are implied by the @code{tas.b} instruction.  On multi-core SH4A
31780 processors the @code{tas.b} instruction must be used with caution since it
31781 can result in data corruption for certain cache configurations.
31783 @opindex mprefergot
31784 @item -mprefergot
31785 When generating position-independent code, emit function calls using
31786 the Global Offset Table instead of the Procedure Linkage Table.
31788 @opindex musermode
31789 @opindex mno-usermode
31790 @item -musermode
31791 @itemx -mno-usermode
31792 Don't allow (allow) the compiler generating privileged mode code.  Specifying
31793 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
31794 inlined code would not work in user mode.  @option{-musermode} is the default
31795 when the target is @code{sh*-*-linux*}.  If the target is SH1* or SH2*
31796 @option{-musermode} has no effect, since there is no user mode.
31798 @opindex multcost=@var{number}
31799 @item -multcost=@var{number}
31800 Set the cost to assume for a multiply insn.
31802 @opindex mdiv=@var{strategy}
31803 @item -mdiv=@var{strategy}
31804 Set the division strategy to be used for integer division operations.
31805 @var{strategy} can be one of: 
31807 @table @samp
31809 @item call-div1
31810 Calls a library function that uses the single-step division instruction
31811 @code{div1} to perform the operation.  Division by zero calculates an
31812 unspecified result and does not trap.  This is the default except for SH4,
31813 SH2A and SHcompact.
31815 @item call-fp
31816 Calls a library function that performs the operation in double precision
31817 floating point.  Division by zero causes a floating-point exception.  This is
31818 the default for SHcompact with FPU.  Specifying this for targets that do not
31819 have a double precision FPU defaults to @code{call-div1}.
31821 @item call-table
31822 Calls a library function that uses a lookup table for small divisors and
31823 the @code{div1} instruction with case distinction for larger divisors.  Division
31824 by zero calculates an unspecified result and does not trap.  This is the default
31825 for SH4.  Specifying this for targets that do not have dynamic shift
31826 instructions defaults to @code{call-div1}.
31828 @end table
31830 When a division strategy has not been specified the default strategy is
31831 selected based on the current target.  For SH2A the default strategy is to
31832 use the @code{divs} and @code{divu} instructions instead of library function
31833 calls.
31835 @opindex maccumulate-outgoing-args
31836 @item -maccumulate-outgoing-args
31837 Reserve space once for outgoing arguments in the function prologue rather
31838 than around each call.  Generally beneficial for performance and size.  Also
31839 needed for unwinding to avoid changing the stack frame around conditional code.
31841 @opindex mdivsi3_libfunc=@var{name}
31842 @item -mdivsi3_libfunc=@var{name}
31843 Set the name of the library function used for 32-bit signed division to
31844 @var{name}.
31845 This only affects the name used in the @samp{call} division strategies, and
31846 the compiler still expects the same sets of input/output/clobbered registers as
31847 if this option were not present.
31849 @opindex mfixed-range
31850 @item -mfixed-range=@var{register-range}
31851 Generate code treating the given register range as fixed registers.
31852 A fixed register is one that the register allocator cannot use.  This is
31853 useful when compiling kernel code.  A register range is specified as
31854 two registers separated by a dash.  Multiple register ranges can be
31855 specified separated by a comma.
31857 @opindex mbranch-cost=@var{num}
31858 @item -mbranch-cost=@var{num}
31859 Assume @var{num} to be the cost for a branch instruction.  Higher numbers
31860 make the compiler try to generate more branch-free code if possible.  
31861 If not specified the value is selected depending on the processor type that
31862 is being compiled for.
31864 @opindex mzdcbranch
31865 @opindex mno-zdcbranch
31866 @item -mzdcbranch
31867 @itemx -mno-zdcbranch
31868 Assume (do not assume) that zero displacement conditional branch instructions
31869 @code{bt} and @code{bf} are fast.  If @option{-mzdcbranch} is specified, the
31870 compiler prefers zero displacement branch code sequences.  This is
31871 enabled by default when generating code for SH4 and SH4A.  It can be explicitly
31872 disabled by specifying @option{-mno-zdcbranch}.
31874 @opindex mcbranch-force-delay-slot
31875 @item -mcbranch-force-delay-slot
31876 Force the usage of delay slots for conditional branches, which stuffs the delay
31877 slot with a @code{nop} if a suitable instruction cannot be found.  By default
31878 this option is disabled.  It can be enabled to work around hardware bugs as
31879 found in the original SH7055.
31881 @opindex mfused-madd
31882 @opindex mno-fused-madd
31883 @item -mfused-madd
31884 @itemx -mno-fused-madd
31885 Generate code that uses (does not use) the floating-point multiply and
31886 accumulate instructions.  These instructions are generated by default
31887 if hardware floating point is used.  The machine-dependent
31888 @option{-mfused-madd} option is now mapped to the machine-independent
31889 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
31890 mapped to @option{-ffp-contract=off}.
31892 @opindex mfsca
31893 @opindex mno-fsca
31894 @item -mfsca
31895 @itemx -mno-fsca
31896 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
31897 and cosine approximations.  The option @option{-mfsca} must be used in
31898 combination with @option{-funsafe-math-optimizations}.  It is enabled by default
31899 when generating code for SH4A.  Using @option{-mno-fsca} disables sine and cosine
31900 approximations even if @option{-funsafe-math-optimizations} is in effect.
31902 @opindex mfsrra
31903 @opindex mno-fsrra
31904 @item -mfsrra
31905 @itemx -mno-fsrra
31906 Allow or disallow the compiler to emit the @code{fsrra} instruction for
31907 reciprocal square root approximations.  The option @option{-mfsrra} must be used
31908 in combination with @option{-funsafe-math-optimizations} and
31909 @option{-ffinite-math-only}.  It is enabled by default when generating code for
31910 SH4A.  Using @option{-mno-fsrra} disables reciprocal square root approximations
31911 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
31912 in effect.
31914 @opindex mpretend-cmove
31915 @item -mpretend-cmove
31916 Prefer zero-displacement conditional branches for conditional move instruction
31917 patterns.  This can result in faster code on the SH4 processor.
31919 @opindex fdpic
31920 @item -mfdpic
31921 Generate code using the FDPIC ABI.
31923 @end table
31925 @node Solaris 2 Options
31926 @subsection Solaris 2 Options
31927 @cindex Solaris 2 options
31929 These @samp{-m} options are supported on Solaris 2:
31931 @table @gcctabopt
31932 @opindex mclear-hwcap
31933 @item -mclear-hwcap
31934 @option{-mclear-hwcap} tells the compiler to remove the hardware
31935 capabilities generated by the Solaris assembler.  This is only necessary
31936 when object files use ISA extensions not supported by the current
31937 machine, but check at runtime whether or not to use them.
31939 @opindex mimpure-text
31940 @item -mimpure-text
31941 @option{-mimpure-text}, used in addition to @option{-shared}, tells
31942 the compiler to not pass @option{-z text} to the linker when linking a
31943 shared object.  Using this option, you can link position-dependent
31944 code into a shared object.
31946 @option{-mimpure-text} suppresses the ``relocations remain against
31947 allocatable but non-writable sections'' linker error message.
31948 However, the necessary relocations trigger copy-on-write, and the
31949 shared object is not actually shared across processes.  Instead of
31950 using @option{-mimpure-text}, you should compile all source code with
31951 @option{-fpic} or @option{-fPIC}.
31953 @end table
31955 These switches are supported in addition to the above on Solaris 2:
31957 @table @gcctabopt
31958 @opindex pthreads
31959 @item -pthreads
31960 This is a synonym for @option{-pthread}.
31961 @end table
31963 @node SPARC Options
31964 @subsection SPARC Options
31965 @cindex SPARC options
31967 These @samp{-m} options are supported on the SPARC:
31969 @table @gcctabopt
31970 @opindex mno-app-regs
31971 @opindex mapp-regs
31972 @item -mno-app-regs
31973 @itemx -mapp-regs
31974 Specify @option{-mapp-regs} to generate output using the global registers
31975 2 through 4, which the SPARC SVR4 ABI reserves for applications.  Like the
31976 global register 1, each global register 2 through 4 is then treated as an
31977 allocable register that is clobbered by function calls.  This is the default.
31979 To be fully SVR4 ABI-compliant at the cost of some performance loss,
31980 specify @option{-mno-app-regs}.  You should compile libraries and system
31981 software with this option.
31983 @opindex mflat
31984 @opindex mno-flat
31985 @item -mflat
31986 @itemx -mno-flat
31987 With @option{-mflat}, the compiler does not generate save/restore instructions
31988 and uses a ``flat'' or single register window model.  This model is compatible
31989 with the regular register window model.  The local registers and the input
31990 registers (0--5) are still treated as ``call-saved'' registers and are
31991 saved on the stack as needed.
31993 With @option{-mno-flat} (the default), the compiler generates save/restore
31994 instructions (except for leaf functions).  This is the normal operating mode.
31996 @opindex mfpu
31997 @opindex mhard-float
31998 @item -mfpu
31999 @itemx -mhard-float
32000 Generate output containing floating-point instructions.  This is the
32001 default.
32003 @opindex mno-fpu
32004 @opindex msoft-float
32005 @item -mno-fpu
32006 @itemx -msoft-float
32007 Generate output containing library calls for floating point.
32008 @strong{Warning:} the requisite libraries are not available for all SPARC
32009 targets.  Normally the facilities of the machine's usual C compiler are
32010 used, but this cannot be done directly in cross-compilation.  You must make
32011 your own arrangements to provide suitable library functions for
32012 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
32013 @samp{sparclite-*-*} do provide software floating-point support.
32015 @option{-msoft-float} changes the calling convention in the output file;
32016 therefore, it is only useful if you compile @emph{all} of a program with
32017 this option.  In particular, you need to compile @file{libgcc.a}, the
32018 library that comes with GCC, with @option{-msoft-float} in order for
32019 this to work.
32021 @opindex mhard-quad-float
32022 @item -mhard-quad-float
32023 Generate output containing quad-word (long double) floating-point
32024 instructions.
32026 @opindex msoft-quad-float
32027 @item -msoft-quad-float
32028 Generate output containing library calls for quad-word (long double)
32029 floating-point instructions.  The functions called are those specified
32030 in the SPARC ABI@.  This is the default.
32032 As of this writing, there are no SPARC implementations that have hardware
32033 support for the quad-word floating-point instructions.  They all invoke
32034 a trap handler for one of these instructions, and then the trap handler
32035 emulates the effect of the instruction.  Because of the trap handler overhead,
32036 this is much slower than calling the ABI library routines.  Thus the
32037 @option{-msoft-quad-float} option is the default.
32039 @opindex mno-unaligned-doubles
32040 @opindex munaligned-doubles
32041 @item -mno-unaligned-doubles
32042 @itemx -munaligned-doubles
32043 Assume that doubles have 8-byte alignment.  This is the default.
32045 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
32046 alignment only if they are contained in another type, or if they have an
32047 absolute address.  Otherwise, it assumes they have 4-byte alignment.
32048 Specifying this option avoids some rare compatibility problems with code
32049 generated by other compilers.  It is not the default because it results
32050 in a performance loss, especially for floating-point code.
32052 @opindex muser-mode
32053 @opindex mno-user-mode
32054 @item -muser-mode
32055 @itemx -mno-user-mode
32056 Do not generate code that can only run in supervisor mode.  This is relevant
32057 only for the @code{casa} instruction emitted for the LEON3 processor.  This
32058 is the default.
32060 @opindex mfaster-structs
32061 @opindex mno-faster-structs
32062 @item -mfaster-structs
32063 @itemx -mno-faster-structs
32064 With @option{-mfaster-structs}, the compiler assumes that structures
32065 should have 8-byte alignment.  This enables the use of pairs of
32066 @code{ldd} and @code{std} instructions for copies in structure
32067 assignment, in place of twice as many @code{ld} and @code{st} pairs.
32068 However, the use of this changed alignment directly violates the SPARC
32069 ABI@.  Thus, it's intended only for use on targets where the developer
32070 acknowledges that their resulting code is not directly in line with
32071 the rules of the ABI@.
32073 @opindex mstd-struct-return
32074 @opindex mno-std-struct-return
32075 @item -mstd-struct-return
32076 @itemx -mno-std-struct-return
32077 With @option{-mstd-struct-return}, the compiler generates checking code
32078 in functions returning structures or unions to detect size mismatches
32079 between the two sides of function calls, as per the 32-bit ABI@.
32081 The default is @option{-mno-std-struct-return}.  This option has no effect
32082 in 64-bit mode.
32084 @opindex mlra
32085 @opindex mno-lra
32086 @item -mlra
32087 @itemx -mno-lra
32088 Enable Local Register Allocation.  This is the default for SPARC since GCC 7
32089 so @option{-mno-lra} needs to be passed to get old Reload.
32091 @opindex mcpu
32092 @item -mcpu=@var{cpu_type}
32093 Set the instruction set, register set, and instruction scheduling parameters
32094 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
32095 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
32096 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
32097 @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
32098 @samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
32099 @samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
32100 @samp{m8}.
32102 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
32103 which selects the best architecture option for the host processor.
32104 @option{-mcpu=native} has no effect if GCC does not recognize
32105 the processor.
32107 Default instruction scheduling parameters are used for values that select
32108 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
32109 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
32111 Here is a list of each supported architecture and their supported
32112 implementations.
32114 @table @asis
32115 @item v7
32116 cypress, leon3v7
32118 @item v8
32119 supersparc, hypersparc, leon, leon3, leon5
32121 @item sparclite
32122 f930, f934, sparclite86x
32124 @item sparclet
32125 tsc701
32127 @item v9
32128 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
32129 niagara7, m8
32130 @end table
32132 By default (unless configured otherwise), GCC generates code for the V7
32133 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
32134 additionally optimizes it for the Cypress CY7C602 chip, as used in the
32135 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
32136 SPARCStation 1, 2, IPX etc.
32138 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
32139 architecture.  The only difference from V7 code is that the compiler emits
32140 the integer multiply and integer divide instructions which exist in SPARC-V8
32141 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
32142 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
32143 2000 series.
32145 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
32146 the SPARC architecture.  This adds the integer multiply, integer divide step
32147 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
32148 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
32149 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
32150 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
32151 MB86934 chip, which is the more recent SPARClite with FPU@.
32153 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
32154 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
32155 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
32156 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
32157 optimizes it for the TEMIC SPARClet chip.
32159 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
32160 architecture.  This adds 64-bit integer and floating-point move instructions,
32161 3 additional floating-point condition code registers and conditional move
32162 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
32163 optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
32164 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
32165 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
32166 @option{-mcpu=niagara}, the compiler additionally optimizes it for
32167 Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
32168 additionally optimizes it for Sun UltraSPARC T2 chips. With
32169 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
32170 UltraSPARC T3 chips.  With @option{-mcpu=niagara4}, the compiler
32171 additionally optimizes it for Sun UltraSPARC T4 chips.  With
32172 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
32173 Oracle SPARC M7 chips.  With @option{-mcpu=m8}, the compiler
32174 additionally optimizes it for Oracle M8 chips.
32176 @opindex mtune
32177 @item -mtune=@var{cpu_type}
32178 Set the instruction scheduling parameters for machine type
32179 @var{cpu_type}, but do not set the instruction set or register set that the
32180 option @option{-mcpu=@var{cpu_type}} does.
32182 The same values for @option{-mcpu=@var{cpu_type}} can be used for
32183 @option{-mtune=@var{cpu_type}}, but the only useful values are those
32184 that select a particular CPU implementation.  Those are
32185 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
32186 @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
32187 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
32188 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
32189 @samp{niagara4}, @samp{niagara7} and @samp{m8}.  With native Solaris
32190 and GNU/Linux toolchains, @samp{native} can also be used.
32192 @opindex mv8plus
32193 @opindex mno-v8plus
32194 @item -mv8plus
32195 @itemx -mno-v8plus
32196 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
32197 difference from the V8 ABI is that the global and out registers are
32198 considered 64 bits wide.  This is enabled by default on Solaris in 32-bit
32199 mode for all SPARC-V9 processors.
32201 @opindex mvis
32202 @opindex mno-vis
32203 @item -mvis
32204 @itemx -mno-vis
32205 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
32206 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
32208 @opindex mvis2
32209 @opindex mno-vis2
32210 @item -mvis2
32211 @itemx -mno-vis2
32212 With @option{-mvis2}, GCC generates code that takes advantage of
32213 version 2.0 of the UltraSPARC Visual Instruction Set extensions.  The
32214 default is @option{-mvis2} when targeting a cpu that supports such
32215 instructions, such as UltraSPARC-III and later.  Setting @option{-mvis2}
32216 also sets @option{-mvis}.
32218 @opindex mvis3
32219 @opindex mno-vis3
32220 @item -mvis3
32221 @itemx -mno-vis3
32222 With @option{-mvis3}, GCC generates code that takes advantage of
32223 version 3.0 of the UltraSPARC Visual Instruction Set extensions.  The
32224 default is @option{-mvis3} when targeting a cpu that supports such
32225 instructions, such as niagara-3 and later.  Setting @option{-mvis3}
32226 also sets @option{-mvis2} and @option{-mvis}.
32228 @opindex mvis4
32229 @opindex mno-vis4
32230 @item -mvis4
32231 @itemx -mno-vis4
32232 With @option{-mvis4}, GCC generates code that takes advantage of
32233 version 4.0 of the UltraSPARC Visual Instruction Set extensions.  The
32234 default is @option{-mvis4} when targeting a cpu that supports such
32235 instructions, such as niagara-7 and later.  Setting @option{-mvis4}
32236 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
32238 @opindex mvis4b
32239 @opindex mno-vis4b
32240 @item -mvis4b
32241 @itemx -mno-vis4b
32242 With @option{-mvis4b}, GCC generates code that takes advantage of
32243 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
32244 the additional VIS instructions introduced in the Oracle SPARC
32245 Architecture 2017.  The default is @option{-mvis4b} when targeting a
32246 cpu that supports such instructions, such as m8 and later.  Setting
32247 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
32248 @option{-mvis2} and @option{-mvis}.
32250 @opindex mcbcond
32251 @opindex mno-cbcond
32252 @item -mcbcond
32253 @itemx -mno-cbcond
32254 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
32255 Compare-and-Branch-on-Condition instructions.  The default is @option{-mcbcond}
32256 when targeting a CPU that supports such instructions, such as Niagara-4 and
32257 later.
32259 @opindex mfmaf
32260 @opindex mno-fmaf
32261 @item -mfmaf
32262 @itemx -mno-fmaf
32263 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
32264 Fused Multiply-Add Floating-point instructions.  The default is @option{-mfmaf}
32265 when targeting a CPU that supports such instructions, such as Niagara-3 and
32266 later.
32268 @opindex mfsmuld
32269 @opindex mno-fsmuld
32270 @item -mfsmuld
32271 @itemx -mno-fsmuld
32272 With @option{-mfsmuld}, GCC generates code that takes advantage of the
32273 Floating-point Multiply Single to Double (FsMULd) instruction.  The default is
32274 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
32275 or V9 with FPU except @option{-mcpu=leon}.
32277 @opindex mpopc
32278 @opindex mno-popc
32279 @item -mpopc
32280 @itemx -mno-popc
32281 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
32282 Population Count instruction.  The default is @option{-mpopc}
32283 when targeting a CPU that supports such an instruction, such as Niagara-2 and
32284 later.
32286 @opindex msubxc
32287 @opindex mno-subxc
32288 @item -msubxc
32289 @itemx -mno-subxc
32290 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
32291 Subtract-Extended-with-Carry instruction.  The default is @option{-msubxc}
32292 when targeting a CPU that supports such an instruction, such as Niagara-7 and
32293 later.
32295 @opindex mfix-at697f
32296 @item -mfix-at697f
32297 Enable the documented workaround for the single erratum of the Atmel AT697F
32298 processor (which corresponds to erratum #13 of the AT697E processor).
32300 @opindex mfix-ut699
32301 @item -mfix-ut699
32302 Enable the documented workarounds for the floating-point errata and the data
32303 cache nullify errata of the UT699 processor.
32305 @opindex mfix-ut700
32306 @item -mfix-ut700
32307 Enable the documented workaround for the back-to-back store errata of
32308 the UT699E/UT700 processor.
32310 @opindex mfix-gr712rc
32311 @item -mfix-gr712rc
32312 Enable the documented workaround for the back-to-back store errata of
32313 the GR712RC processor.
32314 @end table
32316 These @samp{-m} options are supported in addition to the above
32317 on SPARC-V9 processors in 64-bit environments:
32319 @table @gcctabopt
32320 @opindex m32
32321 @opindex m64
32322 @item -m32
32323 @itemx -m64
32324 Generate code for a 32-bit or 64-bit environment.
32325 The 32-bit environment sets int, long and pointer to 32 bits.
32326 The 64-bit environment sets int to 32 bits and long and pointer
32327 to 64 bits.
32329 @opindex mcmodel
32330 @item -mcmodel=@var{which}
32331 Set the code model to one of
32333 @table @samp
32334 @item medlow
32335 The Medium/Low code model: 64-bit addresses, programs
32336 must be linked in the low 32 bits of memory.  Programs can be statically
32337 or dynamically linked.
32339 @item medmid
32340 The Medium/Middle code model: 64-bit addresses, programs
32341 must be linked in the low 44 bits of memory, the text and data segments must
32342 be less than 2GB in size and the data segment must be located within 2GB of
32343 the text segment.
32345 @item medany
32346 The Medium/Anywhere code model: 64-bit addresses, programs
32347 may be linked anywhere in memory, the text and data segments must be less
32348 than 2GB in size and the data segment must be located within 2GB of the
32349 text segment.
32351 @item embmedany
32352 The Medium/Anywhere code model for embedded systems:
32353 64-bit addresses, the text and data segments must be less than 2GB in
32354 size, both starting anywhere in memory (determined at link time).  The
32355 global register %g4 points to the base of the data segment.  Programs
32356 are statically linked and PIC is not supported.
32357 @end table
32359 @opindex mmemory-model
32360 @item -mmemory-model=@var{mem-model}
32361 Set the memory model in force on the processor to one of
32363 @table @samp
32364 @item default
32365 The default memory model for the processor and operating system.
32367 @item rmo
32368 Relaxed Memory Order
32370 @item pso
32371 Partial Store Order
32373 @item tso
32374 Total Store Order
32376 @item sc
32377 Sequential Consistency
32378 @end table
32380 These memory models are formally defined in Appendix D of the SPARC-V9
32381 architecture manual, as set in the processor's @code{PSTATE.MM} field.
32383 @opindex mstack-bias
32384 @opindex mno-stack-bias
32385 @item -mstack-bias
32386 @itemx -mno-stack-bias
32387 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
32388 frame pointer if present, are offset by @minus{}2047 which must be added back
32389 when making stack frame references.  This is the default in 64-bit mode.
32390 Otherwise, assume no such offset is present.
32391 @end table
32393 @node System V Options
32394 @subsection Options for System V
32396 These additional options are available on System V Release 4 for
32397 compatibility with other compilers on those systems:
32399 @table @gcctabopt
32400 @opindex G
32401 @item -G
32402 Create a shared object.
32403 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
32405 @opindex Qy
32406 @item -Qy
32407 Identify the versions of each tool used by the compiler, in a
32408 @code{.ident} assembler directive in the output.
32410 @opindex Qn
32411 @item -Qn
32412 Refrain from adding @code{.ident} directives to the output file (this is
32413 the default).
32415 @opindex YP
32416 @item -YP,@var{dirs}
32417 Search the directories @var{dirs}, and no others, for libraries
32418 specified with @option{-l}.
32420 @opindex Ym
32421 @item -Ym,@var{dir}
32422 Look in the directory @var{dir} to find the M4 preprocessor.
32423 The assembler uses this option.
32424 @c This is supposed to go with a -Yd for predefined M4 macro files, but
32425 @c the generic assembler that comes with Solaris takes just -Ym.
32426 @end table
32428 @node V850 Options
32429 @subsection V850 Options
32430 @cindex V850 Options
32432 These @samp{-m} options are defined for V850 implementations:
32434 @table @gcctabopt
32435 @opindex mlong-calls
32436 @opindex mno-long-calls
32437 @item -mlong-calls
32438 @itemx -mno-long-calls
32439 Treat all calls as being far away (near).  If calls are assumed to be
32440 far away, the compiler always loads the function's address into a
32441 register, and calls indirect through the pointer.
32443 @opindex mno-ep
32444 @opindex mep
32445 @item -mno-ep
32446 @itemx -mep
32447 Do not optimize (do optimize) basic blocks that use the same index
32448 pointer 4 or more times to copy pointer into the @code{ep} register, and
32449 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
32450 option is on by default if you optimize.
32452 @opindex mno-prolog-function
32453 @opindex mprolog-function
32454 @item -mno-prolog-function
32455 @itemx -mprolog-function
32456 Do not use (do use) external functions to save and restore registers
32457 at the prologue and epilogue of a function.  The external functions
32458 are slower, but use less code space if more than one function saves
32459 the same number of registers.  The @option{-mprolog-function} option
32460 is on by default if you optimize.
32462 @opindex mspace
32463 @item -mspace
32464 Try to make the code as small as possible.  At present, this just turns
32465 on the @option{-mep} and @option{-mprolog-function} options.
32467 @opindex mtda
32468 @item -mtda=@var{n}
32469 Put static or global variables whose size is @var{n} bytes or less into
32470 the tiny data area that register @code{ep} points to.  The tiny data
32471 area can hold up to 256 bytes in total (128 bytes for byte references).
32473 @opindex msda
32474 @item -msda=@var{n}
32475 Put static or global variables whose size is @var{n} bytes or less into
32476 the small data area that register @code{gp} points to.  The small data
32477 area can hold up to 64 kilobytes.
32479 @opindex mzda
32480 @item -mzda=@var{n}
32481 Put static or global variables whose size is @var{n} bytes or less into
32482 the first 32 kilobytes of memory.
32484 @opindex mv850
32485 @item -mv850
32486 Specify that the target processor is the V850.
32488 @opindex mv850e3v5
32489 @item -mv850e3v5
32490 Specify that the target processor is the V850E3V5.  The preprocessor
32491 constant @code{__v850e3v5__} is defined if this option is used.
32493 @opindex mv850e2v4
32494 @item -mv850e2v4
32495 Specify that the target processor is the V850E3V5.  This is an alias for
32496 the @option{-mv850e3v5} option.
32498 @opindex mv850e2v3
32499 @item -mv850e2v3
32500 Specify that the target processor is the V850E2V3.  The preprocessor
32501 constant @code{__v850e2v3__} is defined if this option is used.
32503 @opindex mv850e2
32504 @item -mv850e2
32505 Specify that the target processor is the V850E2.  The preprocessor
32506 constant @code{__v850e2__} is defined if this option is used.
32508 @opindex mv850e1
32509 @item -mv850e1
32510 Specify that the target processor is the V850E1.  The preprocessor
32511 constants @code{__v850e1__} and @code{__v850e__} are defined if
32512 this option is used.
32514 @opindex mv850es
32515 @item -mv850es
32516 Specify that the target processor is the V850ES.  This is an alias for
32517 the @option{-mv850e1} option.
32519 @opindex mv850e
32520 @item -mv850e
32521 Specify that the target processor is the V850E@.  The preprocessor
32522 constant @code{__v850e__} is defined if this option is used.
32524 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
32525 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
32526 are defined then a default target processor is chosen and the
32527 relevant @samp{__v850*__} preprocessor constant is defined.
32529 The preprocessor constants @code{__v850} and @code{__v851__} are always
32530 defined, regardless of which processor variant is the target.
32532 @opindex mdisable-callt
32533 @opindex mno-disable-callt
32534 @item -mdisable-callt
32535 @itemx -mno-disable-callt
32536 This option suppresses generation of the @code{CALLT} instruction for the
32537 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
32538 architecture.
32540 This option is enabled by default when the RH850 ABI is
32541 in use (see @option{-mrh850-abi}), and disabled by default when the
32542 GCC ABI is in use.  If @code{CALLT} instructions are being generated
32543 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
32545 @opindex mrelax
32546 @opindex mno-relax
32547 @item -mrelax
32548 @itemx -mno-relax
32549 Pass on (or do not pass on) the @option{-mrelax} command-line option
32550 to the assembler.
32552 @opindex mlong-jumps
32553 @opindex mno-long-jumps
32554 @item -mlong-jumps
32555 @itemx -mno-long-jumps
32556 Disable (or re-enable) the generation of PC-relative jump instructions.
32558 @opindex msoft-float
32559 @opindex mhard-float
32560 @item -msoft-float
32561 @itemx -mhard-float
32562 Disable (or re-enable) the generation of hardware floating point
32563 instructions.  This option is only significant when the target
32564 architecture is @samp{V850E2V3} or higher.  If hardware floating point
32565 instructions are being generated then the C preprocessor symbol
32566 @code{__FPU_OK__} is defined, otherwise the symbol
32567 @code{__NO_FPU__} is defined.
32569 @opindex mloop
32570 @item -mloop
32571 Enables the use of the e3v5 LOOP instruction.  The use of this
32572 instruction is not enabled by default when the e3v5 architecture is
32573 selected because its use is still experimental.
32575 @opindex mrh850-abi
32576 @opindex mghs
32577 @item -mrh850-abi
32578 @itemx -mghs
32579 Enables support for the RH850 version of the V850 ABI.  This is the
32580 default.  With this version of the ABI the following rules apply:
32582 @itemize
32583 @item
32584 Integer sized structures and unions are returned via a memory pointer
32585 rather than a register.
32587 @item
32588 Large structures and unions (more than 8 bytes in size) are passed by
32589 value.
32591 @item
32592 Functions are aligned to 16-bit boundaries.
32594 @item
32595 The @option{-m8byte-align} command-line option is supported.
32597 @item
32598 The @option{-mdisable-callt} command-line option is enabled by
32599 default.  The @option{-mno-disable-callt} command-line option is not
32600 supported.
32601 @end itemize
32603 When this version of the ABI is enabled the C preprocessor symbol
32604 @code{__V850_RH850_ABI__} is defined.
32606 @opindex mgcc-abi
32607 @item -mgcc-abi
32608 Enables support for the old GCC version of the V850 ABI.  With this
32609 version of the ABI the following rules apply:
32611 @itemize
32612 @item
32613 Integer sized structures and unions are returned in register @code{r10}.
32615 @item
32616 Large structures and unions (more than 8 bytes in size) are passed by
32617 reference.
32619 @item
32620 Functions are aligned to 32-bit boundaries, unless optimizing for
32621 size.
32623 @item
32624 The @option{-m8byte-align} command-line option is not supported.
32626 @item
32627 The @option{-mdisable-callt} command-line option is supported but not
32628 enabled by default.
32629 @end itemize
32631 When this version of the ABI is enabled the C preprocessor symbol
32632 @code{__V850_GCC_ABI__} is defined.
32634 @opindex m8byte-align
32635 @opindex mno-8byte-align
32636 @item -m8byte-align
32637 @itemx -mno-8byte-align
32638 Enables support for @code{double} and @code{long long} types to be
32639 aligned on 8-byte boundaries.  The default is to restrict the
32640 alignment of all objects to at most 4-bytes.  When
32641 @option{-m8byte-align} is in effect the C preprocessor symbol
32642 @code{__V850_8BYTE_ALIGN__} is defined.
32644 @opindex mbig-switch
32645 @item -mbig-switch
32646 Generate code suitable for big switch tables.  Use this option only if
32647 the assembler/linker complain about out of range branches within a switch
32648 table.
32650 @opindex mapp-regs
32651 @item -mapp-regs
32652 This option causes r2 and r5 to be used in the code generated by
32653 the compiler.  This setting is the default.
32655 @opindex mno-app-regs
32656 @item -mno-app-regs
32657 This option causes r2 and r5 to be treated as fixed registers.
32659 @end table
32661 @node VAX Options
32662 @subsection VAX Options
32663 @cindex VAX options
32665 These @samp{-m} options are defined for the VAX:
32667 @table @gcctabopt
32668 @opindex munix
32669 @item -munix
32670 Do not output certain jump instructions (@code{aobleq} and so on)
32671 that the Unix assembler for the VAX cannot handle across long
32672 ranges.
32674 @opindex mgnu
32675 @item -mgnu
32676 Do output those jump instructions, on the assumption that the
32677 GNU assembler is being used.
32679 @opindex mg
32680 @item -mg
32681 Output code for G-format floating-point numbers instead of D-format.
32683 @opindex mlra
32684 @opindex mno-lra
32685 @item -mlra
32686 @itemx -mno-lra
32687 Enable Local Register Allocation.  This is still experimental for the VAX,
32688 so by default the compiler uses standard reload.
32689 @end table
32691 @node Visium Options
32692 @subsection Visium Options
32693 @cindex Visium options
32695 @table @gcctabopt
32697 @opindex mdebug
32698 @item -mdebug
32699 A program which performs file I/O and is destined to run on an MCM target
32700 should be linked with this option.  It causes the libraries libc.a and
32701 libdebug.a to be linked.  The program should be run on the target under
32702 the control of the GDB remote debugging stub.
32704 @opindex msim
32705 @item -msim
32706 A program which performs file I/O and is destined to run on the simulator
32707 should be linked with option.  This causes libraries libc.a and libsim.a to
32708 be linked.
32710 @opindex mfpu
32711 @opindex mhard-float
32712 @item -mfpu
32713 @itemx -mhard-float
32714 Generate code containing floating-point instructions.  This is the
32715 default.
32717 @opindex mno-fpu
32718 @opindex msoft-float
32719 @item -mno-fpu
32720 @itemx -msoft-float
32721 Generate code containing library calls for floating-point.
32723 @option{-msoft-float} changes the calling convention in the output file;
32724 therefore, it is only useful if you compile @emph{all} of a program with
32725 this option.  In particular, you need to compile @file{libgcc.a}, the
32726 library that comes with GCC, with @option{-msoft-float} in order for
32727 this to work.
32729 @opindex mcpu
32730 @item -mcpu=@var{cpu_type}
32731 Set the instruction set, register set, and instruction scheduling parameters
32732 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
32733 @samp{mcm}, @samp{gr5} and @samp{gr6}.
32735 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
32737 By default (unless configured otherwise), GCC generates code for the GR5
32738 variant of the Visium architecture.  
32740 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
32741 architecture.  The only difference from GR5 code is that the compiler will
32742 generate block move instructions.
32744 @opindex mtune
32745 @item -mtune=@var{cpu_type}
32746 Set the instruction scheduling parameters for machine type @var{cpu_type},
32747 but do not set the instruction set or register set that the option
32748 @option{-mcpu=@var{cpu_type}} would.
32750 @opindex msv-mode
32751 @item -msv-mode
32752 Generate code for the supervisor mode, where there are no restrictions on
32753 the access to general registers.  This is the default.
32755 @opindex muser-mode
32756 @item -muser-mode
32757 Generate code for the user mode, where the access to some general registers
32758 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
32759 mode; on the GR6, only registers r29 to r31 are affected.
32760 @end table
32762 @node VMS Options
32763 @subsection VMS Options
32765 These @samp{-m} options are defined for the VMS implementations:
32767 @table @gcctabopt
32768 @opindex mvms-return-codes
32769 @item -mvms-return-codes
32770 Return VMS condition codes from @code{main}. The default is to return POSIX-style
32771 condition (e.g.@: error) codes.
32773 @opindex mdebug-main=@var{prefix}
32774 @item -mdebug-main=@var{prefix}
32775 Flag the first routine whose name starts with @var{prefix} as the main
32776 routine for the debugger.
32778 @opindex mmalloc64
32779 @item -mmalloc64
32780 Default to 64-bit memory allocation routines.
32782 @opindex mpointer-size=@var{size}
32783 @item -mpointer-size=@var{size}
32784 Set the default size of pointers. Possible options for @var{size} are
32785 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
32786 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
32787 The later option disables @code{pragma pointer_size}.
32788 @end table
32790 @node VxWorks Options
32791 @subsection VxWorks Options
32792 @cindex VxWorks Options
32794 The options in this section are defined for all VxWorks targets.
32795 Options specific to the target hardware are listed with the other
32796 options for that target.
32798 @table @gcctabopt
32799 @opindex mrtp
32800 @item -mrtp
32801 GCC can generate code for both VxWorks kernels and real time processes
32802 (RTPs).  This option switches from the former to the latter.  It also
32803 defines the preprocessor macro @code{__RTP__}.
32805 @opindex msmp
32806 @item -msmp
32807 Select SMP runtimes for linking.  Not available on architectures other
32808 than PowerPC, nor on VxWorks version 7 or later, in which the selection
32809 is part of the VxWorks build configuration and the library paths are the
32810 same for either choice.
32812 @opindex non-static
32813 @item -non-static
32814 Link an RTP executable against shared libraries rather than static
32815 libraries.  The options @option{-static} and @option{-shared} can
32816 also be used for RTPs (@pxref{Link Options}); @option{-static}
32817 is the default.
32819 @opindex Bstatic
32820 @opindex Bdynamic
32821 @item -Bstatic
32822 @itemx -Bdynamic
32823 These options are passed down to the linker.  They are defined for
32824 compatibility with Diab.
32826 @opindex Xbind-lazy
32827 @item -Xbind-lazy
32828 Enable lazy binding of function calls.  This option is equivalent to
32829 @option{-Wl,-z,now} and is defined for compatibility with Diab.
32831 @opindex Xbind-now
32832 @item -Xbind-now
32833 Disable lazy binding of function calls.  This option is the default and
32834 is defined for compatibility with Diab.
32835 @end table
32837 @node x86 Options
32838 @subsection x86 Options
32839 @cindex x86 Options
32841 These @samp{-m} options are defined for the x86 family of computers.
32843 @table @gcctabopt
32845 @opindex march
32846 @item -march=@var{cpu-type}
32847 Generate instructions for the machine type @var{cpu-type}.  In contrast to
32848 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code 
32849 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
32850 to generate code that may not run at all on processors other than the one
32851 indicated.  Specifying @option{-march=@var{cpu-type}} implies 
32852 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
32854 The choices for @var{cpu-type} are:
32856 @table @samp
32857 @item native
32858 This selects the CPU to generate code for at compilation time by determining
32859 the processor type of the compiling machine.  Using @option{-march=native}
32860 enables all instruction subsets supported by the local machine (hence
32861 the result might not run on different machines).  Using @option{-mtune=native}
32862 produces code optimized for the local machine under the constraints
32863 of the selected instruction set.  
32865 @item x86-64
32866 A generic CPU with 64-bit extensions.
32868 @item x86-64-v2
32869 @itemx x86-64-v3
32870 @itemx x86-64-v4
32871 These choices for @var{cpu-type} select the corresponding
32872 micro-architecture level from the x86-64 psABI.  On ABIs other than
32873 the x86-64 psABI they select the same CPU features as the x86-64 psABI
32874 documents for the particular micro-architecture level.
32876 Since these @var{cpu-type} values do not have a corresponding
32877 @option{-mtune} setting, using @option{-march} with these values enables
32878 generic tuning.  Specific tuning can be enabled using the
32879 @option{-mtune=@var{other-cpu-type}} option with an appropriate
32880 @var{other-cpu-type} value.
32882 @item i386
32883 Original Intel i386 CPU@.
32885 @item i486
32886 Intel i486 CPU@.  (No scheduling is implemented for this chip.)
32888 @item i586
32889 @itemx pentium
32890 Intel Pentium CPU with no MMX support.
32892 @item lakemont
32893 Intel Lakemont MCU, based on Intel Pentium CPU.
32895 @item pentium-mmx
32896 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
32898 @item pentiumpro
32899 Intel Pentium Pro CPU@.
32901 @item i686
32902 When used with @option{-march}, the Pentium Pro
32903 instruction set is used, so the code runs on all i686 family chips.
32904 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
32906 @item pentium2
32907 Intel Pentium II CPU, based on Pentium Pro core with MMX and FXSR instruction
32908 set support.
32910 @item pentium3
32911 @itemx pentium3m
32912 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR and SSE
32913 instruction set support.
32915 @item pentium-m
32916 Intel Pentium M; low-power version of Intel Pentium III CPU
32917 with MMX, SSE, SSE2 and FXSR instruction set support.  Used by Centrino
32918 notebooks.
32920 @item pentium4
32921 @itemx pentium4m
32922 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction set support.
32924 @item prescott
32925 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2, SSE3 and FXSR
32926 instruction set support.
32928 @item nocona
32929 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
32930 SSE2, SSE3 and FXSR instruction set support.
32932 @item core2
32933 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, CX16,
32934 SAHF and FXSR instruction set support.
32936 @item nehalem
32937 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32938 SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction set support.
32940 @item westmere
32941 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32942 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and PCLMUL instruction set support.
32944 @item sandybridge
32945 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32946 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE and PCLMUL instruction set
32947 support.
32949 @item ivybridge
32950 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32951 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND
32952 and F16C instruction set support.
32954 @item haswell
32955 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32956 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32957 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE and HLE instruction set support.
32959 @item broadwell
32960 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32961 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32962 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW
32963 instruction set support.
32965 @item skylake
32966 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32967 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32968 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32969 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
32971 @item bonnell
32972 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
32973 instruction set support.
32975 @item silvermont
32976 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32977 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW and RDRND
32978 instruction set support.
32980 @item goldmont
32981 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32982 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32983 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction
32984 set support.
32986 @item goldmont-plus
32987 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32988 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES,
32989 SHA, RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE,
32990 RDPID and SGX instruction set support.
32992 @item tremont
32993 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32994 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32995 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID,
32996 SGX, CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG instruction set
32997 support.
32999 @item sierraforest
33000 Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33001 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
33002 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
33003 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
33004 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
33005 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, ENQCMD and UINTR instruction set
33006 support.
33008 @item grandridge
33009 Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33010 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
33011 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
33012 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
33013 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
33014 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, ENQCMD, UINTR and RAOINT
33015 instruction set support.
33017 @item clearwaterforest
33018 Intel Clearwater Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
33019 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE,
33020 XSAVEC, XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB,
33021 MOVDIRI, MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
33022 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
33023 ENQCMD, UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16,
33024 SHA512, SM3, SM4, USER_MSR and PREFETCHI instruction set support.
33026 @item knl
33027 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33028 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33029 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33030 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1 instruction set support.
33032 @item knm
33033 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33034 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33035 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33036 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
33037 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
33039 @item skylake-avx512
33040 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33041 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33042 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33043 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW,
33044 AVX512DQ and AVX512CD instruction set support.
33046 @item cannonlake
33047 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
33048 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL,
33049 FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX,
33050 PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
33051 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA instruction set
33052 support.
33054 @item icelake-client
33055 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33056 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33057 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33058 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
33059 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
33060 , VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
33062 @item icelake-server
33063 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33064 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33065 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33066 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
33067 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
33068 , VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB
33069 instruction set support.
33071 @item cascadelake
33072 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33073 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
33074 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
33075 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
33076 AVX512CD and AVX512VNNI instruction set support.
33078 @item cooperlake
33079 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33080 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
33081 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
33082 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
33083 AVX512CD, AVX512VNNI and AVX512BF16 instruction set support.
33085 @item tigerlake
33086 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33087 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
33088 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
33089 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
33090 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
33091 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
33092 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
33094 @item sapphirerapids
33095 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33096 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33097 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33098 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
33099 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
33100 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
33101 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
33102 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16 and AVX512BF16
33103 instruction set support.
33105 @item alderlake
33106 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33107 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
33108 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
33109 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, PCONFIG, PKU,
33110 VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI instruction set
33111 support.
33113 @item rocketlake
33114 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3
33115 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
33116 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
33117 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
33118 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
33119 VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
33121 @item graniterapids
33122 Intel graniterapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33123 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33124 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33125 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
33126 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
33127 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
33128 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
33129 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16, AVX512BF16, AMX-FP16
33130 and PREFETCHI instruction set support.
33132 @item graniterapids-d
33133 Intel graniterapids D CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33134 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33135 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33136 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
33137 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
33138 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
33139 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
33140 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16, AVX512BF16, AMX-FP16,
33141 PREFETCHI and AMX-COMPLEX instruction set support.
33143 @item arrowlake
33144 Intel Arrow Lake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33145 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
33146 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
33147 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
33148 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
33149 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT and CMPCCXADD instruction set
33150 support.
33152 @item arrowlake-s
33153 Intel Arrow Lake S CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33154 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
33155 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
33156 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
33157 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
33158 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16, SHA512,
33159 SM3 and SM4 instruction set support.
33161 @item pantherlake
33162 Intel Panther Lake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33163 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
33164 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
33165 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
33166 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
33167 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16, SHA512,
33168 SM3, SM4 and PREFETCHI instruction set support.
33170 @item k6
33171 AMD K6 CPU with MMX instruction set support.
33173 @item k6-2
33174 @itemx k6-3
33175 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
33177 @item athlon
33178 @itemx athlon-tbird
33179 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
33180 support.
33182 @item athlon-4
33183 @itemx athlon-xp
33184 @itemx athlon-mp
33185 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
33186 instruction set support.
33188 @item k8
33189 @itemx opteron
33190 @itemx athlon64
33191 @itemx athlon-fx
33192 Processors based on the AMD K8 core with x86-64 instruction set support,
33193 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
33194 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
33195 instruction set extensions.)
33197 @item k8-sse3
33198 @itemx opteron-sse3
33199 @itemx athlon64-sse3
33200 Improved versions of AMD K8 cores with SSE3 instruction set support.
33202 @item amdfam10
33203 @itemx barcelona
33204 CPUs based on AMD Family 10h cores with x86-64 instruction set support.  (This
33205 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
33206 instruction set extensions.)
33208 @item bdver1
33209 CPUs based on AMD Family 15h cores with x86-64 instruction set support.  (This
33210 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
33211 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
33213 @item bdver2
33214 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
33215 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
33216 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 
33217 extensions.)
33219 @item bdver3
33220 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
33221 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 
33222 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
33223 64-bit instruction set extensions.)
33225 @item bdver4
33226 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
33227 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 
33228 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
33229 SSE4.2, ABM and 64-bit instruction set extensions.)
33231 @item znver1
33232 AMD Family 17h core based CPUs with x86-64 instruction set support.  (This
33233 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
33234 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
33235 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
33236 instruction set extensions.)
33238 @item znver2
33239 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
33240 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
33241 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
33242 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
33243 WBNOINVD, and 64-bit instruction set extensions.)
33245 @item znver3
33246 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
33247 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
33248 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
33249 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
33250 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
33252 @item znver4
33253 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
33254 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
33255 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
33256 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
33257 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD,
33258 AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, AVX512VNNI,
33259 AVX512BITALG, AVX512VPOPCNTDQ, GFNI and 64-bit instruction set extensions.)
33261 @item btver1
33262 CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
33263 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
33264 instruction set extensions.)
33266 @item btver2
33267 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
33268 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
33269 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
33271 @item winchip-c6
33272 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
33273 set support.
33275 @item winchip2
33276 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
33277 instruction set support.
33279 @item c3
33280 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
33281 (No scheduling is implemented for this chip.)
33283 @item c3-2
33284 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
33285 (No scheduling is implemented for this chip.)
33287 @item c7
33288 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
33289 (No scheduling is implemented for this chip.)
33291 @item samuel-2
33292 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
33293 (No scheduling is implemented for this chip.)
33295 @item nehemiah
33296 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
33297 (No scheduling is implemented for this chip.)
33299 @item esther
33300 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
33301 (No scheduling is implemented for this chip.)
33303 @item eden-x2
33304 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
33305 (No scheduling is implemented for this chip.)
33307 @item eden-x4
33308 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
33309 AVX and AVX2 instruction set support.
33310 (No scheduling is implemented for this chip.)
33312 @item nano
33313 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
33314 instruction set support.
33315 (No scheduling is implemented for this chip.)
33317 @item nano-1000
33318 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
33319 instruction set support.
33320 (No scheduling is implemented for this chip.)
33322 @item nano-2000
33323 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
33324 instruction set support.
33325 (No scheduling is implemented for this chip.)
33327 @item nano-3000
33328 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
33329 instruction set support.
33330 (No scheduling is implemented for this chip.)
33332 @item nano-x2
33333 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
33334 instruction set support.
33335 (No scheduling is implemented for this chip.)
33337 @item nano-x4
33338 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
33339 instruction set support.
33340 (No scheduling is implemented for this chip.)
33342 @item lujiazui
33343 ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
33344 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
33345 ABM, BMI, BMI2, F16C, FXSR, RDSEED instruction set support.
33347 @item yongfeng
33348 ZHAOXIN yongfeng CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
33349 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
33350 ABM, BMI, BMI2, F16C, FXSR, RDSEED, AVX2, FMA, SHA, LZCNT
33351 instruction set support.
33353 @item geode
33354 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
33355 @end table
33357 @opindex mtune
33358 @item -mtune=@var{cpu-type}
33359 Tune to @var{cpu-type} everything applicable about the generated code, except
33360 for the ABI and the set of available instructions.  
33361 While picking a specific @var{cpu-type} schedules things appropriately
33362 for that particular chip, the compiler does not generate any code that
33363 cannot run on the default machine type unless you use a
33364 @option{-march=@var{cpu-type}} option.
33365 For example, if GCC is configured for i686-pc-linux-gnu
33366 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
33367 but still runs on i686 machines.
33369 The choices for @var{cpu-type} are the same as for @option{-march}.
33370 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
33372 @table @samp
33373 @item generic
33374 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
33375 If you know the CPU on which your code will run, then you should use
33376 the corresponding @option{-mtune} or @option{-march} option instead of
33377 @option{-mtune=generic}.  But, if you do not know exactly what CPU users
33378 of your application will have, then you should use this option.
33380 As new processors are deployed in the marketplace, the behavior of this
33381 option will change.  Therefore, if you upgrade to a newer version of
33382 GCC, code generation controlled by this option will change to reflect
33383 the processors
33384 that are most common at the time that version of GCC is released.
33386 There is no @option{-march=generic} option because @option{-march}
33387 indicates the instruction set the compiler can use, and there is no
33388 generic instruction set applicable to all processors.  In contrast,
33389 @option{-mtune} indicates the processor (or, in this case, collection of
33390 processors) for which the code is optimized.
33392 @item intel
33393 Produce code optimized for the most current Intel processors, which are
33394 Haswell and Silvermont for this version of GCC.  If you know the CPU
33395 on which your code will run, then you should use the corresponding
33396 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
33397 But, if you want your application performs better on both Haswell and
33398 Silvermont, then you should use this option.
33400 As new Intel processors are deployed in the marketplace, the behavior of
33401 this option will change.  Therefore, if you upgrade to a newer version of
33402 GCC, code generation controlled by this option will change to reflect
33403 the most current Intel processors at the time that version of GCC is
33404 released.
33406 There is no @option{-march=intel} option because @option{-march} indicates
33407 the instruction set the compiler can use, and there is no common
33408 instruction set applicable to all processors.  In contrast,
33409 @option{-mtune} indicates the processor (or, in this case, collection of
33410 processors) for which the code is optimized.
33411 @end table
33413 @opindex mcpu
33414 @item -mcpu=@var{cpu-type}
33415 A deprecated synonym for @option{-mtune}.
33417 @opindex mfpmath
33418 @item -mfpmath=@var{unit}
33419 Generate floating-point arithmetic for selected unit @var{unit}.  The choices
33420 for @var{unit} are:
33422 @table @samp
33423 @item 387
33424 Use the standard 387 floating-point coprocessor present on the majority of chips and
33425 emulated otherwise.  Code compiled with this option runs almost everywhere.
33426 The temporary results are computed in 80-bit precision instead of the precision
33427 specified by the type, resulting in slightly different results compared to most
33428 of other chips.  See @option{-ffloat-store} for more detailed description.
33430 This is the default choice for non-Darwin x86-32 targets.
33432 @item sse
33433 Use scalar floating-point instructions present in the SSE instruction set.
33434 This instruction set is supported by Pentium III and newer chips,
33435 and in the AMD line
33436 by Athlon-4, Athlon XP and Athlon MP chips.  The earlier version of the SSE
33437 instruction set supports only single-precision arithmetic, thus the double and
33438 extended-precision arithmetic are still done using 387.  A later version, present
33439 only in Pentium 4 and AMD x86-64 chips, supports double-precision
33440 arithmetic too.
33442 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
33443 or @option{-msse2} switches to enable SSE extensions and make this option
33444 effective.  For the x86-64 compiler, these extensions are enabled by default.
33446 The resulting code should be considerably faster in the majority of cases and avoid
33447 the numerical instability problems of 387 code, but may break some existing
33448 code that expects temporaries to be 80 bits.
33450 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
33451 and the default choice for x86-32 targets with the SSE2 instruction set
33452 when @option{-ffast-math} is enabled.
33454 @item sse,387
33455 @itemx sse+387
33456 @itemx both
33457 Attempt to utilize both instruction sets at once.  This effectively doubles the
33458 amount of available registers, and on chips with separate execution units for
33459 387 and SSE the execution resources too.  Use this option with care, as it is
33460 still experimental, because the GCC register allocator does not model separate
33461 functional units well, resulting in unstable performance.
33462 @end table
33464 @opindex masm=@var{dialect}
33465 @item -masm=@var{dialect}
33466 Output assembly instructions using selected @var{dialect}.  Also affects
33467 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
33468 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
33469 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
33470 not support @samp{intel}.
33472 @opindex mieee-fp
33473 @opindex mno-ieee-fp
33474 @item -mieee-fp
33475 @itemx -mno-ieee-fp
33476 Control whether or not the compiler uses IEEE floating-point
33477 comparisons.  These correctly handle the case where the result of a
33478 comparison is unordered.
33480 @opindex m80387
33481 @opindex mhard-float
33482 @item -m80387
33483 @itemx -mhard-float
33484 Generate output containing 80387 instructions for floating point.
33486 @opindex no-80387
33487 @opindex msoft-float
33488 @item -mno-80387
33489 @itemx -msoft-float
33490 Generate output containing library calls for floating point.
33492 @strong{Warning:} the requisite libraries are not part of GCC@.
33493 Normally the facilities of the machine's usual C compiler are used, but
33494 this cannot be done directly in cross-compilation.  You must make your
33495 own arrangements to provide suitable library functions for
33496 cross-compilation.
33498 On machines where a function returns floating-point results in the 80387
33499 register stack, some floating-point opcodes may be emitted even if
33500 @option{-msoft-float} is used.
33502 @opindex mno-fp-ret-in-387
33503 @opindex mfp-ret-in-387
33504 @item -mno-fp-ret-in-387
33505 Do not use the FPU registers for return values of functions.
33507 The usual calling convention has functions return values of types
33508 @code{float} and @code{double} in an FPU register, even if there
33509 is no FPU@.  The idea is that the operating system should emulate
33510 an FPU@.
33512 The option @option{-mno-fp-ret-in-387} causes such values to be returned
33513 in ordinary CPU registers instead.
33515 @opindex mno-fancy-math-387
33516 @opindex mfancy-math-387
33517 @item -mno-fancy-math-387
33518 Some 387 emulators do not support the @code{sin}, @code{cos} and
33519 @code{sqrt} instructions for the 387.  Specify this option to avoid
33520 generating those instructions.
33521 This option is overridden when @option{-march}
33522 indicates that the target CPU always has an FPU and so the
33523 instruction does not need emulation.  These
33524 instructions are not generated unless you also use the
33525 @option{-funsafe-math-optimizations} switch.
33527 @opindex malign-double
33528 @opindex mno-align-double
33529 @item -malign-double
33530 @itemx -mno-align-double
33531 Control whether GCC aligns @code{double}, @code{long double}, and
33532 @code{long long} variables on a two-word boundary or a one-word
33533 boundary.  Aligning @code{double} variables on a two-word boundary
33534 produces code that runs somewhat faster on a Pentium at the
33535 expense of more memory.
33537 On x86-64, @option{-malign-double} is enabled by default.
33539 @strong{Warning:} if you use the @option{-malign-double} switch,
33540 structures containing the above types are aligned differently than
33541 the published application binary interface specifications for the x86-32
33542 and are not binary compatible with structures in code compiled
33543 without that switch.
33545 @opindex m96bit-long-double
33546 @opindex m128bit-long-double
33547 @item -m96bit-long-double
33548 @itemx -m128bit-long-double
33549 These switches control the size of @code{long double} type.  The x86-32
33550 application binary interface specifies the size to be 96 bits,
33551 so @option{-m96bit-long-double} is the default in 32-bit mode.
33553 Modern architectures (Pentium and newer) prefer @code{long double}
33554 to be aligned to an 8- or 16-byte boundary.  In arrays or structures
33555 conforming to the ABI, this is not possible.  So specifying
33556 @option{-m128bit-long-double} aligns @code{long double}
33557 to a 16-byte boundary by padding the @code{long double} with an additional
33558 32-bit zero.
33560 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
33561 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
33563 Notice that neither of these options enable any extra precision over the x87
33564 standard of 80 bits for a @code{long double}.
33566 @strong{Warning:} if you override the default value for your target ABI, this
33567 changes the size of 
33568 structures and arrays containing @code{long double} variables,
33569 as well as modifying the function calling convention for functions taking
33570 @code{long double}.  Hence they are not binary-compatible
33571 with code compiled without that switch.
33573 @opindex mlong-double-64
33574 @opindex mlong-double-80
33575 @opindex mlong-double-128
33576 @item -mlong-double-64
33577 @itemx -mlong-double-80
33578 @itemx -mlong-double-128
33579 These switches control the size of @code{long double} type. A size
33580 of 64 bits makes the @code{long double} type equivalent to the @code{double}
33581 type. This is the default for 32-bit Bionic C library.  A size
33582 of 128 bits makes the @code{long double} type equivalent to the
33583 @code{__float128} type. This is the default for 64-bit Bionic C library.
33585 @strong{Warning:} if you override the default value for your target ABI, this
33586 changes the size of
33587 structures and arrays containing @code{long double} variables,
33588 as well as modifying the function calling convention for functions taking
33589 @code{long double}.  Hence they are not binary-compatible
33590 with code compiled without that switch.
33592 @opindex malign-data
33593 @item -malign-data=@var{type}
33594 Control how GCC aligns variables.  Supported values for @var{type} are
33595 @samp{compat} uses increased alignment value compatible uses GCC 4.8
33596 and earlier, @samp{abi} uses alignment value as specified by the
33597 psABI, and @samp{cacheline} uses increased alignment value to match
33598 the cache line size.  @samp{compat} is the default.
33600 @opindex mlarge-data-threshold
33601 @item -mlarge-data-threshold=@var{threshold}
33602 When @option{-mcmodel=medium} or @option{-mcmodel=large} is specified, data
33603 objects larger than @var{threshold} are placed in large data sections.  The
33604 default is 65535.
33606 @opindex mrtd
33607 @item -mrtd
33608 Use a different function-calling convention, in which functions that
33609 take a fixed number of arguments return with the @code{ret @var{num}}
33610 instruction, which pops their arguments while returning.  This saves one
33611 instruction in the caller since there is no need to pop the arguments
33612 there.
33614 You can specify that an individual function is called with this calling
33615 sequence with the function attribute @code{stdcall}.  You can also
33616 override the @option{-mrtd} option by using the function attribute
33617 @code{cdecl}.  @xref{Function Attributes}.
33619 @strong{Warning:} this calling convention is incompatible with the one
33620 normally used on Unix, so you cannot use it if you need to call
33621 libraries compiled with the Unix compiler.
33623 Also, you must provide function prototypes for all functions that
33624 take variable numbers of arguments (including @code{printf});
33625 otherwise incorrect code is generated for calls to those
33626 functions.
33628 In addition, seriously incorrect code results if you call a
33629 function with too many arguments.  (Normally, extra arguments are
33630 harmlessly ignored.)
33632 @opindex mregparm
33633 @item -mregparm=@var{num}
33634 Control how many registers are used to pass integer arguments.  By
33635 default, no registers are used to pass arguments, and at most 3
33636 registers can be used.  You can control this behavior for a specific
33637 function by using the function attribute @code{regparm}.
33638 @xref{Function Attributes}.
33640 @strong{Warning:} if you use this switch, and
33641 @var{num} is nonzero, then you must build all modules with the same
33642 value, including any libraries.  This includes the system libraries and
33643 startup modules.
33645 @opindex msseregparm
33646 @item -msseregparm
33647 Use SSE register passing conventions for float and double arguments
33648 and return values.  You can control this behavior for a specific
33649 function by using the function attribute @code{sseregparm}.
33650 @xref{Function Attributes}.
33652 @strong{Warning:} if you use this switch then you must build all
33653 modules with the same value, including any libraries.  This includes
33654 the system libraries and startup modules.
33656 @opindex mvect8-ret-in-mem
33657 @item -mvect8-ret-in-mem
33658 Return 8-byte vectors in memory instead of MMX registers.  This is the
33659 default on VxWorks to match the ABI of the Sun Studio compilers until
33660 version 12.  @emph{Only} use this option if you need to remain
33661 compatible with existing code produced by those previous compiler
33662 versions or older versions of GCC@.
33664 @opindex mpc32
33665 @opindex mpc64
33666 @opindex mpc80
33667 @item -mpc32
33668 @itemx -mpc64
33669 @itemx -mpc80
33671 Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
33672 is specified, the significands of results of floating-point operations are
33673 rounded to 24 bits (single precision); @option{-mpc64} rounds the
33674 significands of results of floating-point operations to 53 bits (double
33675 precision) and @option{-mpc80} rounds the significands of results of
33676 floating-point operations to 64 bits (extended double precision), which is
33677 the default.  When this option is used, floating-point operations in higher
33678 precisions are not available to the programmer without setting the FPU
33679 control word explicitly.
33681 Setting the rounding of floating-point operations to less than the default
33682 80 bits can speed some programs by 2% or more.  Note that some mathematical
33683 libraries assume that extended-precision (80-bit) floating-point operations
33684 are enabled by default; routines in such libraries could suffer significant
33685 loss of accuracy, typically through so-called ``catastrophic cancellation'',
33686 when this option is used to set the precision to less than extended precision.
33688 @opindex mdaz-ftz
33689 @item -mdaz-ftz
33691 The flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the MXCSR register
33692 are used to control floating-point calculations.SSE and AVX instructions
33693 including scalar and vector instructions could benefit from enabling the FTZ
33694 and DAZ flags when @option{-mdaz-ftz} is specified. Don't set FTZ/DAZ flags
33695 when @option{-mno-daz-ftz} or @option{-shared} is specified, @option{-mdaz-ftz}
33696 will set FTZ/DAZ flags even with @option{-shared}.
33698 @opindex mstackrealign
33699 @item -mstackrealign
33700 Realign the stack at entry.  On the x86, the @option{-mstackrealign}
33701 option generates an alternate prologue and epilogue that realigns the
33702 run-time stack if necessary.  This supports mixing legacy codes that keep
33703 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
33704 SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
33705 applicable to individual functions.
33707 @opindex mpreferred-stack-boundary
33708 @item -mpreferred-stack-boundary=@var{num}
33709 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
33710 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
33711 the default is 4 (16 bytes or 128 bits).
33713 @strong{Warning:} When generating code for the x86-64 architecture with
33714 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
33715 used to keep the stack boundary aligned to 8 byte boundary.  Since
33716 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
33717 intended to be used in controlled environment where stack space is
33718 important limitation.  This option leads to wrong code when functions
33719 compiled with 16 byte stack alignment (such as functions from a standard
33720 library) are called with misaligned stack.  In this case, SSE
33721 instructions may lead to misaligned memory access traps.  In addition,
33722 variable arguments are handled incorrectly for 16 byte aligned
33723 objects (including x87 long double and __int128), leading to wrong
33724 results.  You must build all modules with
33725 @option{-mpreferred-stack-boundary=3}, including any libraries.  This
33726 includes the system libraries and startup modules.
33728 @opindex mincoming-stack-boundary
33729 @item -mincoming-stack-boundary=@var{num}
33730 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
33731 boundary.  If @option{-mincoming-stack-boundary} is not specified,
33732 the one specified by @option{-mpreferred-stack-boundary} is used.
33734 On Pentium and Pentium Pro, @code{double} and @code{long double} values
33735 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
33736 suffer significant run time performance penalties.  On Pentium III, the
33737 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
33738 properly if it is not 16-byte aligned.
33740 To ensure proper alignment of this values on the stack, the stack boundary
33741 must be as aligned as that required by any value stored on the stack.
33742 Further, every function must be generated such that it keeps the stack
33743 aligned.  Thus calling a function compiled with a higher preferred
33744 stack boundary from a function compiled with a lower preferred stack
33745 boundary most likely misaligns the stack.  It is recommended that
33746 libraries that use callbacks always use the default setting.
33748 This extra alignment does consume extra stack space, and generally
33749 increases code size.  Code that is sensitive to stack space usage, such
33750 as embedded systems and operating system kernels, may want to reduce the
33751 preferred alignment to @option{-mpreferred-stack-boundary=2}.
33753 @need 200
33754 @opindex mmmx
33755 @item -mmmx
33756 @need 200
33757 @opindex msse
33758 @itemx -msse
33759 @need 200
33760 @opindex msse2
33761 @itemx -msse2
33762 @need 200
33763 @opindex msse3
33764 @itemx -msse3
33765 @need 200
33766 @opindex mssse3
33767 @itemx -mssse3
33768 @need 200
33769 @opindex msse4
33770 @itemx -msse4
33771 @need 200
33772 @opindex msse4a
33773 @itemx -msse4a
33774 @need 200
33775 @opindex msse4.1
33776 @itemx -msse4.1
33777 @need 200
33778 @opindex msse4.2
33779 @itemx -msse4.2
33780 @need 200
33781 @opindex mavx
33782 @itemx -mavx
33783 @need 200
33784 @opindex mavx2
33785 @itemx -mavx2
33786 @need 200
33787 @opindex mavx512f
33788 @itemx -mavx512f
33789 @need 200
33790 @opindex mavx512pf
33791 @itemx -mavx512pf
33792 @need 200
33793 @opindex mavx512er
33794 @itemx -mavx512er
33795 @need 200
33796 @opindex mavx512cd
33797 @itemx -mavx512cd
33798 @need 200
33799 @opindex mavx512vl
33800 @itemx -mavx512vl
33801 @need 200
33802 @opindex mavx512bw
33803 @itemx -mavx512bw
33804 @need 200
33805 @opindex mavx512dq
33806 @itemx -mavx512dq
33807 @need 200
33808 @opindex mavx512ifma
33809 @itemx -mavx512ifma
33810 @need 200
33811 @opindex mavx512vbmi
33812 @itemx -mavx512vbmi
33813 @need 200
33814 @opindex msha
33815 @itemx -msha
33816 @need 200
33817 @opindex maes
33818 @itemx -maes
33819 @need 200
33820 @opindex mpclmul
33821 @itemx -mpclmul
33822 @need 200
33823 @opindex mclflushopt
33824 @itemx -mclflushopt
33825 @need 200
33826 @opindex mclwb
33827 @itemx -mclwb
33828 @need 200
33829 @opindex mfsgsbase
33830 @itemx -mfsgsbase
33831 @need 200
33832 @opindex mptwrite
33833 @itemx -mptwrite
33834 @need 200
33835 @opindex mrdrnd
33836 @itemx -mrdrnd
33837 @need 200
33838 @opindex mf16c
33839 @itemx -mf16c
33840 @need 200
33841 @opindex mfma
33842 @itemx -mfma
33843 @need 200
33844 @opindex mpconfig
33845 @itemx -mpconfig
33846 @need 200
33847 @opindex mwbnoinvd
33848 @itemx -mwbnoinvd
33849 @need 200
33850 @opindex mfma4
33851 @itemx -mfma4
33852 @need 200
33853 @opindex mprfchw
33854 @itemx -mprfchw
33855 @need 200
33856 @opindex mrdpid
33857 @itemx -mrdpid
33858 @need 200
33859 @opindex mprefetchwt1
33860 @itemx -mprefetchwt1
33861 @need 200
33862 @opindex mrdseed
33863 @itemx -mrdseed
33864 @need 200
33865 @opindex msgx
33866 @itemx -msgx
33867 @need 200
33868 @opindex mxop
33869 @itemx -mxop
33870 @need 200
33871 @opindex mlwp
33872 @itemx -mlwp
33873 @need 200
33874 @opindex m3dnow
33875 @itemx -m3dnow
33876 @need 200
33877 @opindex m3dnowa
33878 @itemx -m3dnowa
33879 @need 200
33880 @opindex mpopcnt
33881 @itemx -mpopcnt
33882 @need 200
33883 @opindex mabm
33884 @itemx -mabm
33885 @need 200
33886 @opindex madx
33887 @itemx -madx
33888 @need 200
33889 @opindex mbmi
33890 @itemx -mbmi
33891 @need 200
33892 @opindex mbmi2
33893 @itemx -mbmi2
33894 @need 200
33895 @opindex mlzcnt
33896 @itemx -mlzcnt
33897 @need 200
33898 @opindex mfxsr
33899 @itemx -mfxsr
33900 @need 200
33901 @opindex mxsave
33902 @itemx -mxsave
33903 @need 200
33904 @opindex mxsaveopt
33905 @itemx -mxsaveopt
33906 @need 200
33907 @opindex mxsavec
33908 @itemx -mxsavec
33909 @need 200
33910 @opindex mxsaves
33911 @itemx -mxsaves
33912 @need 200
33913 @opindex mrtm
33914 @itemx -mrtm
33915 @need 200
33916 @opindex mhle
33917 @itemx -mhle
33918 @need 200
33919 @opindex mtbm
33920 @itemx -mtbm
33921 @need 200
33922 @opindex mmwaitx
33923 @itemx -mmwaitx
33924 @need 200
33925 @opindex mclzero
33926 @itemx -mclzero
33927 @need 200
33928 @opindex mpku
33929 @itemx -mpku
33930 @need 200
33931 @opindex mavx512vbmi2
33932 @itemx -mavx512vbmi2
33933 @need 200
33934 @opindex mavx512bf16
33935 @itemx -mavx512bf16
33936 @need 200
33937 @opindex mavx512fp16
33938 @itemx -mavx512fp16
33939 @need 200
33940 @opindex mgfni
33941 @itemx -mgfni
33942 @need 200
33943 @opindex mvaes
33944 @itemx -mvaes
33945 @need 200
33946 @opindex mwaitpkg
33947 @itemx -mwaitpkg
33948 @need 200
33949 @opindex mvpclmulqdq
33950 @itemx -mvpclmulqdq
33951 @need 200
33952 @opindex mavx512bitalg
33953 @itemx -mavx512bitalg
33954 @need 200
33955 @opindex mmovdiri
33956 @itemx -mmovdiri
33957 @need 200
33958 @opindex mmovdir64b
33959 @itemx -mmovdir64b
33960 @need 200
33961 @opindex menqcmd
33962 @opindex muintr
33963 @itemx -menqcmd
33964 @itemx -muintr
33965 @need 200
33966 @opindex mtsxldtrk
33967 @itemx -mtsxldtrk
33968 @need 200
33969 @opindex mavx512vpopcntdq
33970 @itemx -mavx512vpopcntdq
33971 @need 200
33972 @opindex mavx512vp2intersect
33973 @itemx -mavx512vp2intersect
33974 @need 200
33975 @opindex mavx5124fmaps
33976 @itemx -mavx5124fmaps
33977 @need 200
33978 @opindex mavx512vnni
33979 @itemx -mavx512vnni
33980 @need 200
33981 @opindex mavxvnni
33982 @itemx -mavxvnni
33983 @need 200
33984 @opindex mavx5124vnniw
33985 @itemx -mavx5124vnniw
33986 @need 200
33987 @opindex mcldemote
33988 @itemx -mcldemote
33989 @need 200
33990 @opindex mserialize
33991 @itemx -mserialize
33992 @need 200
33993 @opindex mamx-tile
33994 @itemx -mamx-tile
33995 @need 200
33996 @opindex mamx-int8
33997 @itemx -mamx-int8
33998 @need 200
33999 @opindex mamx-bf16
34000 @itemx -mamx-bf16
34001 @need 200
34002 @opindex mhreset
34003 @opindex mkl
34004 @itemx -mhreset
34005 @itemx -mkl
34006 @need 200
34007 @opindex mwidekl
34008 @itemx -mwidekl
34009 @need 200
34010 @opindex mavxifma
34011 @itemx -mavxifma
34012 @need 200
34013 @opindex mavxvnniint8
34014 @itemx -mavxvnniint8
34015 @need 200
34016 @opindex mavxneconvert
34017 @itemx -mavxneconvert
34018 @need 200
34019 @opindex mcmpccxadd
34020 @itemx -mcmpccxadd
34021 @need 200
34022 @opindex mamx-fp16
34023 @itemx -mamx-fp16
34024 @need 200
34025 @opindex mprefetchi
34026 @itemx -mprefetchi
34027 @need 200
34028 @opindex mraoint
34029 @itemx -mraoint
34030 @need 200
34031 @opindex mamx-complex
34032 @itemx -mamx-complex
34033 @need 200
34034 @opindex mavxvnniint16
34035 @itemx -mavxvnniint16
34036 @need 200
34037 @opindex msm3
34038 @itemx -msm3
34039 @need 200
34040 @opindex msha512
34041 @itemx -msha512
34042 @need 200
34043 @opindex msm4
34044 @itemx -msm4
34045 @need 200
34046 @opindex mapxf
34047 @itemx -mapxf
34048 @need 200
34049 @opindex musermsr
34050 @itemx -musermsr
34051 These switches enable the use of instructions in the MMX, SSE,
34052 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
34053 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
34054 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
34055 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
34056 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
34057 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
34058 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
34059 UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512-FP16,
34060 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AMX-FP16, PREFETCHI, RAOINT,
34061 AMX-COMPLEX, AVXVNNIINT16, SM3, SHA512, SM4, APX_F, USER_MSR or CLDEMOTE
34062 extended instruction sets.  Each has a corresponding @option{-mno-} option
34063 to disable use of these instructions.
34065 These extensions are also available as built-in functions: see
34066 @ref{x86 Built-in Functions}, for details of the functions enabled and
34067 disabled by these switches.
34069 To generate SSE/SSE2 instructions automatically from floating-point
34070 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
34072 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
34073 generates new AVX instructions or AVX equivalence for all SSEx instructions
34074 when needed.
34076 These options enable GCC to use these extended instructions in
34077 generated code, even without @option{-mfpmath=sse}.  Applications that
34078 perform run-time CPU detection must compile separate files for each
34079 supported architecture, using the appropriate flags.  In particular,
34080 the file containing the CPU detection code should be compiled without
34081 these options.
34083 @opindex mdump-tune-features
34084 @item -mdump-tune-features
34085 This option instructs GCC to dump the names of the x86 performance 
34086 tuning features and default settings. The names can be used in 
34087 @option{-mtune-ctrl=@var{feature-list}}.
34089 @opindex mtune-ctrl=@var{feature-list}
34090 @item -mtune-ctrl=@var{feature-list}
34091 This option is used to do fine grain control of x86 code generation features.
34092 @var{feature-list} is a comma separated list of @var{feature} names. See also
34093 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
34094 on if it is not preceded with @samp{^}, otherwise, it is turned off. 
34095 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
34096 developers. Using it may lead to code paths not covered by testing and can
34097 potentially result in compiler ICEs or runtime errors.
34099 @opindex mno-default
34100 @item -mno-default
34101 This option instructs GCC to turn off all tunable features. See also 
34102 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
34104 @opindex mcld
34105 @item -mcld
34106 This option instructs GCC to emit a @code{cld} instruction in the prologue
34107 of functions that use string instructions.  String instructions depend on
34108 the DF flag to select between autoincrement or autodecrement mode.  While the
34109 ABI specifies the DF flag to be cleared on function entry, some operating
34110 systems violate this specification by not clearing the DF flag in their
34111 exception dispatchers.  The exception handler can be invoked with the DF flag
34112 set, which leads to wrong direction mode when string instructions are used.
34113 This option can be enabled by default on 32-bit x86 targets by configuring
34114 GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
34115 instructions can be suppressed with the @option{-mno-cld} compiler option
34116 in this case.
34118 @opindex mvzeroupper
34119 @item -mvzeroupper
34120 This option instructs GCC to emit a @code{vzeroupper} instruction
34121 before a transfer of control flow out of the function to minimize
34122 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
34123 intrinsics.
34125 @opindex mprefer-avx128
34126 @item -mprefer-avx128
34127 This option instructs GCC to use 128-bit AVX instructions instead of
34128 256-bit AVX instructions in the auto-vectorizer.
34130 @opindex mprefer-vector-width
34131 @item -mprefer-vector-width=@var{opt}
34132 This option instructs GCC to use @var{opt}-bit vector width in instructions
34133 instead of default on the selected platform.
34135 @opindex mpartial-vector-fp-math
34136 @item -mpartial-vector-fp-math
34137 This option enables GCC to generate floating-point operations that might
34138 affect the set of floating-point status flags on partial vectors, where
34139 vector elements reside in the low part of the 128-bit SSE register.  Unless
34140 @option{-fno-trapping-math} is specified, the compiler guarantees correct
34141 behavior by sanitizing all input operands to have zeroes in the unused
34142 upper part of the vector register.  Note that by using built-in functions
34143 or inline assembly with partial vector arguments, NaNs, denormal or invalid
34144 values can leak into the upper part of the vector, causing possible
34145 performance issues when @option{-fno-trapping-math} is in effect.  These
34146 issues can be mitigated by manually sanitizing the upper part of the partial
34147 vector argument register or by using @option{-mdaz-ftz} to set
34148 denormals-are-zero (DAZ) flag in the MXCSR register.
34150 This option is enabled by default.
34152 @opindex mmove-max
34153 @item -mmove-max=@var{bits}
34154 This option instructs GCC to set the maximum number of bits can be
34155 moved from memory to memory efficiently to @var{bits}.  The valid
34156 @var{bits} are 128, 256 and 512.
34158 @opindex mstore-max
34159 @item -mstore-max=@var{bits}
34160 This option instructs GCC to set the maximum number of bits can be
34161 stored to memory efficiently to @var{bits}.  The valid @var{bits} are
34162 128, 256 and 512.
34164 @table @samp
34165 @item none
34166 No extra limitations applied to GCC other than defined by the selected platform.
34168 @item 128
34169 Prefer 128-bit vector width for instructions.
34171 @item 256
34172 Prefer 256-bit vector width for instructions.
34174 @item 512
34175 Prefer 512-bit vector width for instructions.
34176 @end table
34178 @opindex mcx16
34179 @item -mcx16
34180 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
34181 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
34182 objects.  This is useful for atomic updates of data structures exceeding one
34183 machine word in size.  The compiler uses this instruction to implement
34184 @ref{__sync Builtins}.  However, for @ref{__atomic Builtins} operating on
34185 128-bit integers, a library call is always used.
34187 @opindex msahf
34188 @item -msahf
34189 This option enables generation of @code{SAHF} instructions in 64-bit code.
34190 Early Intel Pentium 4 CPUs with Intel 64 support,
34191 prior to the introduction of Pentium 4 G1 step in December 2005,
34192 lacked the @code{LAHF} and @code{SAHF} instructions
34193 which are supported by AMD64.
34194 These are load and store instructions, respectively, for certain status flags.
34195 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
34196 @code{drem}, and @code{remainder} built-in functions;
34197 see @ref{Other Builtins} for details.
34199 @opindex mmovbe
34200 @item -mmovbe
34201 This option enables use of the @code{movbe} instruction to implement
34202 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
34204 @opindex mshstk
34205 @item -mshstk
34206 The @option{-mshstk} option enables shadow stack built-in functions
34207 from x86 Control-flow Enforcement Technology (CET).
34209 @opindex mcrc32
34210 @item -mcrc32
34211 This option enables built-in functions @code{__builtin_ia32_crc32qi},
34212 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
34213 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
34215 @opindex mmwait
34216 @item -mmwait
34217 This option enables built-in functions @code{__builtin_ia32_monitor},
34218 and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
34219 @code{mwait} machine instructions.
34221 @opindex mrecip
34222 @item -mrecip
34223 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
34224 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
34225 with an additional Newton-Raphson step
34226 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
34227 (and their vectorized
34228 variants) for single-precision floating-point arguments.  These instructions
34229 are generated only when @option{-funsafe-math-optimizations} is enabled
34230 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
34231 Note that while the throughput of the sequence is higher than the throughput
34232 of the non-reciprocal instruction, the precision of the sequence can be
34233 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
34235 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
34236 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
34237 combination), and doesn't need @option{-mrecip}.
34239 Also note that GCC emits the above sequence with additional Newton-Raphson step
34240 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
34241 already with @option{-ffast-math} (or the above option combination), and
34242 doesn't need @option{-mrecip}.
34244 @opindex mrecip=opt
34245 @item -mrecip=@var{opt}
34246 This option controls which reciprocal estimate instructions
34247 may be used.  @var{opt} is a comma-separated list of options, which may
34248 be preceded by a @samp{!} to invert the option:
34250 @table @samp
34251 @item all
34252 Enable all estimate instructions.
34254 @item default
34255 Enable the default instructions, equivalent to @option{-mrecip}.
34257 @item none
34258 Disable all estimate instructions, equivalent to @option{-mno-recip}.
34260 @item div
34261 Enable the approximation for scalar division.
34263 @item vec-div
34264 Enable the approximation for vectorized division.
34266 @item sqrt
34267 Enable the approximation for scalar square root.
34269 @item vec-sqrt
34270 Enable the approximation for vectorized square root.
34271 @end table
34273 So, for example, @option{-mrecip=all,!sqrt} enables
34274 all of the reciprocal approximations, except for square root.
34276 @opindex mveclibabi
34277 @item -mveclibabi=@var{type}
34278 Specifies the ABI type to use for vectorizing intrinsics using an
34279 external library.  Supported values for @var{type} are @samp{svml} 
34280 for the Intel short
34281 vector math library and @samp{acml} for the AMD math core library.
34282 To use this option, both @option{-ftree-vectorize} and
34283 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 
34284 ABI-compatible library must be specified at link time.
34286 GCC currently emits calls to @code{vmldExp2},
34287 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
34288 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
34289 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
34290 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
34291 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
34292 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
34293 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
34294 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
34295 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
34296 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
34297 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
34298 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
34299 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
34300 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
34301 when @option{-mveclibabi=acml} is used.  
34303 @opindex mabi
34304 @item -mabi=@var{name}
34305 Generate code for the specified calling convention.  Permissible values
34306 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
34307 @samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
34308 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
34309 You can control this behavior for specific functions by
34310 using the function attributes @code{ms_abi} and @code{sysv_abi}.
34311 @xref{Function Attributes}.
34313 @opindex mforce-indirect-call
34314 @item -mforce-indirect-call
34315 Force all calls to functions to be indirect. This is useful
34316 when using Intel Processor Trace where it generates more precise timing
34317 information for function calls.
34319 @opindex mmanual-endbr
34320 @item -mmanual-endbr
34321 Insert ENDBR instruction at function entry only via the @code{cf_check}
34322 function attribute. This is useful when used with the option
34323 @option{-fcf-protection=branch} to control ENDBR insertion at the
34324 function entry.
34326 @opindex mcet-switch
34327 @item -mcet-switch
34328 By default, CET instrumentation is turned off on switch statements that
34329 use a jump table and indirect branch track is disabled.  Since jump
34330 tables are stored in read-only memory, this does not result in a direct
34331 loss of hardening.  But if the jump table index is attacker-controlled,
34332 the indirect jump may not be constrained by CET.  This option turns on
34333 CET instrumentation to enable indirect branch track for switch statements
34334 with jump tables which leads to the jump targets reachable via any indirect
34335 jumps.
34337 @opindex mcall-ms2sysv-xlogues
34338 @opindex mno-call-ms2sysv-xlogues
34339 @item -mcall-ms2sysv-xlogues
34340 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
34341 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered.  By
34342 default, the code for saving and restoring these registers is emitted inline,
34343 resulting in fairly lengthy prologues and epilogues.  Using
34344 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
34345 use stubs in the static portion of libgcc to perform these saves and restores,
34346 thus reducing function size at the cost of a few extra instructions.
34348 @opindex mtls-dialect
34349 @item -mtls-dialect=@var{type}
34350 Generate code to access thread-local storage using the @samp{gnu} or
34351 @samp{gnu2} conventions.  @samp{gnu} is the conservative default;
34352 @samp{gnu2} is more efficient, but it may add compile- and run-time
34353 requirements that cannot be satisfied on all systems.
34355 @opindex mpush-args
34356 @opindex mno-push-args
34357 @item -mpush-args
34358 @itemx -mno-push-args
34359 Use PUSH operations to store outgoing parameters.  This method is shorter
34360 and usually equally fast as method using SUB/MOV operations and is enabled
34361 by default.  In some cases disabling it may improve performance because of
34362 improved scheduling and reduced dependencies.
34364 @opindex maccumulate-outgoing-args
34365 @item -maccumulate-outgoing-args
34366 If enabled, the maximum amount of space required for outgoing arguments is
34367 computed in the function prologue.  This is faster on most modern CPUs
34368 because of reduced dependencies, improved scheduling and reduced stack usage
34369 when the preferred stack boundary is not equal to 2.  The drawback is a notable
34370 increase in code size.  This switch implies @option{-mno-push-args}.
34372 @opindex mthreads
34373 @item -mthreads
34374 Support thread-safe exception handling on MinGW.  Programs that rely
34375 on thread-safe exception handling must compile and link all code with the
34376 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
34377 @option{-D_MT}; when linking, it links in a special thread helper library
34378 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
34380 @opindex mms-bitfields
34381 @opindex mno-ms-bitfields
34382 @item -mms-bitfields
34383 @itemx -mno-ms-bitfields
34385 Enable/disable bit-field layout compatible with the native Microsoft
34386 Windows compiler.  
34388 If @code{packed} is used on a structure, or if bit-fields are used,
34389 it may be that the Microsoft ABI lays out the structure differently
34390 than the way GCC normally does.  Particularly when moving packed
34391 data between functions compiled with GCC and the native Microsoft compiler
34392 (either via function call or as data in a file), it may be necessary to access
34393 either format.
34395 This option is enabled by default for Microsoft Windows
34396 targets.  This behavior can also be controlled locally by use of variable
34397 or type attributes.  For more information, see @ref{x86 Variable Attributes}
34398 and @ref{x86 Type Attributes}.
34400 The Microsoft structure layout algorithm is fairly simple with the exception
34401 of the bit-field packing.  
34402 The padding and alignment of members of structures and whether a bit-field 
34403 can straddle a storage-unit boundary are determine by these rules:
34405 @enumerate
34406 @item Structure members are stored sequentially in the order in which they are
34407 declared: the first member has the lowest memory address and the last member
34408 the highest.
34410 @item Every data object has an alignment requirement.  The alignment requirement
34411 for all data except structures, unions, and arrays is either the size of the
34412 object or the current packing size (specified with either the
34413 @code{aligned} attribute or the @code{pack} pragma),
34414 whichever is less.  For structures, unions, and arrays,
34415 the alignment requirement is the largest alignment requirement of its members.
34416 Every object is allocated an offset so that:
34418 @smallexample
34419 offset % alignment_requirement == 0
34420 @end smallexample
34422 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
34423 unit if the integral types are the same size and if the next bit-field fits
34424 into the current allocation unit without crossing the boundary imposed by the
34425 common alignment requirements of the bit-fields.
34426 @end enumerate
34428 MSVC interprets zero-length bit-fields in the following ways:
34430 @enumerate
34431 @item If a zero-length bit-field is inserted between two bit-fields that
34432 are normally coalesced, the bit-fields are not coalesced.
34434 For example:
34436 @smallexample
34437 struct
34438  @{
34439    unsigned long bf_1 : 12;
34440    unsigned long : 0;
34441    unsigned long bf_2 : 12;
34442  @} t1;
34443 @end smallexample
34445 @noindent
34446 The size of @code{t1} is 8 bytes with the zero-length bit-field.  If the
34447 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
34449 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
34450 alignment of the zero-length bit-field is greater than the member that follows it,
34451 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
34453 For example:
34455 @smallexample
34456 struct
34457  @{
34458    char foo : 4;
34459    short : 0;
34460    char bar;
34461  @} t2;
34463 struct
34464  @{
34465    char foo : 4;
34466    short : 0;
34467    double bar;
34468  @} t3;
34469 @end smallexample
34471 @noindent
34472 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
34473 Accordingly, the size of @code{t2} is 4.  For @code{t3}, the zero-length
34474 bit-field does not affect the alignment of @code{bar} or, as a result, the size
34475 of the structure.
34477 Taking this into account, it is important to note the following:
34479 @enumerate
34480 @item If a zero-length bit-field follows a normal bit-field, the type of the
34481 zero-length bit-field may affect the alignment of the structure as whole. For
34482 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
34483 normal bit-field, and is of type short.
34485 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
34486 still affect the alignment of the structure:
34488 @smallexample
34489 struct
34490  @{
34491    char foo : 6;
34492    long : 0;
34493  @} t4;
34494 @end smallexample
34496 @noindent
34497 Here, @code{t4} takes up 4 bytes.
34498 @end enumerate
34500 @item Zero-length bit-fields following non-bit-field members are ignored:
34502 @smallexample
34503 struct
34504  @{
34505    char foo;
34506    long : 0;
34507    char bar;
34508  @} t5;
34509 @end smallexample
34511 @noindent
34512 Here, @code{t5} takes up 2 bytes.
34513 @end enumerate
34516 @opindex mno-align-stringops
34517 @opindex malign-stringops
34518 @item -mno-align-stringops
34519 Do not align the destination of inlined string operations.  This switch reduces
34520 code size and improves performance in case the destination is already aligned,
34521 but GCC doesn't know about it.
34523 @opindex minline-all-stringops
34524 @item -minline-all-stringops
34525 By default GCC inlines string operations only when the destination is 
34526 known to be aligned to least a 4-byte boundary.  
34527 This enables more inlining and increases code
34528 size, but may improve performance of code that depends on fast
34529 @code{memcpy} and @code{memset} for short lengths.
34530 The option enables inline expansion of @code{strlen} for all
34531 pointer alignments.
34533 @opindex minline-stringops-dynamically
34534 @item -minline-stringops-dynamically
34535 For string operations of unknown size, use run-time checks with
34536 inline code for small blocks and a library call for large blocks.
34538 @opindex mstringop-strategy=@var{alg}
34539 @item -mstringop-strategy=@var{alg}
34540 Override the internal decision heuristic for the particular algorithm to use
34541 for inlining string operations.  The allowed values for @var{alg} are:
34543 @table @samp
34544 @item rep_byte
34545 @itemx rep_4byte
34546 @itemx rep_8byte
34547 Expand using i386 @code{rep} prefix of the specified size.
34549 @item byte_loop
34550 @itemx loop
34551 @itemx unrolled_loop
34552 Expand into an inline loop.
34554 @item libcall
34555 Always use a library call.
34556 @end table
34558 @opindex mmemcpy-strategy=@var{strategy}
34559 @item -mmemcpy-strategy=@var{strategy}
34560 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
34561 should be inlined and what inline algorithm to use when the expected size
34562 of the copy operation is known. @var{strategy} 
34563 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 
34564 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
34565 the max byte size with which inline algorithm @var{alg} is allowed.  For the last
34566 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
34567 in the list must be specified in increasing order.  The minimal byte size for 
34568 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 
34569 preceding range.
34571 @opindex mmemset-strategy=@var{strategy}
34572 @item -mmemset-strategy=@var{strategy}
34573 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
34574 @code{__builtin_memset} expansion.
34576 @opindex momit-leaf-frame-pointer
34577 @item -momit-leaf-frame-pointer
34578 Don't keep the frame pointer in a register for leaf functions.  This
34579 avoids the instructions to save, set up, and restore frame pointers and
34580 makes an extra register available in leaf functions.  The option
34581 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
34582 which might make debugging harder.
34584 @opindex mtls-direct-seg-refs
34585 @item -mtls-direct-seg-refs
34586 @itemx -mno-tls-direct-seg-refs
34587 Controls whether TLS variables may be accessed with offsets from the
34588 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
34589 or whether the thread base pointer must be added.  Whether or not this
34590 is valid depends on the operating system, and whether it maps the
34591 segment to cover the entire TLS area.
34593 For systems that use the GNU C Library, the default is on.
34595 @opindex msse2avx
34596 @item -msse2avx
34597 @itemx -mno-sse2avx
34598 Specify that the assembler should encode SSE instructions with VEX
34599 prefix.  The option @option{-mavx} turns this on by default.
34601 @opindex mfentry
34602 @item -mfentry
34603 @itemx -mno-fentry
34604 If profiling is active (@option{-pg}), put the profiling
34605 counter call before the prologue.
34606 Note: On x86 architectures the attribute @code{ms_hook_prologue}
34607 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
34609 @opindex mrecord-mcount
34610 @item -mrecord-mcount
34611 @itemx -mno-record-mcount
34612 If profiling is active (@option{-pg}), generate a __mcount_loc section
34613 that contains pointers to each profiling call. This is useful for
34614 automatically patching and out calls.
34616 @opindex mnop-mcount
34617 @item -mnop-mcount
34618 @itemx -mno-nop-mcount
34619 If profiling is active (@option{-pg}), generate the calls to
34620 the profiling functions as NOPs. This is useful when they
34621 should be patched in later dynamically. This is likely only
34622 useful together with @option{-mrecord-mcount}.
34624 @opindex minstrument-return
34625 @item -minstrument-return=@var{type}
34626 Instrument function exit in -pg -mfentry instrumented functions with
34627 call to specified function. This only instruments true returns ending
34628 with ret, but not sibling calls ending with jump. Valid types
34629 are @var{none} to not instrument, @var{call} to generate a call to __return__,
34630 or @var{nop5} to generate a 5 byte nop.
34632 @opindex mrecord-return
34633 @item -mrecord-return
34634 @itemx -mno-record-return
34635 Generate a __return_loc section pointing to all return instrumentation code.
34637 @opindex mfentry-name
34638 @item -mfentry-name=@var{name}
34639 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
34641 @opindex mfentry-section
34642 @item -mfentry-section=@var{name}
34643 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
34645 @opindex mskip-rax-setup
34646 @item -mskip-rax-setup
34647 @itemx -mno-skip-rax-setup
34648 When generating code for the x86-64 architecture with SSE extensions
34649 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
34650 register when there are no variable arguments passed in vector registers.
34652 @strong{Warning:} Since RAX register is used to avoid unnecessarily
34653 saving vector registers on stack when passing variable arguments, the
34654 impacts of this option are callees may waste some stack space,
34655 misbehave or jump to a random location.  GCC 4.4 or newer don't have
34656 those issues, regardless the RAX register value.
34658 @opindex m8bit-idiv
34659 @item -m8bit-idiv
34660 @itemx -mno-8bit-idiv
34661 On some processors, like Intel Atom, 8-bit unsigned integer divide is
34662 much faster than 32-bit/64-bit integer divide.  This option generates a
34663 run-time check.  If both dividend and divisor are within range of 0
34664 to 255, 8-bit unsigned integer divide is used instead of
34665 32-bit/64-bit integer divide.
34667 @opindex mavx256-split-unaligned-load
34668 @opindex mavx256-split-unaligned-store
34669 @item -mavx256-split-unaligned-load
34670 @itemx -mavx256-split-unaligned-store
34671 Split 32-byte AVX unaligned load and store.
34673 @opindex mstack-protector-guard
34674 @opindex mstack-protector-guard-reg
34675 @opindex mstack-protector-guard-offset
34676 @item -mstack-protector-guard=@var{guard}
34677 @itemx -mstack-protector-guard-reg=@var{reg}
34678 @itemx -mstack-protector-guard-offset=@var{offset}
34679 Generate stack protection code using canary at @var{guard}.  Supported
34680 locations are @samp{global} for global canary or @samp{tls} for per-thread
34681 canary in the TLS block (the default).  This option has effect only when
34682 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
34684 With the latter choice the options
34685 @option{-mstack-protector-guard-reg=@var{reg}} and
34686 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
34687 which segment register (@code{%fs} or @code{%gs}) to use as base register
34688 for reading the canary, and from what offset from that base register.
34689 The default for those is as specified in the relevant ABI.
34691 @opindex mgeneral-regs-only
34692 @item -mgeneral-regs-only
34693 Generate code that uses only the general-purpose registers.  This
34694 prevents the compiler from using floating-point, vector, mask and bound
34695 registers.
34697 @opindex mrelax-cmpxchg-loop
34698 @item -mrelax-cmpxchg-loop
34699 When emitting a compare-and-swap loop for @ref{__sync Builtins}
34700 and @ref{__atomic Builtins} lacking a native instruction, optimize
34701 for the highly contended case by issuing an atomic load before the
34702 @code{CMPXCHG} instruction, and using the @code{PAUSE} instruction
34703 to save CPU power when restarting the loop.
34705 @opindex mindirect-branch
34706 @item -mindirect-branch=@var{choice}
34707 Convert indirect call and jump with @var{choice}.  The default is
34708 @samp{keep}, which keeps indirect call and jump unmodified.
34709 @samp{thunk} converts indirect call and jump to call and return thunk.
34710 @samp{thunk-inline} converts indirect call and jump to inlined call
34711 and return thunk.  @samp{thunk-extern} converts indirect call and jump
34712 to external call and return thunk provided in a separate object file.
34713 You can control this behavior for a specific function by using the
34714 function attribute @code{indirect_branch}.  @xref{Function Attributes}.
34716 Note that @option{-mcmodel=large} is incompatible with
34717 @option{-mindirect-branch=thunk} and
34718 @option{-mindirect-branch=thunk-extern} since the thunk function may
34719 not be reachable in the large code model.
34721 Note that @option{-mindirect-branch=thunk-extern} is compatible with
34722 @option{-fcf-protection=branch} since the external thunk can be made
34723 to enable control-flow check.
34725 @opindex mfunction-return
34726 @item -mfunction-return=@var{choice}
34727 Convert function return with @var{choice}.  The default is @samp{keep},
34728 which keeps function return unmodified.  @samp{thunk} converts function
34729 return to call and return thunk.  @samp{thunk-inline} converts function
34730 return to inlined call and return thunk.  @samp{thunk-extern} converts
34731 function return to external call and return thunk provided in a separate
34732 object file.  You can control this behavior for a specific function by
34733 using the function attribute @code{function_return}.
34734 @xref{Function Attributes}.
34736 Note that @option{-mindirect-return=thunk-extern} is compatible with
34737 @option{-fcf-protection=branch} since the external thunk can be made
34738 to enable control-flow check.
34740 Note that @option{-mcmodel=large} is incompatible with
34741 @option{-mfunction-return=thunk} and
34742 @option{-mfunction-return=thunk-extern} since the thunk function may
34743 not be reachable in the large code model.
34746 @opindex mindirect-branch-register
34747 @item -mindirect-branch-register
34748 Force indirect call and jump via register.
34750 @opindex mharden-sls
34751 @item -mharden-sls=@var{choice}
34752 Generate code to mitigate against straight line speculation (SLS) with
34753 @var{choice}.  The default is @samp{none} which disables all SLS
34754 hardening.  @samp{return} enables SLS hardening for function returns.
34755 @samp{indirect-jmp} enables SLS hardening for indirect jumps.
34756 @samp{all} enables all SLS hardening.
34758 @opindex mindirect-branch-cs-prefix
34759 @item -mindirect-branch-cs-prefix
34760 Add CS prefix to call and jmp to indirect thunk with branch target in
34761 r8-r15 registers so that the call and jmp instruction length is 6 bytes
34762 to allow them to be replaced with @samp{lfence; call *%r8-r15} or
34763 @samp{lfence; jmp *%r8-r15} at run-time.
34765 @end table
34767 These @samp{-m} switches are supported in addition to the above
34768 on x86-64 processors in 64-bit environments.
34770 @table @gcctabopt
34771 @opindex m32
34772 @opindex m64
34773 @opindex mx32
34774 @opindex m16
34775 @opindex miamcu
34776 @item -m32
34777 @itemx -m64
34778 @itemx -mx32
34779 @itemx -m16
34780 @itemx -miamcu
34781 Generate code for a 16-bit, 32-bit or 64-bit environment.
34782 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
34783 to 32 bits, and
34784 generates code that runs in 32-bit mode.
34786 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
34787 types to 64 bits, and generates code for the x86-64 architecture.
34788 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
34789 and @option{-mdynamic-no-pic} options.
34791 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
34792 to 32 bits, and
34793 generates code for the x86-64 architecture.
34795 The @option{-m16} option is the same as @option{-m32}, except for that
34796 it outputs the @code{.code16gcc} assembly directive at the beginning of
34797 the assembly output so that the binary can run in 16-bit mode.
34799 The @option{-miamcu} option generates code which conforms to Intel MCU
34800 psABI.  It requires the @option{-m32} option to be turned on.
34802 @opindex mno-red-zone
34803 @opindex mred-zone
34804 @item -mno-red-zone
34805 Do not use a so-called ``red zone'' for x86-64 code.  The red zone is mandated
34806 by the x86-64 ABI; it is a 128-byte area beyond the location of the
34807 stack pointer that is not modified by signal or interrupt handlers
34808 and therefore can be used for temporary data without adjusting the stack
34809 pointer.  The flag @option{-mno-red-zone} disables this red zone.
34811 @opindex mcmodel=small
34812 @item -mcmodel=small
34813 Generate code for the small code model: the program and its symbols must
34814 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
34815 Programs can be statically or dynamically linked.  This is the default
34816 code model.
34818 @opindex mcmodel=kernel
34819 @item -mcmodel=kernel
34820 Generate code for the kernel code model.  The kernel runs in the
34821 negative 2 GB of the address space.
34822 This model has to be used for Linux kernel code.
34824 @opindex mcmodel=medium
34825 @item -mcmodel=medium
34826 Generate code for the medium model: the program is linked in the lower 2
34827 GB of the address space.  Small symbols are also placed there.  Symbols
34828 with sizes larger than @option{-mlarge-data-threshold} are put into
34829 large data or BSS sections and can be located above 2GB.  Programs can
34830 be statically or dynamically linked.
34832 @opindex mcmodel=large
34833 @item -mcmodel=large
34834 Generate code for the large model.  This model makes no assumptions
34835 about addresses and sizes of sections.
34837 @opindex maddress-mode=long
34838 @item -maddress-mode=long
34839 Generate code for long address mode.  This is only supported for 64-bit
34840 and x32 environments.  It is the default address mode for 64-bit
34841 environments.
34843 @opindex maddress-mode=short
34844 @item -maddress-mode=short
34845 Generate code for short address mode.  This is only supported for 32-bit
34846 and x32 environments.  It is the default address mode for 32-bit and
34847 x32 environments.
34849 @opindex mneeded
34850 @item -mneeded
34851 @itemx -mno-needed
34852 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
34853 indicate the micro-architecture ISA level required to execute the binary.
34855 @opindex mno-direct-extern-access
34856 @opindex mdirect-extern-access
34857 @item -mno-direct-extern-access
34858 Without @option{-fpic} nor @option{-fPIC}, always use the GOT pointer
34859 to access external symbols.  With @option{-fpic} or @option{-fPIC},
34860 treat access to protected symbols as local symbols.  The default is
34861 @option{-mdirect-extern-access}.
34863 @strong{Warning:} shared libraries compiled with
34864 @option{-mno-direct-extern-access} and executable compiled with
34865 @option{-mdirect-extern-access} may not be binary compatible if
34866 protected symbols are used in shared libraries and executable.
34868 @opindex munroll-only-small-loops
34869 @opindex mno-unroll-only-small-loops
34870 @item -munroll-only-small-loops
34871 Controls conservative small loop unrolling. It is default enabled by
34872 O2, and unrolls loop with less than 4 insns by 1 time. Explicit
34873 -f[no-]unroll-[all-]loops would disable this flag to avoid any
34874 unintended unrolling behavior that user does not want.
34876 @opindex mlam
34877 @item -mlam=@var{choice}
34878 LAM(linear-address masking) allows special bits in the pointer to be used
34879 for metadata. The default is @samp{none}. With @samp{u48}, pointer bits in
34880 positions 62:48 can be used for metadata; With @samp{u57}, pointer bits in
34881 positions 62:57 can be used for metadata.
34882 @end table
34884 @node x86 Windows Options
34885 @subsection x86 Windows Options
34886 @cindex x86 Windows Options
34887 @cindex Windows Options for x86
34889 These additional options are available for Microsoft Windows targets:
34891 @table @gcctabopt
34892 @opindex mconsole
34893 @item -mconsole
34894 This option
34895 specifies that a console application is to be generated, by
34896 instructing the linker to set the PE header subsystem type
34897 required for console applications.
34898 This option is available for Cygwin and MinGW targets and is
34899 enabled by default on those targets.
34901 @opindex mcrtdll
34902 @item -mcrtdll=@var{library}
34903 Preprocess, compile or link with specified C RunTime DLL @var{library}.
34904 This option adjust predefined macros @code{__CRTDLL__}, @code{__MSVCRT__}
34905 and @code{__MSVCRT_VERSION__} for specified CRT @var{library}, choose
34906 start file for CRT @var{library} and link with CRT @var{library}.
34907 Recognized CRT library names for proprocessor are:
34908 @code{crtdll}, @code{msvcrt10}, @code{msvcrt20}, @code{msvcrt40},
34909 @code{msvcrt-os}, @code{msvcr70}, @code{msvcr80}, @code{msvcr90},
34910 @code{msvcr100}, @code{msvcr110}, @code{msvcr120} and @code{ucrt}.
34911 If this options is not specified then the default MinGW import library
34912 @code{msvcrt} is used for linking and no other adjustment for
34913 preprocessor is done. MinGW import library @code{msvcrt} is just a
34914 symlink to (or a copy of) another MinGW CRT import library
34915 chosen during MinGW compilation. MinGW import library @code{msvcrt-os}
34916 is for Windows system CRT DLL library @code{msvcrt.dll} and
34917 in most cases is the default MinGW import library.
34918 Generally speaking, changing the CRT DLL requires recompiling
34919 the entire MinGW CRT. This option is for experimental and testing
34920 purposes only.
34921 This option is available for MinGW targets.
34923 @opindex mdll
34924 @item -mdll
34925 This option is available for Cygwin and MinGW targets.  It
34926 specifies that a DLL---a dynamic link library---is to be
34927 generated, enabling the selection of the required runtime
34928 startup object and entry point.
34930 @opindex mnop-fun-dllimport
34931 @item -mnop-fun-dllimport
34932 This option is available for Cygwin and MinGW targets.  It
34933 specifies that the @code{dllimport} attribute should be ignored.
34935 @opindex mthreads
34936 @item -mthreads
34937 This option is available for MinGW targets. It specifies
34938 that MinGW-specific thread support is to be used.
34940 @opindex municode
34941 @item -municode
34942 This option is available for MinGW-w64 targets.  It causes
34943 the @code{UNICODE} preprocessor macro to be predefined, and
34944 chooses Unicode-capable runtime startup code.
34946 @opindex mwin32
34947 @item -mwin32
34948 This option is available for Cygwin and MinGW targets.  It
34949 specifies that the typical Microsoft Windows predefined macros are to
34950 be set in the pre-processor, but does not influence the choice
34951 of runtime library/startup code.
34953 @opindex mwindows
34954 @item -mwindows
34955 This option is available for Cygwin and MinGW targets.  It
34956 specifies that a GUI application is to be generated by
34957 instructing the linker to set the PE header subsystem type
34958 appropriately.
34960 @opindex fno-set-stack-executable
34961 @opindex fset-stack-executable
34962 @item -fno-set-stack-executable
34963 This option is available for MinGW targets. It specifies that
34964 the executable flag for the stack used by nested functions isn't
34965 set. This is necessary for binaries running in kernel mode of
34966 Microsoft Windows, as there the User32 API, which is used to set executable
34967 privileges, isn't available.
34969 @opindex fno-writable-relocated-rdata
34970 @opindex fwritable-relocated-rdata
34971 @item -fwritable-relocated-rdata
34972 This option is available for MinGW and Cygwin targets.  It specifies
34973 that relocated-data in read-only section is put into the @code{.data}
34974 section.  This is a necessary for older runtimes not supporting
34975 modification of @code{.rdata} sections for pseudo-relocation.
34977 @opindex mpe-aligned-commons
34978 @item -mpe-aligned-commons
34979 This option is available for Cygwin and MinGW targets.  It
34980 specifies that the GNU extension to the PE file format that
34981 permits the correct alignment of COMMON variables should be
34982 used when generating code.  It is enabled by default if
34983 GCC detects that the target assembler found during configuration
34984 supports the feature.
34985 @end table
34987 See also under @ref{x86 Options} for standard options.
34989 @node Xstormy16 Options
34990 @subsection Xstormy16 Options
34991 @cindex Xstormy16 Options
34993 These options are defined for Xstormy16:
34995 @table @gcctabopt
34996 @opindex msim
34997 @item -msim
34998 Choose startup files and linker script suitable for the simulator.
34999 @end table
35001 @node Xtensa Options
35002 @subsection Xtensa Options
35003 @cindex Xtensa Options
35005 These options are supported for Xtensa targets:
35007 @table @gcctabopt
35008 @opindex mconst16
35009 @opindex mno-const16
35010 @item -mconst16
35011 @itemx -mno-const16
35012 Enable or disable use of @code{CONST16} instructions for loading
35013 constant values.  The @code{CONST16} instruction is currently not a
35014 standard option from Tensilica.  When enabled, @code{CONST16}
35015 instructions are always used in place of the standard @code{L32R}
35016 instructions.  The use of @code{CONST16} is enabled by default only if
35017 the @code{L32R} instruction is not available.
35019 @opindex mfused-madd
35020 @opindex mno-fused-madd
35021 @item -mfused-madd
35022 @itemx -mno-fused-madd
35023 Enable or disable use of fused multiply/add and multiply/subtract
35024 instructions in the floating-point option.  This has no effect if the
35025 floating-point option is not also enabled.  Disabling fused multiply/add
35026 and multiply/subtract instructions forces the compiler to use separate
35027 instructions for the multiply and add/subtract operations.  This may be
35028 desirable in some cases where strict IEEE 754-compliant results are
35029 required: the fused multiply add/subtract instructions do not round the
35030 intermediate result, thereby producing results with @emph{more} bits of
35031 precision than specified by the IEEE standard.  Disabling fused multiply
35032 add/subtract instructions also ensures that the program output is not
35033 sensitive to the compiler's ability to combine multiply and add/subtract
35034 operations.
35036 @opindex mserialize-volatile
35037 @opindex mno-serialize-volatile
35038 @item -mserialize-volatile
35039 @itemx -mno-serialize-volatile
35040 When this option is enabled, GCC inserts @code{MEMW} instructions before
35041 @code{volatile} memory references to guarantee sequential consistency.
35042 The default is @option{-mserialize-volatile}.  Use
35043 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
35045 @opindex mforce-no-pic
35046 @item -mforce-no-pic
35047 For targets, like GNU/Linux, where all user-mode Xtensa code must be
35048 position-independent code (PIC), this option disables PIC for compiling
35049 kernel code.
35051 @opindex mtext-section-literals
35052 @opindex mno-text-section-literals
35053 @item -mtext-section-literals
35054 @itemx -mno-text-section-literals
35055 These options control the treatment of literal pools.  The default is
35056 @option{-mno-text-section-literals}, which places literals in a separate
35057 section in the output file.  This allows the literal pool to be placed
35058 in a data RAM/ROM, and it also allows the linker to combine literal
35059 pools from separate object files to remove redundant literals and
35060 improve code size.  With @option{-mtext-section-literals}, the literals
35061 are interspersed in the text section in order to keep them as close as
35062 possible to their references.  This may be necessary for large assembly
35063 files.  Literals for each function are placed right before that function.
35065 @opindex mauto-litpools
35066 @opindex mno-auto-litpools
35067 @item -mauto-litpools
35068 @itemx -mno-auto-litpools
35069 These options control the treatment of literal pools.  The default is
35070 @option{-mno-auto-litpools}, which places literals in a separate
35071 section in the output file unless @option{-mtext-section-literals} is
35072 used.  With @option{-mauto-litpools} the literals are interspersed in
35073 the text section by the assembler.  Compiler does not produce explicit
35074 @code{.literal} directives and loads literals into registers with
35075 @code{MOVI} instructions instead of @code{L32R} to let the assembler
35076 do relaxation and place literals as necessary.  This option allows
35077 assembler to create several literal pools per function and assemble
35078 very big functions, which may not be possible with
35079 @option{-mtext-section-literals}.
35081 @opindex mtarget-align
35082 @opindex mno-target-align
35083 @item -mtarget-align
35084 @itemx -mno-target-align
35085 When this option is enabled, GCC instructs the assembler to
35086 automatically align instructions to reduce branch penalties at the
35087 expense of some code density.  The assembler attempts to widen density
35088 instructions to align branch targets and the instructions following call
35089 instructions.  If there are not enough preceding safe density
35090 instructions to align a target, no widening is performed.  The
35091 default is @option{-mtarget-align}.  These options do not affect the
35092 treatment of auto-aligned instructions like @code{LOOP}, which the
35093 assembler always aligns, either by widening density instructions or
35094 by inserting NOP instructions.
35096 @opindex mlongcalls
35097 @opindex mno-longcalls
35098 @item -mlongcalls
35099 @itemx -mno-longcalls
35100 When this option is enabled, GCC instructs the assembler to translate
35101 direct calls to indirect calls unless it can determine that the target
35102 of a direct call is in the range allowed by the call instruction.  This
35103 translation typically occurs for calls to functions in other source
35104 files.  Specifically, the assembler translates a direct @code{CALL}
35105 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
35106 The default is @option{-mno-longcalls}.  This option should be used in
35107 programs where the call target can potentially be out of range.  This
35108 option is implemented in the assembler, not the compiler, so the
35109 assembly code generated by GCC still shows direct call
35110 instructions---look at the disassembled object code to see the actual
35111 instructions.  Note that the assembler uses an indirect call for
35112 every cross-file call, not just those that really are out of range.
35114 @opindex mabi
35115 @item -mabi=@var{name}
35116 Generate code for the specified ABI@.  Permissible values are: @samp{call0},
35117 @samp{windowed}.  Default ABI is chosen by the Xtensa core configuration.
35119 @opindex mabi=call0
35120 @item -mabi=call0
35121 When this option is enabled function parameters are passed in registers
35122 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
35123 caller-saved, and register @code{a15} may be used as a frame pointer.
35124 When this version of the ABI is enabled the C preprocessor symbol
35125 @code{__XTENSA_CALL0_ABI__} is defined.
35127 @opindex mabi=windowed
35128 @item -mabi=windowed
35129 When this option is enabled function parameters are passed in registers
35130 @code{a10} through @code{a15}, and called function rotates register window
35131 by 8 registers on entry so that its arguments are found in registers
35132 @code{a2} through @code{a7}.  Register @code{a7} may be used as a frame
35133 pointer.  Register window is rotated 8 registers back upon return.
35134 When this version of the ABI is enabled the C preprocessor symbol
35135 @code{__XTENSA_WINDOWED_ABI__} is defined.
35137 @opindex mextra-l32r-costs
35138 @item -mextra-l32r-costs=@var{n}
35139 Specify an extra cost of instruction RAM/ROM access for @code{L32R}
35140 instructions, in clock cycles.  This affects, when optimizing for speed,
35141 whether loading a constant from literal pool using @code{L32R} or
35142 synthesizing the constant from a small one with a couple of arithmetic
35143 instructions.  The default value is 0.
35145 @opindex mstrict-align
35146 @opindex mno-strict-align
35147 @item -mstrict-align
35148 @itemx -mno-strict-align
35149 Avoid or allow generating memory accesses that may not be aligned on a natural
35150 object boundary as described in the architecture specification.
35151 The default is @option{-mno-strict-align} for cores that support both
35152 unaligned loads and stores in hardware and @option{-mstrict-align} for all
35153 other cores.
35155 @end table
35157 @node zSeries Options
35158 @subsection zSeries Options
35159 @cindex zSeries options
35161 These are listed under @xref{S/390 and zSeries Options}.
35164 @c man end
35166 @node Spec Files
35167 @section Specifying Subprocesses and the Switches to Pass to Them
35168 @cindex Spec Files
35170 @command{gcc} is a driver program.  It performs its job by invoking a
35171 sequence of other programs to do the work of compiling, assembling and
35172 linking.  GCC interprets its command-line parameters and uses these to
35173 deduce which programs it should invoke, and which command-line options
35174 it ought to place on their command lines.  This behavior is controlled
35175 by @dfn{spec strings}.  In most cases there is one spec string for each
35176 program that GCC can invoke, but a few programs have multiple spec
35177 strings to control their behavior.  The spec strings built into GCC can
35178 be overridden by using the @option{-specs=} command-line switch to specify
35179 a spec file.
35181 @dfn{Spec files} are plain-text files that are used to construct spec
35182 strings.  They consist of a sequence of directives separated by blank
35183 lines.  The type of directive is determined by the first non-whitespace
35184 character on the line, which can be one of the following:
35186 @table @code
35187 @item %@var{command}
35188 Issues a @var{command} to the spec file processor.  The commands that can
35189 appear here are:
35191 @table @code
35192 @cindex @code{%include}
35193 @item %include <@var{file}>
35194 Search for @var{file} and insert its text at the current point in the
35195 specs file.
35197 @cindex @code{%include_noerr}
35198 @item %include_noerr <@var{file}>
35199 Just like @samp{%include}, but do not generate an error message if the include
35200 file cannot be found.
35202 @cindex @code{%rename}
35203 @item %rename @var{old_name} @var{new_name}
35204 Rename the spec string @var{old_name} to @var{new_name}.
35206 @end table
35208 @item *[@var{spec_name}]:
35209 This tells the compiler to create, override or delete the named spec
35210 string.  All lines after this directive up to the next directive or
35211 blank line are considered to be the text for the spec string.  If this
35212 results in an empty string then the spec is deleted.  (Or, if the
35213 spec did not exist, then nothing happens.)  Otherwise, if the spec
35214 does not currently exist a new spec is created.  If the spec does
35215 exist then its contents are overridden by the text of this
35216 directive, unless the first character of that text is the @samp{+}
35217 character, in which case the text is appended to the spec.
35219 @item [@var{suffix}]:
35220 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
35221 and up to the next directive or blank line are considered to make up the
35222 spec string for the indicated suffix.  When the compiler encounters an
35223 input file with the named suffix, it processes the spec string in
35224 order to work out how to compile that file.  For example:
35226 @smallexample
35227 .ZZ:
35228 z-compile -input %i
35229 @end smallexample
35231 This says that any input file whose name ends in @samp{.ZZ} should be
35232 passed to the program @samp{z-compile}, which should be invoked with the
35233 command-line switch @option{-input} and with the result of performing the
35234 @samp{%i} substitution.  (See below.)
35236 As an alternative to providing a spec string, the text following a
35237 suffix directive can be one of the following:
35239 @table @code
35240 @item @@@var{language}
35241 This says that the suffix is an alias for a known @var{language}.  This is
35242 similar to using the @option{-x} command-line switch to GCC to specify a
35243 language explicitly.  For example:
35245 @smallexample
35246 .ZZ:
35247 @@c++
35248 @end smallexample
35250 Says that .ZZ files are, in fact, C++ source files.
35252 @item #@var{name}
35253 This causes an error messages saying:
35255 @smallexample
35256 @var{name} compiler not installed on this system.
35257 @end smallexample
35258 @end table
35260 GCC already has an extensive list of suffixes built into it.
35261 This directive adds an entry to the end of the list of suffixes, but
35262 since the list is searched from the end backwards, it is effectively
35263 possible to override earlier entries using this technique.
35265 @end table
35267 GCC has the following spec strings built into it.  Spec files can
35268 override these strings or create their own.  Note that individual
35269 targets can also add their own spec strings to this list.
35271 @smallexample
35272 asm          Options to pass to the assembler
35273 asm_final    Options to pass to the assembler post-processor
35274 cpp          Options to pass to the C preprocessor
35275 cc1          Options to pass to the C compiler
35276 cc1plus      Options to pass to the C++ compiler
35277 endfile      Object files to include at the end of the link
35278 link         Options to pass to the linker
35279 lib          Libraries to include on the command line to the linker
35280 libgcc       Decides which GCC support library to pass to the linker
35281 linker       Sets the name of the linker
35282 predefines   Defines to be passed to the C preprocessor
35283 signed_char  Defines to pass to CPP to say whether @code{char} is signed
35284              by default
35285 startfile    Object files to include at the start of the link
35286 @end smallexample
35288 Here is a small example of a spec file:
35290 @smallexample
35291 %rename lib                 old_lib
35293 *lib:
35294 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
35295 @end smallexample
35297 This example renames the spec called @samp{lib} to @samp{old_lib} and
35298 then overrides the previous definition of @samp{lib} with a new one.
35299 The new definition adds in some extra command-line options before
35300 including the text of the old definition.
35302 @dfn{Spec strings} are a list of command-line options to be passed to their
35303 corresponding program.  In addition, the spec strings can contain
35304 @samp{%}-prefixed sequences to substitute variable text or to
35305 conditionally insert text into the command line.  Using these constructs
35306 it is possible to generate quite complex command lines.
35308 Here is a table of all defined @samp{%}-sequences for spec
35309 strings.  Note that spaces are not generated automatically around the
35310 results of expanding these sequences.  Therefore you can concatenate them
35311 together or combine them with constant text in a single argument.
35313 @table @code
35314 @item %%
35315 Substitute one @samp{%} into the program name or argument.
35317 @item %"
35318 Substitute an empty argument.
35320 @item %i
35321 Substitute the name of the input file being processed.
35323 @item %b
35324 Substitute the basename for outputs related with the input file being
35325 processed.  This is often the substring up to (and not including) the
35326 last period and not including the directory but, unless %w is active, it
35327 expands to the basename for auxiliary outputs, which may be influenced
35328 by an explicit output name, and by various other options that control
35329 how auxiliary outputs are named.
35331 @item %B
35332 This is the same as @samp{%b}, but include the file suffix (text after
35333 the last period).  Without %w, it expands to the basename for dump
35334 outputs.
35336 @item %d
35337 Marks the argument containing or following the @samp{%d} as a
35338 temporary file name, so that that file is deleted if GCC exits
35339 successfully.  Unlike @samp{%g}, this contributes no text to the
35340 argument.
35342 @item %g@var{suffix}
35343 Substitute a file name that has suffix @var{suffix} and is chosen
35344 once per compilation, and mark the argument in the same way as
35345 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
35346 name is now chosen in a way that is hard to predict even when previously
35347 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
35348 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
35349 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
35350 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
35351 was simply substituted with a file name chosen once per compilation,
35352 without regard to any appended suffix (which was therefore treated
35353 just like ordinary text), making such attacks more likely to succeed.
35355 @item %u@var{suffix}
35356 Like @samp{%g}, but generates a new temporary file name
35357 each time it appears instead of once per compilation.
35359 @item %U@var{suffix}
35360 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
35361 new one if there is no such last file name.  In the absence of any
35362 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
35363 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
35364 involves the generation of two distinct file names, one
35365 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
35366 simply substituted with a file name chosen for the previous @samp{%u},
35367 without regard to any appended suffix.
35369 @item %j@var{suffix}
35370 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
35371 writable, and if @option{-save-temps} is not used; 
35372 otherwise, substitute the name
35373 of a temporary file, just like @samp{%u}.  This temporary file is not
35374 meant for communication between processes, but rather as a junk
35375 disposal mechanism.
35377 @item %|@var{suffix}
35378 @itemx %m@var{suffix}
35379 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
35380 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
35381 all.  These are the two most common ways to instruct a program that it
35382 should read from standard input or write to standard output.  If you
35383 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
35384 construct: see for example @file{gcc/fortran/lang-specs.h}.
35386 @item %.@var{SUFFIX}
35387 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
35388 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
35389 terminated by the next space or %.
35391 @item %w
35392 Marks the argument containing or following the @samp{%w} as the
35393 designated output file of this compilation.  This puts the argument
35394 into the sequence of arguments that @samp{%o} substitutes.
35396 @item %V
35397 Indicates that this compilation produces no output file.
35399 @item %o
35400 Substitutes the names of all the output files, with spaces
35401 automatically placed around them.  You should write spaces
35402 around the @samp{%o} as well or the results are undefined.
35403 @samp{%o} is for use in the specs for running the linker.
35404 Input files whose names have no recognized suffix are not compiled
35405 at all, but they are included among the output files, so they are
35406 linked.
35408 @item %O
35409 Substitutes the suffix for object files.  Note that this is
35410 handled specially when it immediately follows @samp{%g, %u, or %U},
35411 because of the need for those to form complete file names.  The
35412 handling is such that @samp{%O} is treated exactly as if it had already
35413 been substituted, except that @samp{%g, %u, and %U} do not currently
35414 support additional @var{suffix} characters following @samp{%O} as they do
35415 following, for example, @samp{.o}.
35417 @item %I
35418 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
35419 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
35420 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
35421 and @option{-imultilib} as necessary.
35423 @item %s
35424 Current argument is the name of a library or startup file of some sort.
35425 Search for that file in a standard list of directories and substitute
35426 the full name found.  The current working directory is included in the
35427 list of directories scanned.
35429 @item %T
35430 Current argument is the name of a linker script.  Search for that file
35431 in the current list of directories to scan for libraries. If the file
35432 is located insert a @option{--script} option into the command line
35433 followed by the full path name found.  If the file is not found then
35434 generate an error message.  Note: the current working directory is not
35435 searched.
35437 @item %e@var{str}
35438 Print @var{str} as an error message.  @var{str} is terminated by a newline.
35439 Use this when inconsistent options are detected.
35441 @item %n@var{str}
35442 Print @var{str} as a notice.  @var{str} is terminated by a newline.
35444 @item %(@var{name})
35445 Substitute the contents of spec string @var{name} at this point.
35447 @item %x@{@var{option}@}
35448 Accumulate an option for @samp{%X}.
35450 @item %X
35451 Output the accumulated linker options specified by a @samp{%x} spec string.
35453 @item %Y
35454 Output the accumulated assembler options specified by @option{-Wa}.
35456 @item %Z
35457 Output the accumulated preprocessor options specified by @option{-Wp}.
35459 @item %M
35460 Output @code{multilib_os_dir}.
35462 @item %R
35463 Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
35465 @item %a
35466 Process the @code{asm} spec.  This is used to compute the
35467 switches to be passed to the assembler.
35469 @item %A
35470 Process the @code{asm_final} spec.  This is a spec string for
35471 passing switches to an assembler post-processor, if such a program is
35472 needed.
35474 @item %l
35475 Process the @code{link} spec.  This is the spec for computing the
35476 command line passed to the linker.  Typically it makes use of the
35477 @samp{%L %G %S %D and %E} sequences.
35479 @item %D
35480 Dump out a @option{-L} option for each directory that GCC believes might
35481 contain startup files.  If the target supports multilibs then the
35482 current multilib directory is prepended to each of these paths.
35484 @item %L
35485 Process the @code{lib} spec.  This is a spec string for deciding which
35486 libraries are included on the command line to the linker.
35488 @item %G
35489 Process the @code{libgcc} spec.  This is a spec string for deciding
35490 which GCC support library is included on the command line to the linker.
35492 @item %S
35493 Process the @code{startfile} spec.  This is a spec for deciding which
35494 object files are the first ones passed to the linker.  Typically
35495 this might be a file named @file{crt0.o}.
35497 @item %E
35498 Process the @code{endfile} spec.  This is a spec string that specifies
35499 the last object files that are passed to the linker.
35501 @item %C
35502 Process the @code{cpp} spec.  This is used to construct the arguments
35503 to be passed to the C preprocessor.
35505 @item %1
35506 Process the @code{cc1} spec.  This is used to construct the options to be
35507 passed to the actual C compiler (@command{cc1}).
35509 @item %2
35510 Process the @code{cc1plus} spec.  This is used to construct the options to be
35511 passed to the actual C++ compiler (@command{cc1plus}).
35513 @item %*
35514 Substitute the variable part of a matched option.  See below.
35515 Note that each comma in the substituted string is replaced by
35516 a single space.
35518 @item %<S
35519 Remove all occurrences of @code{-S} from the command line.  Note---this
35520 command is position dependent.  @samp{%} commands in the spec string
35521 before this one see @code{-S}, @samp{%} commands in the spec string
35522 after this one do not.
35524 @item %<S*
35525 Similar to @samp{%<S}, but match all switches beginning with @code{-S}.
35527 @item %>S
35528 Similar to @samp{%<S}, but keep @code{-S} in the GCC command line.
35530 @item %:@var{function}(@var{args})
35531 Call the named function @var{function}, passing it @var{args}.
35532 @var{args} is first processed as a nested spec string, then split
35533 into an argument vector in the usual fashion.  The function returns
35534 a string which is processed as if it had appeared literally as part
35535 of the current spec.
35537 The following built-in spec functions are provided:
35539 @table @code
35540 @item @code{getenv}
35541 The @code{getenv} spec function takes two arguments: an environment
35542 variable name and a string.  If the environment variable is not
35543 defined, a fatal error is issued.  Otherwise, the return value is the
35544 value of the environment variable concatenated with the string.  For
35545 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
35547 @smallexample
35548 %:getenv(TOPDIR /include)
35549 @end smallexample
35551 expands to @file{/path/to/top/include}.
35553 @item @code{if-exists}
35554 The @code{if-exists} spec function takes one argument, an absolute
35555 pathname to a file.  If the file exists, @code{if-exists} returns the
35556 pathname.  Here is a small example of its usage:
35558 @smallexample
35559 *startfile:
35560 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
35561 @end smallexample
35563 @item @code{if-exists-else}
35564 The @code{if-exists-else} spec function is similar to the @code{if-exists}
35565 spec function, except that it takes two arguments.  The first argument is
35566 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
35567 returns the pathname.  If it does not exist, it returns the second argument.
35568 This way, @code{if-exists-else} can be used to select one file or another,
35569 based on the existence of the first.  Here is a small example of its usage:
35571 @smallexample
35572 *startfile:
35573 crt0%O%s %:if-exists(crti%O%s) \
35574 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
35575 @end smallexample
35577 @item @code{if-exists-then-else}
35578 The @code{if-exists-then-else} spec function takes at least two arguments
35579 and an optional third one. The first argument is an absolute pathname to a
35580 file.  If the file exists, the function returns the second argument.
35581 If the file does not exist, the function returns the third argument if there
35582 is one, or NULL otherwise. This can be used to expand one text, or optionally
35583 another, based on the existence of a file.  Here is a small example of its
35584 usage:
35586 @smallexample
35587 -l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
35588 @end smallexample
35590 @item @code{sanitize}
35591 The @code{sanitize} spec function takes no arguments.  It returns non-NULL if
35592 any address, thread or undefined behavior sanitizers are active.
35594 @smallexample
35595 %@{%:sanitize(address):-funwind-tables@}
35596 @end smallexample
35598 @item @code{replace-outfile}
35599 The @code{replace-outfile} spec function takes two arguments.  It looks for the
35600 first argument in the outfiles array and replaces it with the second argument.  Here
35601 is a small example of its usage:
35603 @smallexample
35604 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
35605 @end smallexample
35607 @item @code{remove-outfile}
35608 The @code{remove-outfile} spec function takes one argument.  It looks for the
35609 first argument in the outfiles array and removes it.  Here is a small example
35610 its usage:
35612 @smallexample
35613 %:remove-outfile(-lm)
35614 @end smallexample
35616 @item @code{version-compare}
35617 The @code{version-compare} spec function takes four or five arguments of the following
35618 form:
35620 @smallexample
35621 <comparison-op> <arg1> [<arg2>] <switch> <result>
35622 @end smallexample
35624 It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
35625 The supported @code{comparison-op} values are:
35627 @table @code
35628 @item >=
35629 True if @code{switch} is a later (or same) version than @code{arg1}
35631 @item !>
35632 Opposite of @code{>=}
35634 @item <
35635 True if @code{switch} is an earlier version than @code{arg1}
35637 @item !<
35638 Opposite of @code{<}
35640 @item ><
35641 True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
35643 @item <>
35644 True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
35645 @end table
35647 If the @code{switch} is not present at all, the condition is false unless the first character
35648 of the @code{comparison-op} is @code{!}.
35650 @smallexample
35651 %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
35652 @end smallexample
35654 The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
35655 passed.
35657 @item @code{include}
35658 The @code{include} spec function behaves much like @code{%include}, with the advantage
35659 that it can be nested inside a spec and thus be conditionalized.  It takes one argument,
35660 the filename, and looks for it in the startfile path.  It always returns NULL.
35662 @smallexample
35663 %@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
35664 @end smallexample
35666 @item @code{pass-through-libs}
35667 The @code{pass-through-libs} spec function takes any number of arguments.  It
35668 finds any @option{-l} options and any non-options ending in @file{.a} (which it
35669 assumes are the names of linker input library archive files) and returns a
35670 result containing all the found arguments each prepended by
35671 @option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
35672 intended to be passed to the LTO linker plugin.
35674 @smallexample
35675 %:pass-through-libs(%G %L %G)
35676 @end smallexample
35678 @item @code{print-asm-header}
35679 The @code{print-asm-header} function takes no arguments and simply
35680 prints a banner like:
35682 @smallexample
35683 Assembler options
35684 =================
35686 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
35687 @end smallexample
35689 It is used to separate compiler options from assembler options
35690 in the @option{--target-help} output.
35692 @item @code{gt}
35693 The @code{gt} spec function takes two or more arguments.  It returns @code{""} (the
35694 empty string) if the second-to-last argument is greater than the last argument, and NULL
35695 otherwise.  The following example inserts the @code{link_gomp} spec if the last
35696 @option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
35698 @smallexample
35699 %@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
35700 @end smallexample
35702 @item @code{debug-level-gt}
35703 The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
35704 empty string) if @code{debug_info_level} is greater than the specified number, and NULL
35705 otherwise.
35707 @smallexample
35708 %@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
35709 @end smallexample
35710 @end table
35712 @item %@{S@}
35713 Substitutes the @code{-S} switch, if that switch is given to GCC@.
35714 If that switch is not specified, this substitutes nothing.  Note that
35715 the leading dash is omitted when specifying this option, and it is
35716 automatically inserted if the substitution is performed.  Thus the spec
35717 string @samp{%@{foo@}} matches the command-line option @option{-foo}
35718 and outputs the command-line option @option{-foo}.
35720 @item %W@{S@}
35721 Like %@{@code{S}@} but mark last argument supplied within as a file to be
35722 deleted on failure.
35724 @item %@@@{S@}
35725 Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes
35726 @code{@@FILE} if an @code{@@file} argument has been supplied.
35728 @item %@{S*@}
35729 Substitutes all the switches specified to GCC whose names start
35730 with @code{-S}, but which also take an argument.  This is used for
35731 switches like @option{-o}, @option{-D}, @option{-I}, etc.
35732 GCC considers @option{-o foo} as being
35733 one switch whose name starts with @samp{o}.  %@{o*@} substitutes this
35734 text, including the space.  Thus two arguments are generated.
35736 @item %@{S*&T*@}
35737 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
35738 (the order of @code{S} and @code{T} in the spec is not significant).
35739 There can be any number of ampersand-separated variables; for each the
35740 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
35742 @item %@{S:X@}
35743 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
35745 @item %@{!S:X@}
35746 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
35748 @item %@{S*:X@}
35749 Substitutes @code{X} if one or more switches whose names start with
35750 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
35751 once, no matter how many such switches appeared.  However, if @code{%*}
35752 appears somewhere in @code{X}, then @code{X} is substituted once
35753 for each matching switch, with the @code{%*} replaced by the part of
35754 that switch matching the @code{*}.
35756 If @code{%*} appears as the last part of a spec sequence then a space
35757 is added after the end of the last substitution.  If there is more
35758 text in the sequence, however, then a space is not generated.  This
35759 allows the @code{%*} substitution to be used as part of a larger
35760 string.  For example, a spec string like this:
35762 @smallexample
35763 %@{mcu=*:--script=%*/memory.ld@}
35764 @end smallexample
35766 @noindent
35767 when matching an option like @option{-mcu=newchip} produces:
35769 @smallexample
35770 --script=newchip/memory.ld
35771 @end smallexample
35773 @item %@{.S:X@}
35774 Substitutes @code{X}, if processing a file with suffix @code{S}.
35776 @item %@{!.S:X@}
35777 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
35779 @item %@{,S:X@}
35780 Substitutes @code{X}, if processing a file for language @code{S}.
35782 @item %@{!,S:X@}
35783 Substitutes @code{X}, if not processing a file for language @code{S}.
35785 @item %@{S|P:X@}
35786 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
35787 GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
35788 @code{*} sequences as well, although they have a stronger binding than
35789 the @samp{|}.  If @code{%*} appears in @code{X}, all of the
35790 alternatives must be starred, and only the first matching alternative
35791 is substituted.
35793 For example, a spec string like this:
35795 @smallexample
35796 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
35797 @end smallexample
35799 @noindent
35800 outputs the following command-line options from the following input
35801 command-line options:
35803 @smallexample
35804 fred.c        -foo -baz
35805 jim.d         -bar -boggle
35806 -d fred.c     -foo -baz -boggle
35807 -d jim.d      -bar -baz -boggle
35808 @end smallexample
35810 @item %@{%:@var{function}(@var{args}):X@}
35812 Call function named @var{function} with args @var{args}.  If the
35813 function returns non-NULL, then @code{X} is substituted, if it returns
35814 NULL, it isn't substituted.
35816 @item %@{S:X; T:Y; :D@}
35818 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
35819 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
35820 be as many clauses as you need.  This may be combined with @code{.},
35821 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
35824 @end table
35826 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
35827 or similar construct can use a backslash to ignore the special meaning
35828 of the character following it, thus allowing literal matching of a
35829 character that is otherwise specially treated.  For example,
35830 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
35831 @option{-std=iso9899:1999} option is given.
35833 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
35834 construct may contain other nested @samp{%} constructs or spaces, or
35835 even newlines.  They are processed as usual, as described above.
35836 Trailing white space in @code{X} is ignored.  White space may also
35837 appear anywhere on the left side of the colon in these constructs,
35838 except between @code{.} or @code{*} and the corresponding word.
35840 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
35841 handled specifically in these constructs.  If another value of
35842 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
35843 @option{-W} switch is found later in the command line, the earlier
35844 switch value is ignored, except with @{@code{S}*@} where @code{S} is
35845 just one letter, which passes all matching options.
35847 The character @samp{|} at the beginning of the predicate text is used to
35848 indicate that a command should be piped to the following command, but
35849 only if @option{-pipe} is specified.
35851 It is built into GCC which switches take arguments and which do not.
35852 (You might think it would be useful to generalize this to allow each
35853 compiler's spec to say which switches take arguments.  But this cannot
35854 be done in a consistent fashion.  GCC cannot even decide which input
35855 files have been specified without knowing which switches take arguments,
35856 and it must know which input files to compile in order to tell which
35857 compilers to run).
35859 GCC also knows implicitly that arguments starting in @option{-l} are to be
35860 treated as compiler output files, and passed to the linker in their
35861 proper position among the other output files.
35863 @node Environment Variables
35864 @section Environment Variables Affecting GCC
35865 @cindex environment variables
35867 @c man begin ENVIRONMENT
35868 This section describes several environment variables that affect how GCC
35869 operates.  Some of them work by specifying directories or prefixes to use
35870 when searching for various kinds of files.  Some are used to specify other
35871 aspects of the compilation environment.
35873 Note that you can also specify places to search using options such as
35874 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
35875 take precedence over places specified using environment variables, which
35876 in turn take precedence over those specified by the configuration of GCC@.
35877 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
35878 GNU Compiler Collection (GCC) Internals}.
35880 @table @env
35881 @vindex LANG
35882 @vindex LC_CTYPE
35883 @c @vindex LC_COLLATE
35884 @vindex LC_MESSAGES
35885 @c @vindex LC_MONETARY
35886 @c @vindex LC_NUMERIC
35887 @c @vindex LC_TIME
35888 @vindex LC_ALL
35889 @cindex locale
35890 @item LANG
35891 @itemx LC_CTYPE
35892 @c @itemx LC_COLLATE
35893 @itemx LC_MESSAGES
35894 @c @itemx LC_MONETARY
35895 @c @itemx LC_NUMERIC
35896 @c @itemx LC_TIME
35897 @itemx LC_ALL
35898 These environment variables control the way that GCC uses
35899 localization information which allows GCC to work with different
35900 national conventions.  GCC inspects the locale categories
35901 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
35902 so.  These locale categories can be set to any value supported by your
35903 installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
35904 Kingdom encoded in UTF-8.
35906 The @env{LC_CTYPE} environment variable specifies character
35907 classification.  GCC uses it to determine the character boundaries in
35908 a string; this is needed for some multibyte encodings that contain quote
35909 and escape characters that are otherwise interpreted as a string
35910 end or escape.
35912 The @env{LC_MESSAGES} environment variable specifies the language to
35913 use in diagnostic messages.
35915 If the @env{LC_ALL} environment variable is set, it overrides the value
35916 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
35917 and @env{LC_MESSAGES} default to the value of the @env{LANG}
35918 environment variable.  If none of these variables are set, GCC
35919 defaults to traditional C English behavior.
35921 @vindex TMPDIR
35922 @item TMPDIR
35923 If @env{TMPDIR} is set, it specifies the directory to use for temporary
35924 files.  GCC uses temporary files to hold the output of one stage of
35925 compilation which is to be used as input to the next stage: for example,
35926 the output of the preprocessor, which is the input to the compiler
35927 proper.
35929 @vindex GCC_COMPARE_DEBUG
35930 @item GCC_COMPARE_DEBUG
35931 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
35932 @option{-fcompare-debug} to the compiler driver.  See the documentation
35933 of this option for more details.
35935 @vindex GCC_EXEC_PREFIX
35936 @item GCC_EXEC_PREFIX
35937 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
35938 names of the subprograms executed by the compiler.  No slash is added
35939 when this prefix is combined with the name of a subprogram, but you can
35940 specify a prefix that ends with a slash if you wish.
35942 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
35943 an appropriate prefix to use based on the pathname it is invoked with.
35945 If GCC cannot find the subprogram using the specified prefix, it
35946 tries looking in the usual places for the subprogram.
35948 The default value of @env{GCC_EXEC_PREFIX} is
35949 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
35950 the installed compiler. In many cases @var{prefix} is the value
35951 of @code{prefix} when you ran the @file{configure} script.
35953 Other prefixes specified with @option{-B} take precedence over this prefix.
35955 This prefix is also used for finding files such as @file{crt0.o} that are
35956 used for linking.
35958 In addition, the prefix is used in an unusual way in finding the
35959 directories to search for header files.  For each of the standard
35960 directories whose name normally begins with @samp{/usr/local/lib/gcc}
35961 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
35962 replacing that beginning with the specified prefix to produce an
35963 alternate directory name.  Thus, with @option{-Bfoo/}, GCC searches
35964 @file{foo/bar} just before it searches the standard directory 
35965 @file{/usr/local/lib/bar}.
35966 If a standard directory begins with the configured
35967 @var{prefix} then the value of @var{prefix} is replaced by
35968 @env{GCC_EXEC_PREFIX} when looking for header files.
35970 @vindex COMPILER_PATH
35971 @item COMPILER_PATH
35972 The value of @env{COMPILER_PATH} is a colon-separated list of
35973 directories, much like @env{PATH}.  GCC tries the directories thus
35974 specified when searching for subprograms, if it cannot find the
35975 subprograms using @env{GCC_EXEC_PREFIX}.
35977 @vindex LIBRARY_PATH
35978 @item LIBRARY_PATH
35979 The value of @env{LIBRARY_PATH} is a colon-separated list of
35980 directories, much like @env{PATH}.  When configured as a native compiler,
35981 GCC tries the directories thus specified when searching for special
35982 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}.  Linking
35983 using GCC also uses these directories when searching for ordinary
35984 libraries for the @option{-l} option (but directories specified with
35985 @option{-L} come first).
35987 @vindex LANG
35988 @cindex locale definition
35989 @item LANG
35990 This variable is used to pass locale information to the compiler.  One way in
35991 which this information is used is to determine the character set to be used
35992 when character literals, string literals and comments are parsed in C and C++.
35993 When the compiler is configured to allow multibyte characters,
35994 the following values for @env{LANG} are recognized:
35996 @table @samp
35997 @item C-JIS
35998 Recognize JIS characters.
35999 @item C-SJIS
36000 Recognize SJIS characters.
36001 @item C-EUCJP
36002 Recognize EUCJP characters.
36003 @end table
36005 If @env{LANG} is not defined, or if it has some other value, then the
36006 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
36007 recognize and translate multibyte characters.
36009 @vindex GCC_EXTRA_DIAGNOSTIC_OUTPUT
36010 @item GCC_EXTRA_DIAGNOSTIC_OUTPUT
36011 If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
36012 then additional text will be emitted to stderr when fix-it hints are
36013 emitted.  @option{-fdiagnostics-parseable-fixits} and
36014 @option{-fno-diagnostics-parseable-fixits} take precedence over this
36015 environment variable.
36017 @table @samp
36018 @item fixits-v1
36019 Emit parseable fix-it hints, equivalent to
36020 @option{-fdiagnostics-parseable-fixits}.  In particular, columns are
36021 expressed as a count of bytes, starting at byte 1 for the initial column.
36023 @item fixits-v2
36024 As @code{fixits-v1}, but columns are expressed as display columns,
36025 as per @option{-fdiagnostics-column-unit=display}.
36026 @end table
36028 @end table
36030 @noindent
36031 Some additional environment variables affect the behavior of the
36032 preprocessor.
36034 @include cppenv.texi
36036 @c man end
36038 @node Precompiled Headers
36039 @section Using Precompiled Headers
36040 @cindex precompiled headers
36041 @cindex speed of compilation
36043 Often large projects have many header files that are included in every
36044 source file.  The time the compiler takes to process these header files
36045 over and over again can account for nearly all of the time required to
36046 build the project.  To make builds faster, GCC allows you to
36047 @dfn{precompile} a header file.
36049 To create a precompiled header file, simply compile it as you would any
36050 other file, if necessary using the @option{-x} option to make the driver
36051 treat it as a C or C++ header file.  You may want to use a
36052 tool like @command{make} to keep the precompiled header up-to-date when
36053 the headers it contains change.
36055 A precompiled header file is searched for when @code{#include} is
36056 seen in the compilation.  As it searches for the included file
36057 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
36058 compiler looks for a precompiled header in each directory just before it
36059 looks for the include file in that directory.  The name searched for is
36060 the name specified in the @code{#include} with @samp{.gch} appended.  If
36061 the precompiled header file cannot be used, it is ignored.
36063 For instance, if you have @code{#include "all.h"}, and you have
36064 @file{all.h.gch} in the same directory as @file{all.h}, then the
36065 precompiled header file is used if possible, and the original
36066 header is used otherwise.
36068 Alternatively, you might decide to put the precompiled header file in a
36069 directory and use @option{-I} to ensure that directory is searched
36070 before (or instead of) the directory containing the original header.
36071 Then, if you want to check that the precompiled header file is always
36072 used, you can put a file of the same name as the original header in this
36073 directory containing an @code{#error} command.
36075 This also works with @option{-include}.  So yet another way to use
36076 precompiled headers, good for projects not designed with precompiled
36077 header files in mind, is to simply take most of the header files used by
36078 a project, include them from another header file, precompile that header
36079 file, and @option{-include} the precompiled header.  If the header files
36080 have guards against multiple inclusion, they are skipped because
36081 they've already been included (in the precompiled header).
36083 If you need to precompile the same header file for different
36084 languages, targets, or compiler options, you can instead make a
36085 @emph{directory} named like @file{all.h.gch}, and put each precompiled
36086 header in the directory, perhaps using @option{-o}.  It doesn't matter
36087 what you call the files in the directory; every precompiled header in
36088 the directory is considered.  The first precompiled header
36089 encountered in the directory that is valid for this compilation is
36090 used; they're searched in no particular order.
36092 There are many other possibilities, limited only by your imagination,
36093 good sense, and the constraints of your build system.
36095 A precompiled header file can be used only when these conditions apply:
36097 @itemize
36098 @item
36099 Only one precompiled header can be used in a particular compilation.
36101 @item
36102 A precompiled header cannot be used once the first C token is seen.  You
36103 can have preprocessor directives before a precompiled header; you cannot
36104 include a precompiled header from inside another header.
36106 @item
36107 The precompiled header file must be produced for the same language as
36108 the current compilation.  You cannot use a C precompiled header for a C++
36109 compilation.
36111 @item
36112 The precompiled header file must have been produced by the same compiler
36113 binary as the current compilation is using.
36115 @item
36116 Any macros defined before the precompiled header is included must
36117 either be defined in the same way as when the precompiled header was
36118 generated, or must not affect the precompiled header, which usually
36119 means that they don't appear in the precompiled header at all.
36121 The @option{-D} option is one way to define a macro before a
36122 precompiled header is included; using a @code{#define} can also do it.
36123 There are also some options that define macros implicitly, like
36124 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
36125 defined this way.
36127 @item If debugging information is output when using the precompiled
36128 header, using @option{-g} or similar, the same kind of debugging information
36129 must have been output when building the precompiled header.  However,
36130 a precompiled header built using @option{-g} can be used in a compilation
36131 when no debugging information is being output.
36133 @item The same @option{-m} options must generally be used when building
36134 and using the precompiled header.  @xref{Submodel Options},
36135 for any cases where this rule is relaxed.
36137 @item Each of the following options must be the same when building and using
36138 the precompiled header:
36140 @gccoptlist{-fexceptions}
36142 @item
36143 Some other command-line options starting with @option{-f},
36144 @option{-p}, or @option{-O} must be defined in the same way as when
36145 the precompiled header was generated.  At present, it's not clear
36146 which options are safe to change and which are not; the safest choice
36147 is to use exactly the same options when generating and using the
36148 precompiled header.  The following are known to be safe:
36150 @gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock
36151 -fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous
36152 -fsched-verbose=@var{number}  -fschedule-insns  -fvisibility=
36153 -pedantic-errors}
36155 @item Address space layout randomization (ASLR) can lead to not binary identical
36156 PCH files.  If you rely on stable PCH file contents disable ASLR when generating
36157 PCH files.
36159 @end itemize
36161 For all of these except the last, the compiler automatically
36162 ignores the precompiled header if the conditions aren't met.  If you
36163 find an option combination that doesn't work and doesn't cause the
36164 precompiled header to be ignored, please consider filing a bug report,
36165 see @ref{Bugs}.
36167 If you do use differing options when generating and using the
36168 precompiled header, the actual behavior is a mixture of the
36169 behavior for the options.  For instance, if you use @option{-g} to
36170 generate the precompiled header but not when using it, you may or may
36171 not get debugging information for routines in the precompiled header.
36173 @node C++ Modules
36174 @section C++ Modules
36175 @cindex speed of compilation
36177 Modules are a C++20 language feature.  As the name suggests, they
36178 provides a modular compilation system, intending to provide both
36179 faster builds and better library isolation.  The ``Merging Modules''
36180 paper @uref{https://wg21.link/p1103}, provides the easiest to read set
36181 of changes to the standard, although it does not capture later
36182 changes.
36184 @emph{G++'s modules support is not complete.}  Other than bugs, the
36185 known missing pieces are:
36187 @table @emph
36189 @item Private Module Fragment
36190 The Private Module Fragment is recognized, but an error is emitted.
36192 @item Partition definition visibility rules
36193 Entities may be defined in implementation partitions, and those
36194 definitions are not available outside of the module.  This is not
36195 implemented, and the definitions are available to extra-module use.
36197 @item Textual merging of reachable GM entities
36198 Entities may be multiply defined across different header-units.
36199 These must be de-duplicated, and this is implemented across imports,
36200 or when an import redefines a textually-defined entity.  However the
36201 reverse is not implemented---textually redefining an entity that has
36202 been defined in an imported header-unit.  A redefinition error is
36203 emitted.
36205 @item Translation-Unit local referencing rules
36206 Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
36207 (@uref{https://wg21.link/p2003}) add limitations on which entities an
36208 exported region may reference (for instance, the entities an exported
36209 template definition may reference).  These are not fully implemented.
36211 @item Standard Library Header Units
36212 The Standard Library is not provided as importable header units.  If
36213 you want to import such units, you must explicitly build them first.
36214 If you do not do this with care, you may have multiple declarations,
36215 which the module machinery must merge---compiler resource usage can be
36216 affected by how you partition header files into header units.
36218 @end table
36220 Modular compilation is @emph{not} enabled with just the
36221 @option{-std=c++20} option.  You must explicitly enable it with the
36222 @option{-fmodules-ts} option.  It is independent of the language
36223 version selected, although in pre-C++20 versions, it is of course an
36224 extension.
36226 No new source file suffixes are required or supported.  If you wish to
36227 use a non-standard suffix (@pxref{Overall Options}), you also need
36228 to provide a @option{-x c++} option too.@footnote{Some users like to
36229 distinguish module interface files with a new suffix, such as naming
36230 the source @code{module.cppm}, which involves
36231 teaching all tools about the new suffix.  A different scheme, such as
36232 naming @code{module-m.cpp} would be less invasive.}
36234 Compiling a module interface unit produces an additional output (to
36235 the assembly or object file), called a Compiled Module Interface
36236 (CMI).  This encodes the exported declarations of the module.
36237 Importing a module reads in the CMI.  The import graph is a Directed
36238 Acyclic Graph (DAG).  You must build imports before the importer.
36240 Header files may themselves be compiled to header units, which are a
36241 transitional ability aiming at faster compilation.  The
36242 @option{-fmodule-header} option is used to enable this, and implies
36243 the @option{-fmodules-ts} option.  These CMIs are named by the fully
36244 resolved underlying header file, and thus may be a complete pathname
36245 containing subdirectories.  If the header file is found at an absolute
36246 pathname, the CMI location is still relative to a CMI root directory.
36248 As header files often have no suffix, you commonly have to specify a
36249 @option{-x} option to tell the compiler the source is a header file.
36250 You may use @option{-x c++-header}, @option{-x c++-user-header} or
36251 @option{-x c++-system-header}.  When used in conjunction with
36252 @option{-fmodules-ts}, these all imply an appropriate
36253 @option{-fmodule-header} option.  The latter two variants use the
36254 user or system include path to search for the file specified.  This
36255 allows you to, for instance, compile standard library header files as
36256 header units, without needing to know exactly where they are
36257 installed.  Specifying the language as one of these variants also
36258 inhibits output of the object file, as header files have no associated
36259 object file.
36261 The @option{-fmodule-only} option disables generation of the
36262 associated object file for compiling a module interface.  Only the CMI
36263 is generated.  This option is implied when using the
36264 @option{-fmodule-header} option.
36266 The @option{-flang-info-include-translate} and
36267 @option{-flang-info-include-translate-not} options notes whether
36268 include translation occurs or not.  With no argument, the first will
36269 note all include translation.  The second will note all
36270 non-translations of include files not known to intentionally be
36271 textual.  With an argument, queries about include translation of a
36272 header files with that particular trailing pathname are noted.  You
36273 may repeat this form to cover several different header files.  This
36274 option may be helpful in determining whether include translation is
36275 happening---if it is working correctly, it behaves as if it isn't
36276 there at all.
36278 The @option{-flang-info-module-cmi} option can be used to determine
36279 where the compiler is reading a CMI from.  Without the option, the
36280 compiler is silent when such a read is successful.  This option has an
36281 optional argument, which will restrict the notification to just the
36282 set of named modules or header units specified.
36284 The @option{-Winvalid-imported-macros} option causes all imported macros
36285 to be resolved at the end of compilation.  Without this, imported
36286 macros are only resolved when expanded or (re)defined.  This option
36287 detects conflicting import definitions for all macros.
36289 For details of the @option{-fmodule-mapper} family of options,
36290 @pxref{C++ Module Mapper}.
36292 @menu
36293 * C++ Module Mapper::       Module Mapper
36294 * C++ Module Preprocessing::  Module Preprocessing
36295 * C++ Compiled Module Interface:: Compiled Module Interface
36296 @end menu
36298 @node C++ Module Mapper
36299 @subsection Module Mapper
36300 @cindex C++ Module Mapper
36302 A module mapper provides a server or file that the compiler queries to
36303 determine the mapping between module names and CMI files.  It is also
36304 used to build CMIs on demand.  @emph{Mapper functionality is in its
36305 infancy and is intended for experimentation with build system
36306 interactions.}
36308 You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
36309 option or @env{CXX_MODULE_MAPPER} environment variable.  The value may
36310 have one of the following forms:
36312 @table @gcctabopt
36314 @item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
36315 An optional hostname and a numeric port number to connect to.  If the
36316 hostname is omitted, the loopback address is used.  If the hostname
36317 corresponds to multiple IPV6 addresses, these are tried in turn, until
36318 one is successful.  If your host lacks IPv6, this form is
36319 non-functional.  If you must use IPv4 use
36320 @option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
36322 @item =@var{socket}@r{[}?@var{ident}@r{]}
36323 A local domain socket.  If your host lacks local domain sockets, this
36324 form is non-functional.
36326 @item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
36327 A program to spawn, and communicate with on its stdin/stdout streams.
36328 Your @var{PATH} environment variable is searched for the program.
36329 Arguments are separated by space characters, (it is not possible for
36330 one of the arguments delivered to the program to contain a space).  An
36331 exception is if @var{program} begins with @@.  In that case
36332 @var{program} (sans @@) is looked for in the compiler's internal
36333 binary directory.  Thus the sample mapper-server can be specified
36334 with @code{@@g++-mapper-server}.
36336 @item <>@r{[}?@var{ident}@r{]}
36337 @item <>@var{inout}@r{[}?@var{ident}@r{]}
36338 @item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
36339 Named pipes or file descriptors to communicate over.  The first form,
36340 @option{<>}, communicates over stdin and stdout.  The other forms
36341 allow you to specify a file descriptor or name a pipe.  A numeric value
36342 is interpreted as a file descriptor, otherwise named pipe is opened.
36343 The second form specifies a bidirectional pipe and the last form
36344 allows specifying two independent pipes.  Using file descriptors
36345 directly in this manner is fragile in general, as it can require the
36346 cooperation of intermediate processes.  In particular using stdin &
36347 stdout is fraught with danger as other compiler options might also
36348 cause the compiler to read stdin or write stdout, and it can have
36349 unfortunate interactions with signal delivery from the terminal.
36351 @item @var{file}@r{[}?@var{ident}@r{]}
36352 A mapping file consisting of space-separated module-name, filename
36353 pairs, one per line.  Only the mappings for the direct imports and any
36354 module export name need be provided.  If other mappings are provided,
36355 they override those stored in any imported CMI files.  A repository
36356 root may be specified in the mapping file by using @samp{$root} as the
36357 module name in the first active line.  Use of this option will disable
36358 any default module->CMI name mapping.
36360 @end table
36362 As shown, an optional @var{ident} may suffix the first word of the
36363 option, indicated by a @samp{?} prefix.  The value is used in the
36364 initial handshake with the module server, or to specify a prefix on
36365 mapping file lines.  In the server case, the main source file name is
36366 used if no @var{ident} is specified.  In the file case, all non-blank
36367 lines are significant, unless a value is specified, in which case only
36368 lines beginning with @var{ident} are significant.  The @var{ident}
36369 must be separated by whitespace from the module name.  Be aware that
36370 @samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
36371 significant to the shell, and therefore may need quoting.
36373 The mapper is connected to or loaded lazily, when the first module
36374 mapping is required.  The networking protocols are only supported on
36375 hosts that provide networking.  If no mapper is specified a default is
36376 provided.
36378 A project-specific mapper is expected to be provided by the build
36379 system that invokes the compiler.  It is not expected that a
36380 general-purpose server is provided for all compilations.  As such, the
36381 server will know the build configuration, the compiler it invoked, and
36382 the environment (such as working directory) in which that is
36383 operating.  As it may parallelize builds, several compilations may
36384 connect to the same socket.
36386 The default mapper generates CMI files in a @samp{gcm.cache}
36387 directory.  CMI files have a @samp{.gcm} suffix.  The module unit name
36388 is used directly to provide the basename.  Header units construct a
36389 relative path using the underlying header file name.  If the path is
36390 already relative, a @samp{,} directory is prepended.  Internal
36391 @samp{..} components are translated to @samp{,,}.  No attempt is made
36392 to canonicalize these filenames beyond that done by the preprocessor's
36393 include search algorithm, as in general it is ambiguous when symbolic
36394 links are present.
36396 The mapper protocol was published as ``A Module Mapper''
36397 @uref{https://wg21.link/p1184}.  The implementation is provided by
36398 @command{libcody}, @uref{https://github.com/urnathan/libcody},
36399 which specifies the canonical protocol definition.  A proof of concept
36400 server implementation embedded in @command{make} was described in
36401 ''Make Me A Module'', @uref{https://wg21.link/p1602}.
36403 @node C++ Module Preprocessing
36404 @subsection Module Preprocessing
36405 @cindex C++ Module Preprocessing
36407 Modules affect preprocessing because of header units and include
36408 translation.  Some uses of the preprocessor as a separate step either
36409 do not produce a correct output, or require CMIs to be available.
36411 Header units import macros.  These macros can affect later conditional
36412 inclusion, which therefore can cascade to differing import sets.  When
36413 preprocessing, it is necessary to load the CMI.  If a header unit is
36414 unavailable, the preprocessor issues a warning and continue (when
36415 not just preprocessing, an error is emitted).  Detecting such imports
36416 requires preprocessor tokenization of the input stream to phase 4
36417 (macro expansion).
36419 Include translation converts @code{#include}, @code{#include_next} and
36420 @code{#import} directives to internal @code{import} declarations.
36421 Whether a particular directive is translated is controlled by the
36422 module mapper.  Header unit names are canonicalized during
36423 preprocessing.
36425 Dependency information can be emitted for macro import, extending the
36426 functionality of @option{-MD} and @option{-MMD} options.  Detection of
36427 import declarations also requires phase 4 preprocessing, and thus
36428 requires full preprocessing (or compilation).
36430 The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
36431 preprocessing before phase 4.
36433 The @option{-save-temps} option uses @option{-fdirectives-only} for
36434 preprocessing, and preserve the macro definitions in the preprocessed
36435 output.  Usually you also want to use this option when explicitly
36436 preprocessing a header-unit, or consuming such preprocessed output:
36438 @smallexample
36439 g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
36440 g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
36441 @end smallexample
36443 @node C++ Compiled Module Interface
36444 @subsection Compiled Module Interface
36445 @cindex C++ Compiled Module Interface
36447 CMIs are an additional artifact when compiling named module
36448 interfaces, partitions or header units.  These are read when
36449 importing.  CMI contents are implementation-specific, and in GCC's
36450 case tied to the compiler version.  Consider them a rebuildable cache
36451 artifact, not a distributable object.
36453 When creating an output CMI, any missing directory components are
36454 created in a manner that is safe for concurrent builds creating
36455 multiple, different, CMIs within a common subdirectory tree.
36457 CMI contents are written to a temporary file, which is then atomically
36458 renamed.  Observers either see old contents (if there is an
36459 existing file), or complete new contents.  They do not observe the
36460 CMI during its creation.  This is unlike object file writing, which
36461 may be observed by an external process.
36463 CMIs are read in lazily, if the host OS provides @code{mmap}
36464 functionality.  Generally blocks are read when name lookup or template
36465 instantiation occurs.  To inhibit this, the @option{-fno-module-lazy}
36466 option may be used.
36468 The @option{--param lazy-modules=@var{n}} parameter controls the limit
36469 on the number of concurrently open module files during lazy loading.
36470 Should more modules be imported, an LRU algorithm is used to determine
36471 which files to close---until that file is needed again.  This limit
36472 may be exceeded with deep module dependency hierarchies.  With large
36473 code bases there may be more imports than the process limit of file
36474 descriptors.  By default, the limit is a few less than the per-process
36475 file descriptor hard limit, if that is determinable.@footnote{Where
36476 applicable the soft limit is incremented as needed towards the hard limit.}
36478 GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
36479 You may use @command{readelf} to inspect them, although section
36480 contents are largely undecipherable.  There is a section named
36481 @code{.gnu.c++.README}, which contains human-readable text.  Other
36482 than the first line, each line consists of @code{@var{tag}: @code{value}}
36483 tuples.
36485 @smallexample
36486 > @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
36488 String dump of section '.gnu.c++.README':
36489   [     0]  GNU C++ primary module interface
36490   [    21]  compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
36491   [    6f]  version: 2020/11/16-04:54
36492   [    89]  module: foo
36493   [    95]  source: c_b.ii
36494   [    a4]  dialect: C++20/coroutines
36495   [    be]  cwd: /data/users/nathans/modules/obj/x86_64/gcc
36496   [    ee]  repository: gcm.cache
36497   [   104]  buildtime: 2020/11/16 15:03:21 UTC
36498   [   127]  localtime: 2020/11/16 07:03:21 PST
36499   [   14a]  export: foo:part1 foo-part1.gcm
36500 @end smallexample
36502 Amongst other things, this lists the source that was built, C++
36503 dialect used and imports of the module.@footnote{The precise contents
36504 of this output may change.} The timestamp is the same value as that
36505 provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
36506 explicitly specified with the environment variable
36507 @code{SOURCE_DATE_EPOCH}.  For further details
36508 @pxref{Environment Variables}.
36510 A set of related CMIs may be copied, provided the relative pathnames
36511 are preserved.
36513 The @code{.gnu.c++.README} contents do not affect CMI integrity, and
36514 it may be removed or altered.  The section numbering of the sections
36515 whose names do not begin with @code{.gnu.c++.}, or are not the string
36516 section is significant and must not be altered.