lower-bitint: Encode address space qualifiers in VIEW_CONVERT_EXPRs [PR113736]
[official-gcc.git] / gcc / doc / invoke.texi
blob71339b8b30fa22720a98de1eaafeb9693d4e2025
1 @c Copyright (C) 1988-2024 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2024 Free Software Foundation, Inc.
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below).  A copy of the license is
19 included in the gfdl(7) man page.
21 (a) The FSF's Front-Cover Text is:
23      A GNU Manual
25 (b) The FSF's Back-Cover Text is:
27      You have freedom to copy and modify this GNU Manual, like GNU
28      software.  Copies published by the Free Software Foundation raise
29      funds for GNU development.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
35 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36     [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37     [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38     [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39     [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40     [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41     [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
43 Only the most useful options are listed here; see below for the
44 remainder.  @command{g++} accepts mostly the same options as @command{gcc}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
51 @c man end
52 @c man begin BUGS
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{https://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
60 @c man end
61 @end ignore
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
69 @c man begin DESCRIPTION
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking.  The ``overall options'' allow you to stop this
72 process at an intermediate stage.  For example, the @option{-c} option
73 says not to run the linker.  Then the output consists of object files
74 output by the assembler.
75 @xref{Overall Options,,Options Controlling the Kind of Output}.
77 Other options are passed on to one or more stages of processing.  Some options
78 control the preprocessor and others the compiler itself.  Yet other
79 options control the assembler and linker; most of these are not
80 documented here, since you rarely need to use any of them.
82 @cindex C compilation options
83 Most of the command-line options that you can use with GCC are useful
84 for C programs; when an option is only useful with another language
85 (usually C++), the explanation says so explicitly.  If the description
86 for a particular option does not mention a source language, you can use
87 that option with all supported languages.
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
94 The usual way to run GCC is to run the executable called @command{gcc}, or
95 @command{@var{machine}-gcc} when cross-compiling, or
96 @command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97 When you compile C++ programs, you should invoke GCC as @command{g++} 
98 instead.  @xref{Invoking G++,,Compiling C++ Programs}, 
99 for information about the differences in behavior between @command{gcc} 
100 and @command{g++} when compiling C++ programs.
102 @cindex grouping options
103 @cindex options, grouping
104 The @command{gcc} program accepts options and file names as operands.  Many
105 options have multi-letter names; therefore multiple single-letter options
106 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107 -v}}.
109 @cindex order of options
110 @cindex options, order
111 You can mix options and other arguments.  For the most part, the order
112 you use doesn't matter.  Order does matter when you use several
113 options of the same kind; for example, if you specify @option{-L} more
114 than once, the directories are searched in the order specified.  Also,
115 the placement of the @option{-l} option is significant.
117 Many options have long names starting with @samp{-f} or with
118 @samp{-W}---for example,
119 @option{-fmove-loop-invariants}, @option{-Wformat} and so on.  Most of
120 these have both positive and negative forms; the negative form of
121 @option{-ffoo} is @option{-fno-foo}.  This manual documents
122 only one of these two forms, whichever one is not the default.
124 Some options take one or more arguments typically separated either
125 by a space or by the equals sign (@samp{=}) from the option name.
126 Unless documented otherwise, an argument can be either numeric or
127 a string.  Numeric arguments must typically be small unsigned decimal
128 or hexadecimal integers.  Hexadecimal arguments must begin with
129 the @samp{0x} prefix.  Arguments to options that specify a size
130 threshold of some sort may be arbitrarily large decimal or hexadecimal
131 integers followed by a byte size suffix designating a multiple of bytes
132 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
133 @code{MB} and @code{MiB} for megabyte and mebibyte, @code{GB} and
134 @code{GiB} for gigabyte and gigibyte, and so on.  Such arguments are
135 designated by @var{byte-size} in the following text.  Refer to the NIST,
136 IEC, and other relevant national and international standards for the full
137 listing and explanation of the binary and decimal byte size prefixes.
139 @c man end
141 @xref{Option Index}, for an index to GCC's options.
143 @menu
144 * Option Summary::      Brief list of all options, without explanations.
145 * Overall Options::     Controlling the kind of output:
146                         an executable, object files, assembler files,
147                         or preprocessed source.
148 * Invoking G++::        Compiling C++ programs.
149 * C Dialect Options::   Controlling the variant of C language compiled.
150 * C++ Dialect Options:: Variations on C++.
151 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
152                         and Objective-C++.
153 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
154                         be formatted.
155 * Warning Options::     How picky should the compiler be?
156 * Static Analyzer Options:: More expensive warnings.
157 * Debugging Options::   Producing debuggable code.
158 * Optimize Options::    How much optimization?
159 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
160 * Preprocessor Options:: Controlling header files and macro definitions.
161                          Also, getting dependency information for Make.
162 * Assembler Options::   Passing options to the assembler.
163 * Link Options::        Specifying libraries and so on.
164 * Directory Options::   Where to find header files and libraries.
165                         Where to find the compiler executable files.
166 * Code Gen Options::    Specifying conventions for function calls, data layout
167                         and register usage.
168 * Developer Options::   Printing GCC configuration info, statistics, and
169                         debugging dumps.
170 * Submodel Options::    Target-specific options, such as compiling for a
171                         specific processor variant.
172 * Spec Files::          How to pass switches to sub-processes.
173 * Environment Variables:: Env vars that affect GCC.
174 * Precompiled Headers:: Compiling a header once, and using it many times.
175 * C++ Modules::         Experimental C++20 module system.
176 @end menu
178 @c man begin OPTIONS
180 @node Option Summary
181 @section Option Summary
183 Here is a summary of all the options, grouped by type.  Explanations are
184 in the following sections.
186 @table @emph
187 @item Overall Options
188 @xref{Overall Options,,Options Controlling the Kind of Output}.
189 @gccoptlist{-c  -S  -E  -o @var{file}
190 -dumpbase @var{dumpbase}  -dumpbase-ext @var{auxdropsuf}
191 -dumpdir @var{dumppfx}  -x @var{language}
192 -v  -###  --help@r{[}=@var{class}@r{[},@dots{}@r{]]}  --target-help  --version
193 -pass-exit-codes  -pipe  -specs=@var{file}  -wrapper
194 @@@var{file}  -ffile-prefix-map=@var{old}=@var{new}  -fcanon-prefix-map
195 -fplugin=@var{file}  -fplugin-arg-@var{name}=@var{arg}
196 -fdump-ada-spec@r{[}-slim@r{]}  -fada-spec-parent=@var{unit}  -fdump-go-spec=@var{file}}
198 @item C Language Options
199 @xref{C Dialect Options,,Options Controlling C Dialect}.
200 @gccoptlist{-ansi  -std=@var{standard}  -aux-info @var{filename}
201 -fno-asm
202 -fno-builtin  -fno-builtin-@var{function}  -fcond-mismatch
203 -ffreestanding  -fgimple  -fgnu-tm  -fgnu89-inline  -fhosted
204 -flax-vector-conversions  -fms-extensions
205 -foffload=@var{arg}  -foffload-options=@var{arg}
206 -fopenacc  -fopenacc-dim=@var{geom}
207 -fopenmp  -fopenmp-simd  -fopenmp-target-simd-clone@r{[}=@var{device-type}@r{]}
208 -fpermitted-flt-eval-methods=@var{standard}
209 -fplan9-extensions  -fsigned-bitfields  -funsigned-bitfields
210 -fsigned-char  -funsigned-char  -fstrict-flex-arrays[=@var{n}]
211 -fsso-struct=@var{endianness}}
213 @item C++ Language Options
214 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
215 @gccoptlist{-fabi-version=@var{n}  -fno-access-control
216 -faligned-new=@var{n}  -fargs-in-order=@var{n}  -fchar8_t  -fcheck-new
217 -fconstexpr-depth=@var{n}  -fconstexpr-cache-depth=@var{n}
218 -fconstexpr-loop-limit=@var{n}  -fconstexpr-ops-limit=@var{n}
219 -fno-elide-constructors
220 -fno-enforce-eh-specs
221 -fno-gnu-keywords
222 -fno-immediate-escalation
223 -fno-implicit-templates
224 -fno-implicit-inline-templates
225 -fno-implement-inlines
226 -fmodule-header@r{[}=@var{kind}@r{]} -fmodule-only -fmodules-ts
227 -fmodule-implicit-inline
228 -fno-module-lazy
229 -fmodule-mapper=@var{specification}
230 -fmodule-version-ignore
231 -fms-extensions
232 -fnew-inheriting-ctors
233 -fnew-ttp-matching
234 -fno-nonansi-builtins  -fnothrow-opt  -fno-operator-names
235 -fno-optional-diags
236 -fno-pretty-templates
237 -fno-rtti  -fsized-deallocation
238 -ftemplate-backtrace-limit=@var{n}
239 -ftemplate-depth=@var{n}
240 -fno-threadsafe-statics  -fuse-cxa-atexit
241 -fno-weak  -nostdinc++
242 -fvisibility-inlines-hidden
243 -fvisibility-ms-compat
244 -fext-numeric-literals
245 -flang-info-include-translate@r{[}=@var{header}@r{]}
246 -flang-info-include-translate-not
247 -flang-info-module-cmi@r{[}=@var{module}@r{]}
248 -stdlib=@var{libstdc++,libc++}
249 -Wabi-tag  -Wcatch-value  -Wcatch-value=@var{n}
250 -Wno-class-conversion  -Wclass-memaccess
251 -Wcomma-subscript  -Wconditionally-supported
252 -Wno-conversion-null  -Wctad-maybe-unsupported
253 -Wctor-dtor-privacy  -Wdangling-reference
254 -Wno-delete-incomplete
255 -Wdelete-non-virtual-dtor  -Wno-deprecated-array-compare
256 -Wdeprecated-copy -Wdeprecated-copy-dtor
257 -Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion
258 -Weffc++ -Wno-elaborated-enum-base
259 -Wno-exceptions -Wextra-semi  -Wno-inaccessible-base
260 -Wno-inherited-variadic-ctor  -Wno-init-list-lifetime
261 -Winvalid-constexpr -Winvalid-imported-macros
262 -Wno-invalid-offsetof  -Wno-literal-suffix
263 -Wmismatched-new-delete -Wmismatched-tags
264 -Wmultiple-inheritance  -Wnamespaces  -Wnarrowing
265 -Wnoexcept  -Wnoexcept-type  -Wnon-virtual-dtor
266 -Wpessimizing-move  -Wno-placement-new  -Wplacement-new=@var{n}
267 -Wrange-loop-construct -Wredundant-move -Wredundant-tags
268 -Wreorder  -Wregister
269 -Wstrict-null-sentinel  -Wno-subobject-linkage  -Wtemplates
270 -Wno-non-template-friend  -Wold-style-cast
271 -Woverloaded-virtual  -Wno-pmf-conversions -Wself-move -Wsign-promo
272 -Wsized-deallocation  -Wsuggest-final-methods
273 -Wsuggest-final-types  -Wsuggest-override
274 -Wno-terminate  -Wno-vexing-parse  -Wvirtual-inheritance
275 -Wno-virtual-move-assign  -Wvolatile  -Wzero-as-null-pointer-constant}
277 @item Objective-C and Objective-C++ Language Options
278 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
279 Objective-C and Objective-C++ Dialects}.
280 @gccoptlist{-fconstant-string-class=@var{class-name}
281 -fgnu-runtime  -fnext-runtime
282 -fno-nil-receivers
283 -fobjc-abi-version=@var{n}
284 -fobjc-call-cxx-cdtors
285 -fobjc-direct-dispatch
286 -fobjc-exceptions
287 -fobjc-gc
288 -fobjc-nilcheck
289 -fobjc-std=objc1
290 -fno-local-ivars
291 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
292 -freplace-objc-classes
293 -fzero-link
294 -gen-decls
295 -Wassign-intercept  -Wno-property-assign-default
296 -Wno-protocol -Wobjc-root-class -Wselector
297 -Wstrict-selector-match
298 -Wundeclared-selector}
300 @item Diagnostic Message Formatting Options
301 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
302 @gccoptlist{-fmessage-length=@var{n}
303 -fdiagnostics-plain-output
304 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}
305 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]}
306 -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]}
307 -fdiagnostics-format=@r{[}text@r{|}sarif-stderr@r{|}sarif-file@r{|}json@r{|}json-stderr@r{|}json-file@r{]}
308 -fno-diagnostics-json-formatting
309 -fno-diagnostics-show-option  -fno-diagnostics-show-caret
310 -fno-diagnostics-show-labels  -fno-diagnostics-show-line-numbers
311 -fno-diagnostics-show-cwe
312 -fno-diagnostics-show-rule
313 -fdiagnostics-minimum-margin-width=@var{width}
314 -fdiagnostics-parseable-fixits  -fdiagnostics-generate-patch
315 -fdiagnostics-show-template-tree  -fno-elide-type
316 -fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]}
317 -fdiagnostics-show-path-depths
318 -fno-show-column
319 -fdiagnostics-column-unit=@r{[}display@r{|}byte@r{]}
320 -fdiagnostics-column-origin=@var{origin}
321 -fdiagnostics-escape-format=@r{[}unicode@r{|}bytes@r{]}
322 -fdiagnostics-text-art-charset=@r{[}none@r{|}ascii@r{|}unicode@r{|}emoji@r{]}}
324 @item Warning Options
325 @xref{Warning Options,,Options to Request or Suppress Warnings}.
326 @gccoptlist{-fsyntax-only  -fmax-errors=@var{n}  -Wpedantic
327 -pedantic-errors -fpermissive
328 -w  -Wextra  -Wall  -Wabi=@var{n}
329 -Waddress  -Wno-address-of-packed-member  -Waggregate-return
330 -Walloc-size  -Walloc-size-larger-than=@var{byte-size}  -Walloc-zero
331 -Walloca  -Walloca-larger-than=@var{byte-size}
332 -Wno-aggressive-loop-optimizations
333 -Warith-conversion
334 -Warray-bounds  -Warray-bounds=@var{n}  -Warray-compare
335 -Warray-parameter  -Warray-parameter=@var{n}
336 -Wno-attributes  -Wattribute-alias=@var{n} -Wno-attribute-alias
337 -Wno-attribute-warning
338 -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
339 -Wbool-compare  -Wbool-operation
340 -Wno-builtin-declaration-mismatch
341 -Wno-builtin-macro-redefined  -Wc90-c99-compat  -Wc99-c11-compat
342 -Wc11-c23-compat
343 -Wc++-compat  -Wc++11-compat  -Wc++14-compat  -Wc++17-compat
344 -Wc++20-compat
345 -Wno-c++11-extensions  -Wno-c++14-extensions -Wno-c++17-extensions
346 -Wno-c++20-extensions  -Wno-c++23-extensions
347 -Wcalloc-transposed-args
348 -Wcast-align  -Wcast-align=strict  -Wcast-function-type  -Wcast-qual
349 -Wchar-subscripts
350 -Wclobbered  -Wcomment
351 -Wcompare-distinct-pointer-types
352 -Wno-complain-wrong-lang
353 -Wconversion  -Wno-coverage-mismatch  -Wno-cpp
354 -Wdangling-else  -Wdangling-pointer  -Wdangling-pointer=@var{n}
355 -Wdate-time
356 -Wno-deprecated  -Wno-deprecated-declarations  -Wno-designated-init
357 -Wdisabled-optimization
358 -Wno-discarded-array-qualifiers  -Wno-discarded-qualifiers
359 -Wno-div-by-zero  -Wdouble-promotion
360 -Wduplicated-branches  -Wduplicated-cond
361 -Wempty-body  -Wno-endif-labels  -Wenum-compare  -Wenum-conversion
362 -Wenum-int-mismatch
363 -Werror  -Werror=*  -Wexpansion-to-defined  -Wfatal-errors
364 -Wflex-array-member-not-at-end
365 -Wfloat-conversion  -Wfloat-equal  -Wformat  -Wformat=2
366 -Wno-format-contains-nul  -Wno-format-extra-args
367 -Wformat-nonliteral  -Wformat-overflow=@var{n}
368 -Wformat-security  -Wformat-signedness  -Wformat-truncation=@var{n}
369 -Wformat-y2k  -Wframe-address
370 -Wframe-larger-than=@var{byte-size}  -Wno-free-nonheap-object
371 -Wno-if-not-aligned  -Wno-ignored-attributes
372 -Wignored-qualifiers  -Wno-incompatible-pointer-types  -Whardened
373 -Wimplicit  -Wimplicit-fallthrough  -Wimplicit-fallthrough=@var{n}
374 -Wno-implicit-function-declaration  -Wno-implicit-int
375 -Winfinite-recursion
376 -Winit-self  -Winline  -Wno-int-conversion  -Wint-in-bool-context
377 -Wno-int-to-pointer-cast  -Wno-invalid-memory-model
378 -Winvalid-pch  -Winvalid-utf8  -Wno-unicode  -Wjump-misses-init
379 -Wlarger-than=@var{byte-size}  -Wlogical-not-parentheses  -Wlogical-op
380 -Wlong-long  -Wno-lto-type-mismatch -Wmain  -Wmaybe-uninitialized
381 -Wmemset-elt-size  -Wmemset-transposed-args
382 -Wmisleading-indentation  -Wmissing-attributes  -Wmissing-braces
383 -Wmissing-field-initializers  -Wmissing-format-attribute
384 -Wmissing-include-dirs  -Wmissing-noreturn  -Wno-missing-profile
385 -Wno-multichar  -Wmultistatement-macros  -Wnonnull  -Wnonnull-compare
386 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
387 -Wnull-dereference  -Wno-odr
388 -Wopenacc-parallelism
389 -Wopenmp -Wopenmp-simd
390 -Wno-overflow  -Woverlength-strings  -Wno-override-init-side-effects
391 -Wpacked  -Wno-packed-bitfield-compat  -Wpacked-not-aligned  -Wpadded
392 -Wparentheses  -Wno-pedantic-ms-format
393 -Wpointer-arith  -Wno-pointer-compare  -Wno-pointer-to-int-cast
394 -Wno-pragmas  -Wno-prio-ctor-dtor  -Wredundant-decls
395 -Wrestrict  -Wno-return-local-addr  -Wreturn-type
396 -Wno-scalar-storage-order  -Wsequence-point
397 -Wshadow  -Wshadow=global  -Wshadow=local  -Wshadow=compatible-local
398 -Wno-shadow-ivar
399 -Wno-shift-count-negative  -Wno-shift-count-overflow  -Wshift-negative-value
400 -Wno-shift-overflow  -Wshift-overflow=@var{n}
401 -Wsign-compare  -Wsign-conversion
402 -Wno-sizeof-array-argument
403 -Wsizeof-array-div
404 -Wsizeof-pointer-div  -Wsizeof-pointer-memaccess
405 -Wstack-protector  -Wstack-usage=@var{byte-size}  -Wstrict-aliasing
406 -Wstrict-aliasing=n  -Wstrict-overflow  -Wstrict-overflow=@var{n}
407 -Wstring-compare
408 -Wno-stringop-overflow -Wno-stringop-overread
409 -Wno-stringop-truncation  -Wstrict-flex-arrays
410 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]}
411 -Wswitch  -Wno-switch-bool  -Wswitch-default  -Wswitch-enum
412 -Wno-switch-outside-range  -Wno-switch-unreachable  -Wsync-nand
413 -Wsystem-headers  -Wtautological-compare  -Wtrampolines  -Wtrigraphs
414 -Wtrivial-auto-var-init  -Wno-tsan  -Wtype-limits  -Wundef
415 -Wuninitialized  -Wunknown-pragmas
416 -Wunsuffixed-float-constants  -Wunused
417 -Wunused-but-set-parameter  -Wunused-but-set-variable
418 -Wunused-const-variable  -Wunused-const-variable=@var{n}
419 -Wunused-function  -Wunused-label  -Wunused-local-typedefs
420 -Wunused-macros
421 -Wunused-parameter  -Wno-unused-result
422 -Wunused-value  -Wunused-variable
423 -Wuse-after-free  -Wuse-after-free=@var{n}  -Wuseless-cast
424 -Wno-varargs  -Wvariadic-macros
425 -Wvector-operation-performance
426 -Wvla  -Wvla-larger-than=@var{byte-size}  -Wno-vla-larger-than
427 -Wvolatile-register-var  -Wwrite-strings
428 -Wno-xor-used-as-pow
429 -Wzero-length-bounds}
431 @item Static Analyzer Options
432 @gccoptlist{
433 -fanalyzer
434 -fanalyzer-call-summaries
435 -fanalyzer-checker=@var{name}
436 -fno-analyzer-feasibility
437 -fanalyzer-fine-grained
438 -fanalyzer-show-events-in-system-headers
439 -fno-analyzer-state-merge
440 -fno-analyzer-state-purge
441 -fno-analyzer-suppress-followups
442 -fanalyzer-transitivity
443 -fno-analyzer-undo-inlining
444 -fanalyzer-verbose-edges
445 -fanalyzer-verbose-state-changes
446 -fanalyzer-verbosity=@var{level}
447 -fdump-analyzer
448 -fdump-analyzer-callgraph
449 -fdump-analyzer-exploded-graph
450 -fdump-analyzer-exploded-nodes
451 -fdump-analyzer-exploded-nodes-2
452 -fdump-analyzer-exploded-nodes-3
453 -fdump-analyzer-exploded-paths
454 -fdump-analyzer-feasibility
455 -fdump-analyzer-infinite-loop
456 -fdump-analyzer-json
457 -fdump-analyzer-state-purge
458 -fdump-analyzer-stderr
459 -fdump-analyzer-supergraph
460 -fdump-analyzer-untracked
461 -Wno-analyzer-double-fclose
462 -Wno-analyzer-double-free
463 -Wno-analyzer-exposure-through-output-file
464 -Wno-analyzer-exposure-through-uninit-copy
465 -Wno-analyzer-fd-access-mode-mismatch
466 -Wno-analyzer-fd-double-close
467 -Wno-analyzer-fd-leak
468 -Wno-analyzer-fd-phase-mismatch
469 -Wno-analyzer-fd-type-mismatch
470 -Wno-analyzer-fd-use-after-close
471 -Wno-analyzer-fd-use-without-check
472 -Wno-analyzer-file-leak
473 -Wno-analyzer-free-of-non-heap
474 -Wno-analyzer-imprecise-fp-arithmetic
475 -Wno-analyzer-infinite-loop
476 -Wno-analyzer-infinite-recursion
477 -Wno-analyzer-jump-through-null
478 -Wno-analyzer-malloc-leak
479 -Wno-analyzer-mismatching-deallocation
480 -Wno-analyzer-null-argument
481 -Wno-analyzer-null-dereference
482 -Wno-analyzer-out-of-bounds
483 -Wno-analyzer-overlapping-buffers
484 -Wno-analyzer-possible-null-argument
485 -Wno-analyzer-possible-null-dereference
486 -Wno-analyzer-putenv-of-auto-var
487 -Wno-analyzer-shift-count-negative
488 -Wno-analyzer-shift-count-overflow
489 -Wno-analyzer-stale-setjmp-buffer
490 -Wno-analyzer-tainted-allocation-size
491 -Wno-analyzer-tainted-assertion
492 -Wno-analyzer-tainted-array-index
493 -Wno-analyzer-tainted-divisor
494 -Wno-analyzer-tainted-offset
495 -Wno-analyzer-tainted-size
496 -Wanalyzer-symbol-too-complex
497 -Wanalyzer-too-complex
498 -Wno-analyzer-undefined-behavior-strtok
499 -Wno-analyzer-unsafe-call-within-signal-handler
500 -Wno-analyzer-use-after-free
501 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
502 -Wno-analyzer-use-of-uninitialized-value
503 -Wno-analyzer-va-arg-type-mismatch
504 -Wno-analyzer-va-list-exhausted
505 -Wno-analyzer-va-list-leak
506 -Wno-analyzer-va-list-use-after-va-end
507 -Wno-analyzer-write-to-const
508 -Wno-analyzer-write-to-string-literal
511 @item C and Objective-C-only Warning Options
512 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations
513 -Wmissing-parameter-type -Wdeclaration-missing-parameter-type
514 -Wmissing-prototypes -Wmissing-variable-declarations
515 -Wnested-externs -Wold-style-declaration  -Wold-style-definition
516 -Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion
517 -Wdeclaration-after-statement  -Wpointer-sign}
519 @item Debugging Options
520 @xref{Debugging Options,,Options for Debugging Your Program}.
521 @gccoptlist{-g  -g@var{level}  -gdwarf  -gdwarf-@var{version}
522 -gbtf -gctf  -gctf@var{level}
523 -ggdb  -grecord-gcc-switches  -gno-record-gcc-switches
524 -gstrict-dwarf  -gno-strict-dwarf
525 -gas-loc-support  -gno-as-loc-support
526 -gas-locview-support  -gno-as-locview-support
527 -gcodeview
528 -gcolumn-info  -gno-column-info  -gdwarf32  -gdwarf64
529 -gstatement-frontiers  -gno-statement-frontiers
530 -gvariable-location-views  -gno-variable-location-views
531 -ginternal-reset-location-views  -gno-internal-reset-location-views
532 -ginline-points  -gno-inline-points
533 -gvms -gz@r{[}=@var{type}@r{]}
534 -gsplit-dwarf  -gdescribe-dies  -gno-describe-dies
535 -fdebug-prefix-map=@var{old}=@var{new}  -fdebug-types-section
536 -fno-eliminate-unused-debug-types
537 -femit-struct-debug-baseonly  -femit-struct-debug-reduced
538 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
539 -fno-eliminate-unused-debug-symbols  -femit-class-debug-always
540 -fno-merge-debug-strings  -fno-dwarf2-cfi-asm
541 -fvar-tracking  -fvar-tracking-assignments}
543 @item Optimization Options
544 @xref{Optimize Options,,Options that Control Optimization}.
545 @gccoptlist{-faggressive-loop-optimizations
546 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
547 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
548 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
549 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
550 -fmin-function-alignment=[@var{n}]
551 -fno-allocation-dce -fallow-store-data-races
552 -fassociative-math  -fauto-profile  -fauto-profile[=@var{path}]
553 -fauto-inc-dec  -fbranch-probabilities
554 -fcaller-saves
555 -fcombine-stack-adjustments  -fconserve-stack
556 -ffold-mem-offsets
557 -fcompare-elim  -fcprop-registers  -fcrossjumping
558 -fcse-follow-jumps  -fcse-skip-blocks  -fcx-fortran-rules
559 -fcx-limited-range
560 -fdata-sections  -fdce  -fdelayed-branch
561 -fdelete-null-pointer-checks  -fdevirtualize  -fdevirtualize-speculatively
562 -fdevirtualize-at-ltrans  -fdse
563 -fearly-inlining  -fipa-sra  -fexpensive-optimizations  -ffat-lto-objects
564 -ffast-math  -ffinite-math-only  -ffloat-store  -fexcess-precision=@var{style}
565 -ffinite-loops
566 -fforward-propagate  -ffp-contract=@var{style}  -ffunction-sections
567 -fgcse  -fgcse-after-reload  -fgcse-las  -fgcse-lm  -fgraphite-identity
568 -fgcse-sm  -fhoist-adjacent-loads  -fif-conversion
569 -fif-conversion2  -findirect-inlining
570 -finline-stringops[=@var{fn}]
571 -finline-functions  -finline-functions-called-once  -finline-limit=@var{n}
572 -finline-small-functions -fipa-modref -fipa-cp  -fipa-cp-clone
573 -fipa-bit-cp  -fipa-vrp  -fipa-pta  -fipa-profile  -fipa-pure-const
574 -fipa-reference  -fipa-reference-addressable
575 -fipa-stack-alignment  -fipa-icf  -fira-algorithm=@var{algorithm}
576 -flive-patching=@var{level}
577 -fira-region=@var{region}  -fira-hoist-pressure
578 -fira-loop-pressure  -fno-ira-share-save-slots
579 -fno-ira-share-spill-slots
580 -fisolate-erroneous-paths-dereference  -fisolate-erroneous-paths-attribute
581 -fivopts  -fkeep-inline-functions  -fkeep-static-functions
582 -fkeep-static-consts  -flimit-function-alignment  -flive-range-shrinkage
583 -floop-block  -floop-interchange  -floop-strip-mine
584 -floop-unroll-and-jam  -floop-nest-optimize
585 -floop-parallelize-all  -flra-remat  -flto  -flto-compression-level
586 -flto-partition=@var{alg}  -fmerge-all-constants
587 -fmerge-constants  -fmodulo-sched  -fmodulo-sched-allow-regmoves
588 -fmove-loop-invariants  -fmove-loop-stores  -fno-branch-count-reg
589 -fno-defer-pop  -fno-fp-int-builtin-inexact  -fno-function-cse
590 -fno-guess-branch-probability  -fno-inline  -fno-math-errno  -fno-peephole
591 -fno-peephole2  -fno-printf-return-value  -fno-sched-interblock
592 -fno-sched-spec  -fno-signed-zeros
593 -fno-toplevel-reorder  -fno-trapping-math  -fno-zero-initialized-in-bss
594 -fomit-frame-pointer  -foptimize-sibling-calls
595 -fpartial-inlining  -fpeel-loops  -fpredictive-commoning
596 -fprefetch-loop-arrays
597 -fprofile-correction
598 -fprofile-use  -fprofile-use=@var{path} -fprofile-partial-training
599 -fprofile-values -fprofile-reorder-functions
600 -freciprocal-math  -free  -frename-registers  -freorder-blocks
601 -freorder-blocks-algorithm=@var{algorithm}
602 -freorder-blocks-and-partition  -freorder-functions
603 -frerun-cse-after-loop  -freschedule-modulo-scheduled-loops
604 -frounding-math  -fsave-optimization-record
605 -fsched2-use-superblocks  -fsched-pressure
606 -fsched-spec-load  -fsched-spec-load-dangerous
607 -fsched-stalled-insns-dep[=@var{n}]  -fsched-stalled-insns[=@var{n}]
608 -fsched-group-heuristic  -fsched-critical-path-heuristic
609 -fsched-spec-insn-heuristic  -fsched-rank-heuristic
610 -fsched-last-insn-heuristic  -fsched-dep-count-heuristic
611 -fschedule-fusion
612 -fschedule-insns  -fschedule-insns2  -fsection-anchors
613 -fselective-scheduling  -fselective-scheduling2
614 -fsel-sched-pipelining  -fsel-sched-pipelining-outer-loops
615 -fsemantic-interposition  -fshrink-wrap  -fshrink-wrap-separate
616 -fsignaling-nans
617 -fsingle-precision-constant  -fsplit-ivs-in-unroller  -fsplit-loops
618 -fsplit-paths
619 -fsplit-wide-types  -fsplit-wide-types-early  -fssa-backprop  -fssa-phiopt
620 -fstdarg-opt  -fstore-merging  -fstrict-aliasing -fipa-strict-aliasing
621 -fthread-jumps  -ftracer  -ftree-bit-ccp
622 -ftree-builtin-call-dce  -ftree-ccp  -ftree-ch
623 -ftree-coalesce-vars  -ftree-copy-prop  -ftree-dce  -ftree-dominator-opts
624 -ftree-dse  -ftree-forwprop  -ftree-fre  -fcode-hoisting
625 -ftree-loop-if-convert  -ftree-loop-im
626 -ftree-phiprop  -ftree-loop-distribution  -ftree-loop-distribute-patterns
627 -ftree-loop-ivcanon  -ftree-loop-linear  -ftree-loop-optimize
628 -ftree-loop-vectorize
629 -ftree-parallelize-loops=@var{n}  -ftree-pre  -ftree-partial-pre  -ftree-pta
630 -ftree-reassoc  -ftree-scev-cprop  -ftree-sink  -ftree-slsr  -ftree-sra
631 -ftree-switch-conversion  -ftree-tail-merge
632 -ftree-ter  -ftree-vectorize  -ftree-vrp  -ftrivial-auto-var-init
633 -funconstrained-commons -funit-at-a-time  -funroll-all-loops
634 -funroll-loops -funsafe-math-optimizations  -funswitch-loops
635 -fipa-ra  -fvariable-expansion-in-unroller  -fvect-cost-model  -fvpt
636 -fweb  -fwhole-program  -fwpa  -fuse-linker-plugin -fzero-call-used-regs
637 --param @var{name}=@var{value}
638 -O  -O0  -O1  -O2  -O3  -Os  -Ofast  -Og  -Oz}
640 @item Program Instrumentation Options
641 @xref{Instrumentation Options,,Program Instrumentation Options}.
642 @gccoptlist{-p  -pg  -fprofile-arcs  --coverage  -ftest-coverage
643 -fprofile-abs-path
644 -fprofile-dir=@var{path}  -fprofile-generate  -fprofile-generate=@var{path}
645 -fprofile-info-section  -fprofile-info-section=@var{name}
646 -fprofile-note=@var{path} -fprofile-prefix-path=@var{path}
647 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex}
648 -fprofile-exclude-files=@var{regex}
649 -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
650 -fsanitize=@var{style}  -fsanitize-recover  -fsanitize-recover=@var{style}
651 -fsanitize-trap   -fsanitize-trap=@var{style}
652 -fasan-shadow-offset=@var{number}  -fsanitize-sections=@var{s1},@var{s2},...
653 -fsanitize-undefined-trap-on-error  -fbounds-check
654 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
655 -fharden-compares -fharden-conditional-branches  -fhardened
656 -fharden-control-flow-redundancy  -fhardcfr-skip-leaf
657 -fhardcfr-check-exceptions  -fhardcfr-check-returning-calls
658 -fhardcfr-check-noreturn-calls=@r{[}always@r{|}no-xthrow@r{|}nothrow@r{|}never@r{]}
659 -fstack-protector  -fstack-protector-all  -fstack-protector-strong
660 -fstack-protector-explicit  -fstack-check
661 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym}
662 -fno-stack-limit  -fsplit-stack
663 -fstrub=disable  -fstrub=strict  -fstrub=relaxed
664 -fstrub=all  -fstrub=at-calls  -fstrub=internal
665 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
666 -fvtv-counts  -fvtv-debug
667 -finstrument-functions  -finstrument-functions-once
668 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
669 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
670 -fprofile-prefix-map=@var{old}=@var{new}
671 -fpatchable-function-entry=@var{N}@r{[},@var{M}@r{]}}
673 @item Preprocessor Options
674 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
675 @gccoptlist{-A@var{question}=@var{answer}
676 -A-@var{question}@r{[}=@var{answer}@r{]}
677 -C  -CC  -D@var{macro}@r{[}=@var{defn}@r{]}
678 -dD  -dI  -dM  -dN  -dU
679 -fdebug-cpp  -fdirectives-only  -fdollars-in-identifiers
680 -fexec-charset=@var{charset}  -fextended-identifiers
681 -finput-charset=@var{charset}  -flarge-source-files
682 -fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth}
683 -fno-canonical-system-headers  -fpch-deps  -fpch-preprocess
684 -fpreprocessed  -ftabstop=@var{width}  -ftrack-macro-expansion
685 -fwide-exec-charset=@var{charset}  -fworking-directory
686 -H  -imacros @var{file}  -include @var{file}
687 -M  -MD  -MF  -MG  -MM  -MMD  -MP  -MQ  -MT -Mno-modules
688 -no-integrated-cpp  -P  -pthread  -remap
689 -traditional  -traditional-cpp  -trigraphs
690 -U@var{macro}  -undef
691 -Wp,@var{option}  -Xpreprocessor @var{option}}
693 @item Assembler Options
694 @xref{Assembler Options,,Passing Options to the Assembler}.
695 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
697 @item Linker Options
698 @xref{Link Options,,Options for Linking}.
699 @gccoptlist{@var{object-file-name}  -fuse-ld=@var{linker}  -l@var{library}
700 -nostartfiles  -nodefaultlibs  -nolibc  -nostdlib  -nostdlib++
701 -e @var{entry}  --entry=@var{entry}
702 -pie  -pthread  -r  -rdynamic
703 -s  -static  -static-pie  -static-libgcc  -static-libstdc++
704 -static-libasan  -static-libtsan  -static-liblsan  -static-libubsan
705 -shared  -shared-libgcc  -symbolic
706 -T @var{script}  -Wl,@var{option}  -Xlinker @var{option}
707 -u @var{symbol}  -z @var{keyword}}
709 @item Directory Options
710 @xref{Directory Options,,Options for Directory Search}.
711 @gccoptlist{-B@var{prefix}  -I@var{dir}  -I-
712 -idirafter @var{dir}
713 -imacros @var{file}  -imultilib @var{dir}
714 -iplugindir=@var{dir}  -iprefix @var{file}
715 -iquote @var{dir}  -isysroot @var{dir}  -isystem @var{dir}
716 -iwithprefix @var{dir}  -iwithprefixbefore @var{dir}
717 -L@var{dir}  -no-canonical-prefixes  --no-sysroot-suffix
718 -nostdinc  -nostdinc++  --sysroot=@var{dir}}
720 @item Code Generation Options
721 @xref{Code Gen Options,,Options for Code Generation Conventions}.
722 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg}
723 -ffixed-@var{reg}  -fexceptions
724 -fnon-call-exceptions  -fdelete-dead-exceptions  -funwind-tables
725 -fasynchronous-unwind-tables
726 -fno-gnu-unique
727 -finhibit-size-directive  -fcommon  -fno-ident
728 -fpcc-struct-return  -fpic  -fPIC  -fpie  -fPIE  -fno-plt
729 -fno-jump-tables -fno-bit-tests
730 -frecord-gcc-switches
731 -freg-struct-return  -fshort-enums  -fshort-wchar
732 -fverbose-asm  -fpack-struct[=@var{n}]
733 -fleading-underscore  -ftls-model=@var{model}
734 -fstack-reuse=@var{reuse_level}
735 -ftrampolines -ftrampoline-impl=@r{[}stack@r{|}heap@r{]}
736 -ftrapv  -fwrapv
737 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
738 -fstrict-volatile-bitfields  -fsync-libcalls}
740 @item Developer Options
741 @xref{Developer Options,,GCC Developer Options}.
742 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion
743 -dumpfullversion  -fcallgraph-info@r{[}=su,da@r{]}
744 -fchecking  -fchecking=@var{n}
745 -fdbg-cnt-list  -fdbg-cnt=@var{counter-value-list}
746 -fdisable-ipa-@var{pass_name}
747 -fdisable-rtl-@var{pass_name}
748 -fdisable-rtl-@var{pass-name}=@var{range-list}
749 -fdisable-tree-@var{pass_name}
750 -fdisable-tree-@var{pass-name}=@var{range-list}
751 -fdump-debug  -fdump-earlydebug
752 -fdump-noaddr  -fdump-unnumbered  -fdump-unnumbered-links
753 -fdump-final-insns@r{[}=@var{file}@r{]}
754 -fdump-ipa-all  -fdump-ipa-cgraph  -fdump-ipa-inline
755 -fdump-lang-all
756 -fdump-lang-@var{switch}
757 -fdump-lang-@var{switch}-@var{options}
758 -fdump-lang-@var{switch}-@var{options}=@var{filename}
759 -fdump-passes
760 -fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename}
761 -fdump-statistics
762 -fdump-tree-all
763 -fdump-tree-@var{switch}
764 -fdump-tree-@var{switch}-@var{options}
765 -fdump-tree-@var{switch}-@var{options}=@var{filename}
766 -fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second
767 -fenable-@var{kind}-@var{pass}
768 -fenable-@var{kind}-@var{pass}=@var{range-list}
769 -fira-verbose=@var{n}
770 -flto-report  -flto-report-wpa  -fmem-report-wpa
771 -fmem-report  -fpre-ipa-mem-report  -fpost-ipa-mem-report
772 -fopt-info  -fopt-info-@var{options}@r{[}=@var{file}@r{]}
773 -fmultiflags  -fprofile-report
774 -frandom-seed=@var{string}  -fsched-verbose=@var{n}
775 -fsel-sched-verbose  -fsel-sched-dump-cfg  -fsel-sched-pipelining-verbose
776 -fstats  -fstack-usage  -ftime-report  -ftime-report-details
777 -fvar-tracking-assignments-toggle  -gtoggle
778 -print-file-name=@var{library}  -print-libgcc-file-name
779 -print-multi-directory  -print-multi-lib  -print-multi-os-directory
780 -print-prog-name=@var{program}  -print-search-dirs  -Q
781 -print-sysroot  -print-sysroot-headers-suffix
782 -save-temps  -save-temps=cwd  -save-temps=obj  -time@r{[}=@var{file}@r{]}}
784 @item Machine-Dependent Options
785 @xref{Submodel Options,,Machine-Dependent Options}.
786 @c This list is ordered alphanumerically by subsection name.
787 @c Try and put the significant identifier (CPU or system) first,
788 @c so users have a clue at guessing where the ones they want will be.
790 @emph{AArch64 Options}
791 @gccoptlist{-mabi=@var{name}  -mbig-endian  -mlittle-endian
792 -mgeneral-regs-only
793 -mcmodel=tiny  -mcmodel=small  -mcmodel=large
794 -mstrict-align  -mno-strict-align
795 -momit-leaf-frame-pointer
796 -mtls-dialect=desc  -mtls-dialect=traditional
797 -mtls-size=@var{size}
798 -mfix-cortex-a53-835769  -mfix-cortex-a53-843419
799 -mlow-precision-recip-sqrt  -mlow-precision-sqrt  -mlow-precision-div
800 -mpc-relative-literal-loads
801 -msign-return-address=@var{scope}
802 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
803 +@var{b-key}]|@var{bti}
804 -mharden-sls=@var{opts}
805 -march=@var{name}  -mcpu=@var{name}  -mtune=@var{name}
806 -moverride=@var{string}  -mverbose-cost-dump
807 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg}
808 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation
809 -moutline-atomics -mearly-ldp-fusion -mlate-ldp-fusion}
811 @emph{Adapteva Epiphany Options}
812 @gccoptlist{-mhalf-reg-file  -mprefer-short-insn-regs
813 -mbranch-cost=@var{num}  -mcmove  -mnops=@var{num}  -msoft-cmpsf
814 -msplit-lohi  -mpost-inc  -mpost-modify  -mstack-offset=@var{num}
815 -mround-nearest  -mlong-calls  -mshort-calls  -msmall16
816 -mfp-mode=@var{mode}  -mvect-double  -max-vect-align=@var{num}
817 -msplit-vecmove-early  -m1reg-@var{reg}}
819 @emph{AMD GCN Options}
820 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
822 @emph{ARC Options}
823 @gccoptlist{-mbarrel-shifter  -mjli-always
824 -mcpu=@var{cpu}  -mA6  -mARC600  -mA7  -mARC700
825 -mdpfp  -mdpfp-compact  -mdpfp-fast  -mno-dpfp-lrsr
826 -mea  -mno-mpy  -mmul32x16  -mmul64  -matomic
827 -mnorm  -mspfp  -mspfp-compact  -mspfp-fast  -msimd  -msoft-float  -mswap
828 -mcrc  -mdsp-packa  -mdvbf  -mlock  -mmac-d16  -mmac-24  -mrtsc  -mswape
829 -mtelephony  -mxy  -misize  -mannotate-align  -marclinux  -marclinux_prof
830 -mlong-calls  -mmedium-calls  -msdata  -mirq-ctrl-saved
831 -mrgf-banked-regs  -mlpc-width=@var{width}  -G @var{num}
832 -mvolatile-cache  -mtp-regno=@var{regno}
833 -malign-call  -mauto-modify-reg  -mbbit-peephole  -mno-brcc
834 -mcase-vector-pcrel  -mcompact-casesi  -mno-cond-exec  -mearly-cbranchsi
835 -mexpand-adddi  -mindexed-loads  -mlra  -mlra-priority-none
836 -mlra-priority-compact -mlra-priority-noncompact  -mmillicode
837 -mmixed-code  -mq-class  -mRcq  -mRcw  -msize-level=@var{level}
838 -mtune=@var{cpu}  -mmultcost=@var{num}  -mcode-density-frame
839 -munalign-prob-threshold=@var{probability}  -mmpy-option=@var{multo}
840 -mdiv-rem  -mcode-density  -mll64  -mfpu=@var{fpu}  -mrf16  -mbranch-index}
842 @emph{ARM Options}
843 @gccoptlist{-mapcs-frame  -mno-apcs-frame
844 -mabi=@var{name}
845 -mapcs-stack-check  -mno-apcs-stack-check
846 -mapcs-reentrant  -mno-apcs-reentrant
847 -mgeneral-regs-only
848 -msched-prolog  -mno-sched-prolog
849 -mlittle-endian  -mbig-endian
850 -mbe8  -mbe32
851 -mfloat-abi=@var{name}
852 -mfp16-format=@var{name}
853 -mthumb-interwork  -mno-thumb-interwork
854 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}
855 -mtune=@var{name}  -mprint-tune-info
856 -mstructure-size-boundary=@var{n}
857 -mabort-on-noreturn
858 -mlong-calls  -mno-long-calls
859 -msingle-pic-base  -mno-single-pic-base
860 -mpic-register=@var{reg}
861 -mnop-fun-dllimport
862 -mpoke-function-name
863 -mthumb  -marm  -mflip-thumb
864 -mtpcs-frame  -mtpcs-leaf-frame
865 -mcaller-super-interworking  -mcallee-super-interworking
866 -mtp=@var{name}  -mtls-dialect=@var{dialect}
867 -mword-relocations
868 -mfix-cortex-m3-ldrd
869 -mfix-cortex-a57-aes-1742098
870 -mfix-cortex-a72-aes-1655431
871 -munaligned-access
872 -mneon-for-64bits
873 -mslow-flash-data
874 -masm-syntax-unified
875 -mrestrict-it
876 -mverbose-cost-dump
877 -mpure-code
878 -mcmse
879 -mfix-cmse-cve-2021-35465
880 -mstack-protector-guard=@var{guard} -mstack-protector-guard-offset=@var{offset}
881 -mfdpic
882 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}]
883 [+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]]}
885 @emph{AVR Options}
886 @gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args
887 -mbranch-cost=@var{cost}
888 -mcall-prologues  -mgas-isr-prologues  -mint8  -mflmap
889 -mdouble=@var{bits}  -mlong-double=@var{bits}
890 -mn_flash=@var{size}  -mno-interrupts
891 -mmain-is-OS_task  -mrelax  -mrmw  -mstrict-X  -mtiny-stack
892 -mrodata-in-ram  -mfract-convert-truncate
893 -mshort-calls  -mskip-bug  -nodevicelib  -nodevicespecs
894 -Waddr-space-convert  -Wmisspelled-isr}
896 @emph{Blackfin Options}
897 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
898 -msim  -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer
899 -mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly
900 -mlow-64k  -mno-low64k  -mstack-check-l1  -mid-shared-library
901 -mno-id-shared-library  -mshared-library-id=@var{n}
902 -mleaf-id-shared-library  -mno-leaf-id-shared-library
903 -msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls
904 -mfast-fp  -minline-plt  -mmulticore  -mcorea  -mcoreb  -msdram
905 -micplb}
907 @emph{C6X Options}
908 @gccoptlist{-mbig-endian  -mlittle-endian  -march=@var{cpu}
909 -msim  -msdata=@var{sdata-type}}
911 @emph{CRIS Options}
912 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}
913 -mtune=@var{cpu} -mmax-stack-frame=@var{n}
914 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects
915 -mstack-align  -mdata-align  -mconst-align
916 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue
917 -melf  -maout  -sim  -sim2
918 -mmul-bug-workaround  -mno-mul-bug-workaround}
920 @emph{C-SKY Options}
921 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}
922 -mbig-endian  -EB  -mlittle-endian  -EL
923 -mhard-float  -msoft-float  -mfpu=@var{fpu}  -mdouble-float  -mfdivdu
924 -mfloat-abi=@var{name}
925 -melrw  -mistack  -mmp  -mcp  -mcache  -msecurity  -mtrust
926 -mdsp  -medsp  -mvdsp
927 -mdiv  -msmart  -mhigh-registers  -manchor
928 -mpushpop  -mmultiple-stld  -mconstpool  -mstack-size  -mccrt
929 -mbranch-cost=@var{n}  -mcse-cc  -msched-prolog -msim}
931 @emph{Darwin Options}
932 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal
933 -arch_only  -bind_at_load  -bundle  -bundle_loader
934 -client_name  -compatibility_version  -current_version
935 -dead_strip
936 -dependency-file  -dylib_file  -dylinker_install_name
937 -dynamic  -dynamiclib  -exported_symbols_list
938 -filelist  -flat_namespace  -force_cpusubtype_ALL
939 -force_flat_namespace  -headerpad_max_install_names
940 -iframework
941 -image_base  -init  -install_name  -keep_private_externs
942 -multi_module  -multiply_defined  -multiply_defined_unused
943 -noall_load   -no_dead_strip_inits_and_terms -nodefaultrpaths
944 -nofixprebinding  -nomultidefs  -noprebind  -noseglinkedit
945 -pagezero_size  -prebind  -prebind_all_twolevel_modules
946 -private_bundle  -read_only_relocs  -sectalign
947 -sectobjectsymbols  -whyload  -seg1addr
948 -sectcreate  -sectobjectsymbols  -sectorder
949 -segaddr  -segs_read_only_addr  -segs_read_write_addr
950 -seg_addr_table  -seg_addr_table_filename  -seglinkedit
951 -segprot  -segs_read_only_addr  -segs_read_write_addr
952 -single_module  -static  -sub_library  -sub_umbrella
953 -twolevel_namespace  -umbrella  -undefined
954 -unexported_symbols_list  -weak_reference_mismatches
955 -whatsloaded  -F  -gused  -gfull  -mmacosx-version-min=@var{version}
956 -mkernel  -mone-byte-bool}
958 @emph{DEC Alpha Options}
959 @gccoptlist{-mno-fp-regs  -msoft-float
960 -mieee  -mieee-with-inexact  -mieee-conformant
961 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode}
962 -mtrap-precision=@var{mode}  -mbuild-constants
963 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type}
964 -mbwx  -mmax  -mfix  -mcix
965 -mfloat-vax  -mfloat-ieee
966 -mexplicit-relocs  -msmall-data  -mlarge-data
967 -msmall-text  -mlarge-text
968 -mmemory-latency=@var{time}}
970 @emph{eBPF Options}
971 @gccoptlist{-mbig-endian -mlittle-endian
972 -mframe-limit=@var{bytes} -mxbpf -mco-re -mno-co-re -mjmpext
973 -mjmp32 -malu32 -mv3-atomics -mbswap -msdiv -msmov -mcpu=@var{version}
974 -masm=@var{dialect}}
976 @emph{FR30 Options}
977 @gccoptlist{-msmall-model  -mno-lsim}
979 @emph{FT32 Options}
980 @gccoptlist{-msim  -mlra  -mnodiv  -mft32b  -mcompress  -mnopm}
982 @emph{FRV Options}
983 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64
984 -mhard-float  -msoft-float
985 -malloc-cc  -mfixed-cc  -mdword  -mno-dword
986 -mdouble  -mno-double
987 -mmedia  -mno-media  -mmuladd  -mno-muladd
988 -mfdpic  -minline-plt  -mgprel-ro  -multilib-library-pic
989 -mlinked-fp  -mlong-calls  -malign-labels
990 -mlibrary-pic  -macc-4  -macc-8
991 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move
992 -moptimize-membar  -mno-optimize-membar
993 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec
994 -mvliw-branch  -mno-vliw-branch
995 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec
996 -mno-nested-cond-exec  -mtomcat-stats
997 -mTLS  -mtls
998 -mcpu=@var{cpu}}
1000 @emph{GNU/Linux Options}
1001 @gccoptlist{-mglibc  -muclibc  -mmusl  -mbionic  -mandroid
1002 -tno-android-cc  -tno-android-ld}
1004 @emph{H8/300 Options}
1005 @gccoptlist{-mrelax  -mh  -ms  -mn  -mexr  -mno-exr  -mint32  -malign-300}
1007 @emph{HPPA Options}
1008 @gccoptlist{-march=@var{architecture-type}
1009 -matomic-libcalls  -mbig-switch
1010 -mcaller-copies  -mdisable-fpregs  -mdisable-indexing
1011 -mordered  -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld
1012 -mfixed-range=@var{register-range}
1013 -mcoherent-ldcw -mjump-in-delay  -mlinker-opt  -mlong-calls
1014 -mlong-load-store  -mno-atomic-libcalls  -mno-disable-fpregs
1015 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas
1016 -mno-jump-in-delay  -mno-long-load-store
1017 -mno-portable-runtime  -mno-soft-float
1018 -mno-space-regs  -msoft-float  -mpa-risc-1-0
1019 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime
1020 -mschedule=@var{cpu-type}  -mspace-regs  -msoft-mult  -msio  -mwsio
1021 -munix=@var{unix-std}  -nolibdld  -static  -threads}
1023 @emph{IA-64 Options}
1024 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic
1025 -mvolatile-asm-stop  -mregister-names  -msdata  -mno-sdata
1026 -mconstant-gp  -mauto-pic  -mfused-madd
1027 -minline-float-divide-min-latency
1028 -minline-float-divide-max-throughput
1029 -mno-inline-float-divide
1030 -minline-int-divide-min-latency
1031 -minline-int-divide-max-throughput
1032 -mno-inline-int-divide
1033 -minline-sqrt-min-latency  -minline-sqrt-max-throughput
1034 -mno-inline-sqrt
1035 -mdwarf2-asm  -mearly-stop-bits
1036 -mfixed-range=@var{register-range}  -mtls-size=@var{tls-size}
1037 -mtune=@var{cpu-type}  -milp32  -mlp64
1038 -msched-br-data-spec  -msched-ar-data-spec  -msched-control-spec
1039 -msched-br-in-data-spec  -msched-ar-in-data-spec  -msched-in-control-spec
1040 -msched-spec-ldc  -msched-spec-control-ldc
1041 -msched-prefer-non-data-spec-insns  -msched-prefer-non-control-spec-insns
1042 -msched-stop-bits-after-every-cycle  -msched-count-spec-in-critical-path
1043 -msel-sched-dont-check-control-spec  -msched-fp-mem-deps-zero-cost
1044 -msched-max-memory-insns-hard-limit  -msched-max-memory-insns=@var{max-insns}}
1046 @emph{LM32 Options}
1047 @gccoptlist{-mbarrel-shift-enabled  -mdivide-enabled  -mmultiply-enabled
1048 -msign-extend-enabled  -muser-enabled}
1050 @emph{LoongArch Options}
1051 @gccoptlist{-march=@var{cpu-type}  -mtune=@var{cpu-type} -mabi=@var{base-abi-type}
1052 -mfpu=@var{fpu-type} -msimd=@var{simd-type}
1053 -msoft-float -msingle-float -mdouble-float -mlsx -mno-lsx -mlasx -mno-lasx
1054 -mbranch-cost=@var{n}  -mcheck-zero-division -mno-check-zero-division
1055 -mcond-move-int  -mno-cond-move-int
1056 -mcond-move-float  -mno-cond-move-float
1057 -memcpy  -mno-memcpy -mstrict-align -mno-strict-align
1058 -mmax-inline-memcpy-size=@var{n}
1059 -mexplicit-relocs=@var{style} -mexplicit-relocs -mno-explicit-relocs
1060 -mdirect-extern-access -mno-direct-extern-access
1061 -mcmodel=@var{code-model} -mrelax -mpass-mrelax-to-as}
1062 -mrecip  -mrecip=@var{opt}
1064 @emph{M32R/D Options}
1065 @gccoptlist{-m32r2  -m32rx  -m32r
1066 -mdebug
1067 -malign-loops  -mno-align-loops
1068 -missue-rate=@var{number}
1069 -mbranch-cost=@var{number}
1070 -mmodel=@var{code-size-model-type}
1071 -msdata=@var{sdata-type}
1072 -mno-flush-func  -mflush-func=@var{name}
1073 -mno-flush-trap  -mflush-trap=@var{number}
1074 -G @var{num}}
1076 @emph{M32C Options}
1077 @gccoptlist{-mcpu=@var{cpu}  -msim  -memregs=@var{number}}
1079 @emph{M680x0 Options}
1080 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune}
1081 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040
1082 -m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407
1083 -mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020
1084 -mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort
1085 -mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel
1086 -malign-int  -mstrict-align  -msep-data  -mno-sep-data
1087 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library
1088 -mxgot  -mno-xgot  -mlong-jump-table-offsets}
1090 @emph{MCore Options}
1091 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates
1092 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields
1093 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data
1094 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim
1095 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
1097 @emph{MicroBlaze Options}
1098 @gccoptlist{-msoft-float  -mhard-float  -msmall-divides  -mcpu=@var{cpu}
1099 -mmemcpy  -mxl-soft-mul  -mxl-soft-div  -mxl-barrel-shift
1100 -mxl-pattern-compare  -mxl-stack-check  -mxl-gp-opt  -mno-clearbss
1101 -mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt
1102 -mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model}
1103 -mpic-data-is-text-relative}
1105 @emph{MIPS Options}
1106 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch}
1107 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips32r3  -mips32r5
1108 -mips32r6  -mips64  -mips64r2  -mips64r3  -mips64r5  -mips64r6
1109 -mips16  -mno-mips16  -mflip-mips16
1110 -minterlink-compressed  -mno-interlink-compressed
1111 -minterlink-mips16  -mno-interlink-mips16
1112 -mabi=@var{abi}  -mabicalls  -mno-abicalls
1113 -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot
1114 -mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float
1115 -mno-float  -msingle-float  -mdouble-float
1116 -modd-spreg  -mno-odd-spreg
1117 -mabs=@var{mode}  -mnan=@var{encoding}
1118 -mdsp  -mno-dsp  -mdspr2  -mno-dspr2
1119 -mmcu  -mmno-mcu
1120 -meva  -mno-eva
1121 -mvirt  -mno-virt
1122 -mxpa  -mno-xpa
1123 -mcrc  -mno-crc
1124 -mginv  -mno-ginv
1125 -mmicromips  -mno-micromips
1126 -mmsa  -mno-msa
1127 -mloongson-mmi  -mno-loongson-mmi
1128 -mloongson-ext  -mno-loongson-ext
1129 -mloongson-ext2  -mno-loongson-ext2
1130 -mfpu=@var{fpu-type}
1131 -msmartmips  -mno-smartmips
1132 -mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx
1133 -mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc
1134 -mlong64  -mlong32  -msym32  -mno-sym32
1135 -G@var{num}  -mlocal-sdata  -mno-local-sdata
1136 -mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt
1137 -membedded-data  -mno-embedded-data
1138 -muninit-const-in-rodata  -mno-uninit-const-in-rodata
1139 -mcode-readable=@var{setting}
1140 -msplit-addresses  -mno-split-addresses
1141 -mexplicit-relocs  -mno-explicit-relocs
1142 -mexplicit-relocs=@var{release}
1143 -mcheck-zero-division  -mno-check-zero-division
1144 -mdivide-traps  -mdivide-breaks
1145 -mload-store-pairs  -mno-load-store-pairs
1146 -munaligned-access  -mno-unaligned-access
1147 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls
1148 -mmad  -mno-mad  -mimadd  -mno-imadd  -mfused-madd  -mno-fused-madd  -nocpp
1149 -mfix-24k  -mno-fix-24k
1150 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400
1151 -mfix-r5900  -mno-fix-r5900
1152 -mfix-r10000  -mno-fix-r10000  -mfix-rm7000  -mno-fix-rm7000
1153 -mfix-vr4120  -mno-fix-vr4120
1154 -mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1
1155 -mflush-func=@var{func}  -mno-flush-func
1156 -mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely
1157 -mcompact-branches=@var{policy}
1158 -mfp-exceptions  -mno-fp-exceptions
1159 -mvr4130-align  -mno-vr4130-align  -msynci  -mno-synci
1160 -mlxc1-sxc1  -mno-lxc1-sxc1  -mmadd4  -mno-madd4
1161 -mrelax-pic-calls  -mno-relax-pic-calls  -mmcount-ra-address
1162 -mframe-header-opt  -mno-frame-header-opt}
1164 @emph{MMIX Options}
1165 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu
1166 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols
1167 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses
1168 -mno-base-addresses  -msingle-exit  -mno-single-exit}
1170 @emph{MN10300 Options}
1171 @gccoptlist{-mmult-bug  -mno-mult-bug
1172 -mno-am33  -mam33  -mam33-2  -mam34
1173 -mtune=@var{cpu-type}
1174 -mreturn-pointer-on-d0
1175 -mno-crt0  -mrelax  -mliw  -msetlb}
1177 @emph{Moxie Options}
1178 @gccoptlist{-meb  -mel  -mmul.x  -mno-crt0}
1180 @emph{MSP430 Options}
1181 @gccoptlist{-msim  -masm-hex  -mmcu=  -mcpu=  -mlarge  -msmall  -mrelax
1182 -mwarn-mcu
1183 -mcode-region=  -mdata-region=
1184 -msilicon-errata=  -msilicon-errata-warn=
1185 -mhwmult=  -minrt  -mtiny-printf  -mmax-inline-shift=}
1187 @emph{NDS32 Options}
1188 @gccoptlist{-mbig-endian  -mlittle-endian
1189 -mreduced-regs  -mfull-regs
1190 -mcmov  -mno-cmov
1191 -mext-perf  -mno-ext-perf
1192 -mext-perf2  -mno-ext-perf2
1193 -mext-string  -mno-ext-string
1194 -mv3push  -mno-v3push
1195 -m16bit  -mno-16bit
1196 -misr-vector-size=@var{num}
1197 -mcache-block-size=@var{num}
1198 -march=@var{arch}
1199 -mcmodel=@var{code-model}
1200 -mctor-dtor  -mrelax}
1202 @emph{Nios II Options}
1203 @gccoptlist{-G @var{num}  -mgpopt=@var{option}  -mgpopt  -mno-gpopt
1204 -mgprel-sec=@var{regexp}  -mr0rel-sec=@var{regexp}
1205 -mel  -meb
1206 -mno-bypass-cache  -mbypass-cache
1207 -mno-cache-volatile  -mcache-volatile
1208 -mno-fast-sw-div  -mfast-sw-div
1209 -mhw-mul  -mno-hw-mul  -mhw-mulx  -mno-hw-mulx  -mno-hw-div  -mhw-div
1210 -mcustom-@var{insn}=@var{N}  -mno-custom-@var{insn}
1211 -mcustom-fpu-cfg=@var{name}
1212 -mhal  -msmallc  -msys-crt0=@var{name}  -msys-lib=@var{name}
1213 -march=@var{arch}  -mbmx  -mno-bmx  -mcdx  -mno-cdx}
1215 @emph{Nvidia PTX Options}
1216 @gccoptlist{-m64  -mmainkernel  -moptimize}
1218 @emph{OpenRISC Options}
1219 @gccoptlist{-mboard=@var{name}  -mnewlib  -mhard-mul  -mhard-div
1220 -msoft-mul  -msoft-div
1221 -msoft-float  -mhard-float  -mdouble-float -munordered-float
1222 -mcmov  -mror  -mrori  -msext  -msfimm  -mshftimm
1223 -mcmodel=@var{code-model}}
1225 @emph{PDP-11 Options}
1226 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10
1227 -mint32  -mno-int16  -mint16  -mno-int32
1228 -msplit  -munix-asm  -mdec-asm  -mgnu-asm  -mlra}
1230 @emph{PowerPC Options}
1231 See RS/6000 and PowerPC Options.
1233 @emph{PRU Options}
1234 @gccoptlist{-mmcu=@var{mcu}  -minrt  -mno-relax  -mloop
1235 -mabi=@var{variant}}
1237 @emph{RISC-V Options}
1238 @gccoptlist{-mbranch-cost=@var{N-instruction}
1239 -mplt  -mno-plt
1240 -mabi=@var{ABI-string}
1241 -mfdiv  -mno-fdiv
1242 -mdiv  -mno-div
1243 -misa-spec=@var{ISA-spec-string}
1244 -march=@var{ISA-string}
1245 -mtune=@var{processor-string}
1246 -mpreferred-stack-boundary=@var{num}
1247 -msmall-data-limit=@var{N-bytes}
1248 -msave-restore  -mno-save-restore
1249 -mshorten-memrefs  -mno-shorten-memrefs
1250 -mstrict-align  -mno-strict-align
1251 -mcmodel=medlow  -mcmodel=medany
1252 -mexplicit-relocs  -mno-explicit-relocs
1253 -mrelax  -mno-relax
1254 -mriscv-attribute  -mno-riscv-attribute
1255 -malign-data=@var{type}
1256 -mbig-endian  -mlittle-endian
1257 -mstack-protector-guard=@var{guard}  -mstack-protector-guard-reg=@var{reg}
1258 -mstack-protector-guard-offset=@var{offset}
1259 -mcsr-check -mno-csr-check
1260 -mmovcc  -mno-movcc
1261 -minline-atomics  -mno-inline-atomics
1262 -minline-strlen  -mno-inline-strlen
1263 -minline-strcmp  -mno-inline-strcmp
1264 -minline-strncmp  -mno-inline-strncmp}
1266 @emph{RL78 Options}
1267 @gccoptlist{-msim  -mmul=none  -mmul=g13  -mmul=g14  -mallregs
1268 -mcpu=g10  -mcpu=g13  -mcpu=g14  -mg10  -mg13  -mg14
1269 -m64bit-doubles  -m32bit-doubles  -msave-mduc-in-interrupts}
1271 @emph{RS/6000 and PowerPC Options}
1272 @gccoptlist{-mcpu=@var{cpu-type}
1273 -mtune=@var{cpu-type}
1274 -mcmodel=@var{code-model}
1275 -mpowerpc64
1276 -maltivec  -mno-altivec
1277 -mpowerpc-gpopt  -mno-powerpc-gpopt
1278 -mpowerpc-gfxopt  -mno-powerpc-gfxopt
1279 -mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mpopcntd  -mno-popcntd
1280 -mfprnd  -mno-fprnd
1281 -mcmpb  -mno-cmpb  -mhard-dfp  -mno-hard-dfp
1282 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc
1283 -m64  -m32  -mxl-compat  -mno-xl-compat  -mpe
1284 -malign-power  -malign-natural
1285 -msoft-float  -mhard-float  -mmultiple  -mno-multiple
1286 -mupdate  -mno-update
1287 -mavoid-indexed-addresses  -mno-avoid-indexed-addresses
1288 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align
1289 -mstrict-align  -mno-strict-align  -mrelocatable
1290 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib
1291 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian
1292 -mdynamic-no-pic  -mswdiv  -msingle-pic-base
1293 -mprioritize-restricted-insns=@var{priority}
1294 -msched-costly-dep=@var{dependence_type}
1295 -minsert-sched-nops=@var{scheme}
1296 -mcall-aixdesc  -mcall-eabi  -mcall-freebsd
1297 -mcall-linux  -mcall-netbsd  -mcall-openbsd
1298 -mcall-sysv  -mcall-sysv-eabi  -mcall-sysv-noeabi
1299 -mtraceback=@var{traceback_type}
1300 -maix-struct-return  -msvr4-struct-return
1301 -mabi=@var{abi-type}  -msecure-plt  -mbss-plt
1302 -mlongcall  -mno-longcall  -mpltseq  -mno-pltseq
1303 -mblock-move-inline-limit=@var{num}
1304 -mblock-compare-inline-limit=@var{num}
1305 -mblock-compare-inline-loop-limit=@var{num}
1306 -mno-block-ops-unaligned-vsx
1307 -mstring-compare-inline-limit=@var{num}
1308 -misel  -mno-isel
1309 -mvrsave  -mno-vrsave
1310 -mmulhw  -mno-mulhw
1311 -mdlmzb  -mno-dlmzb
1312 -mprototype  -mno-prototype
1313 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata
1314 -msdata=@var{opt}  -mreadonly-in-sdata  -mvxworks  -G @var{num}
1315 -mrecip  -mrecip=@var{opt}  -mno-recip  -mrecip-precision
1316 -mno-recip-precision
1317 -mveclibabi=@var{type}  -mfriz  -mno-friz
1318 -mpointers-to-nested-functions  -mno-pointers-to-nested-functions
1319 -msave-toc-indirect  -mno-save-toc-indirect
1320 -mpower8-fusion  -mno-mpower8-fusion  -mpower8-vector  -mno-power8-vector
1321 -mcrypto  -mno-crypto  -mhtm  -mno-htm
1322 -mquad-memory  -mno-quad-memory
1323 -mquad-memory-atomic  -mno-quad-memory-atomic
1324 -mcompat-align-parm  -mno-compat-align-parm
1325 -mfloat128  -mno-float128  -mfloat128-hardware  -mno-float128-hardware
1326 -mgnu-attribute  -mno-gnu-attribute
1327 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg}
1328 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed
1329 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
1330 -mprivileged -mno-privileged}
1332 @emph{RX Options}
1333 @gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu
1334 -mcpu=
1335 -mbig-endian-data  -mlittle-endian-data
1336 -msmall-data
1337 -msim  -mno-sim
1338 -mas100-syntax  -mno-as100-syntax
1339 -mrelax
1340 -mmax-constant-size=
1341 -mint-register=
1342 -mpid
1343 -mallow-string-insns  -mno-allow-string-insns
1344 -mjsr
1345 -mno-warn-multiple-fast-interrupts
1346 -msave-acc-in-interrupts}
1348 @emph{S/390 and zSeries Options}
1349 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type}
1350 -mhard-float  -msoft-float  -mhard-dfp  -mno-hard-dfp
1351 -mlong-double-64  -mlong-double-128
1352 -mbackchain  -mno-backchain  -mpacked-stack  -mno-packed-stack
1353 -msmall-exec  -mno-small-exec  -mmvcle  -mno-mvcle
1354 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch
1355 -mhtm  -mvx  -mzvector
1356 -mtpf-trace  -mno-tpf-trace  -mtpf-trace-skip  -mno-tpf-trace-skip
1357 -mfused-madd  -mno-fused-madd
1358 -mwarn-framesize  -mwarn-dynamicstack  -mstack-size  -mstack-guard
1359 -mhotpatch=@var{halfwords},@var{halfwords}}
1361 @emph{SH Options}
1362 @gccoptlist{-m1  -m2  -m2e
1363 -m2a-nofpu  -m2a-single-only  -m2a-single  -m2a
1364 -m3  -m3e
1365 -m4-nofpu  -m4-single-only  -m4-single  -m4
1366 -m4a-nofpu  -m4a-single-only  -m4a-single  -m4a  -m4al
1367 -mb  -ml  -mdalign  -mrelax
1368 -mbigtable  -mfmovd  -mrenesas  -mno-renesas  -mnomacsave
1369 -mieee  -mno-ieee  -mbitops  -misize  -minline-ic_invalidate  -mpadstruct
1370 -mprefergot  -musermode  -multcost=@var{number}  -mdiv=@var{strategy}
1371 -mdivsi3_libfunc=@var{name}  -mfixed-range=@var{register-range}
1372 -maccumulate-outgoing-args
1373 -matomic-model=@var{atomic-model}
1374 -mbranch-cost=@var{num}  -mzdcbranch  -mno-zdcbranch
1375 -mcbranch-force-delay-slot
1376 -mfused-madd  -mno-fused-madd  -mfsca  -mno-fsca  -mfsrra  -mno-fsrra
1377 -mpretend-cmove  -mtas}
1379 @emph{Solaris 2 Options}
1380 @gccoptlist{-mclear-hwcap  -mno-clear-hwcap  -mimpure-text  -mno-impure-text
1381 -pthreads}
1383 @emph{SPARC Options}
1384 @gccoptlist{-mcpu=@var{cpu-type}
1385 -mtune=@var{cpu-type}
1386 -mcmodel=@var{code-model}
1387 -mmemory-model=@var{mem-model}
1388 -m32  -m64  -mapp-regs  -mno-app-regs
1389 -mfaster-structs  -mno-faster-structs  -mflat  -mno-flat
1390 -mfpu  -mno-fpu  -mhard-float  -msoft-float
1391 -mhard-quad-float  -msoft-quad-float
1392 -mstack-bias  -mno-stack-bias
1393 -mstd-struct-return  -mno-std-struct-return
1394 -munaligned-doubles  -mno-unaligned-doubles
1395 -muser-mode  -mno-user-mode
1396 -mv8plus  -mno-v8plus  -mvis  -mno-vis
1397 -mvis2  -mno-vis2  -mvis3  -mno-vis3
1398 -mvis4  -mno-vis4  -mvis4b  -mno-vis4b
1399 -mcbcond  -mno-cbcond  -mfmaf  -mno-fmaf  -mfsmuld  -mno-fsmuld
1400 -mpopc  -mno-popc  -msubxc  -mno-subxc
1401 -mfix-at697f  -mfix-ut699  -mfix-ut700  -mfix-gr712rc
1402 -mlra  -mno-lra}
1404 @emph{System V Options}
1405 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
1407 @emph{V850 Options}
1408 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep
1409 -mprolog-function  -mno-prolog-function  -mspace
1410 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n}
1411 -mapp-regs  -mno-app-regs
1412 -mdisable-callt  -mno-disable-callt
1413 -mv850e2v3  -mv850e2  -mv850e1  -mv850es
1414 -mv850e  -mv850  -mv850e3v5
1415 -mloop
1416 -mrelax
1417 -mlong-jumps
1418 -msoft-float
1419 -mhard-float
1420 -mgcc-abi
1421 -mrh850-abi
1422 -mbig-switch}
1424 @emph{VAX Options}
1425 @gccoptlist{-mg  -mgnu  -munix  -mlra}
1427 @emph{Visium Options}
1428 @gccoptlist{-mdebug  -msim  -mfpu  -mno-fpu  -mhard-float  -msoft-float
1429 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type}  -msv-mode  -muser-mode}
1431 @emph{VMS Options}
1432 @gccoptlist{-mvms-return-codes  -mdebug-main=@var{prefix}  -mmalloc64
1433 -mpointer-size=@var{size}}
1435 @emph{VxWorks Options}
1436 @gccoptlist{-mrtp  -msmp  -non-static  -Bstatic  -Bdynamic
1437 -Xbind-lazy  -Xbind-now}
1439 @emph{x86 Options}
1440 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type}
1441 -mtune-ctrl=@var{feature-list}  -mdump-tune-features  -mno-default
1442 -mfpmath=@var{unit}
1443 -masm=@var{dialect}  -mno-fancy-math-387
1444 -mno-fp-ret-in-387  -m80387  -mhard-float  -msoft-float
1445 -mno-wide-multiply  -mrtd  -malign-double
1446 -mpreferred-stack-boundary=@var{num}
1447 -mincoming-stack-boundary=@var{num}
1448 -mcld  -mcx16  -msahf  -mmovbe  -mcrc32 -mmwait
1449 -mrecip  -mrecip=@var{opt}
1450 -mvzeroupper  -mprefer-avx128  -mprefer-vector-width=@var{opt}
1451 -mpartial-vector-fp-math
1452 -mmove-max=@var{bits} -mstore-max=@var{bits}
1453 -mmmx  -msse  -msse2  -msse3  -mssse3  -msse4.1  -msse4.2  -msse4  -mavx
1454 -mavx2  -mavx512f  -mavx512pf  -mavx512er  -mavx512cd  -mavx512vl
1455 -mavx512bw  -mavx512dq  -mavx512ifma  -mavx512vbmi  -msha  -maes
1456 -mpclmul  -mfsgsbase  -mrdrnd  -mf16c  -mfma  -mpconfig  -mwbnoinvd
1457 -mptwrite  -mprefetchwt1  -mclflushopt  -mclwb  -mxsavec  -mxsaves
1458 -msse4a  -m3dnow  -m3dnowa  -mpopcnt  -mabm  -mbmi  -mtbm  -mfma4  -mxop
1459 -madx  -mlzcnt  -mbmi2  -mfxsr  -mxsave  -mxsaveopt  -mrtm  -mhle  -mlwp
1460 -mmwaitx  -mclzero  -mpku  -mthreads  -mgfni  -mvaes  -mwaitpkg
1461 -mshstk -mmanual-endbr -mcet-switch -mforce-indirect-call
1462 -mavx512vbmi2 -mavx512bf16 -menqcmd
1463 -mvpclmulqdq  -mavx512bitalg  -mmovdiri  -mmovdir64b  -mavx512vpopcntdq
1464 -mavx5124fmaps  -mavx512vnni  -mavx5124vnniw  -mprfchw  -mrdpid
1465 -mrdseed  -msgx -mavx512vp2intersect -mserialize -mtsxldtrk
1466 -mamx-tile  -mamx-int8  -mamx-bf16 -muintr -mhreset -mavxvnni
1467 -mavx512fp16 -mavxifma -mavxvnniint8 -mavxneconvert -mcmpccxadd -mamx-fp16
1468 -mprefetchi -mraoint -mamx-complex -mavxvnniint16 -msm3 -msha512 -msm4 -mapxf
1469 -musermsr -mavx10.1 -mavx10.1-256 -mavx10.1-512 -mevex512
1470 -mcldemote  -mms-bitfields  -mno-align-stringops  -minline-all-stringops
1471 -minline-stringops-dynamically  -mstringop-strategy=@var{alg}
1472 -mkl -mwidekl
1473 -mmemcpy-strategy=@var{strategy}  -mmemset-strategy=@var{strategy}
1474 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double
1475 -m96bit-long-double  -mlong-double-64  -mlong-double-80  -mlong-double-128
1476 -mregparm=@var{num}  -msseregparm
1477 -mveclibabi=@var{type}  -mvect8-ret-in-mem
1478 -mpc32  -mpc64  -mpc80  -mdaz-ftz -mstackrealign
1479 -momit-leaf-frame-pointer  -mno-red-zone  -mno-tls-direct-seg-refs
1480 -mcmodel=@var{code-model}  -mabi=@var{name}  -maddress-mode=@var{mode}
1481 -m32  -m64  -mx32  -m16  -miamcu  -mlarge-data-threshold=@var{num}
1482 -msse2avx  -mfentry  -mrecord-mcount  -mnop-mcount  -m8bit-idiv
1483 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name}
1484 -mavx256-split-unaligned-load  -mavx256-split-unaligned-store
1485 -malign-data=@var{type}  -mstack-protector-guard=@var{guard}
1486 -mstack-protector-guard-reg=@var{reg}
1487 -mstack-protector-guard-offset=@var{offset}
1488 -mstack-protector-guard-symbol=@var{symbol}
1489 -mgeneral-regs-only  -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop
1490 -mindirect-branch=@var{choice}  -mfunction-return=@var{choice}
1491 -mindirect-branch-register -mharden-sls=@var{choice}
1492 -mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access
1493 -munroll-only-small-loops -mlam=@var{choice}}
1495 @emph{x86 Windows Options}
1496 @gccoptlist{-mconsole  -mcrtdll=@var{library}  -mdll
1497 -mnop-fun-dllimport  -mthread
1498 -municode  -mwin32  -mwindows  -fno-set-stack-executable}
1500 @emph{Xstormy16 Options}
1501 @gccoptlist{-msim}
1503 @emph{Xtensa Options}
1504 @gccoptlist{-mconst16  -mno-const16
1505 -mfused-madd  -mno-fused-madd
1506 -mforce-no-pic
1507 -mserialize-volatile  -mno-serialize-volatile
1508 -mtext-section-literals  -mno-text-section-literals
1509 -mauto-litpools  -mno-auto-litpools
1510 -mtarget-align  -mno-target-align
1511 -mlongcalls  -mno-longcalls
1512 -mabi=@var{abi-type}
1513 -mextra-l32r-costs=@var{cycles}
1514 -mstrict-align  -mno-strict-align}
1516 @emph{zSeries Options}
1517 See S/390 and zSeries Options.
1518 @end table
1521 @node Overall Options
1522 @section Options Controlling the Kind of Output
1524 Compilation can involve up to four stages: preprocessing, compilation
1525 proper, assembly and linking, always in that order.  GCC is capable of
1526 preprocessing and compiling several files either into several
1527 assembler input files, or into one assembler input file; then each
1528 assembler input file produces an object file, and linking combines all
1529 the object files (those newly compiled, and those specified as input)
1530 into an executable file.
1532 @cindex file name suffix
1533 For any given input file, the file name suffix determines what kind of
1534 compilation is done:
1536 @table @gcctabopt
1537 @item @var{file}.c
1538 C source code that must be preprocessed.
1540 @item @var{file}.i
1541 C source code that should not be preprocessed.
1543 @item @var{file}.ii
1544 C++ source code that should not be preprocessed.
1546 @item @var{file}.m
1547 Objective-C source code.  Note that you must link with the @file{libobjc}
1548 library to make an Objective-C program work.
1550 @item @var{file}.mi
1551 Objective-C source code that should not be preprocessed.
1553 @item @var{file}.mm
1554 @itemx @var{file}.M
1555 Objective-C++ source code.  Note that you must link with the @file{libobjc}
1556 library to make an Objective-C++ program work.  Note that @samp{.M} refers
1557 to a literal capital M@.
1559 @item @var{file}.mii
1560 Objective-C++ source code that should not be preprocessed.
1562 @item @var{file}.h
1563 C, C++, Objective-C or Objective-C++ header file to be turned into a
1564 precompiled header (default), or C, C++ header file to be turned into an
1565 Ada spec (via the @option{-fdump-ada-spec} switch).
1567 @item @var{file}.cc
1568 @itemx @var{file}.cp
1569 @itemx @var{file}.cxx
1570 @itemx @var{file}.cpp
1571 @itemx @var{file}.CPP
1572 @itemx @var{file}.c++
1573 @itemx @var{file}.C
1574 C++ source code that must be preprocessed.  Note that in @samp{.cxx},
1575 the last two letters must both be literally @samp{x}.  Likewise,
1576 @samp{.C} refers to a literal capital C@.
1578 @item @var{file}.mm
1579 @itemx @var{file}.M
1580 Objective-C++ source code that must be preprocessed.
1582 @item @var{file}.mii
1583 Objective-C++ source code that should not be preprocessed.
1585 @item @var{file}.hh
1586 @itemx @var{file}.H
1587 @itemx @var{file}.hp
1588 @itemx @var{file}.hxx
1589 @itemx @var{file}.hpp
1590 @itemx @var{file}.HPP
1591 @itemx @var{file}.h++
1592 @itemx @var{file}.tcc
1593 C++ header file to be turned into a precompiled header or Ada spec.
1595 @item @var{file}.f
1596 @itemx @var{file}.for
1597 @itemx @var{file}.ftn
1598 @itemx @var{file}.fi
1599 Fixed form Fortran source code that should not be preprocessed.
1601 @item @var{file}.F
1602 @itemx @var{file}.FOR
1603 @itemx @var{file}.fpp
1604 @itemx @var{file}.FPP
1605 @itemx @var{file}.FTN
1606 Fixed form Fortran source code that must be preprocessed (with the traditional
1607 preprocessor).
1609 @item @var{file}.f90
1610 @itemx @var{file}.f95
1611 @itemx @var{file}.f03
1612 @itemx @var{file}.f08
1613 @itemx @var{file}.fii
1614 Free form Fortran source code that should not be preprocessed.
1616 @item @var{file}.F90
1617 @itemx @var{file}.F95
1618 @itemx @var{file}.F03
1619 @itemx @var{file}.F08
1620 Free form Fortran source code that must be preprocessed (with the
1621 traditional preprocessor).
1623 @item @var{file}.go
1624 Go source code.
1626 @item @var{file}.d
1627 D source code.
1629 @item @var{file}.di
1630 D interface file.
1632 @item @var{file}.dd
1633 D documentation code (Ddoc).
1635 @item @var{file}.ads
1636 Ada source code file that contains a library unit declaration (a
1637 declaration of a package, subprogram, or generic, or a generic
1638 instantiation), or a library unit renaming declaration (a package,
1639 generic, or subprogram renaming declaration).  Such files are also
1640 called @dfn{specs}.
1642 @item @var{file}.adb
1643 Ada source code file containing a library unit body (a subprogram or
1644 package body).  Such files are also called @dfn{bodies}.
1646 @c GCC also knows about some suffixes for languages not yet included:
1647 @c Ratfor:
1648 @c @var{file}.r
1650 @item @var{file}.s
1651 Assembler code.
1653 @item @var{file}.S
1654 @itemx @var{file}.sx
1655 Assembler code that must be preprocessed.
1657 @item @var{other}
1658 An object file to be fed straight into linking.
1659 Any file name with no recognized suffix is treated this way.
1660 @end table
1662 @opindex x
1663 You can specify the input language explicitly with the @option{-x} option:
1665 @table @gcctabopt
1666 @item -x @var{language}
1667 Specify explicitly the @var{language} for the following input files
1668 (rather than letting the compiler choose a default based on the file
1669 name suffix).  This option applies to all following input files until
1670 the next @option{-x} option.  Possible values for @var{language} are:
1671 @smallexample
1672 c  c-header  cpp-output
1673 c++  c++-header  c++-system-header c++-user-header c++-cpp-output
1674 objective-c  objective-c-header  objective-c-cpp-output
1675 objective-c++ objective-c++-header objective-c++-cpp-output
1676 assembler  assembler-with-cpp
1679 f77  f77-cpp-input f95  f95-cpp-input
1681 @end smallexample
1683 @item -x none
1684 Turn off any specification of a language, so that subsequent files are
1685 handled according to their file name suffixes (as they are if @option{-x}
1686 has not been used at all).
1687 @end table
1689 If you only want some of the stages of compilation, you can use
1690 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1691 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1692 @command{gcc} is to stop.  Note that some combinations (for example,
1693 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1695 @table @gcctabopt
1696 @opindex c
1697 @item -c
1698 Compile or assemble the source files, but do not link.  The linking
1699 stage simply is not done.  The ultimate output is in the form of an
1700 object file for each source file.
1702 By default, the object file name for a source file is made by replacing
1703 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1705 Unrecognized input files, not requiring compilation or assembly, are
1706 ignored.
1708 @opindex S
1709 @item -S
1710 Stop after the stage of compilation proper; do not assemble.  The output
1711 is in the form of an assembler code file for each non-assembler input
1712 file specified.
1714 By default, the assembler file name for a source file is made by
1715 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1717 Input files that don't require compilation are ignored.
1719 @opindex E
1720 @item -E
1721 Stop after the preprocessing stage; do not run the compiler proper.  The
1722 output is in the form of preprocessed source code, which is sent to the
1723 standard output.
1725 Input files that don't require preprocessing are ignored.
1727 @cindex output file option
1728 @opindex o
1729 @item -o @var{file}
1730 Place the primary output in file @var{file}.  This applies to whatever
1731 sort of output is being produced, whether it be an executable file, an
1732 object file, an assembler file or preprocessed C code.
1734 If @option{-o} is not specified, the default is to put an executable
1735 file in @file{a.out}, the object file for
1736 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1737 assembler file in @file{@var{source}.s}, a precompiled header file in
1738 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1739 standard output.
1741 Though @option{-o} names only the primary output, it also affects the
1742 naming of auxiliary and dump outputs.  See the examples below.  Unless
1743 overridden, both auxiliary outputs and dump outputs are placed in the
1744 same directory as the primary output.  In auxiliary outputs, the suffix
1745 of the input file is replaced with that of the auxiliary output file
1746 type; in dump outputs, the suffix of the dump file is appended to the
1747 input file suffix.  In compilation commands, the base name of both
1748 auxiliary and dump outputs is that of the primary output; in compile and
1749 link commands, the primary output name, minus the executable suffix, is
1750 combined with the input file name.  If both share the same base name,
1751 disregarding the suffix, the result of the combination is that base
1752 name, otherwise, they are concatenated, separated by a dash.
1754 @smallexample
1755 gcc -c foo.c ...
1756 @end smallexample
1758 will use @file{foo.o} as the primary output, and place aux outputs and
1759 dumps next to it, e.g., aux file @file{foo.dwo} for
1760 @option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1761 @option{-fdump-rtl-final}.
1763 If a non-linker output file is explicitly specified, aux and dump files
1764 by default take the same base name:
1766 @smallexample
1767 gcc -c foo.c -o dir/foobar.o ...
1768 @end smallexample
1770 will name aux outputs @file{dir/foobar.*} and dump outputs
1771 @file{dir/foobar.c.*}.
1773 A linker output will instead prefix aux and dump outputs:
1775 @smallexample
1776 gcc foo.c bar.c -o dir/foobar ...
1777 @end smallexample
1779 will generally name aux outputs @file{dir/foobar-foo.*} and
1780 @file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1781 @file{dir/foobar-bar.c.*}.
1783 The one exception to the above is when the executable shares the base
1784 name with the single input:
1786 @smallexample
1787 gcc foo.c -o dir/foo ...
1788 @end smallexample
1790 in which case aux outputs are named @file{dir/foo.*} and dump outputs
1791 named @file{dir/foo.c.*}.
1793 The location and the names of auxiliary and dump outputs can be adjusted
1794 by the options @option{-dumpbase}, @option{-dumpbase-ext},
1795 @option{-dumpdir}, @option{-save-temps=cwd}, and
1796 @option{-save-temps=obj}.
1799 @opindex dumpbase
1800 @item -dumpbase @var{dumpbase}
1801 This option sets the base name for auxiliary and dump output files.  It
1802 does not affect the name of the primary output file.  Intermediate
1803 outputs, when preserved, are not regarded as primary outputs, but as
1804 auxiliary outputs:
1806 @smallexample
1807 gcc -save-temps -S foo.c
1808 @end smallexample
1810 saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1811 then compiles to the (implied) output file @file{foo.s}, whereas:
1813 @smallexample
1814 gcc -save-temps -dumpbase save-foo -c foo.c
1815 @end smallexample
1817 preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1818 an intermediate, thus auxiliary output), and then assembles to the
1819 (implied) output file @file{foo.o}.
1821 Absent this option, dump and aux files take their names from the input
1822 file, or from the (non-linker) output file, if one is explicitly
1823 specified: dump output files (e.g. those requested by @option{-fdump-*}
1824 options) with the input name suffix, and aux output files (those
1825 requested by other non-dump options, e.g. @code{-save-temps},
1826 @code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1828 Similar suffix differentiation of dump and aux outputs can be attained
1829 for explicitly-given @option{-dumpbase basename.suf} by also specifying
1830 @option{-dumpbase-ext .suf}.
1832 If @var{dumpbase} is explicitly specified with any directory component,
1833 any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1834 @option{-save-temps=*}) is ignored, and instead of appending to it,
1835 @var{dumpbase} fully overrides it:
1837 @smallexample
1838 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1839   -dumpdir pfx- -save-temps=cwd ...
1840 @end smallexample
1842 creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1843 @file{dir/} in @option{-o}, the @file{./} prefix implied by
1844 @option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1846 When @option{-dumpbase} is specified in a command that compiles multiple
1847 inputs, or that compiles and then links, it may be combined with
1848 @var{dumppfx}, as specified under @option{-dumpdir}.  Then, each input
1849 file is compiled using the combined @var{dumppfx}, and default values
1850 for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1851 file:
1853 @smallexample
1854 gcc foo.c bar.c -c -dumpbase main ...
1855 @end smallexample
1857 creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1858 overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1859 as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1860 and @file{main-bar.*}.
1862 An empty string specified as @var{dumpbase} avoids the influence of the
1863 output basename in the naming of auxiliary and dump outputs during
1864 compilation, computing default values :
1866 @smallexample
1867 gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1868 @end smallexample
1870 will name aux outputs @file{dir/foo.*} and dump outputs
1871 @file{dir/foo.c.*}.  Note how their basenames are taken from the input
1872 name, but the directory still defaults to that of the output.
1874 The empty-string dumpbase does not prevent the use of the output
1875 basename for outputs during linking:
1877 @smallexample
1878 gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1879 @end smallexample
1881 The compilation of the source files will name auxiliary outputs
1882 @file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1883 @file{dir/foo.c.*} and @file{dir/bar.c.*}.  LTO recompilation during
1884 linking will use @file{dir/foobar.} as the prefix for dumps and
1885 auxiliary files.
1888 @opindex dumpbase-ext
1889 @item -dumpbase-ext @var{auxdropsuf}
1890 When forming the name of an auxiliary (but not a dump) output file, drop
1891 trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1892 suffixes.  If not specified, this option defaults to the suffix of a
1893 default @var{dumpbase}, i.e., the suffix of the input file when
1894 @option{-dumpbase} is not present in the command line, or @var{dumpbase}
1895 is combined with @var{dumppfx}.
1897 @smallexample
1898 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1899 @end smallexample
1901 creates @file{dir/foo.o} as the main output, and generates auxiliary
1902 outputs in @file{dir/x-foo.*}, taking the location of the primary
1903 output, and dropping the @file{.c} suffix from the @var{dumpbase}.  Dump
1904 outputs retain the suffix: @file{dir/x-foo.c.*}.
1906 This option is disregarded if it does not match the suffix of a
1907 specified @var{dumpbase}, except as an alternative to the executable
1908 suffix when appending the linker output base name to @var{dumppfx}, as
1909 specified below:
1911 @smallexample
1912 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1913 @end smallexample
1915 creates @file{main.out} as the primary output, and avoids overwriting
1916 the auxiliary and dump outputs by using the executable name minus
1917 @var{auxdropsuf} as a prefix, creating auxiliary outputs named
1918 @file{main-foo.*} and @file{main-bar.*} and dump outputs named
1919 @file{main-foo.c.*} and @file{main-bar.c.*}.
1922 @opindex dumpdir
1923 @item -dumpdir @var{dumppfx}
1924 When forming the name of an auxiliary or dump output file, use
1925 @var{dumppfx} as a prefix:
1927 @smallexample
1928 gcc -dumpdir pfx- -c foo.c ...
1929 @end smallexample
1931 creates @file{foo.o} as the primary output, and auxiliary outputs named
1932 @file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1933 @var{dumpbase} derived from the default primary output, derived in turn
1934 from the input name.  Dump outputs also take the input name suffix:
1935 @file{pfx-foo.c.*}.
1937 If @var{dumppfx} is to be used as a directory name, it must end with a
1938 directory separator:
1940 @smallexample
1941 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1942 @end smallexample
1944 creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1945 named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1946 default @var{dumpbase} derived from the primary output name.  Dump
1947 outputs also take the input name suffix: @file{dir/bar.c.*}.
1949 It defaults to the location of the output file, unless the output
1950 file is a special file like @code{/dev/null}. Options
1951 @option{-save-temps=cwd} and @option{-save-temps=obj} override this
1952 default, just like an explicit @option{-dumpdir} option.  In case
1953 multiple such options are given, the last one prevails:
1955 @smallexample
1956 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1957 @end smallexample
1959 outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1960 @option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1961 @option{-dumpdir} option.  It does not matter that @option{=obj} is the
1962 default for @option{-save-temps}, nor that the output directory is
1963 implicitly the current directory.  Dump outputs are named
1964 @file{foo.c.*}.
1966 When compiling from multiple input files, if @option{-dumpbase} is
1967 specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1968 are appended to (or override, if containing any directory components) an
1969 explicit or defaulted @var{dumppfx}, so that each of the multiple
1970 compilations gets differently-named aux and dump outputs.
1972 @smallexample
1973 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1974 @end smallexample
1976 outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1977 @file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1978 Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1979 and @file{dir/pfx-main-bar.c.*}, respectively.  Contrast with the
1980 single-input compilation:
1982 @smallexample
1983 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1984 @end smallexample
1986 that, applying @option{-dumpbase} to a single source, does not compute
1987 and append a separate @var{dumpbase} per input file.  Its auxiliary and
1988 dump outputs go in @file{dir/pfx-main.*}.
1990 When compiling and then linking from multiple input files, a defaulted
1991 or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1992 transformation above (e.g. the compilation of @file{foo.c} and
1993 @file{bar.c} above, but without @option{-c}).  If neither
1994 @option{-dumpdir} nor @option{-dumpbase} are given, the linker output
1995 base name, minus @var{auxdropsuf}, if specified, or the executable
1996 suffix otherwise, plus a dash is appended to the default @var{dumppfx}
1997 instead.  Note, however, that unlike earlier cases of linking:
1999 @smallexample
2000 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
2001 @end smallexample
2003 does not append the output name @file{main} to @var{dumppfx}, because
2004 @option{-dumpdir} is explicitly specified.  The goal is that the
2005 explicitly-specified @var{dumppfx} may contain the specified output name
2006 as part of the prefix, if desired; only an explicitly-specified
2007 @option{-dumpbase} would be combined with it, in order to avoid simply
2008 discarding a meaningful option.
2010 When compiling and then linking from a single input file, the linker
2011 output base name will only be appended to the default @var{dumppfx} as
2012 above if it does not share the base name with the single input file
2013 name.  This has been covered in single-input linking cases above, but
2014 not with an explicit @option{-dumpdir} that inhibits the combination,
2015 even if overridden by @option{-save-temps=*}:
2017 @smallexample
2018 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
2019 @end smallexample
2021 Auxiliary outputs are named @file{foo.*}, and dump outputs
2022 @file{foo.c.*}, in the current working directory as ultimately requested
2023 by @option{-save-temps=cwd}.
2025 Summing it all up for an intuitive though slightly imprecise data flow:
2026 the primary output name is broken into a directory part and a basename
2027 part; @var{dumppfx} is set to the former, unless overridden by
2028 @option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
2029 to the latter, unless overriden by @option{-dumpbase}.  If there are
2030 multiple inputs or linking, this @var{dumpbase} may be combined with
2031 @var{dumppfx} and taken from each input file.  Auxiliary output names
2032 for each input are formed by combining @var{dumppfx}, @var{dumpbase}
2033 minus suffix, and the auxiliary output suffix; dump output names are
2034 only different in that the suffix from @var{dumpbase} is retained.
2036 When it comes to auxiliary and dump outputs created during LTO
2037 recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
2038 given or as derived from the linker output name but not from inputs,
2039 even in cases in which this combination would not otherwise be used as
2040 such, is passed down with a trailing period replacing the compiler-added
2041 dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
2042 being involved in linking, this program does not normally get any
2043 @option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
2045 When running sub-compilers, @command{lto-wrapper} appends LTO stage
2046 names to the received @var{dumppfx}, ensures it contains a directory
2047 component so that it overrides any @option{-dumpdir}, and passes that as
2048 @option{-dumpbase} to sub-compilers.
2050 @opindex v
2051 @item -v
2052 Print (on standard error output) the commands executed to run the stages
2053 of compilation.  Also print the version number of the compiler driver
2054 program and of the preprocessor and the compiler proper.
2056 @opindex ###
2057 @item -###
2058 Like @option{-v} except the commands are not executed and arguments
2059 are quoted unless they contain only alphanumeric characters or @code{./-_}.
2060 This is useful for shell scripts to capture the driver-generated command lines.
2062 @opindex help
2063 @item --help
2064 Print (on the standard output) a description of the command-line options
2065 understood by @command{gcc}.  If the @option{-v} option is also specified
2066 then @option{--help} is also passed on to the various processes
2067 invoked by @command{gcc}, so that they can display the command-line options
2068 they accept.  If the @option{-Wextra} option has also been specified
2069 (prior to the @option{--help} option), then command-line options that
2070 have no documentation associated with them are also displayed.
2072 @opindex target-help
2073 @item --target-help
2074 Print (on the standard output) a description of target-specific command-line
2075 options for each tool.  For some targets extra target-specific
2076 information may also be printed.
2078 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
2079 Print (on the standard output) a description of the command-line
2080 options understood by the compiler that fit into all specified classes
2081 and qualifiers.  These are the supported classes:
2083 @table @asis
2084 @item @samp{optimizers}
2085 Display all of the optimization options supported by the
2086 compiler.
2088 @item @samp{warnings}
2089 Display all of the options controlling warning messages
2090 produced by the compiler.
2092 @item @samp{target}
2093 Display target-specific options.  Unlike the
2094 @option{--target-help} option however, target-specific options of the
2095 linker and assembler are not displayed.  This is because those
2096 tools do not currently support the extended @option{--help=} syntax.
2098 @item @samp{params}
2099 Display the values recognized by the @option{--param}
2100 option.
2102 @item @var{language}
2103 Display the options supported for @var{language}, where
2104 @var{language} is the name of one of the languages supported in this
2105 version of GCC@.  If an option is supported by all languages, one needs
2106 to select @samp{common} class.
2108 @item @samp{common}
2109 Display the options that are common to all languages.
2110 @end table
2112 These are the supported qualifiers:
2114 @table @asis
2115 @item @samp{undocumented}
2116 Display only those options that are undocumented.
2118 @item @samp{joined}
2119 Display options taking an argument that appears after an equal
2120 sign in the same continuous piece of text, such as:
2121 @samp{--help=target}.
2123 @item @samp{separate}
2124 Display options taking an argument that appears as a separate word
2125 following the original option, such as: @samp{-o output-file}.
2126 @end table
2128 Thus for example to display all the undocumented target-specific
2129 switches supported by the compiler, use:
2131 @smallexample
2132 --help=target,undocumented
2133 @end smallexample
2135 The sense of a qualifier can be inverted by prefixing it with the
2136 @samp{^} character, so for example to display all binary warning
2137 options (i.e., ones that are either on or off and that do not take an
2138 argument) that have a description, use:
2140 @smallexample
2141 --help=warnings,^joined,^undocumented
2142 @end smallexample
2144 The argument to @option{--help=} should not consist solely of inverted
2145 qualifiers.
2147 Combining several classes is possible, although this usually
2148 restricts the output so much that there is nothing to display.  One
2149 case where it does work, however, is when one of the classes is
2150 @var{target}.  For example, to display all the target-specific
2151 optimization options, use:
2153 @smallexample
2154 --help=target,optimizers
2155 @end smallexample
2157 The @option{--help=} option can be repeated on the command line.  Each
2158 successive use displays its requested class of options, skipping
2159 those that have already been displayed.  If @option{--help} is also
2160 specified anywhere on the command line then this takes precedence
2161 over any @option{--help=} option.
2163 If the @option{-Q} option appears on the command line before the
2164 @option{--help=} option, then the descriptive text displayed by
2165 @option{--help=} is changed.  Instead of describing the displayed
2166 options, an indication is given as to whether the option is enabled,
2167 disabled or set to a specific value (assuming that the compiler
2168 knows this at the point where the @option{--help=} option is used).
2170 Here is a truncated example from the ARM port of @command{gcc}:
2172 @smallexample
2173   % gcc -Q -mabi=2 --help=target -c
2174   The following options are target specific:
2175   -mabi=                                2
2176   -mabort-on-noreturn                   [disabled]
2177   -mapcs                                [disabled]
2178 @end smallexample
2180 The output is sensitive to the effects of previous command-line
2181 options, so for example it is possible to find out which optimizations
2182 are enabled at @option{-O2} by using:
2184 @smallexample
2185 -Q -O2 --help=optimizers
2186 @end smallexample
2188 Alternatively you can discover which binary optimizations are enabled
2189 by @option{-O3} by using:
2191 @smallexample
2192 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2193 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2194 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2195 @end smallexample
2197 @opindex version
2198 @item --version
2199 Display the version number and copyrights of the invoked GCC@.
2201 @opindex pass-exit-codes
2202 @item -pass-exit-codes
2203 Normally the @command{gcc} program exits with the code of 1 if any
2204 phase of the compiler returns a non-success return code.  If you specify
2205 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
2206 the numerically highest error produced by any phase returning an error
2207 indication.  The C, C++, and Fortran front ends return 4 if an internal
2208 compiler error is encountered.
2210 @opindex pipe
2211 @item -pipe
2212 Use pipes rather than temporary files for communication between the
2213 various stages of compilation.  This fails to work on some systems where
2214 the assembler is unable to read from a pipe; but the GNU assembler has
2215 no trouble.
2217 @opindex specs
2218 @item -specs=@var{file}
2219 Process @var{file} after the compiler reads in the standard @file{specs}
2220 file, in order to override the defaults which the @command{gcc} driver
2221 program uses when determining what switches to pass to @command{cc1},
2222 @command{cc1plus}, @command{as}, @command{ld}, etc.  More than one
2223 @option{-specs=@var{file}} can be specified on the command line, and they
2224 are processed in order, from left to right.  @xref{Spec Files}, for
2225 information about the format of the @var{file}.
2227 @opindex wrapper
2228 @item -wrapper
2229 Invoke all subcommands under a wrapper program.  The name of the
2230 wrapper program and its parameters are passed as a comma separated
2231 list.
2233 @smallexample
2234 gcc -c t.c -wrapper gdb,--args
2235 @end smallexample
2237 @noindent
2238 This invokes all subprograms of @command{gcc} under
2239 @samp{gdb --args}, thus the invocation of @command{cc1} is
2240 @samp{gdb --args cc1 @dots{}}.
2242 @opindex ffile-prefix-map
2243 @item -ffile-prefix-map=@var{old}=@var{new}
2244 When compiling files residing in directory @file{@var{old}}, record
2245 any references to them in the result of the compilation as if the
2246 files resided in directory @file{@var{new}} instead.  Specifying this
2247 option is equivalent to specifying all the individual
2248 @option{-f*-prefix-map} options.  This can be used to make reproducible
2249 builds that are location independent.  Directories referenced by
2250 directives are not affected by these options.  See also
2251 @option{-fmacro-prefix-map}, @option{-fdebug-prefix-map},
2252 @option{-fprofile-prefix-map} and @option{-fcanon-prefix-map}.
2254 @opindex fcanon-prefix-map
2255 @item -fcanon-prefix-map
2256 For the @option{-f*-prefix-map} options normally comparison
2257 of @file{@var{old}} prefix against the filename that would be normally
2258 referenced in the result of the compilation is done using textual
2259 comparison of the prefixes, or ignoring character case for case insensitive
2260 filesystems and considering slashes and backslashes as equal on DOS based
2261 filesystems.  The @option{-fcanon-prefix-map} causes such comparisons
2262 to be done on canonicalized paths of @file{@var{old}}
2263 and the referenced filename.
2265 @opindex fplugin
2266 @item -fplugin=@var{name}.so
2267 Load the plugin code in file @var{name}.so, assumed to be a
2268 shared object to be dlopen'd by the compiler.  The base name of
2269 the shared object file is used to identify the plugin for the
2270 purposes of argument parsing (See
2271 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2272 Each plugin should define the callback functions specified in the
2273 Plugins API.
2275 @opindex fplugin-arg
2276 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
2277 Define an argument called @var{key} with a value of @var{value}
2278 for the plugin called @var{name}.
2280 @opindex fdump-ada-spec
2281 @item -fdump-ada-spec@r{[}-slim@r{]}
2282 For C and C++ source and include files, generate corresponding Ada specs.
2283 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2284 GNAT User's Guide}, which provides detailed documentation on this feature.
2286 @opindex fada-spec-parent
2287 @item -fada-spec-parent=@var{unit}
2288 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2289 Ada specs as child units of parent @var{unit}.
2291 @opindex fdump-go-spec
2292 @item -fdump-go-spec=@var{file}
2293 For input files in any language, generate corresponding Go
2294 declarations in @var{file}.  This generates Go @code{const},
2295 @code{type}, @code{var}, and @code{func} declarations which may be a
2296 useful way to start writing a Go interface to code written in some
2297 other language.
2299 @include @value{srcdir}/../libiberty/at-file.texi
2300 @end table
2302 @node Invoking G++
2303 @section Compiling C++ Programs
2305 @cindex suffixes for C++ source
2306 @cindex C++ source file suffixes
2307 C++ source files conventionally use one of the suffixes @samp{.C},
2308 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2309 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2310 @samp{.H}, or (for shared template code) @samp{.tcc}; and
2311 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
2312 files with these names and compiles them as C++ programs even if you
2313 call the compiler the same way as for compiling C programs (usually
2314 with the name @command{gcc}).
2316 @findex g++
2317 @findex c++
2318 However, the use of @command{gcc} does not add the C++ library.
2319 @command{g++} is a program that calls GCC and automatically specifies linking
2320 against the C++ library.  It treats @samp{.c},
2321 @samp{.h} and @samp{.i} files as C++ source files instead of C source
2322 files unless @option{-x} is used.  This program is also useful when
2323 precompiling a C header file with a @samp{.h} extension for use in C++
2324 compilations.  On many systems, @command{g++} is also installed with
2325 the name @command{c++}.
2327 @cindex invoking @command{g++}
2328 When you compile C++ programs, you may specify many of the same
2329 command-line options that you use for compiling programs in any
2330 language; or command-line options meaningful for C and related
2331 languages; or options that are meaningful only for C++ programs.
2332 @xref{C Dialect Options,,Options Controlling C Dialect}, for
2333 explanations of options for languages related to C@.
2334 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2335 explanations of options that are meaningful only for C++ programs.
2337 @node C Dialect Options
2338 @section Options Controlling C Dialect
2339 @cindex dialect options
2340 @cindex language dialect options
2341 @cindex options, dialect
2343 The following options control the dialect of C (or languages derived
2344 from C, such as C++, Objective-C and Objective-C++) that the compiler
2345 accepts:
2347 @table @gcctabopt
2348 @cindex ANSI support
2349 @cindex ISO support
2350 @opindex ansi
2351 @item -ansi
2352 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2353 equivalent to @option{-std=c++98}.
2355 This turns off certain features of GCC that are incompatible with ISO
2356 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2357 such as the @code{asm} and @code{typeof} keywords, and
2358 predefined macros such as @code{unix} and @code{vax} that identify the
2359 type of system you are using.  It also enables the undesirable and
2360 rarely used ISO trigraph feature.  For the C compiler,
2361 it disables recognition of C++ style @samp{//} comments as well as
2362 the @code{inline} keyword.
2364 The alternate keywords @code{__asm__}, @code{__extension__},
2365 @code{__inline__} and @code{__typeof__} continue to work despite
2366 @option{-ansi}.  You would not want to use them in an ISO C program, of
2367 course, but it is useful to put them in header files that might be included
2368 in compilations done with @option{-ansi}.  Alternate predefined macros
2369 such as @code{__unix__} and @code{__vax__} are also available, with or
2370 without @option{-ansi}.
2372 The @option{-ansi} option does not cause non-ISO programs to be
2373 rejected gratuitously.  For that, @option{-Wpedantic} is required in
2374 addition to @option{-ansi}.  @xref{Warning Options}.
2376 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2377 option is used.  Some header files may notice this macro and refrain
2378 from declaring certain functions or defining certain macros that the
2379 ISO standard doesn't call for; this is to avoid interfering with any
2380 programs that might use these names for other things.
2382 Functions that are normally built in but do not have semantics
2383 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2384 functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
2385 built-in functions provided by GCC}, for details of the functions
2386 affected.
2388 @opindex std
2389 @item -std=
2390 Determine the language standard. @xref{Standards,,Language Standards
2391 Supported by GCC}, for details of these standard versions.  This option
2392 is currently only supported when compiling C or C++.
2394 The compiler can accept several base standards, such as @samp{c90} or
2395 @samp{c++98}, and GNU dialects of those standards, such as
2396 @samp{gnu90} or @samp{gnu++98}.  When a base standard is specified, the
2397 compiler accepts all programs following that standard plus those
2398 using GNU extensions that do not contradict it.  For example,
2399 @option{-std=c90} turns off certain features of GCC that are
2400 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2401 keywords, but not other GNU extensions that do not have a meaning in
2402 ISO C90, such as omitting the middle term of a @code{?:}
2403 expression. On the other hand, when a GNU dialect of a standard is
2404 specified, all features supported by the compiler are enabled, even when
2405 those features change the meaning of the base standard.  As a result, some
2406 strict-conforming programs may be rejected.  The particular standard
2407 is used by @option{-Wpedantic} to identify which features are GNU
2408 extensions given that version of the standard. For example
2409 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2410 comments, while @option{-std=gnu99 -Wpedantic} does not.
2412 A value for this option must be provided; possible values are
2414 @table @samp
2415 @item c90
2416 @itemx c89
2417 @itemx iso9899:1990
2418 Support all ISO C90 programs (certain GNU extensions that conflict
2419 with ISO C90 are disabled). Same as @option{-ansi} for C code.
2421 @item iso9899:199409
2422 ISO C90 as modified in amendment 1.
2424 @item c99
2425 @itemx c9x
2426 @itemx iso9899:1999
2427 @itemx iso9899:199x
2428 ISO C99.  This standard is substantially completely supported, modulo
2429 bugs and floating-point issues
2430 (mainly but not entirely relating to optional C99 features from
2431 Annexes F and G).  See
2432 @w{@uref{https://gcc.gnu.org/c99status.html}} for more information.  The
2433 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2435 @item c11
2436 @itemx c1x
2437 @itemx iso9899:2011
2438 ISO C11, the 2011 revision of the ISO C standard.  This standard is
2439 substantially completely supported, modulo bugs, floating-point issues
2440 (mainly but not entirely relating to optional C11 features from
2441 Annexes F and G) and the optional Annexes K (Bounds-checking
2442 interfaces) and L (Analyzability).  The name @samp{c1x} is deprecated.
2444 @item c17
2445 @itemx c18
2446 @itemx iso9899:2017
2447 @itemx iso9899:2018
2448 ISO C17, the 2017 revision of the ISO C standard
2449 (published in 2018).  This standard is
2450 same as C11 except for corrections of defects (all of which are also
2451 applied with @option{-std=c11}) and a new value of
2452 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2454 @item c23
2455 @itemx c2x
2456 @itemx iso9899:2024
2457 ISO C23, the 2023 revision of the ISO C standard (expected to be
2458 published in 2024).  The support for this version is experimental and
2459 incomplete.  The name @samp{c2x} is deprecated.
2461 @item gnu90
2462 @itemx gnu89
2463 GNU dialect of ISO C90 (including some C99 features).
2465 @item gnu99
2466 @itemx gnu9x
2467 GNU dialect of ISO C99.  The name @samp{gnu9x} is deprecated.
2469 @item gnu11
2470 @itemx gnu1x
2471 GNU dialect of ISO C11.
2472 The name @samp{gnu1x} is deprecated.
2474 @item gnu17
2475 @itemx gnu18
2476 GNU dialect of ISO C17.  This is the default for C code.
2478 @item gnu23
2479 @itemx gnu2x
2480 The next version of the ISO C standard, still under development, plus
2481 GNU extensions.  The support for this version is experimental and
2482 incomplete.  The name @samp{gnu2x} is deprecated.
2484 @item c++98
2485 @itemx c++03
2486 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2487 additional defect reports. Same as @option{-ansi} for C++ code.
2489 @item gnu++98
2490 @itemx gnu++03
2491 GNU dialect of @option{-std=c++98}.
2493 @item c++11
2494 @itemx c++0x
2495 The 2011 ISO C++ standard plus amendments.
2496 The name @samp{c++0x} is deprecated.
2498 @item gnu++11
2499 @itemx gnu++0x
2500 GNU dialect of @option{-std=c++11}.
2501 The name @samp{gnu++0x} is deprecated.
2503 @item c++14
2504 @itemx c++1y
2505 The 2014 ISO C++ standard plus amendments.
2506 The name @samp{c++1y} is deprecated.
2508 @item gnu++14
2509 @itemx gnu++1y
2510 GNU dialect of @option{-std=c++14}.
2511 The name @samp{gnu++1y} is deprecated.
2513 @item c++17
2514 @itemx c++1z
2515 The 2017 ISO C++ standard plus amendments.
2516 The name @samp{c++1z} is deprecated.
2518 @item gnu++17
2519 @itemx gnu++1z
2520 GNU dialect of @option{-std=c++17}.
2521 This is the default for C++ code.
2522 The name @samp{gnu++1z} is deprecated.
2524 @item c++20
2525 @itemx c++2a
2526 The 2020 ISO C++ standard plus amendments.
2527 Support is experimental, and could change in incompatible ways in
2528 future releases.
2529 The name @samp{c++2a} is deprecated.
2531 @item gnu++20
2532 @itemx gnu++2a
2533 GNU dialect of @option{-std=c++20}.
2534 Support is experimental, and could change in incompatible ways in
2535 future releases.
2536 The name @samp{gnu++2a} is deprecated.
2538 @item c++2b
2539 @itemx c++23
2540 The next revision of the ISO C++ standard, planned for
2541 2023.  Support is highly experimental, and will almost certainly
2542 change in incompatible ways in future releases.
2544 @item gnu++2b
2545 @itemx gnu++23
2546 GNU dialect of @option{-std=c++2b}.  Support is highly experimental,
2547 and will almost certainly change in incompatible ways in future
2548 releases.
2550 @item c++2c
2551 @itemx c++26
2552 The next revision of the ISO C++ standard, planned for
2553 2026.  Support is highly experimental, and will almost certainly
2554 change in incompatible ways in future releases.
2556 @item gnu++2c
2557 @itemx gnu++26
2558 GNU dialect of @option{-std=c++2c}.  Support is highly experimental,
2559 and will almost certainly change in incompatible ways in future
2560 releases.
2561 @end table
2563 @opindex aux-info
2564 @item -aux-info @var{filename}
2565 Output to the given filename prototyped declarations for all functions
2566 declared and/or defined in a translation unit, including those in header
2567 files.  This option is silently ignored in any language other than C@.
2569 Besides declarations, the file indicates, in comments, the origin of
2570 each declaration (source file and line), whether the declaration was
2571 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2572 @samp{O} for old, respectively, in the first character after the line
2573 number and the colon), and whether it came from a declaration or a
2574 definition (@samp{C} or @samp{F}, respectively, in the following
2575 character).  In the case of function definitions, a K&R-style list of
2576 arguments followed by their declarations is also provided, inside
2577 comments, after the declaration.
2579 @opindex fno-asm
2580 @opindex fasm
2581 @item -fno-asm
2582 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2583 keyword, so that code can use these words as identifiers.  You can use
2584 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2585 instead.  In C, @option{-ansi} implies @option{-fno-asm}.
2587 In C++, @code{inline} is a standard keyword and is not affected by
2588 this switch.  You may want to use the @option{-fno-gnu-keywords} flag
2589 instead, which disables @code{typeof} but not @code{asm} and
2590 @code{inline}.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}),
2591 this switch only affects the @code{asm} and @code{typeof} keywords,
2592 since @code{inline} is a standard keyword in ISO C99.  In C23 mode
2593 (@option{-std=c23} or @option{-std=gnu23}), this switch only affects
2594 the @code{asm} keyword, since @code{typeof} is a standard keyword in
2595 ISO C23.
2597 @opindex fno-builtin
2598 @opindex fbuiltin
2599 @cindex built-in functions
2600 @item -fno-builtin
2601 @itemx -fno-builtin-@var{function}
2602 Don't recognize built-in functions that do not begin with
2603 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
2604 functions provided by GCC}, for details of the functions affected,
2605 including those which are not built-in functions when @option{-ansi} or
2606 @option{-std} options for strict ISO C conformance are used because they
2607 do not have an ISO standard meaning.
2609 GCC normally generates special code to handle certain built-in functions
2610 more efficiently; for instance, calls to @code{alloca} may become single
2611 instructions which adjust the stack directly, and calls to @code{memcpy}
2612 may become inline copy loops.  The resulting code is often both smaller
2613 and faster, but since the function calls no longer appear as such, you
2614 cannot set a breakpoint on those calls, nor can you change the behavior
2615 of the functions by linking with a different library.  In addition,
2616 when a function is recognized as a built-in function, GCC may use
2617 information about that function to warn about problems with calls to
2618 that function, or to generate more efficient code, even if the
2619 resulting code still contains calls to that function.  For example,
2620 warnings are given with @option{-Wformat} for bad calls to
2621 @code{printf} when @code{printf} is built in and @code{strlen} is
2622 known not to modify global memory.
2624 With the @option{-fno-builtin-@var{function}} option
2625 only the built-in function @var{function} is
2626 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
2627 function is named that is not built-in in this version of GCC, this
2628 option is ignored.  There is no corresponding
2629 @option{-fbuiltin-@var{function}} option; if you wish to enable
2630 built-in functions selectively when using @option{-fno-builtin} or
2631 @option{-ffreestanding}, you may define macros such as:
2633 @smallexample
2634 #define abs(n)          __builtin_abs ((n))
2635 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
2636 @end smallexample
2638 @opindex fcond-mismatch
2639 @item -fcond-mismatch
2640 Allow conditional expressions with mismatched types in the second and
2641 third arguments.  The value of such an expression is void.  This option
2642 is not supported for C++.
2644 @opindex ffreestanding
2645 @cindex hosted environment
2646 @item -ffreestanding
2648 Assert that compilation targets a freestanding environment.  This
2649 implies @option{-fno-builtin}.  A freestanding environment
2650 is one in which the standard library may not exist, and program startup may
2651 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
2652 This is equivalent to @option{-fno-hosted}.
2654 @xref{Standards,,Language Standards Supported by GCC}, for details of
2655 freestanding and hosted environments.
2657 @opindex fgimple
2658 @item -fgimple
2660 Enable parsing of function definitions marked with @code{__GIMPLE}.
2661 This is an experimental feature that allows unit testing of GIMPLE
2662 passes.
2664 @opindex fgnu-tm
2665 @item -fgnu-tm
2666 When the option @option{-fgnu-tm} is specified, the compiler
2667 generates code for the Linux variant of Intel's current Transactional
2668 Memory ABI specification document (Revision 1.1, May 6 2009).  This is
2669 an experimental feature whose interface may change in future versions
2670 of GCC, as the official specification changes.  Please note that not
2671 all architectures are supported for this feature.
2673 For more information on GCC's support for transactional memory,
2674 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2675 Transactional Memory Library}.
2677 Note that the transactional memory feature is not supported with
2678 non-call exceptions (@option{-fnon-call-exceptions}).
2680 @opindex fgnu89-inline
2681 @item -fgnu89-inline
2682 The option @option{-fgnu89-inline} tells GCC to use the traditional
2683 GNU semantics for @code{inline} functions when in C99 mode.
2684 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2685 Using this option is roughly equivalent to adding the
2686 @code{gnu_inline} function attribute to all inline functions
2687 (@pxref{Function Attributes}).
2689 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2690 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2691 specifies the default behavior).
2692 This option is not supported in @option{-std=c90} or
2693 @option{-std=gnu90} mode.
2695 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2696 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2697 in effect for @code{inline} functions.  @xref{Common Predefined
2698 Macros,,,cpp,The C Preprocessor}.
2700 @opindex fhosted
2701 @cindex hosted environment
2702 @item -fhosted
2704 Assert that compilation targets a hosted environment.  This implies
2705 @option{-fbuiltin}.  A hosted environment is one in which the
2706 entire standard library is available, and in which @code{main} has a return
2707 type of @code{int}.  Examples are nearly everything except a kernel.
2708 This is equivalent to @option{-fno-freestanding}.
2710 @opindex flax-vector-conversions
2711 @item -flax-vector-conversions
2712 Allow implicit conversions between vectors with differing numbers of
2713 elements and/or incompatible element types.  This option should not be
2714 used for new code.
2716 @opindex fms-extensions
2717 @item -fms-extensions
2718 Accept some non-standard constructs used in Microsoft header files.
2720 In C++ code, this allows member names in structures to be similar
2721 to previous types declarations.
2723 @smallexample
2724 typedef int UOW;
2725 struct ABC @{
2726   UOW UOW;
2728 @end smallexample
2730 Some cases of unnamed fields in structures and unions are only
2731 accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
2732 fields within structs/unions}, for details.
2734 Note that this option is off for all targets except for x86
2735 targets using ms-abi.
2737 @opindex foffload
2738 @cindex Offloading targets
2739 @cindex OpenACC offloading targets
2740 @cindex OpenMP offloading targets
2741 @item -foffload=disable
2742 @itemx -foffload=default
2743 @itemx -foffload=@var{target-list}
2744 Specify for which OpenMP and OpenACC offload targets code should be generated.
2745 The default behavior, equivalent to @option{-foffload=default}, is to generate
2746 code for all supported offload targets.  The @option{-foffload=disable} form
2747 generates code only for the host fallback, while
2748 @option{-foffload=@var{target-list}} generates code only for the specified
2749 comma-separated list of offload targets.
2751 Offload targets are specified in GCC's internal target-triplet format. You can
2752 run the compiler with @option{-v} to show the list of configured offload targets
2753 under @code{OFFLOAD_TARGET_NAMES}.
2755 @opindex foffload-options
2756 @cindex Offloading options
2757 @cindex OpenACC offloading options
2758 @cindex OpenMP offloading options
2759 @item -foffload-options=@var{options}
2760 @itemx -foffload-options=@var{target-triplet-list}=@var{options}
2762 With @option{-foffload-options=@var{options}}, GCC passes the specified
2763 @var{options} to the compilers for all enabled offloading targets.  You can
2764 specify options that apply only to a specific target or targets by using
2765 the @option{-foffload-options=@var{target-list}=@var{options}} form.  The
2766 @var{target-list} is a comma-separated list in the same format as for the
2767 @option{-foffload=} option.
2769 Typical command lines are
2771 @smallexample
2772 -foffload-options='-fno-math-errno -ffinite-math-only' -foffload-options=nvptx-none=-latomic
2773 -foffload-options=amdgcn-amdhsa=-march=gfx906
2774 @end smallexample
2776 @opindex fopenacc
2777 @cindex OpenACC accelerator programming
2778 @item -fopenacc
2779 Enable handling of OpenACC directives @samp{#pragma acc} in C/C++ and
2780 @samp{!$acc} in free-form Fortran and @samp{!$acc}, @samp{c$acc} and
2781 @samp{*$acc} in fixed-form Fortran.  When @option{-fopenacc} is specified,
2782 the compiler generates accelerated code according to the OpenACC Application
2783 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}.  This option
2784 implies @option{-pthread}, and thus is only supported on targets that
2785 have support for @option{-pthread}.
2787 @opindex fopenacc-dim
2788 @cindex OpenACC accelerator programming
2789 @item -fopenacc-dim=@var{geom}
2790 Specify default compute dimensions for parallel offload regions that do
2791 not explicitly specify.  The @var{geom} value is a triple of
2792 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'.  A size
2793 can be omitted, to use a target-specific default value.
2795 @opindex fopenmp
2796 @cindex OpenMP parallel
2797 @item -fopenmp
2798 Enable handling of OpenMP directives @samp{#pragma omp},
2799 @samp{[[omp::directive(...)]]}, @samp{[[omp::sequence(...)]]} and
2800 @samp{[[omp::decl(...)]]} in C/C++ and @samp{!$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{*}.  When @option{-fopenmp} is specified, the
2804 compiler generates parallel code according to the OpenMP Application
2805 Program Interface v4.5 @w{@uref{https://www.openmp.org}}.  This option
2806 implies @option{-pthread}, and thus is only supported on targets that
2807 have support for @option{-pthread}. @option{-fopenmp} implies
2808 @option{-fopenmp-simd}.
2810 @opindex fopenmp-simd
2811 @cindex OpenMP SIMD
2812 @cindex SIMD
2813 @item -fopenmp-simd
2814 Enable handling of OpenMP's @code{simd}, @code{declare simd},
2815 @code{declare reduction}, @code{assume}, @code{ordered}, @code{scan}
2816 and @code{loop} directive, and of combined or composite directives with
2817 @code{simd} as constituent with @code{#pragma omp},
2818 @code{[[omp::directive(...)]]}, @code{[[omp::sequence(...)]]} and
2819 @code{[[omp::decl(...)]]} in C/C++ and @code{!$omp} in Fortran.  It
2820 additionally enables the conditional compilation sentinel @samp{!$} in
2821 Fortran.  In fixed source form Fortran, the sentinels can also start with
2822 @samp{c} or @samp{*}.  Other OpenMP directives are ignored.  Unless
2823 @option{-fopenmp} is additionally specified, the @code{loop} region binds
2824 to the current task region, independent of the specified @code{bind} clause.
2826 @opindex fopenmp-target-simd-clone
2827 @cindex OpenMP target SIMD clone
2828 @item -fopenmp-target-simd-clone
2829 @item -fopenmp-target-simd-clone=@var{device-type}
2830 In addition to generating SIMD clones for functions marked with the
2831 @code{declare simd} directive, GCC also generates clones
2832 for functions marked with the OpenMP @code{declare target} directive
2833 that are suitable for vectorization when this option is in effect.  The
2834 @var{device-type} may be one of @code{none}, @code{host}, @code{nohost},
2835 and @code{any}, which correspond to keywords for the @code{device_type}
2836 clause of the @code{declare target} directive; clones are generated for
2837 the intersection of devices specified.
2838 @option{-fopenmp-target-simd-clone} is equivalent to
2839 @option{-fopenmp-target-simd-clone=any} and
2840 @option{-fno-openmp-target-simd-clone} is equivalent to
2841 @option{-fopenmp-target-simd-clone=none}.
2843 At @option{-O2} and higher (but not @option{-Os} or @option{-Og}) this
2844 optimization defaults to @option{-fopenmp-target-simd-clone=nohost}; otherwise
2845 it is disabled by default.
2847 @opindex fpermitted-flt-eval-methods
2848 @opindex fpermitted-flt-eval-methods=c11
2849 @opindex fpermitted-flt-eval-methods=ts-18661-3
2850 @item -fpermitted-flt-eval-methods=@var{style}
2851 ISO/IEC TS 18661-3 defines new permissible values for
2852 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2853 a semantic type that is an interchange or extended format should be
2854 evaluated to the precision and range of that type.  These new values are
2855 a superset of those permitted under C99/C11, which does not specify the
2856 meaning of other positive values of @code{FLT_EVAL_METHOD}.  As such, code
2857 conforming to C11 may not have been written expecting the possibility of
2858 the new values.
2860 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2861 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2862 or the extended set of values specified in ISO/IEC TS 18661-3.
2864 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2866 The default when in a standards compliant mode (@option{-std=c11} or similar)
2867 is @option{-fpermitted-flt-eval-methods=c11}.  The default when in a GNU
2868 dialect (@option{-std=gnu11} or similar) is
2869 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2871 @opindex fdeps-
2872 The @samp{-fdeps-*} options are used to extract structured dependency
2873 information for a source.  This involves determining what resources provided by
2874 other source files will be required to compile the source as well as what
2875 resources are provided by the source.  This information can be used to add
2876 required dependencies between compilation rules of dependent sources based on
2877 their contents rather than requiring such information be reflected within the
2878 build tools as well.
2880 @opindex fdeps-file
2881 @item -fdeps-file=@var{file}
2882 Where to write structured dependency information.
2884 @opindex fdeps-format
2885 @item -fdeps-format=@var{format}
2886 The format to use for structured dependency information. @samp{p1689r5} is the
2887 only supported format right now.  Note that when this argument is specified, the
2888 output of @samp{-MF} is stripped of some information (namely C++ modules) so
2889 that it does not use extended makefile syntax not understood by most tools.
2891 @opindex fdeps-target
2892 @item -fdeps-target=@var{file}
2893 Analogous to @option{-MT} but for structured dependency information.  This
2894 indicates the target which will ultimately need any required resources and
2895 provide any resources extracted from the source that may be required by other
2896 sources.
2898 @opindex fplan9-extensions
2899 @item -fplan9-extensions
2900 Accept some non-standard constructs used in Plan 9 code.
2902 This enables @option{-fms-extensions}, permits passing pointers to
2903 structures with anonymous fields to functions that expect pointers to
2904 elements of the type of the field, and permits referring to anonymous
2905 fields declared using a typedef.  @xref{Unnamed Fields,,Unnamed
2906 struct/union fields within structs/unions}, for details.  This is only
2907 supported for C, not C++.
2909 @opindex fsigned-bitfields
2910 @opindex funsigned-bitfields
2911 @opindex fno-signed-bitfields
2912 @opindex fno-unsigned-bitfields
2913 @item -fsigned-bitfields
2914 @itemx -funsigned-bitfields
2915 @itemx -fno-signed-bitfields
2916 @itemx -fno-unsigned-bitfields
2917 These options control whether a bit-field is signed or unsigned, when the
2918 declaration does not use either @code{signed} or @code{unsigned}.  By
2919 default, such a bit-field is signed, because this is consistent: the
2920 basic integer types such as @code{int} are signed types.
2922 @opindex fsigned-char
2923 @item -fsigned-char
2924 Let the type @code{char} be signed, like @code{signed char}.
2926 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2927 the negative form of @option{-funsigned-char}.  Likewise, the option
2928 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2930 @opindex funsigned-char
2931 @item -funsigned-char
2932 Let the type @code{char} be unsigned, like @code{unsigned char}.
2934 Each kind of machine has a default for what @code{char} should
2935 be.  It is either like @code{unsigned char} by default or like
2936 @code{signed char} by default.
2938 Ideally, a portable program should always use @code{signed char} or
2939 @code{unsigned char} when it depends on the signedness of an object.
2940 But many programs have been written to use plain @code{char} and
2941 expect it to be signed, or expect it to be unsigned, depending on the
2942 machines they were written for.  This option, and its inverse, let you
2943 make such a program work with the opposite default.
2945 The type @code{char} is always a distinct type from each of
2946 @code{signed char} or @code{unsigned char}, even though its behavior
2947 is always just like one of those two.
2949 @opindex fstrict-flex-arrays
2950 @opindex fno-strict-flex-arrays
2951 @opindex fstrict-flex-arrays=@var{level}
2952 @item -fstrict-flex-arrays @r{(C and C++ only)}
2953 @itemx -fstrict-flex-arrays=@var{level} @r{(C and C++ only)}
2954 Control when to treat the trailing array of a structure as a flexible array
2955 member for the purpose of accessing the elements of such an array.  The value
2956 of @var{level} controls the level of strictness.
2958 @option{-fstrict-flex-arrays} is equivalent to
2959 @option{-fstrict-flex-arrays=3}, which is the strictest; all
2960 trailing arrays of structures are treated as flexible array members.
2962 The negative form @option{-fno-strict-flex-arrays} is equivalent to
2963 @option{-fstrict-flex-arrays=0}, which is the least strict.  In this
2964 case a trailing array is treated as a flexible array member only when
2965 it is declared as a flexible array member per C99 standard onwards.
2967 The possible values of @var{level} are the same as for the
2968 @code{strict_flex_array} attribute (@pxref{Variable Attributes}).
2970 You can control this behavior for a specific trailing array field of a
2971 structure by using the variable attribute @code{strict_flex_array} attribute
2972 (@pxref{Variable Attributes}).
2974 The @option{-fstrict_flex_arrays} option interacts with the
2975 @option{-Wstrict-flex-arrays} option.  @xref{Warning Options}, for more
2976 information.
2978 @opindex fsso-struct
2979 @item -fsso-struct=@var{endianness}
2980 Set the default scalar storage order of structures and unions to the
2981 specified endianness.  The accepted values are @samp{big-endian},
2982 @samp{little-endian} and @samp{native} for the native endianness of
2983 the target (the default).  This option is not supported for C++.
2985 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2986 code that is not binary compatible with code generated without it if the
2987 specified endianness is not the native endianness of the target.
2988 @end table
2990 @node C++ Dialect Options
2991 @section Options Controlling C++ Dialect
2993 @cindex compiler options, C++
2994 @cindex C++ options, command-line
2995 @cindex options, C++
2996 This section describes the command-line options that are only meaningful
2997 for C++ programs.  You can also use most of the GNU compiler options
2998 regardless of what language your program is in.  For example, you
2999 might compile a file @file{firstClass.C} like this:
3001 @smallexample
3002 g++ -g -fstrict-enums -O -c firstClass.C
3003 @end smallexample
3005 @noindent
3006 In this example, only @option{-fstrict-enums} is an option meant
3007 only for C++ programs; you can use the other options with any
3008 language supported by GCC@.
3010 Some options for compiling C programs, such as @option{-std}, are also
3011 relevant for C++ programs.
3012 @xref{C Dialect Options,,Options Controlling C Dialect}.
3014 Here is a list of options that are @emph{only} for compiling C++ programs:
3016 @table @gcctabopt
3018 @opindex fabi-version
3019 @item -fabi-version=@var{n}
3020 Use version @var{n} of the C++ ABI@.  The default is version 0.
3022 Version 0 refers to the version conforming most closely to
3023 the C++ ABI specification.  Therefore, the ABI obtained using version 0
3024 will change in different versions of G++ as ABI bugs are fixed.
3026 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
3028 Version 2 is the version of the C++ ABI that first appeared in G++
3029 3.4, and was the default through G++ 4.9.
3031 Version 3 corrects an error in mangling a constant address as a
3032 template argument.
3034 Version 4, which first appeared in G++ 4.5, implements a standard
3035 mangling for vector types.
3037 Version 5, which first appeared in G++ 4.6, corrects the mangling of
3038 attribute const/volatile on function pointer types, decltype of a
3039 plain decl, and use of a function parameter in the declaration of
3040 another parameter.
3042 Version 6, which first appeared in G++ 4.7, corrects the promotion
3043 behavior of C++11 scoped enums and the mangling of template argument
3044 packs, const/static_cast, prefix ++ and --, and a class scope function
3045 used as a template argument.
3047 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
3048 builtin type and corrects the mangling of lambdas in default argument
3049 scope.
3051 Version 8, which first appeared in G++ 4.9, corrects the substitution
3052 behavior of function types with function-cv-qualifiers.
3054 Version 9, which first appeared in G++ 5.2, corrects the alignment of
3055 @code{nullptr_t}.
3057 Version 10, which first appeared in G++ 6.1, adds mangling of
3058 attributes that affect type identity, such as ia32 calling convention
3059 attributes (e.g.@: @samp{stdcall}).
3061 Version 11, which first appeared in G++ 7, corrects the mangling of
3062 sizeof... expressions and operator names.  For multiple entities with
3063 the same name within a function, that are declared in different scopes,
3064 the mangling now changes starting with the twelfth occurrence.  It also
3065 implies @option{-fnew-inheriting-ctors}.
3067 Version 12, which first appeared in G++ 8, corrects the calling
3068 conventions for empty classes on the x86_64 target and for classes
3069 with only deleted copy/move constructors.  It accidentally changes the
3070 calling convention for classes with a deleted copy constructor and a
3071 trivial move constructor.
3073 Version 13, which first appeared in G++ 8.2, fixes the accidental
3074 change in version 12.
3076 Version 14, which first appeared in G++ 10, corrects the mangling of
3077 the nullptr expression.
3079 Version 15, which first appeared in G++ 10.3, corrects G++ 10 ABI
3080 tag regression.
3082 Version 16, which first appeared in G++ 11, changes the mangling of
3083 @code{__alignof__} to be distinct from that of @code{alignof}, and
3084 dependent operator names.
3086 Version 17, which first appeared in G++ 12, fixes layout of classes
3087 that inherit from aggregate classes with default member initializers
3088 in C++14 and up.
3090 Version 18, which first appeard in G++ 13, fixes manglings of lambdas
3091 that have additional context.
3093 Version 19, which first appeard in G++ 14, fixes manglings of structured
3094 bindings to include ABI tags.
3096 See also @option{-Wabi}.
3098 @opindex fabi-compat-version
3099 @item -fabi-compat-version=@var{n}
3100 On targets that support strong aliases, G++
3101 works around mangling changes by creating an alias with the correct
3102 mangled name when defining a symbol with an incorrect mangled name.
3103 This switch specifies which ABI version to use for the alias.
3105 With @option{-fabi-version=0} (the default), this defaults to 13 (GCC 8.2
3106 compatibility).  If another ABI version is explicitly selected, this
3107 defaults to 0.  For compatibility with GCC versions 3.2 through 4.9,
3108 use @option{-fabi-compat-version=2}.
3110 If this option is not provided but @option{-Wabi=@var{n}} is, that
3111 version is used for compatibility aliases.  If this option is provided
3112 along with @option{-Wabi} (without the version), the version from this
3113 option is used for the warning.
3115 @opindex fno-access-control
3116 @opindex faccess-control
3117 @item -fno-access-control
3118 Turn off all access checking.  This switch is mainly useful for working
3119 around bugs in the access control code.
3121 @opindex faligned-new
3122 @item -faligned-new
3123 Enable support for C++17 @code{new} of types that require more
3124 alignment than @code{void* ::operator new(std::size_t)} provides.  A
3125 numeric argument such as @code{-faligned-new=32} can be used to
3126 specify how much alignment (in bytes) is provided by that function,
3127 but few users will need to override the default of
3128 @code{alignof(std::max_align_t)}.
3130 This flag is enabled by default for @option{-std=c++17}.
3132 @opindex fchar8_t
3133 @opindex fno-char8_t
3134 @item -fchar8_t
3135 @itemx -fno-char8_t
3136 Enable support for @code{char8_t} as adopted for C++20.  This includes
3137 the addition of a new @code{char8_t} fundamental type, changes to the
3138 types of UTF-8 string and character literals, new signatures for
3139 user-defined literals, associated standard library updates, and new
3140 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
3142 This option enables functions to be overloaded for ordinary and UTF-8
3143 strings:
3145 @smallexample
3146 int f(const char *);    // #1
3147 int f(const char8_t *); // #2
3148 int v1 = f("text");     // Calls #1
3149 int v2 = f(u8"text");   // Calls #2
3150 @end smallexample
3152 @noindent
3153 and introduces new signatures for user-defined literals:
3155 @smallexample
3156 int operator""_udl1(char8_t);
3157 int v3 = u8'x'_udl1;
3158 int operator""_udl2(const char8_t*, std::size_t);
3159 int v4 = u8"text"_udl2;
3160 template<typename T, T...> int operator""_udl3();
3161 int v5 = u8"text"_udl3;
3162 @end smallexample
3164 @noindent
3165 The change to the types of UTF-8 string and character literals introduces
3166 incompatibilities with ISO C++11 and later standards.  For example, the
3167 following code is well-formed under ISO C++11, but is ill-formed when
3168 @option{-fchar8_t} is specified.
3170 @smallexample
3171 const char *cp = u8"xx";// error: invalid conversion from
3172                         //        `const char8_t*' to `const char*'
3173 int f(const char*);
3174 auto v = f(u8"xx");     // error: invalid conversion from
3175                         //        `const char8_t*' to `const char*'
3176 std::string s@{u8"xx"@};  // error: no matching function for call to
3177                         //        `std::basic_string<char>::basic_string()'
3178 using namespace std::literals;
3179 s = u8"xx"s;            // error: conversion from
3180                         //        `basic_string<char8_t>' to non-scalar
3181                         //        type `basic_string<char>' requested
3182 @end smallexample
3184 @opindex fcheck-new
3185 @item -fcheck-new
3186 Check that the pointer returned by @code{operator new} is non-null
3187 before attempting to modify the storage allocated.  This check is
3188 normally unnecessary because the C++ standard specifies that
3189 @code{operator new} only returns @code{0} if it is declared
3190 @code{throw()}, in which case the compiler always checks the
3191 return value even without this option.  In all other cases, when
3192 @code{operator new} has a non-empty exception specification, memory
3193 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
3194 @samp{new (nothrow)}.
3196 @opindex fconcepts
3197 @opindex fconcepts-ts
3198 @item -fconcepts
3199 @itemx -fconcepts-ts
3200 Enable support for the C++ Concepts feature for constraining template
3201 arguments.  With @option{-std=c++20} and above, Concepts are part of
3202 the language standard, so @option{-fconcepts} defaults to on.
3204 Some constructs that were allowed by the earlier C++ Extensions for
3205 Concepts Technical Specification, ISO 19217 (2015), but didn't make it
3206 into the standard, can additionally be enabled by
3207 @option{-fconcepts-ts}.  The option @option{-fconcepts-ts} was deprecated
3208 in GCC 14 and may be removed in GCC 15; users are expected to convert
3209 their code to C++20 concepts.
3211 @opindex fconstexpr-depth
3212 @item -fconstexpr-depth=@var{n}
3213 Set the maximum nested evaluation depth for C++11 constexpr functions
3214 to @var{n}.  A limit is needed to detect endless recursion during
3215 constant expression evaluation.  The minimum specified by the standard
3216 is 512.
3218 @opindex fconstexpr-cache-depth
3219 @item -fconstexpr-cache-depth=@var{n}
3220 Set the maximum level of nested evaluation depth for C++11 constexpr
3221 functions that will be cached to @var{n}.  This is a heuristic that
3222 trades off compilation speed (when the cache avoids repeated
3223 calculations) against memory consumption (when the cache grows very
3224 large from highly recursive evaluations).  The default is 8.  Very few
3225 users are likely to want to adjust it, but if your code does heavy
3226 constexpr calculations you might want to experiment to find which
3227 value works best for you.
3229 @opindex fconstexpr-fp-except
3230 @item -fconstexpr-fp-except
3231 Annex F of the C standard specifies that IEC559 floating point
3232 exceptions encountered at compile time should not stop compilation.
3233 C++ compilers have historically not followed this guidance, instead
3234 treating floating point division by zero as non-constant even though
3235 it has a well defined value.  This flag tells the compiler to give
3236 Annex F priority over other rules saying that a particular operation
3237 is undefined.
3239 @smallexample
3240 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
3241 @end smallexample
3243 @opindex fconstexpr-loop-limit
3244 @item -fconstexpr-loop-limit=@var{n}
3245 Set the maximum number of iterations for a loop in C++14 constexpr functions
3246 to @var{n}.  A limit is needed to detect infinite loops during
3247 constant expression evaluation.  The default is 262144 (1<<18).
3249 @opindex fconstexpr-ops-limit
3250 @item -fconstexpr-ops-limit=@var{n}
3251 Set the maximum number of operations during a single constexpr evaluation.
3252 Even when number of iterations of a single loop is limited with the above limit,
3253 if there are several nested loops and each of them has many iterations but still
3254 smaller than the above limit, or if in a body of some loop or even outside
3255 of a loop too many expressions need to be evaluated, the resulting constexpr
3256 evaluation might take too long.
3257 The default is 33554432 (1<<25).
3259 @opindex fcontracts
3260 @item -fcontracts
3261 Enable experimental support for the C++ Contracts feature, as briefly
3262 added to and then removed from the C++20 working paper (N4820).  The
3263 implementation also includes proposed enhancements from papers P1290,
3264 P1332, and P1429.  This functionality is intended mostly for those
3265 interested in experimentation towards refining the feature to get it
3266 into shape for a future C++ standard.
3268 On violation of a checked contract, the violation handler is called.
3269 Users can replace the violation handler by defining
3270 @smallexample
3271 void
3272 handle_contract_violation (const std::experimental::contract_violation&);
3273 @end smallexample
3275 There are different sets of additional flags that can be used together
3276 to specify which contracts will be checked and how, for N4820
3277 contracts, P1332 contracts, or P1429 contracts; these sets cannot be
3278 used together.
3280 @table @gcctabopt
3281 @opindex fcontract-mode
3282 @item -fcontract-mode=[on|off]
3283 Control whether any contracts have any semantics at all.  Defaults to on.
3285 @opindex fcontract-assumption-mode
3286 @item -fcontract-assumption-mode=[on|off]
3287 [N4820] Control whether contracts with level @samp{axiom}
3288 should have the assume semantic.  Defaults to on.
3290 @opindex fcontract-build-level
3291 @item -fcontract-build-level=[off|default|audit]
3292 [N4820] Specify which level of contracts to generate checks
3293 for.  Defaults to @samp{default}.
3295 @opindex fcontract-continuation-mode
3296 @item -fcontract-continuation-mode=[on|off]
3297 [N4820] Control whether to allow the program to continue executing
3298 after a contract violation.  That is, do checked contracts have the
3299 @samp{maybe} semantic described below rather than the @samp{never}
3300 semantic.  Defaults to off.
3302 @opindex fcontract-role
3303 @item -fcontract-role=<name>:<default>,<audit>,<axiom>
3304 [P1332] Specify the concrete semantics for each contract level
3305 of a particular contract role.
3307 @item -fcontract-semantic=[default|audit|axiom]:<semantic>
3308 [P1429] Specify the concrete semantic for a particular
3309 contract level.
3311 @opindex fcontract-strict-declarations
3312 @item -fcontract-strict-declarations=[on|off]
3313 Control whether to reject adding contracts to a function after its
3314 first declaration.  Defaults to off.
3315 @end table
3317 The possible concrete semantics for that can be specified with
3318 @samp{-fcontract-role} or @samp{-fcontract-semantic} are:
3320 @table @code
3321 @item ignore
3322 This contract has no effect.
3324 @item assume
3325 This contract is treated like C++23 @code{[[assume]]}.
3327 @item check_never_continue
3328 @itemx never
3329 @itemx abort
3330 This contract is checked.  If it fails, the violation handler is
3331 called.  If the handler returns, @code{std::terminate} is called.
3333 @item check_maybe_continue
3334 @itemx maybe
3335 This contract is checked.  If it fails, the violation handler is
3336 called.  If the handler returns, execution continues normally.
3337 @end table
3339 @opindex fcoroutines
3340 @item -fcoroutines
3341 Enable support for the C++ coroutines extension (experimental).
3343 @opindex fdiagnostics-all-candidates
3344 @item -fdiagnostics-all-candidates
3345 Permit the C++ front end to note all candidates during overload resolution
3346 failure, including when a deleted function is selected.
3348 @opindex fno-elide-constructors
3349 @opindex felide-constructors
3350 @item -fno-elide-constructors
3351 The C++ standard allows an implementation to omit creating a temporary
3352 that is only used to initialize another object of the same type.
3353 Specifying this option disables that optimization, and forces G++ to
3354 call the copy constructor in all cases.  This option also causes G++
3355 to call trivial member functions which otherwise would be expanded inline.
3357 In C++17, the compiler is required to omit these temporaries, but this
3358 option still affects trivial member functions.
3360 @opindex fno-enforce-eh-specs
3361 @opindex fenforce-eh-specs
3362 @item -fno-enforce-eh-specs
3363 Don't generate code to check for violation of exception specifications
3364 at run time.  This option violates the C++ standard, but may be useful
3365 for reducing code size in production builds, much like defining
3366 @code{NDEBUG}.  This does not give user code permission to throw
3367 exceptions in violation of the exception specifications; the compiler
3368 still optimizes based on the specifications, so throwing an
3369 unexpected exception results in undefined behavior at run time.
3371 @opindex fextern-tls-init
3372 @opindex fno-extern-tls-init
3373 @item -fextern-tls-init
3374 @itemx -fno-extern-tls-init
3375 The C++11 and OpenMP standards allow @code{thread_local} and
3376 @code{threadprivate} variables to have dynamic (runtime)
3377 initialization.  To support this, any use of such a variable goes
3378 through a wrapper function that performs any necessary initialization.
3379 When the use and definition of the variable are in the same
3380 translation unit, this overhead can be optimized away, but when the
3381 use is in a different translation unit there is significant overhead
3382 even if the variable doesn't actually need dynamic initialization.  If
3383 the programmer can be sure that no use of the variable in a
3384 non-defining TU needs to trigger dynamic initialization (either
3385 because the variable is statically initialized, or a use of the
3386 variable in the defining TU will be executed before any uses in
3387 another TU), they can avoid this overhead with the
3388 @option{-fno-extern-tls-init} option.
3390 On targets that support symbol aliases, the default is
3391 @option{-fextern-tls-init}.  On targets that do not support symbol
3392 aliases, the default is @option{-fno-extern-tls-init}.
3394 @opindex ffold-simple-inlines
3395 @opindex fno-fold-simple-inlines
3396 @item -ffold-simple-inlines
3397 @itemx -fno-fold-simple-inlines
3398 Permit the C++ frontend to fold calls to @code{std::move}, @code{std::forward},
3399 @code{std::addressof} and @code{std::as_const}.  In contrast to inlining, this
3400 means no debug information will be generated for such calls.  Since these
3401 functions are rarely interesting to debug, this flag is enabled by default
3402 unless @option{-fno-inline} is active.
3404 @opindex fno-gnu-keywords
3405 @opindex fgnu-keywords
3406 @item -fno-gnu-keywords
3407 Do not recognize @code{typeof} as a keyword, so that code can use this
3408 word as an identifier.  You can use the keyword @code{__typeof__} instead.
3409 This option is implied by the strict ISO C++ dialects: @option{-ansi},
3410 @option{-std=c++98}, @option{-std=c++11}, etc.
3412 @opindex fno-immediate-escalation
3413 @opindex fimmediate-escalation
3414 @item -fno-immediate-escalation
3415 Do not enable immediate function escalation whereby certain functions
3416 can be promoted to consteval, as specified in P2564R3.  For example:
3418 @example
3419 consteval int id(int i) @{ return i; @}
3421 constexpr int f(auto t)
3423   return t + id(t); // id causes f<int> to be promoted to consteval
3426 void g(int i)
3428   f (3);
3430 @end example
3432 compiles in C++20: @code{f} is an immediate-escalating function (due to
3433 the @code{auto} it is a function template and is declared @code{constexpr})
3434 and @code{id(t)} is an immediate-escalating expression, so @code{f} is
3435 promoted to @code{consteval}.  Consequently, the call to @code{id(t)}
3436 is in an immediate context, so doesn't have to produce a constant (that
3437 is the mechanism allowing consteval function composition).  However,
3438 with @option{-fno-immediate-escalation}, @code{f} is not promoted to
3439 @code{consteval}, and since the call to consteval function @code{id(t)}
3440 is not a constant expression, the compiler rejects the code.
3442 This option is turned on by default; it is only effective in C++20 mode
3443 or later.
3445 @opindex fimplicit-constexpr
3446 @item -fimplicit-constexpr
3447 Make inline functions implicitly constexpr, if they satisfy the
3448 requirements for a constexpr function.  This option can be used in
3449 C++14 mode or later.  This can result in initialization changing from
3450 dynamic to static and other optimizations.
3452 @opindex fno-implicit-templates
3453 @opindex fimplicit-templates
3454 @item -fno-implicit-templates
3455 Never emit code for non-inline templates that are instantiated
3456 implicitly (i.e.@: by use); only emit code for explicit instantiations.
3457 If you use this option, you must take care to structure your code to
3458 include all the necessary explicit instantiations to avoid getting
3459 undefined symbols at link time.
3460 @xref{Template Instantiation}, for more information.
3462 @opindex fno-implicit-inline-templates
3463 @opindex fimplicit-inline-templates
3464 @item -fno-implicit-inline-templates
3465 Don't emit code for implicit instantiations of inline templates, either.
3466 The default is to handle inlines differently so that compiles with and
3467 without optimization need the same set of explicit instantiations.
3469 @opindex fno-implement-inlines
3470 @opindex fimplement-inlines
3471 @item -fno-implement-inlines
3472 To save space, do not emit out-of-line copies of inline functions
3473 controlled by @code{#pragma implementation}.  This causes linker
3474 errors if these functions are not inlined everywhere they are called.
3476 @opindex fmodules-ts
3477 @opindex fno-modules-ts
3478 @item -fmodules-ts
3479 @itemx -fno-modules-ts
3480 Enable support for C++20 modules (@pxref{C++ Modules}).  The
3481 @option{-fno-modules-ts} is usually not needed, as that is the
3482 default.  Even though this is a C++20 feature, it is not currently
3483 implicitly enabled by selecting that standard version.
3485 @opindex fmodule-header
3486 @item -fmodule-header
3487 @itemx -fmodule-header=user
3488 @itemx -fmodule-header=system
3489 Compile a header file to create an importable header unit.
3491 @opindex fmodule-implicit-inline
3492 @item -fmodule-implicit-inline
3493 Member functions defined in their class definitions are not implicitly
3494 inline for modular code.  This is different to traditional C++
3495 behavior, for good reasons.  However, it may result in a difficulty
3496 during code porting.  This option makes such function definitions
3497 implicitly inline.  It does however generate an ABI incompatibility,
3498 so you must use it everywhere or nowhere.  (Such definitions outside
3499 of a named module remain implicitly inline, regardless.)
3501 @opindex fno-module-lazy
3502 @opindex fmodule-lazy
3503 @item -fno-module-lazy
3504 Disable lazy module importing and module mapper creation.
3506 @vindex CXX_MODULE_MAPPER @r{environment variable}
3507 @opindex fmodule-mapper
3508 @item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
3509 @itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...}
3510 @itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]}
3511 @itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]}
3512 @itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]}
3513 @itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]}
3514 An oracle to query for module name to filename mappings.  If
3515 unspecified the @env{CXX_MODULE_MAPPER} environment variable is used,
3516 and if that is unset, an in-process default is provided.
3518 @opindex fmodule-only
3519 @item -fmodule-only
3520 Only emit the Compiled Module Interface, inhibiting any object file.
3522 @opindex fms-extensions
3523 @item -fms-extensions
3524 Disable Wpedantic warnings about constructs used in MFC, such as implicit
3525 int and getting a pointer to member function via non-standard syntax.
3527 @opindex fnew-inheriting-ctors
3528 @item -fnew-inheriting-ctors
3529 Enable the P0136 adjustment to the semantics of C++11 constructor
3530 inheritance.  This is part of C++17 but also considered to be a Defect
3531 Report against C++11 and C++14.  This flag is enabled by default
3532 unless @option{-fabi-version=10} or lower is specified.
3534 @opindex fnew-ttp-matching
3535 @item -fnew-ttp-matching
3536 Enable the P0522 resolution to Core issue 150, template template
3537 parameters and default arguments: this allows a template with default
3538 template arguments as an argument for a template template parameter
3539 with fewer template parameters.  This flag is enabled by default for
3540 @option{-std=c++17}.
3542 @opindex fno-nonansi-builtins
3543 @opindex fnonansi-builtins
3544 @item -fno-nonansi-builtins
3545 Disable built-in declarations of functions that are not mandated by
3546 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
3547 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
3549 @opindex fnothrow-opt
3550 @item -fnothrow-opt
3551 Treat a @code{throw()} exception specification as if it were a
3552 @code{noexcept} specification to reduce or eliminate the text size
3553 overhead relative to a function with no exception specification.  If
3554 the function has local variables of types with non-trivial
3555 destructors, the exception specification actually makes the
3556 function smaller because the EH cleanups for those variables can be
3557 optimized away.  The semantic effect is that an exception thrown out of
3558 a function with such an exception specification results in a call
3559 to @code{terminate} rather than @code{unexpected}.
3561 @opindex fno-operator-names
3562 @opindex foperator-names
3563 @item -fno-operator-names
3564 Do not treat the operator name keywords @code{and}, @code{bitand},
3565 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3566 synonyms as keywords.
3568 @opindex fno-optional-diags
3569 @opindex foptional-diags
3570 @item -fno-optional-diags
3571 Disable diagnostics that the standard says a compiler does not need to
3572 issue.  Currently, the only such diagnostic issued by G++ is the one for
3573 a name having multiple meanings within a class.
3575 @opindex fno-pretty-templates
3576 @opindex fpretty-templates
3577 @item -fno-pretty-templates
3578 When an error message refers to a specialization of a function
3579 template, the compiler normally prints the signature of the
3580 template followed by the template arguments and any typedefs or
3581 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3582 rather than @code{void f(int)}) so that it's clear which template is
3583 involved.  When an error message refers to a specialization of a class
3584 template, the compiler omits any template arguments that match
3585 the default template arguments for that template.  If either of these
3586 behaviors make it harder to understand the error message rather than
3587 easier, you can use @option{-fno-pretty-templates} to disable them.
3589 @opindex fno-rtti
3590 @opindex frtti
3591 @item -fno-rtti
3592 Disable generation of information about every class with virtual
3593 functions for use by the C++ run-time type identification features
3594 (@code{dynamic_cast} and @code{typeid}).  If you don't use those parts
3595 of the language, you can save some space by using this flag.  Note that
3596 exception handling uses the same information, but G++ generates it as
3597 needed. The @code{dynamic_cast} operator can still be used for casts that
3598 do not require run-time type information, i.e.@: casts to @code{void *} or to
3599 unambiguous base classes.
3601 Mixing code compiled with @option{-frtti} with that compiled with
3602 @option{-fno-rtti} may not work.  For example, programs may
3603 fail to link if a class compiled with @option{-fno-rtti} is used as a base 
3604 for a class compiled with @option{-frtti}.  
3606 @opindex fsized-deallocation
3607 @item -fsized-deallocation
3608 Enable the built-in global declarations
3609 @smallexample
3610 void operator delete (void *, std::size_t) noexcept;
3611 void operator delete[] (void *, std::size_t) noexcept;
3612 @end smallexample
3613 as introduced in C++14.  This is useful for user-defined replacement
3614 deallocation functions that, for example, use the size of the object
3615 to make deallocation faster.  Enabled by default under
3616 @option{-std=c++14} and above.  The flag @option{-Wsized-deallocation}
3617 warns about places that might want to add a definition.
3619 @opindex fstrict-enums
3620 @item -fstrict-enums
3621 Allow the compiler to optimize using the assumption that a value of
3622 enumerated type can only be one of the values of the enumeration (as
3623 defined in the C++ standard; basically, a value that can be
3624 represented in the minimum number of bits needed to represent all the
3625 enumerators).  This assumption may not be valid if the program uses a
3626 cast to convert an arbitrary integer value to the enumerated type.
3627 This option has no effect for an enumeration type with a fixed underlying
3628 type.
3630 @opindex fstrong-eval-order
3631 @item -fstrong-eval-order
3632 Evaluate member access, array subscripting, and shift expressions in
3633 left-to-right order, and evaluate assignment in right-to-left order,
3634 as adopted for C++17.  Enabled by default with @option{-std=c++17}.
3635 @option{-fstrong-eval-order=some} enables just the ordering of member
3636 access and shift expressions, and is the default without
3637 @option{-std=c++17}.
3639 @opindex ftemplate-backtrace-limit
3640 @item -ftemplate-backtrace-limit=@var{n}
3641 Set the maximum number of template instantiation notes for a single
3642 warning or error to @var{n}.  The default value is 10.
3644 @opindex ftemplate-depth
3645 @item -ftemplate-depth=@var{n}
3646 Set the maximum instantiation depth for template classes to @var{n}.
3647 A limit on the template instantiation depth is needed to detect
3648 endless recursions during template class instantiation.  ANSI/ISO C++
3649 conforming programs must not rely on a maximum depth greater than 17
3650 (changed to 1024 in C++11).  The default value is 900, as the compiler
3651 can run out of stack space before hitting 1024 in some situations.
3653 @opindex fno-threadsafe-statics
3654 @opindex fthreadsafe-statics
3655 @item -fno-threadsafe-statics
3656 Do not emit the extra code to use the routines specified in the C++
3657 ABI for thread-safe initialization of local statics.  You can use this
3658 option to reduce code size slightly in code that doesn't need to be
3659 thread-safe.
3661 @opindex fuse-cxa-atexit
3662 @item -fuse-cxa-atexit
3663 Register destructors for objects with static storage duration with the
3664 @code{__cxa_atexit} function rather than the @code{atexit} function.
3665 This option is required for fully standards-compliant handling of static
3666 destructors, but only works if your C library supports
3667 @code{__cxa_atexit}.
3669 @opindex fno-use-cxa-get-exception-ptr
3670 @opindex fuse-cxa-get-exception-ptr
3671 @item -fno-use-cxa-get-exception-ptr
3672 Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
3673 causes @code{std::uncaught_exception} to be incorrect, but is necessary
3674 if the runtime routine is not available.
3676 @opindex fvisibility-inlines-hidden
3677 @item -fvisibility-inlines-hidden
3678 This switch declares that the user does not attempt to compare
3679 pointers to inline functions or methods where the addresses of the two functions
3680 are taken in different shared objects.
3682 The effect of this is that GCC may, effectively, mark inline methods with
3683 @code{__attribute__ ((visibility ("hidden")))} so that they do not
3684 appear in the export table of a DSO and do not require a PLT indirection
3685 when used within the DSO@.  Enabling this option can have a dramatic effect
3686 on load and link times of a DSO as it massively reduces the size of the
3687 dynamic export table when the library makes heavy use of templates.
3689 The behavior of this switch is not quite the same as marking the
3690 methods as hidden directly, because it does not affect static variables
3691 local to the function or cause the compiler to deduce that
3692 the function is defined in only one shared object.
3694 You may mark a method as having a visibility explicitly to negate the
3695 effect of the switch for that method.  For example, if you do want to
3696 compare pointers to a particular inline method, you might mark it as
3697 having default visibility.  Marking the enclosing class with explicit
3698 visibility has no effect.
3700 Explicitly instantiated inline methods are unaffected by this option
3701 as their linkage might otherwise cross a shared library boundary.
3702 @xref{Template Instantiation}.
3704 @opindex fvisibility-ms-compat
3705 @item -fvisibility-ms-compat
3706 This flag attempts to use visibility settings to make GCC's C++
3707 linkage model compatible with that of Microsoft Visual Studio.
3709 The flag makes these changes to GCC's linkage model:
3711 @enumerate
3712 @item
3713 It sets the default visibility to @code{hidden}, like
3714 @option{-fvisibility=hidden}.
3716 @item
3717 Types, but not their members, are not hidden by default.
3719 @item
3720 The One Definition Rule is relaxed for types without explicit
3721 visibility specifications that are defined in more than one
3722 shared object: those declarations are permitted if they are
3723 permitted when this option is not used.
3724 @end enumerate
3726 In new code it is better to use @option{-fvisibility=hidden} and
3727 export those classes that are intended to be externally visible.
3728 Unfortunately it is possible for code to rely, perhaps accidentally,
3729 on the Visual Studio behavior.
3731 Among the consequences of these changes are that static data members
3732 of the same type with the same name but defined in different shared
3733 objects are different, so changing one does not change the other;
3734 and that pointers to function members defined in different shared
3735 objects may not compare equal.  When this flag is given, it is a
3736 violation of the ODR to define types with the same name differently.
3738 @opindex fno-weak
3739 @opindex fweak
3740 @item -fno-weak
3741 Do not use weak symbol support, even if it is provided by the linker.
3742 By default, G++ uses weak symbols if they are available.  This
3743 option exists only for testing, and should not be used by end-users;
3744 it results in inferior code and has no benefits.  This option may
3745 be removed in a future release of G++.
3747 @opindex fext-numeric-literals
3748 @opindex fno-ext-numeric-literals
3749 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3750 Accept imaginary, fixed-point, or machine-defined
3751 literal number suffixes as GNU extensions.
3752 When this option is turned off these suffixes are treated
3753 as C++11 user-defined literal numeric suffixes.
3754 This is on by default for all pre-C++11 dialects and all GNU dialects:
3755 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3756 @option{-std=gnu++14}.
3757 This option is off by default
3758 for ISO C++11 onwards (@option{-std=c++11}, ...).
3760 @opindex nostdinc++
3761 @item -nostdinc++
3762 Do not search for header files in the standard directories specific to
3763 C++, but do still search the other standard directories.  (This option
3764 is used when building the C++ library.)
3766 @opindex flang-info-include-translate
3767 @opindex flang-info-include-translate-not
3768 @item -flang-info-include-translate
3769 @itemx -flang-info-include-translate-not
3770 @itemx -flang-info-include-translate=@var{header}
3771 Inform of include translation events.  The first will note accepted
3772 include translations, the second will note declined include
3773 translations.  The @var{header} form will inform of include
3774 translations relating to that specific header.  If @var{header} is of
3775 the form @code{"user"} or @code{<system>} it will be resolved to a
3776 specific user or system header using the include path.
3778 @opindex flang-info-module-cmi
3779 @item -flang-info-module-cmi
3780 @itemx -flang-info-module-cmi=@var{module}
3781 Inform of Compiled Module Interface pathnames.  The first will note
3782 all read CMI pathnames.  The @var{module} form will not reading a
3783 specific module's CMI.  @var{module} may be a named module or a
3784 header-unit (the latter indicated by either being a pathname containing
3785 directory separators or enclosed in @code{<>} or @code{""}).
3787 @opindex stdlib
3788 @item -stdlib=@var{libstdc++,libc++}
3789 When G++ is configured to support this option, it allows specification of
3790 alternate C++ runtime libraries.  Two options are available: @var{libstdc++}
3791 (the default, native C++ runtime for G++) and @var{libc++} which is the
3792 C++ runtime installed on some operating systems (e.g. Darwin versions from
3793 Darwin11 onwards).  The option switches G++ to use the headers from the
3794 specified library and to emit @code{-lstdc++} or @code{-lc++} respectively,
3795 when a C++ runtime is required for linking.
3796 @end table
3798 In addition, these warning options have meanings only for C++ programs:
3800 @table @gcctabopt
3801 @opindex Wabi-tag
3802 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3803 Warn when a type with an ABI tag is used in a context that does not
3804 have that ABI tag.  See @ref{C++ Attributes} for more information
3805 about ABI tags.
3807 @opindex Wcomma-subscript
3808 @opindex Wno-comma-subscript
3809 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3810 Warn about uses of a comma expression within a subscripting expression.
3811 This usage was deprecated in C++20 and is going to be removed in C++23.
3812 However, a comma expression wrapped in @code{( )} is not deprecated.  Example:
3814 @smallexample
3815 @group
3816 void f(int *a, int b, int c) @{
3817     a[b,c];     // deprecated in C++20, invalid in C++23
3818     a[(b,c)];   // OK
3820 @end group
3821 @end smallexample
3823 In C++23 it is valid to have comma separated expressions in a subscript
3824 when an overloaded subscript operator is found and supports the right
3825 number and types of arguments.  G++ will accept the formerly valid syntax
3826 for code that is not valid in C++23 but used to be valid but deprecated
3827 in C++20 with a pedantic warning that can be disabled with
3828 @option{-Wno-comma-subscript}.
3830 Enabled by default with @option{-std=c++20} unless @option{-Wno-deprecated},
3831 and with @option{-std=c++23} regardless of @option{-Wno-deprecated}.
3833 This warning is upgraded to an error by @option{-pedantic-errors} in
3834 C++23 mode or later.
3836 @opindex Wctad-maybe-unsupported
3837 @opindex Wno-ctad-maybe-unsupported
3838 @item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)}
3839 Warn when performing class template argument deduction (CTAD) on a type with
3840 no explicitly written deduction guides.  This warning will point out cases
3841 where CTAD succeeded only because the compiler synthesized the implicit
3842 deduction guides, which might not be what the programmer intended.  Certain
3843 style guides allow CTAD only on types that specifically "opt-in"; i.e., on
3844 types that are designed to support CTAD.  This warning can be suppressed with
3845 the following pattern:
3847 @smallexample
3848 struct allow_ctad_t; // any name works
3849 template <typename T> struct S @{
3850   S(T) @{ @}
3852 // Guide with incomplete parameter type will never be considered.
3853 S(allow_ctad_t) -> S<void>;
3854 @end smallexample
3856 @opindex Wctor-dtor-privacy
3857 @opindex Wno-ctor-dtor-privacy
3858 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3859 Warn when a class seems unusable because all the constructors or
3860 destructors in that class are private, and it has neither friends nor
3861 public static member functions.  Also warn if there are no non-private
3862 methods, and there's at least one private member function that isn't
3863 a constructor or destructor.
3865 @opindex Wdangling-reference
3866 @opindex Wno-dangling-reference
3867 @item -Wdangling-reference @r{(C++ and Objective-C++ only)}
3868 Warn when a reference is bound to a temporary whose lifetime has ended.
3869 For example:
3871 @smallexample
3872 int n = 1;
3873 const int& r = std::max(n - 1, n + 1); // r is dangling
3874 @end smallexample
3876 In the example above, two temporaries are created, one for each
3877 argument, and a reference to one of the temporaries is returned.
3878 However, both temporaries are destroyed at the end of the full
3879 expression, so the reference @code{r} is dangling.  This warning
3880 also detects dangling references in member initializer lists:
3882 @smallexample
3883 const int& f(const int& i) @{ return i; @}
3884 struct S @{
3885   const int &r; // r is dangling
3886   S() : r(f(10)) @{ @}
3888 @end smallexample
3890 Member functions are checked as well, but only their object argument:
3892 @smallexample
3893 struct S @{
3894    const S& self () @{ return *this; @}
3896 const S& s = S().self(); // s is dangling
3897 @end smallexample
3899 Certain functions are safe in this respect, for example @code{std::use_facet}:
3900 they take and return a reference, but they don't return one of its arguments,
3901 which can fool the warning.  Such functions can be excluded from the warning
3902 by wrapping them in a @code{#pragma}:
3904 @smallexample
3905 #pragma GCC diagnostic push
3906 #pragma GCC diagnostic ignored "-Wdangling-reference"
3907 const T& foo (const T&) @{ @dots{} @}
3908 #pragma GCC diagnostic pop
3909 @end smallexample
3911 @option{-Wdangling-reference} also warns about code like
3913 @smallexample
3914 auto p = std::minmax(1, 2);
3915 @end smallexample
3917 where @code{std::minmax} returns @code{std::pair<const int&, const int&>}, and
3918 both references dangle after the end of the full expression that contains
3919 the call to @code{std::minmax}.
3921 The warning does not warn for @code{std::span}-like classes.  We consider
3922 classes of the form:
3924 @smallexample
3925 template<typename T>
3926 struct Span @{
3927   T* data_;
3928   std::size len_;
3930 @end smallexample
3932 as @code{std::span}-like; that is, the class is a non-union class
3933 that has a pointer data member and a trivial destructor.
3935 This warning is enabled by @option{-Wall}.
3937 @opindex Wdelete-non-virtual-dtor
3938 @opindex Wno-delete-non-virtual-dtor
3939 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3940 Warn when @code{delete} is used to destroy an instance of a class that
3941 has virtual functions and non-virtual destructor. It is unsafe to delete
3942 an instance of a derived class through a pointer to a base class if the
3943 base class does not have a virtual destructor.  This warning is enabled
3944 by @option{-Wall}.
3946 @opindex Wdeprecated-copy
3947 @opindex Wno-deprecated-copy
3948 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3949 Warn that the implicit declaration of a copy constructor or copy
3950 assignment operator is deprecated if the class has a user-provided
3951 copy constructor or copy assignment operator, in C++11 and up.  This
3952 warning is enabled by @option{-Wextra}.  With
3953 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3954 user-provided destructor.
3956 @opindex Wdeprecated-enum-enum-conversion
3957 @opindex Wno-deprecated-enum-enum-conversion
3958 @item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)}
3959 Disable the warning about the case when the usual arithmetic conversions
3960 are applied on operands where one is of enumeration type and the other is
3961 of a different enumeration type.  This conversion was deprecated in C++20.
3962 For example:
3964 @smallexample
3965 enum E1 @{ e @};
3966 enum E2 @{ f @};
3967 int k = f - e;
3968 @end smallexample
3970 @option{-Wdeprecated-enum-enum-conversion} is enabled by default with
3971 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3972 by @option{-Wenum-conversion}.
3974 @opindex Wdeprecated-enum-float-conversion
3975 @opindex Wno-deprecated-enum-float-conversion
3976 @item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)}
3977 Disable the warning about the case when the usual arithmetic conversions
3978 are applied on operands where one is of enumeration type and the other is
3979 of a floating-point type.  This conversion was deprecated in C++20.  For
3980 example:
3982 @smallexample
3983 enum E1 @{ e @};
3984 enum E2 @{ f @};
3985 bool b = e <= 3.7;
3986 @end smallexample
3988 @option{-Wdeprecated-enum-float-conversion} is enabled by default with
3989 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3990 by @option{-Wenum-conversion}.
3992 @opindex Welaborated-enum-base
3993 @opindex Wno-elaborated-enum-base
3994 @item -Wno-elaborated-enum-base
3995 For C++11 and above, warn if an (invalid) additional enum-base is used
3996 in an elaborated-type-specifier.  That is, if an enum with given
3997 underlying type and no enumerator list is used in a declaration other
3998 than just a standalone declaration of the enum.  Enabled by default.  This
3999 warning is upgraded to an error with -pedantic-errors.
4001 @opindex Winit-list-lifetime
4002 @opindex Wno-init-list-lifetime
4003 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
4004 Do not warn about uses of @code{std::initializer_list} that are likely
4005 to result in dangling pointers.  Since the underlying array for an
4006 @code{initializer_list} is handled like a normal C++ temporary object,
4007 it is easy to inadvertently keep a pointer to the array past the end
4008 of the array's lifetime.  For example:
4010 @itemize @bullet
4011 @item
4012 If a function returns a temporary @code{initializer_list}, or a local
4013 @code{initializer_list} variable, the array's lifetime ends at the end
4014 of the return statement, so the value returned has a dangling pointer.
4016 @item
4017 If a new-expression creates an @code{initializer_list}, the array only
4018 lives until the end of the enclosing full-expression, so the
4019 @code{initializer_list} in the heap has a dangling pointer.
4021 @item
4022 When an @code{initializer_list} variable is assigned from a
4023 brace-enclosed initializer list, the temporary array created for the
4024 right side of the assignment only lives until the end of the
4025 full-expression, so at the next statement the @code{initializer_list}
4026 variable has a dangling pointer.
4028 @smallexample
4029 // li's initial underlying array lives as long as li
4030 std::initializer_list<int> li = @{ 1,2,3 @};
4031 // assignment changes li to point to a temporary array
4032 li = @{ 4, 5 @};
4033 // now the temporary is gone and li has a dangling pointer
4034 int i = li.begin()[0] // undefined behavior
4035 @end smallexample
4037 @item
4038 When a list constructor stores the @code{begin} pointer from the
4039 @code{initializer_list} argument, this doesn't extend the lifetime of
4040 the array, so if a class variable is constructed from a temporary
4041 @code{initializer_list}, the pointer is left dangling by the end of
4042 the variable declaration statement.
4044 @end itemize
4046 @opindex Winvalid-constexpr
4047 @opindex Wno-invalid-constexpr
4048 @item -Winvalid-constexpr
4050 Warn when a function never produces a constant expression.  In C++20
4051 and earlier, for every @code{constexpr} function and function template,
4052 there must be at least one set of function arguments in at least one
4053 instantiation such that an invocation of the function or constructor
4054 could be an evaluated subexpression of a core constant expression.
4055 C++23 removed this restriction, so it's possible to have a function
4056 or a function template marked @code{constexpr} for which no invocation
4057 satisfies the requirements of a core constant expression.
4059 This warning is enabled as a pedantic warning by default in C++20 and
4060 earlier.  In C++23, @option{-Winvalid-constexpr} can be turned on, in
4061 which case it will be an ordinary warning.  For example:
4063 @smallexample
4064 void f (int& i);
4065 constexpr void
4066 g (int& i)
4068   // Warns by default in C++20, in C++23 only with -Winvalid-constexpr.
4069   f(i);
4071 @end smallexample
4073 @opindex Winvalid-imported-macros
4074 @opindex Wno-invalid-imported-macros
4075 @item -Winvalid-imported-macros
4076 Verify all imported macro definitions are valid at the end of
4077 compilation.  This is not enabled by default, as it requires
4078 additional processing to determine.  It may be useful when preparing
4079 sets of header-units to ensure consistent macros.
4081 @opindex Wliteral-suffix
4082 @opindex Wno-literal-suffix
4083 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
4084 Do not warn when a string or character literal is followed by a
4085 ud-suffix which does not begin with an underscore.  As a conforming
4086 extension, GCC treats such suffixes as separate preprocessing tokens
4087 in order to maintain backwards compatibility with code that uses
4088 formatting macros from @code{<inttypes.h>}.  For example:
4090 @smallexample
4091 #define __STDC_FORMAT_MACROS
4092 #include <inttypes.h>
4093 #include <stdio.h>
4095 int main() @{
4096   int64_t i64 = 123;
4097   printf("My int64: %" PRId64"\n", i64);
4099 @end smallexample
4101 In this case, @code{PRId64} is treated as a separate preprocessing token.
4103 This option also controls warnings when a user-defined literal
4104 operator is declared with a literal suffix identifier that doesn't
4105 begin with an underscore. Literal suffix identifiers that don't begin
4106 with an underscore are reserved for future standardization.
4108 These warnings are enabled by default.
4110 @opindex Wnarrowing
4111 @opindex Wno-narrowing
4112 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
4113 For C++11 and later standards, narrowing conversions are diagnosed by default,
4114 as required by the standard.  A narrowing conversion from a constant produces
4115 an error, and a narrowing conversion from a non-constant produces a warning,
4116 but @option{-Wno-narrowing} suppresses the diagnostic.
4117 Note that this does not affect the meaning of well-formed code;
4118 narrowing conversions are still considered ill-formed in SFINAE contexts.
4120 With @option{-Wnarrowing} in C++98, warn when a narrowing
4121 conversion prohibited by C++11 occurs within
4122 @samp{@{ @}}, e.g.
4124 @smallexample
4125 int i = @{ 2.2 @}; // error: narrowing from double to int
4126 @end smallexample
4128 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
4130 @opindex Wnoexcept
4131 @opindex Wno-noexcept
4132 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
4133 Warn when a noexcept-expression evaluates to false because of a call
4134 to a function that does not have a non-throwing exception
4135 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
4136 the compiler to never throw an exception.
4138 @opindex Wnoexcept-type
4139 @opindex Wno-noexcept-type
4140 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
4141 Warn if the C++17 feature making @code{noexcept} part of a function
4142 type changes the mangled name of a symbol relative to C++14.  Enabled
4143 by @option{-Wabi} and @option{-Wc++17-compat}.
4145 As an example:
4147 @smallexample
4148 template <class T> void f(T t) @{ t(); @};
4149 void g() noexcept;
4150 void h() @{ f(g); @} 
4151 @end smallexample
4153 @noindent
4154 In C++14, @code{f} calls @code{f<void(*)()>}, but in
4155 C++17 it calls @code{f<void(*)()noexcept>}.
4157 @opindex Wclass-memaccess
4158 @opindex Wno-class-memaccess
4159 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
4160 Warn when the destination of a call to a raw memory function such as
4161 @code{memset} or @code{memcpy} is an object of class type, and when writing
4162 into such an object might bypass the class non-trivial or deleted constructor
4163 or copy assignment, violate const-correctness or encapsulation, or corrupt
4164 virtual table pointers.  Modifying the representation of such objects may
4165 violate invariants maintained by member functions of the class.  For example,
4166 the call to @code{memset} below is undefined because it modifies a non-trivial
4167 class object and is, therefore, diagnosed.  The safe way to either initialize
4168 or clear the storage of objects of such types is by using the appropriate
4169 constructor or assignment operator, if one is available.
4170 @smallexample
4171 std::string str = "abc";
4172 memset (&str, 0, sizeof str);
4173 @end smallexample
4174 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
4175 Explicitly casting the pointer to the class object to @code{void *} or
4176 to a type that can be safely accessed by the raw memory function suppresses
4177 the warning.
4179 @opindex Wnon-virtual-dtor
4180 @opindex Wno-non-virtual-dtor
4181 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
4182 Warn when a class has virtual functions and an accessible non-virtual
4183 destructor itself or in an accessible polymorphic base class, in which
4184 case it is possible but unsafe to delete an instance of a derived
4185 class through a pointer to the class itself or base class.  This
4186 warning is automatically enabled if @option{-Weffc++} is specified.
4187 The @option{-Wdelete-non-virtual-dtor} option (enabled by @option{-Wall})
4188 should be preferred because it warns about the unsafe cases without false
4189 positives.
4191 @opindex Wregister
4192 @opindex Wno-register
4193 @item -Wregister @r{(C++ and Objective-C++ only)}
4194 Warn on uses of the @code{register} storage class specifier, except
4195 when it is part of the GNU @ref{Explicit Register Variables} extension.
4196 The use of the @code{register} keyword as storage class specifier has
4197 been deprecated in C++11 and removed in C++17.
4198 Enabled by default with @option{-std=c++17}.
4200 @opindex Wreorder
4201 @opindex Wno-reorder
4202 @cindex reordering, warning
4203 @cindex warning for reordering of member initializers
4204 @item -Wreorder @r{(C++ and Objective-C++ only)}
4205 Warn when the order of member initializers given in the code does not
4206 match the order in which they must be executed.  For instance:
4208 @smallexample
4209 struct A @{
4210   int i;
4211   int j;
4212   A(): j (0), i (1) @{ @}
4214 @end smallexample
4216 @noindent
4217 The compiler rearranges the member initializers for @code{i}
4218 and @code{j} to match the declaration order of the members, emitting
4219 a warning to that effect.  This warning is enabled by @option{-Wall}.
4221 @opindex Wpessimizing-move
4222 @opindex Wno-pessimizing-move
4223 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
4224 This warning warns when a call to @code{std::move} prevents copy
4225 elision.  A typical scenario when copy elision can occur is when returning in
4226 a function with a class return type, when the expression being returned is the
4227 name of a non-volatile automatic object, and is not a function parameter, and
4228 has the same type as the function return type.
4230 @smallexample
4231 struct T @{
4232 @dots{}
4234 T fn()
4236   T t;
4237   @dots{}
4238   return std::move (t);
4240 @end smallexample
4242 But in this example, the @code{std::move} call prevents copy elision.
4244 This warning is enabled by @option{-Wall}.
4246 @opindex Wredundant-move
4247 @opindex Wno-redundant-move
4248 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
4249 This warning warns about redundant calls to @code{std::move}; that is, when
4250 a move operation would have been performed even without the @code{std::move}
4251 call.  This happens because the compiler is forced to treat the object as if
4252 it were an rvalue in certain situations such as returning a local variable,
4253 where copy elision isn't applicable.  Consider:
4255 @smallexample
4256 struct T @{
4257 @dots{}
4259 T fn(T t)
4261   @dots{}
4262   return std::move (t);
4264 @end smallexample
4266 Here, the @code{std::move} call is redundant.  Because G++ implements Core
4267 Issue 1579, another example is:
4269 @smallexample
4270 struct T @{ // convertible to U
4271 @dots{}
4273 struct U @{
4274 @dots{}
4276 U fn()
4278   T t;
4279   @dots{}
4280   return std::move (t);
4282 @end smallexample
4283 In this example, copy elision isn't applicable because the type of the
4284 expression being returned and the function return type differ, yet G++
4285 treats the return value as if it were designated by an rvalue.
4287 This warning is enabled by @option{-Wextra}.
4289 @opindex Wrange-loop-construct
4290 @opindex Wno-range-loop-construct
4291 @item -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
4292 This warning warns when a C++ range-based for-loop is creating an unnecessary
4293 copy.  This can happen when the range declaration is not a reference, but
4294 probably should be.  For example:
4296 @smallexample
4297 struct S @{ char arr[128]; @};
4298 void fn () @{
4299   S arr[5];
4300   for (const auto x : arr) @{ @dots{} @}
4302 @end smallexample
4304 It does not warn when the type being copied is a trivially-copyable type whose
4305 size is less than 64 bytes.
4307 This warning also warns when a loop variable in a range-based for-loop is
4308 initialized with a value of a different type resulting in a copy.  For example:
4310 @smallexample
4311 void fn() @{
4312   int arr[10];
4313   for (const double &x : arr) @{ @dots{} @}
4315 @end smallexample
4317 In the example above, in every iteration of the loop a temporary value of
4318 type @code{double} is created and destroyed, to which the reference
4319 @code{const double &} is bound.
4321 This warning is enabled by @option{-Wall}.
4323 @opindex Wredundant-tags
4324 @opindex Wno-redundant-tags
4325 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
4326 Warn about redundant class-key and enum-key in references to class types
4327 and enumerated types in contexts where the key can be eliminated without
4328 causing an ambiguity.  For example:
4330 @smallexample
4331 struct foo;
4332 struct foo *p;   // warn that keyword struct can be eliminated
4333 @end smallexample
4335 @noindent
4336 On the other hand, in this example there is no warning:
4338 @smallexample
4339 struct foo;
4340 void foo ();   // "hides" struct foo
4341 void bar (struct foo&);  // no warning, keyword struct is necessary
4342 @end smallexample
4344 @opindex Wsubobject-linkage
4345 @opindex Wno-subobject-linkage
4346 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
4347 Do not warn
4348 if a class type has a base or a field whose type uses the anonymous
4349 namespace or depends on a type with no linkage.  If a type A depends on
4350 a type B with no or internal linkage, defining it in multiple
4351 translation units would be an ODR violation because the meaning of B
4352 is different in each translation unit.  If A only appears in a single
4353 translation unit, the best way to silence the warning is to give it
4354 internal linkage by putting it in an anonymous namespace as well.  The
4355 compiler doesn't give this warning for types defined in the main .C
4356 file, as those are unlikely to have multiple definitions.
4357 @option{-Wsubobject-linkage} is enabled by default.
4359 @opindex Weffc++
4360 @opindex Wno-effc++
4361 @item -Weffc++ @r{(C++ and Objective-C++ only)}
4362 Warn about violations of the following style guidelines from Scott Meyers'
4363 @cite{Effective C++} series of books:
4365 @itemize @bullet
4366 @item
4367 Define a copy constructor and an assignment operator for classes
4368 with dynamically-allocated memory.
4370 @item
4371 Prefer initialization to assignment in constructors.
4373 @item
4374 Have @code{operator=} return a reference to @code{*this}.
4376 @item
4377 Don't try to return a reference when you must return an object.
4379 @item
4380 Distinguish between prefix and postfix forms of increment and
4381 decrement operators.
4383 @item
4384 Never overload @code{&&}, @code{||}, or @code{,}.
4386 @end itemize
4388 This option also enables @option{-Wnon-virtual-dtor}, which is also
4389 one of the effective C++ recommendations.  However, the check is
4390 extended to warn about the lack of virtual destructor in accessible
4391 non-polymorphic bases classes too.
4393 When selecting this option, be aware that the standard library
4394 headers do not obey all of these guidelines; use @samp{grep -v}
4395 to filter out those warnings.
4397 @opindex Wexceptions
4398 @opindex Wno-exceptions
4399 @item -Wno-exceptions @r{(C++ and Objective-C++ only)}
4400 Disable the warning about the case when an exception handler is shadowed by
4401 another handler, which can point out a wrong ordering of exception handlers.
4403 @opindex Wstrict-null-sentinel
4404 @opindex Wno-strict-null-sentinel
4405 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
4406 Warn about the use of an uncasted @code{NULL} as sentinel.  When
4407 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
4408 to @code{__null}.  Although it is a null pointer constant rather than a
4409 null pointer, it is guaranteed to be of the same size as a pointer.
4410 But this use is not portable across different compilers.
4412 @opindex Wno-non-template-friend
4413 @opindex Wnon-template-friend
4414 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
4415 Disable warnings when non-template friend functions are declared
4416 within a template.  In very old versions of GCC that predate implementation
4417 of the ISO standard, declarations such as 
4418 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
4419 could be interpreted as a particular specialization of a template
4420 function; the warning exists to diagnose compatibility problems, 
4421 and is enabled by default.
4423 @opindex Wold-style-cast
4424 @opindex Wno-old-style-cast
4425 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
4426 Warn if an old-style (C-style) cast to a non-void type is used within
4427 a C++ program.  The new-style casts (@code{dynamic_cast},
4428 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
4429 less vulnerable to unintended effects and much easier to search for.
4431 @opindex Woverloaded-virtual
4432 @opindex Wno-overloaded-virtual
4433 @cindex overloaded virtual function, warning
4434 @cindex warning for overloaded virtual function
4435 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
4436 @itemx -Woverloaded-virtual=@var{n}
4437 Warn when a function declaration hides virtual functions from a
4438 base class.  For example, in:
4440 @smallexample
4441 struct A @{
4442   virtual void f();
4445 struct B: public A @{
4446   void f(int); // does not override
4448 @end smallexample
4450 the @code{A} class version of @code{f} is hidden in @code{B}, and code
4451 like:
4453 @smallexample
4454 B* b;
4455 b->f();
4456 @end smallexample
4458 @noindent
4459 fails to compile.
4461 In cases where the different signatures are not an accident, the
4462 simplest solution is to add a using-declaration to the derived class
4463 to un-hide the base function, e.g. add @code{using A::f;} to @code{B}.
4465 The optional level suffix controls the behavior when all the
4466 declarations in the derived class override virtual functions in the
4467 base class, even if not all of the base functions are overridden:
4469 @smallexample
4470 struct C @{
4471   virtual void f();
4472   virtual void f(int);
4475 struct D: public C @{
4476   void f(int); // does override
4478 @end smallexample
4480 This pattern is less likely to be a mistake; if D is only used
4481 virtually, the user might have decided that the base class semantics
4482 for some of the overloads are fine.
4484 At level 1, this case does not warn; at level 2, it does.
4485 @option{-Woverloaded-virtual} by itself selects level 2.  Level 1 is
4486 included in @option{-Wall}.
4488 @opindex Wno-pmf-conversions
4489 @opindex Wpmf-conversions
4490 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
4491 Disable the diagnostic for converting a bound pointer to member function
4492 to a plain pointer.
4494 @opindex Wsign-promo
4495 @opindex Wno-sign-promo
4496 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
4497 Warn when overload resolution chooses a promotion from unsigned or
4498 enumerated type to a signed type, over a conversion to an unsigned type of
4499 the same size.  Previous versions of G++ tried to preserve
4500 unsignedness, but the standard mandates the current behavior.
4502 @opindex Wtemplates
4503 @opindex Wno-templates
4504 @item -Wtemplates @r{(C++ and Objective-C++ only)}
4505 Warn when a primary template declaration is encountered.  Some coding
4506 rules disallow templates, and this may be used to enforce that rule.
4507 The warning is inactive inside a system header file, such as the STL, so
4508 one can still use the STL.  One may also instantiate or specialize
4509 templates.
4511 @opindex Wmismatched-new-delete
4512 @opindex Wno-mismatched-new-delete
4513 @item -Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
4514 Warn for mismatches between calls to @code{operator new} or @code{operator
4515 delete} and the corresponding call to the allocation or deallocation function.
4516 This includes invocations of C++ @code{operator delete} with pointers
4517 returned from either mismatched forms of @code{operator new}, or from other
4518 functions that allocate objects for which the @code{operator delete} isn't
4519 a suitable deallocator, as well as calls to other deallocation functions
4520 with pointers returned from @code{operator new} for which the deallocation
4521 function isn't suitable.
4523 For example, the @code{delete} expression in the function below is diagnosed
4524 because it doesn't match the array form of the @code{new} expression
4525 the pointer argument was returned from.  Similarly, the call to @code{free}
4526 is also diagnosed.
4528 @smallexample
4529 void f ()
4531   int *a = new int[n];
4532   delete a;   // warning: mismatch in array forms of expressions
4534   char *p = new char[n];
4535   free (p);   // warning: mismatch between new and free
4537 @end smallexample
4539 The related option @option{-Wmismatched-dealloc} diagnoses mismatches
4540 involving allocation and deallocation functions other than @code{operator
4541 new} and @code{operator delete}.
4543 @option{-Wmismatched-new-delete} is included in @option{-Wall}.
4545 @opindex Wmismatched-tags
4546 @opindex Wno-mismatched-tags
4547 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
4548 Warn for declarations of structs, classes, and class templates and their
4549 specializations with a class-key that does not match either the definition
4550 or the first declaration if no definition is provided.
4552 For example, the declaration of @code{struct Object} in the argument list
4553 of @code{draw} triggers the warning.  To avoid it, either remove the redundant
4554 class-key @code{struct} or replace it with @code{class} to match its definition.
4555 @smallexample
4556 class Object @{
4557 public:
4558   virtual ~Object () = 0;
4560 void draw (struct Object*);
4561 @end smallexample
4563 It is not wrong to declare a class with the class-key @code{struct} as
4564 the example above shows.  The @option{-Wmismatched-tags} option is intended
4565 to help achieve a consistent style of class declarations.  In code that is
4566 intended to be portable to Windows-based compilers the warning helps prevent
4567 unresolved references due to the difference in the mangling of symbols
4568 declared with different class-keys.  The option can be used either on its
4569 own or in conjunction with @option{-Wredundant-tags}.
4571 @opindex Wmultiple-inheritance
4572 @opindex Wno-multiple-inheritance
4573 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
4574 Warn when a class is defined with multiple direct base classes.  Some
4575 coding rules disallow multiple inheritance, and this may be used to
4576 enforce that rule.  The warning is inactive inside a system header file,
4577 such as the STL, so one can still use the STL.  One may also define
4578 classes that indirectly use multiple inheritance.
4580 @opindex Wvirtual-inheritance
4581 @opindex Wno-virtual-inheritance
4582 @item -Wvirtual-inheritance
4583 Warn when a class is defined with a virtual direct base class.  Some
4584 coding rules disallow multiple inheritance, and this may be used to
4585 enforce that rule.  The warning is inactive inside a system header file,
4586 such as the STL, so one can still use the STL.  One may also define
4587 classes that indirectly use virtual inheritance.
4589 @opindex Wvirtual-move-assign
4590 @opindex Wno-virtual-move-assign
4591 @item -Wno-virtual-move-assign
4592 Suppress warnings about inheriting from a virtual base with a
4593 non-trivial C++11 move assignment operator.  This is dangerous because
4594 if the virtual base is reachable along more than one path, it is
4595 moved multiple times, which can mean both objects end up in the
4596 moved-from state.  If the move assignment operator is written to avoid
4597 moving from a moved-from object, this warning can be disabled.
4599 @opindex Wnamespaces
4600 @opindex Wno-namespaces
4601 @item -Wnamespaces
4602 Warn when a namespace definition is opened.  Some coding rules disallow
4603 namespaces, and this may be used to enforce that rule.  The warning is
4604 inactive inside a system header file, such as the STL, so one can still
4605 use the STL.  One may also use using directives and qualified names.
4607 @opindex Wterminate
4608 @opindex Wno-terminate
4609 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
4610 Disable the warning about a throw-expression that will immediately
4611 result in a call to @code{terminate}.
4613 @opindex Wvexing-parse
4614 @opindex Wno-vexing-parse
4615 @item -Wno-vexing-parse @r{(C++ and Objective-C++ only)}
4616 Warn about the most vexing parse syntactic ambiguity.  This warns about
4617 the cases when a declaration looks like a variable definition, but the
4618 C++ language requires it to be interpreted as a function declaration.
4619 For instance:
4621 @smallexample
4622 void f(double a) @{
4623   int i();        // extern int i (void);
4624   int n(int(a));  // extern int n (int);
4626 @end smallexample
4628 Another example:
4630 @smallexample
4631 struct S @{ S(int); @};
4632 void f(double a) @{
4633   S x(int(a));   // extern struct S x (int);
4634   S y(int());    // extern struct S y (int (*) (void));
4635   S z();         // extern struct S z (void);
4637 @end smallexample
4639 The warning will suggest options how to deal with such an ambiguity; e.g.,
4640 it can suggest removing the parentheses or using braces instead.
4642 This warning is enabled by default.
4644 @opindex Wno-class-conversion
4645 @opindex Wclass-conversion
4646 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
4647 Do not warn when a conversion function converts an
4648 object to the same type, to a base class of that type, or to void; such
4649 a conversion function will never be called.
4651 @opindex Wvolatile
4652 @opindex Wno-volatile
4653 @item -Wvolatile @r{(C++ and Objective-C++ only)}
4654 Warn about deprecated uses of the @code{volatile} qualifier.  This includes
4655 postfix and prefix @code{++} and @code{--} expressions of
4656 @code{volatile}-qualified types, using simple assignments where the left
4657 operand is a @code{volatile}-qualified non-class type for their value,
4658 compound assignments where the left operand is a @code{volatile}-qualified
4659 non-class type, @code{volatile}-qualified function return type,
4660 @code{volatile}-qualified parameter type, and structured bindings of a
4661 @code{volatile}-qualified type.  This usage was deprecated in C++20.
4663 Enabled by default with @option{-std=c++20}.
4665 @opindex Wzero-as-null-pointer-constant
4666 @opindex Wno-zero-as-null-pointer-constant
4667 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4668 Warn when a literal @samp{0} is used as null pointer constant.  This can
4669 be useful to facilitate the conversion to @code{nullptr} in C++11.
4671 @opindex Waligned-new
4672 @opindex Wno-aligned-new
4673 @item -Waligned-new
4674 Warn about a new-expression of a type that requires greater alignment
4675 than the @code{alignof(std::max_align_t)} but uses an allocation
4676 function without an explicit alignment parameter. This option is
4677 enabled by @option{-Wall}.
4679 Normally this only warns about global allocation functions, but
4680 @option{-Waligned-new=all} also warns about class member allocation
4681 functions.
4683 @opindex Wplacement-new
4684 @opindex Wno-placement-new
4685 @item -Wno-placement-new
4686 @itemx -Wplacement-new=@var{n}
4687 Warn about placement new expressions with undefined behavior, such as
4688 constructing an object in a buffer that is smaller than the type of
4689 the object.  For example, the placement new expression below is diagnosed
4690 because it attempts to construct an array of 64 integers in a buffer only
4691 64 bytes large.
4692 @smallexample
4693 char buf [64];
4694 new (buf) int[64];
4695 @end smallexample
4696 This warning is enabled by default.
4698 @table @gcctabopt
4699 @item -Wplacement-new=1
4700 This is the default warning level of @option{-Wplacement-new}.  At this
4701 level the warning is not issued for some strictly undefined constructs that
4702 GCC allows as extensions for compatibility with legacy code.  For example,
4703 the following @code{new} expression is not diagnosed at this level even
4704 though it has undefined behavior according to the C++ standard because
4705 it writes past the end of the one-element array.
4706 @smallexample
4707 struct S @{ int n, a[1]; @};
4708 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4709 new (s->a)int [32]();
4710 @end smallexample
4712 @item -Wplacement-new=2
4713 At this level, in addition to diagnosing all the same constructs as at level
4714 1, a diagnostic is also issued for placement new expressions that construct
4715 an object in the last member of structure whose type is an array of a single
4716 element and whose size is less than the size of the object being constructed.
4717 While the previous example would be diagnosed, the following construct makes
4718 use of the flexible member array extension to avoid the warning at level 2.
4719 @smallexample
4720 struct S @{ int n, a[]; @};
4721 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4722 new (s->a)int [32]();
4723 @end smallexample
4725 @end table
4727 @opindex Wcatch-value
4728 @opindex Wno-catch-value
4729 @item -Wcatch-value
4730 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
4731 Warn about catch handlers that do not catch via reference.
4732 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
4733 warn about polymorphic class types that are caught by value.
4734 With @option{-Wcatch-value=2} warn about all class types that are caught
4735 by value. With @option{-Wcatch-value=3} warn about all types that are
4736 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
4738 @opindex Wconditionally-supported
4739 @opindex Wno-conditionally-supported
4740 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4741 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4743 @opindex Wdelete-incomplete
4744 @opindex Wno-delete-incomplete
4745 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
4746 Do not warn when deleting a pointer to incomplete type, which may cause
4747 undefined behavior at runtime.  This warning is enabled by default.
4749 @opindex Wextra-semi
4750 @opindex Wno-extra-semi
4751 @item -Wextra-semi @r{(C++, Objective-C++ only)}
4752 Warn about redundant semicolons after in-class function definitions.
4754 @opindex Winaccessible-base
4755 @opindex Wno-inaccessible-base
4756 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
4757 This option controls warnings
4758 when a base class is inaccessible in a class derived from it due to
4759 ambiguity.  The warning is enabled by default.
4760 Note that the warning for ambiguous virtual
4761 bases is enabled by the @option{-Wextra} option.
4762 @smallexample
4763 @group
4764 struct A @{ int a; @};
4766 struct B : A @{ @};
4768 struct C : B, A @{ @};
4769 @end group
4770 @end smallexample
4772 @opindex Winherited-variadic-ctor
4773 @opindex Wno-inherited-variadic-ctor
4774 @item -Wno-inherited-variadic-ctor
4775 Suppress warnings about use of C++11 inheriting constructors when the
4776 base class inherited from has a C variadic constructor; the warning is
4777 on by default because the ellipsis is not inherited.
4779 @opindex Wno-invalid-offsetof
4780 @opindex Winvalid-offsetof
4781 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4782 Suppress warnings from applying the @code{offsetof} macro to a non-POD
4783 type.  According to the 2014 ISO C++ standard, applying @code{offsetof}
4784 to a non-standard-layout type is undefined.  In existing C++ implementations,
4785 however, @code{offsetof} typically gives meaningful results.
4786 This flag is for users who are aware that they are
4787 writing nonportable code and who have deliberately chosen to ignore the
4788 warning about it.
4790 The restrictions on @code{offsetof} may be relaxed in a future version
4791 of the C++ standard.
4793 @opindex Wsized-deallocation
4794 @opindex Wno-sized-deallocation
4795 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
4796 Warn about a definition of an unsized deallocation function
4797 @smallexample
4798 void operator delete (void *) noexcept;
4799 void operator delete[] (void *) noexcept;
4800 @end smallexample
4801 without a definition of the corresponding sized deallocation function
4802 @smallexample
4803 void operator delete (void *, std::size_t) noexcept;
4804 void operator delete[] (void *, std::size_t) noexcept;
4805 @end smallexample
4806 or vice versa.  Enabled by @option{-Wextra} along with
4807 @option{-fsized-deallocation}.
4809 @opindex Wno-suggest-final-types
4810 @opindex Wsuggest-final-types
4811 @item -Wsuggest-final-types
4812 Warn about types with virtual methods where code quality would be improved
4813 if the type were declared with the C++11 @code{final} specifier,
4814 or, if possible,
4815 declared in an anonymous namespace. This allows GCC to more aggressively
4816 devirtualize the polymorphic calls. This warning is more effective with
4817 link-time optimization,
4818 where the information about the class hierarchy graph is
4819 more complete.
4821 @opindex Wno-suggest-final-methods
4822 @opindex Wsuggest-final-methods
4823 @item -Wsuggest-final-methods
4824 Warn about virtual methods where code quality would be improved if the method
4825 were declared with the C++11 @code{final} specifier,
4826 or, if possible, its type were
4827 declared in an anonymous namespace or with the @code{final} specifier.
4828 This warning is
4829 more effective with link-time optimization, where the information about the
4830 class hierarchy graph is more complete. It is recommended to first consider
4831 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4832 annotations.
4834 @opindex Wsuggest-override
4835 @opindex Wno-suggest-override
4836 @item -Wsuggest-override
4837 Warn about overriding virtual functions that are not marked with the
4838 @code{override} keyword.
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.
5716 Diagnostics can have child diagnostics.  For example, this error and note:
5718 @smallexample
5719 misleading-indentation.c:15:3: warning: this 'if' clause does not
5720   guard... [-Wmisleading-indentation]
5721    15 |   if (flag)
5722       |   ^~
5723 misleading-indentation.c:17:5: note: ...this statement, but the latter
5724   is misleadingly indented as if it were guarded by the 'if'
5725    17 |     y = 2;
5726       |     ^
5727 @end smallexample
5729 @noindent
5730 might be printed in JSON form (after formatting) like this:
5732 @smallexample
5734     @{
5735         "kind": "warning",
5736         "locations": [
5737             @{
5738                 "caret": @{
5739                     "display-column": 3,
5740                     "byte-column": 3,
5741                     "column": 3,
5742                     "file": "misleading-indentation.c",
5743                     "line": 15
5744                 @},
5745                 "finish": @{
5746                     "display-column": 4,
5747                     "byte-column": 4,
5748                     "column": 4,
5749                     "file": "misleading-indentation.c",
5750                     "line": 15
5751                 @}
5752             @}
5753         ],
5754         "message": "this \u2018if\u2019 clause does not guard...",
5755         "option": "-Wmisleading-indentation",
5756         "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
5757         "children": [
5758             @{
5759                 "kind": "note",
5760                 "locations": [
5761                     @{
5762                         "caret": @{
5763                             "display-column": 5,
5764                             "byte-column": 5,
5765                             "column": 5,
5766                             "file": "misleading-indentation.c",
5767                             "line": 17
5768                         @}
5769                     @}
5770                 ],
5771                 "escape-source": false,
5772                 "message": "...this statement, but the latter is @dots{}"
5773             @}
5774         ]
5775         "escape-source": false,
5776         "column-origin": 1,
5777     @}
5779 @end smallexample
5781 @noindent
5782 where the @code{note} is a child of the @code{warning}.
5784 A diagnostic has a @code{kind}.  If this is @code{warning}, then there is
5785 an @code{option} key describing the command-line option controlling the
5786 warning.
5788 A diagnostic can contain zero or more locations.  Each location has an
5789 optional @code{label} string and up to three positions within it: a
5790 @code{caret} position and optional @code{start} and @code{finish} positions.
5791 A position is described by a @code{file} name, a @code{line} number, and
5792 three numbers indicating a column position:
5793 @itemize @bullet
5795 @item
5796 @code{display-column} counts display columns, accounting for tabs and
5797 multibyte characters.
5799 @item
5800 @code{byte-column} counts raw bytes.
5802 @item
5803 @code{column} is equal to one of
5804 the previous two, as dictated by the @option{-fdiagnostics-column-unit}
5805 option.
5807 @end itemize
5808 All three columns are relative to the origin specified by
5809 @option{-fdiagnostics-column-origin}, which is typically equal to 1 but may
5810 be set, for instance, to 0 for compatibility with other utilities that
5811 number columns from 0.  The column origin is recorded in the JSON output in
5812 the @code{column-origin} tag.  In the remaining examples below, the extra
5813 column number outputs have been omitted for brevity.
5815 For example, this error:
5817 @smallexample
5818 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
5819    'struct s'@} and 'T' @{aka 'struct t'@})
5820    64 |   return callee_4a () + callee_4b ();
5821       |          ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
5822       |          |              |
5823       |          |              T @{aka struct t@}
5824       |          S @{aka struct s@}
5825 @end smallexample
5827 @noindent
5828 has three locations.  Its primary location is at the ``+'' token at column
5829 23.  It has two secondary locations, describing the left and right-hand sides
5830 of the expression, which have labels.  It might be printed in JSON form as:
5832 @smallexample
5833     @{
5834         "children": [],
5835         "kind": "error",
5836         "locations": [
5837             @{
5838                 "caret": @{
5839                     "column": 23, "file": "bad-binary-ops.c", "line": 64
5840                 @}
5841             @},
5842             @{
5843                 "caret": @{
5844                     "column": 10, "file": "bad-binary-ops.c", "line": 64
5845                 @},
5846                 "finish": @{
5847                     "column": 21, "file": "bad-binary-ops.c", "line": 64
5848                 @},
5849                 "label": "S @{aka struct s@}"
5850             @},
5851             @{
5852                 "caret": @{
5853                     "column": 25, "file": "bad-binary-ops.c", "line": 64
5854                 @},
5855                 "finish": @{
5856                     "column": 36, "file": "bad-binary-ops.c", "line": 64
5857                 @},
5858                 "label": "T @{aka struct t@}"
5859             @}
5860         ],
5861         "escape-source": false,
5862         "message": "invalid operands to binary + @dots{}"
5863     @}
5864 @end smallexample
5866 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
5867 consisting of half-open intervals, similar to the output of
5868 @option{-fdiagnostics-parseable-fixits}.  For example, this diagnostic
5869 with a replacement fix-it hint:
5871 @smallexample
5872 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
5873   mean 'color'?
5874     8 |   return ptr->colour;
5875       |               ^~~~~~
5876       |               color
5877 @end smallexample
5879 @noindent
5880 might be printed in JSON form as:
5882 @smallexample
5883     @{
5884         "children": [],
5885         "fixits": [
5886             @{
5887                 "next": @{
5888                     "column": 21,
5889                     "file": "demo.c",
5890                     "line": 8
5891                 @},
5892                 "start": @{
5893                     "column": 15,
5894                     "file": "demo.c",
5895                     "line": 8
5896                 @},
5897                 "string": "color"
5898             @}
5899         ],
5900         "kind": "error",
5901         "locations": [
5902             @{
5903                 "caret": @{
5904                     "column": 15,
5905                     "file": "demo.c",
5906                     "line": 8
5907                 @},
5908                 "finish": @{
5909                     "column": 20,
5910                     "file": "demo.c",
5911                     "line": 8
5912                 @}
5913             @}
5914         ],
5915         "escape-source": false,
5916         "message": "\u2018struct s\u2019 has no member named @dots{}"
5917     @}
5918 @end smallexample
5920 @noindent
5921 where the fix-it hint suggests replacing the text from @code{start} up
5922 to but not including @code{next} with @code{string}'s value.  Deletions
5923 are expressed via an empty value for @code{string}, insertions by
5924 having @code{start} equal @code{next}.
5926 If the diagnostic has a path of control-flow events associated with it,
5927 it has a @code{path} array of objects representing the events.  Each
5928 event object has a @code{description} string, a @code{location} object,
5929 along with a @code{function} string and a @code{depth} number for
5930 representing interprocedural paths.  The @code{function} represents the
5931 current function at that event, and the @code{depth} represents the
5932 stack depth relative to some baseline: the higher, the more frames are
5933 within the stack.
5935 For example, the intraprocedural example shown for
5936 @option{-fdiagnostics-path-format=} might have this JSON for its path:
5938 @smallexample
5939     "path": [
5940         @{
5941             "depth": 0,
5942             "description": "when 'PyList_New' fails, returning NULL",
5943             "function": "test",
5944             "location": @{
5945                 "column": 10,
5946                 "file": "test.c",
5947                 "line": 25
5948             @}
5949         @},
5950         @{
5951             "depth": 0,
5952             "description": "when 'i < count'",
5953             "function": "test",
5954             "location": @{
5955                 "column": 3,
5956                 "file": "test.c",
5957                 "line": 27
5958             @}
5959         @},
5960         @{
5961             "depth": 0,
5962             "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
5963             "function": "test",
5964             "location": @{
5965                 "column": 5,
5966                 "file": "test.c",
5967                 "line": 29
5968             @}
5969         @}
5970     ]
5971 @end smallexample
5973 Diagnostics have a boolean attribute @code{escape-source}, hinting whether
5974 non-ASCII bytes should be escaped when printing the pertinent lines of
5975 source code (@code{true} for diagnostics involving source encoding issues).
5977 @opindex fno-diagnostics-json-formatting
5978 @opindex fdiagnostics-json-formatting
5979 @item -fno-diagnostics-json-formatting
5980 By default, when JSON is emitted for diagnostics (via
5981 @option{-fdiagnostics-format=sarif-stderr},
5982 @option{-fdiagnostics-format=sarif-file},
5983 @option{-fdiagnostics-format=json},
5984 @option{-fdiagnostics-format=json-stderr},
5985 @option{-fdiagnostics-format=json-file}),
5986 GCC will add newlines and indentation to visually emphasize the
5987 hierarchical structure of the JSON.
5989 Use @option{-fno-diagnostics-json-formatting} to suppress this whitespace.
5990 It must be passed before the option it is to affect.
5992 This is intended for compatibility with tools that do not expect the output
5993 to contain newlines, such as that emitted by older GCC releases.
5995 @end table
5997 @node Warning Options
5998 @section Options to Request or Suppress Warnings
5999 @cindex options to control warnings
6000 @cindex warning messages
6001 @cindex messages, warning
6002 @cindex suppressing warnings
6004 Warnings are diagnostic messages that report constructions that
6005 are not inherently erroneous but that are risky or suggest there
6006 may have been an error.
6008 The following language-independent options do not enable specific
6009 warnings but control the kinds of diagnostics produced by GCC@.
6011 @table @gcctabopt
6012 @cindex syntax checking
6013 @opindex fsyntax-only
6014 @item -fsyntax-only
6015 Check the code for syntax errors, but don't do anything beyond that.
6017 @opindex fmax-errors
6018 @item -fmax-errors=@var{n}
6019 Limits the maximum number of error messages to @var{n}, at which point
6020 GCC bails out rather than attempting to continue processing the source
6021 code.  If @var{n} is 0 (the default), there is no limit on the number
6022 of error messages produced.  If @option{-Wfatal-errors} is also
6023 specified, then @option{-Wfatal-errors} takes precedence over this
6024 option.
6026 @opindex w
6027 @item -w
6028 Inhibit all warning messages.
6030 @opindex Werror
6031 @opindex Wno-error
6032 @item -Werror
6033 Make all warnings into errors.
6035 @opindex Werror=
6036 @opindex Wno-error=
6037 @item -Werror=
6038 Make the specified warning into an error.  The specifier for a warning
6039 is appended; for example @option{-Werror=switch} turns the warnings
6040 controlled by @option{-Wswitch} into errors.  This switch takes a
6041 negative form, to be used to negate @option{-Werror} for specific
6042 warnings; for example @option{-Wno-error=switch} makes
6043 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
6044 is in effect.
6046 The warning message for each controllable warning includes the
6047 option that controls the warning.  That option can then be used with
6048 @option{-Werror=} and @option{-Wno-error=} as described above.
6049 (Printing of the option in the warning message can be disabled using the
6050 @option{-fno-diagnostics-show-option} flag.)
6052 Note that specifying @option{-Werror=}@var{foo} automatically implies
6053 @option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
6054 imply anything.
6056 @opindex Wfatal-errors
6057 @opindex Wno-fatal-errors
6058 @item -Wfatal-errors
6059 This option causes the compiler to abort compilation on the first error
6060 occurred rather than trying to keep going and printing further error
6061 messages.
6063 @end table
6065 You can request many specific warnings with options beginning with
6066 @samp{-W}, for example @option{-Wimplicit} to request warnings on
6067 implicit declarations.  Each of these specific warning options also
6068 has a negative form beginning @samp{-Wno-} to turn off warnings; for
6069 example, @option{-Wno-implicit}.  This manual lists only one of the
6070 two forms, whichever is not the default.  For further
6071 language-specific options also refer to @ref{C++ Dialect Options} and
6072 @ref{Objective-C and Objective-C++ Dialect Options}.
6073 Additional warnings can be produced by enabling the static analyzer;
6074 @xref{Static Analyzer Options}.
6076 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
6077 options, such as @option{-Wunused}, which may turn on further options,
6078 such as @option{-Wunused-value}. The combined effect of positive and
6079 negative forms is that more specific options have priority over less
6080 specific ones, independently of their position in the command-line. For
6081 options of the same specificity, the last one takes effect. Options
6082 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
6083 as if they appeared at the end of the command-line.
6085 When an unrecognized warning option is requested (e.g.,
6086 @option{-Wunknown-warning}), GCC emits a diagnostic stating
6087 that the option is not recognized.  However, if the @option{-Wno-} form
6088 is used, the behavior is slightly different: no diagnostic is
6089 produced for @option{-Wno-unknown-warning} unless other diagnostics
6090 are being produced.  This allows the use of new @option{-Wno-} options
6091 with old compilers, but if something goes wrong, the compiler
6092 warns that an unrecognized option is present.
6094 The effectiveness of some warnings depends on optimizations also being
6095 enabled. For example @option{-Wsuggest-final-types} is more effective
6096 with link-time optimization and some instances of other warnings may
6097 not be issued at all unless optimization is enabled.  While optimization
6098 in general improves the efficacy of control and data flow sensitive
6099 warnings, in some cases it may also cause false positives.
6101 @table @gcctabopt
6102 @opindex pedantic
6103 @opindex Wpedantic
6104 @opindex Wno-pedantic
6105 @item -Wpedantic
6106 @itemx -pedantic
6107 Issue all the warnings demanded by strict ISO C and ISO C++;
6108 diagnose all programs that use forbidden extensions, and some other
6109 programs that do not follow ISO C and ISO C++.  This follows the version
6110 of the ISO C or C++ standard specified by any @option{-std} option used.
6112 Valid ISO C and ISO C++ programs should compile properly with or without
6113 this option (though a rare few require @option{-ansi} or a
6114 @option{-std} option specifying the version of the standard)@.  However,
6115 without this option, certain GNU extensions and traditional C and C++
6116 features are supported as well.  With this option, they are diagnosed
6117 (or rejected with @option{-pedantic-errors}).
6119 @option{-Wpedantic} does not cause warning messages for use of the
6120 alternate keywords whose names begin and end with @samp{__}.  This alternate
6121 format can also be used to disable warnings for non-ISO @samp{__intN} types,
6122 i.e. @samp{__intN__}.
6123 Pedantic warnings are also disabled in the expression that follows
6124 @code{__extension__}.  However, only system header files should use
6125 these escape routes; application programs should avoid them.
6126 @xref{Alternate Keywords}.
6128 Some warnings about non-conforming programs are controlled by options
6129 other than @option{-Wpedantic}; in many cases they are implied by
6130 @option{-Wpedantic} but can be disabled separately by their specific
6131 option, e.g. @option{-Wpedantic -Wno-pointer-sign}.
6133 Where the standard specified with @option{-std} represents a GNU
6134 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
6135 corresponding @dfn{base standard}, the version of ISO C on which the GNU
6136 extended dialect is based.  Warnings from @option{-Wpedantic} are given
6137 where they are required by the base standard.  (It does not make sense
6138 for such warnings to be given only for features not in the specified GNU
6139 C dialect, since by definition the GNU dialects of C include all
6140 features the compiler supports with the given option, and there would be
6141 nothing to warn about.)
6143 @opindex pedantic-errors
6144 @item -pedantic-errors
6145 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
6146 requires a diagnostic, in some cases where there is undefined behavior
6147 at compile-time and in some other cases that do not prevent compilation
6148 of programs that are valid according to the standard. This is not
6149 equivalent to @option{-Werror=pedantic}: the latter option is unlikely to be
6150 useful, as it only makes errors of the diagnostics that are controlled by
6151 @option{-Wpedantic}, whereas this option also affects required diagnostics that
6152 are always enabled or controlled by options other than @option{-Wpedantic}.
6154 If you want the required diagnostics that are warnings by default to
6155 be errors instead, but don't also want to enable the @option{-Wpedantic}
6156 diagnostics, you can specify @option{-pedantic-errors -Wno-pedantic}
6157 (or @option{-pedantic-errors -Wno-error=pedantic} to enable them but
6158 only as warnings).
6160 Some required diagnostics are errors by default, but can be reduced to
6161 warnings using @option{-fpermissive} or their specific warning option,
6162 e.g. @option{-Wno-error=narrowing}.
6164 Some diagnostics for non-ISO practices are controlled by specific
6165 warning options other than @option{-Wpedantic}, but are also made
6166 errors by @option{-pedantic-errors}.  For instance:
6168 @gccoptlist{
6169 -Wattributes @r{(for standard attributes)}
6170 -Wchanges-meaning @r{(C++)}
6171 -Wcomma-subscript @r{(C++23 or later)}
6172 -Wdeclaration-after-statement @r{(C90 or earlier)}
6173 -Welaborated-enum-base @r{(C++11 or later)}
6174 -Wimplicit-int @r{(C99 or later)}
6175 -Wimplicit-function-declaration @r{(C99 or later)}
6176 -Wincompatible-pointer-types
6177 -Wint-conversion
6178 -Wlong-long @r{(C90 or earlier)}
6179 -Wmain
6180 -Wnarrowing @r{(C++11 or later)}
6181 -Wpointer-arith
6182 -Wpointer-sign
6183 -Wincompatible-pointer-types
6184 -Wregister @r{(C++17 or later)}
6185 -Wvla @r{(C90 or earlier)}
6186 -Wwrite-strings @r{(C++11 or later)}
6189 @opindex fpermissive
6190 @item -fpermissive
6191 Downgrade some required diagnostics about nonconformant code from
6192 errors to warnings.  Thus, using @option{-fpermissive} allows some
6193 nonconforming code to compile.  Some C++ diagnostics are controlled
6194 only by this flag, but it also downgrades some C and C++ diagnostics
6195 that have their own flag:
6197 @gccoptlist{
6198 -Wdeclaration-missing-parameter-type @r{(C and Objective-C only)}
6199 -Wimplicit-function-declaration @r{(C and Objective-C only)}
6200 -Wimplicit-int @r{(C and Objective-C only)}
6201 -Wincompatible-pointer-types @r{(C and Objective-C only)}
6202 -Wint-conversion @r{(C and Objective-C only)}
6203 -Wnarrowing @r{(C++ and Objective-C++ only)}
6204 -Wreturn-mismatch @r{(C and Objective-C only)}
6207 The @option{-fpermissive} option is the default for historic C language
6208 modes (@option{-std=c89}, @option{-std=gnu89}, @option{-std=c90},
6209 @option{-std=gnu90}).
6211 @opindex Wall
6212 @opindex Wno-all
6213 @item -Wall
6214 This enables all the warnings about constructions that some users
6215 consider questionable, and that are easy to avoid (or modify to
6216 prevent the warning), even in conjunction with macros.  This also
6217 enables some language-specific warnings described in @ref{C++ Dialect
6218 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
6220 @option{-Wall} turns on the following warning flags:
6222 @gccoptlist{-Waddress
6223 -Waligned-new @r{(C++ and Objective-C++ only)}
6224 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)}
6225 -Warray-compare
6226 -Warray-parameter=2
6227 -Wbool-compare
6228 -Wbool-operation
6229 -Wc++11-compat  -Wc++14-compat  -Wc++17compat  -Wc++20compat
6230 -Wcatch-value @r{(C++ and Objective-C++ only)}
6231 -Wchar-subscripts
6232 -Wclass-memaccess @r{(C++ and Objective-C++ only)}
6233 -Wcomment
6234 -Wdangling-else
6235 -Wdangling-pointer=2
6236 -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
6237 -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6238 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)}
6239 -Wenum-int-mismatch @r{(C and Objective-C only)}
6240 -Wformat=1
6241 -Wformat-contains-nul
6242 -Wformat-diag
6243 -Wformat-extra-args
6244 -Wformat-overflow=1
6245 -Wformat-truncation=1
6246 -Wformat-zero-length
6247 -Wframe-address
6248 -Wimplicit @r{(C and Objective-C only)}
6249 -Wimplicit-function-declaration @r{(C and Objective-C only)}
6250 -Wimplicit-int @r{(C and Objective-C only)}
6251 -Winfinite-recursion
6252 -Winit-self @r{(C++ and Objective-C++ only)}
6253 -Wint-in-bool-context
6254 -Wlogical-not-parentheses
6255 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}
6256 -Wmaybe-uninitialized
6257 -Wmemset-elt-size
6258 -Wmemset-transposed-args
6259 -Wmisleading-indentation @r{(only for C/C++)}
6260 -Wmismatched-dealloc
6261 -Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
6262 -Wmissing-attributes
6263 -Wmissing-braces @r{(only for C/ObjC)}
6264 -Wmultistatement-macros
6265 -Wnarrowing  @r{(C++ and Objective-C++ only)}
6266 -Wnonnull
6267 -Wnonnull-compare
6268 -Wopenmp-simd @r{(C and C++ only)}
6269 -Woverloaded-virtual=1 @r{(C++ and Objective-C++ only)}
6270 -Wpacked-not-aligned
6271 -Wparentheses
6272 -Wpessimizing-move @r{(C++ and Objective-C++ only)}
6273 -Wpointer-sign @r{(only for C/ObjC)}
6274 -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
6275 -Wreorder @r{(C++ and Objective-C++ only)}
6276 -Wrestrict
6277 -Wreturn-type
6278 -Wself-move @r{(C++ and Objective-C++ only)}
6279 -Wsequence-point
6280 -Wsign-compare @r{(C++ and Objective-C++ only)}
6281 -Wsizeof-array-div
6282 -Wsizeof-pointer-div
6283 -Wsizeof-pointer-memaccess
6284 -Wstrict-aliasing
6285 -Wstrict-overflow=1
6286 -Wswitch
6287 -Wtautological-compare
6288 -Wtrigraphs
6289 -Wuninitialized
6290 -Wunknown-pragmas
6291 -Wunused
6292 -Wunused-but-set-variable
6293 -Wunused-const-variable=1 @r{(only for C/ObjC)}
6294 -Wunused-function
6295 -Wunused-label
6296 -Wunused-local-typedefs
6297 -Wunused-value
6298 -Wunused-variable
6299 -Wuse-after-free=2
6300 -Wvla-parameter
6301 -Wvolatile-register-var
6302 -Wzero-length-bounds}
6304 Note that some warning flags are not implied by @option{-Wall}.  Some of
6305 them warn about constructions that users generally do not consider
6306 questionable, but which occasionally you might wish to check for;
6307 others warn about constructions that are necessary or hard to avoid in
6308 some cases, and there is no simple way to modify the code to suppress
6309 the warning. Some of them are enabled by @option{-Wextra} but many of
6310 them must be enabled individually.
6312 @opindex W
6313 @opindex Wextra
6314 @opindex Wno-extra
6315 @item -Wextra
6316 This enables some extra warning flags that are not enabled by
6317 @option{-Wall}. (This option used to be called @option{-W}.  The older
6318 name is still supported, but the newer name is more descriptive.)
6320 @gccoptlist{-Wabsolute-value @r{(only for C/ObjC)}
6321 -Walloc-size
6322 -Wcalloc-transposed-args
6323 -Wcast-function-type
6324 -Wclobbered
6325 -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
6326 -Wempty-body
6327 -Wenum-conversion @r{(only for C/ObjC)}
6328 -Wexpansion-to-defined
6329 -Wignored-qualifiers  @r{(only for C/C++)}
6330 -Wimplicit-fallthrough=3
6331 -Wmaybe-uninitialized
6332 -Wmissing-field-initializers
6333 -Wmissing-parameter-type @r{(C/ObjC only)}
6334 -Wold-style-declaration @r{(C/ObjC only)}
6335 -Woverride-init @r{(C/ObjC only)}
6336 -Wredundant-move @r{(C++ and Objective-C++ only)}
6337 -Wshift-negative-value @r{(in C++11 to C++17 and in C99 and newer)}
6338 -Wsign-compare @r{(C++ and Objective-C++ only)}
6339 -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6340 -Wstring-compare
6341 -Wtype-limits
6342 -Wuninitialized
6343 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}
6344 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
6346 The option @option{-Wextra} also prints warning messages for the
6347 following cases:
6349 @itemize @bullet
6351 @item
6352 A pointer is compared against integer zero with @code{<}, @code{<=},
6353 @code{>}, or @code{>=}.
6355 @item
6356 (C++ only) An enumerator and a non-enumerator both appear in a
6357 conditional expression.
6359 @item
6360 (C++ only) Ambiguous virtual bases.
6362 @item
6363 (C++ only) Subscripting an array that has been declared @code{register}.
6365 @item
6366 (C++ only) Taking the address of a variable that has been declared
6367 @code{register}.
6369 @item
6370 (C++ only) A base class is not initialized in the copy constructor
6371 of a derived class.
6373 @end itemize
6375 @opindex Wabi
6376 @opindex Wno-abi
6377 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
6379 Warn about code affected by ABI changes.  This includes code that may
6380 not be compatible with the vendor-neutral C++ ABI as well as the psABI
6381 for the particular target.
6383 Since G++ now defaults to updating the ABI with each major release,
6384 normally @option{-Wabi} warns only about C++ ABI compatibility
6385 problems if there is a check added later in a release series for an
6386 ABI issue discovered since the initial release.  @option{-Wabi} warns
6387 about more things if an older ABI version is selected (with
6388 @option{-fabi-version=@var{n}}).
6390 @option{-Wabi} can also be used with an explicit version number to
6391 warn about C++ ABI compatibility with a particular @option{-fabi-version}
6392 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
6393 @option{-fabi-version=2}.
6395 If an explicit version number is provided and
6396 @option{-fabi-compat-version} is not specified, the version number
6397 from this option is used for compatibility aliases.  If no explicit
6398 version number is provided with this option, but
6399 @option{-fabi-compat-version} is specified, that version number is
6400 used for C++ ABI warnings.
6402 Although an effort has been made to warn about
6403 all such cases, there are probably some cases that are not warned about,
6404 even though G++ is generating incompatible code.  There may also be
6405 cases where warnings are emitted even though the code that is generated
6406 is compatible.
6408 You should rewrite your code to avoid these warnings if you are
6409 concerned about the fact that code generated by G++ may not be binary
6410 compatible with code generated by other compilers.
6412 Known incompatibilities in @option{-fabi-version=2} (which was the
6413 default from GCC 3.4 to 4.9) include:
6415 @itemize @bullet
6417 @item
6418 A template with a non-type template parameter of reference type was
6419 mangled incorrectly:
6420 @smallexample
6421 extern int N;
6422 template <int &> struct S @{@};
6423 void n (S<N>) @{2@}
6424 @end smallexample
6426 This was fixed in @option{-fabi-version=3}.
6428 @item
6429 SIMD vector types declared using @code{__attribute ((vector_size))} were
6430 mangled in a non-standard way that does not allow for overloading of
6431 functions taking vectors of different sizes.
6433 The mangling was changed in @option{-fabi-version=4}.
6435 @item
6436 @code{__attribute ((const))} and @code{noreturn} were mangled as type
6437 qualifiers, and @code{decltype} of a plain declaration was folded away.
6439 These mangling issues were fixed in @option{-fabi-version=5}.
6441 @item
6442 Scoped enumerators passed as arguments to a variadic function are
6443 promoted like unscoped enumerators, causing @code{va_arg} to complain.
6444 On most targets this does not actually affect the parameter passing
6445 ABI, as there is no way to pass an argument smaller than @code{int}.
6447 Also, the ABI changed the mangling of template argument packs,
6448 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
6449 a class scope function used as a template argument.
6451 These issues were corrected in @option{-fabi-version=6}.
6453 @item
6454 Lambdas in default argument scope were mangled incorrectly, and the
6455 ABI changed the mangling of @code{nullptr_t}.
6457 These issues were corrected in @option{-fabi-version=7}.
6459 @item
6460 When mangling a function type with function-cv-qualifiers, the
6461 un-qualified function type was incorrectly treated as a substitution
6462 candidate.
6464 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
6466 @item
6467 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
6468 unaligned accesses.  Note that this did not affect the ABI of a
6469 function with a @code{nullptr_t} parameter, as parameters have a
6470 minimum alignment.
6472 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
6474 @item
6475 Target-specific attributes that affect the identity of a type, such as
6476 ia32 calling conventions on a function type (stdcall, regparm, etc.),
6477 did not affect the mangled name, leading to name collisions when
6478 function pointers were used as template arguments.
6480 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
6482 @end itemize
6484 This option also enables warnings about psABI-related changes.
6485 The known psABI changes at this point include:
6487 @itemize @bullet
6489 @item
6490 For SysV/x86-64, unions with @code{long double} members are
6491 passed in memory as specified in psABI.  Prior to GCC 4.4, this was not
6492 the case.  For example:
6494 @smallexample
6495 union U @{
6496   long double ld;
6497   int i;
6499 @end smallexample
6501 @noindent
6502 @code{union U} is now always passed in memory.
6504 @end itemize
6506 @item -Wno-changes-meaning @r{(C++ and Objective-C++ only)}
6507 C++ requires that unqualified uses of a name within a class have the
6508 same meaning in the complete scope of the class, so declaring the name
6509 after using it is ill-formed:
6510 @smallexample
6511 struct A;
6512 struct B1 @{ A a; typedef A A; @}; // warning, 'A' changes meaning
6513 struct B2 @{ A a; struct A @{ @}; @}; // error, 'A' changes meaning
6514 @end smallexample
6515 By default, the B1 case is only a warning because the two declarations
6516 have the same type, while the B2 case is an error.  Both diagnostics
6517 can be disabled with @option{-Wno-changes-meaning}.  Alternately, the
6518 error case can be reduced to a warning with
6519 @option{-Wno-error=changes-meaning} or @option{-fpermissive}.
6521 Both diagnostics are also suppressed by @option{-fms-extensions}.
6523 @opindex Wchar-subscripts
6524 @opindex Wno-char-subscripts
6525 @item -Wchar-subscripts
6526 Warn if an array subscript has type @code{char}.  This is a common cause
6527 of error, as programmers often forget that this type is signed on some
6528 machines.
6529 This warning is enabled by @option{-Wall}.
6531 @opindex Wno-coverage-mismatch
6532 @opindex Wcoverage-mismatch
6533 @item -Wno-coverage-mismatch
6534 Warn if feedback profiles do not match when using the
6535 @option{-fprofile-use} option.
6536 If a source file is changed between compiling with @option{-fprofile-generate}
6537 and with @option{-fprofile-use}, the files with the profile feedback can fail
6538 to match the source file and GCC cannot use the profile feedback
6539 information.  By default, this warning is enabled and is treated as an
6540 error.  @option{-Wno-coverage-mismatch} can be used to disable the
6541 warning or @option{-Wno-error=coverage-mismatch} can be used to
6542 disable the error.  Disabling the error for this warning can result in
6543 poorly optimized code and is useful only in the
6544 case of very minor changes such as bug fixes to an existing code-base.
6545 Completely disabling the warning is not recommended.
6547 @opindex Wno-coverage-invalid-line-number
6548 @opindex Wcoverage-invalid-line-number
6549 @item -Wno-coverage-invalid-line-number
6550 Warn in case a function ends earlier than it begins due
6551 to an invalid linenum macros.  The warning is emitted only
6552 with @option{--coverage} enabled.
6554 By default, this warning is enabled and is treated as an
6555 error.  @option{-Wno-coverage-invalid-line-number} can be used to disable the
6556 warning or @option{-Wno-error=coverage-invalid-line-number} can be used to
6557 disable the error.
6559 @opindex Wno-cpp
6560 @opindex Wcpp
6561 @item -Wno-cpp @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
6562 Suppress warning messages emitted by @code{#warning} directives.
6564 @opindex Wdouble-promotion
6565 @opindex Wno-double-promotion
6566 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
6567 Give a warning when a value of type @code{float} is implicitly
6568 promoted to @code{double}.  CPUs with a 32-bit ``single-precision''
6569 floating-point unit implement @code{float} in hardware, but emulate
6570 @code{double} in software.  On such a machine, doing computations
6571 using @code{double} values is much more expensive because of the
6572 overhead required for software emulation.
6574 It is easy to accidentally do computations with @code{double} because
6575 floating-point literals are implicitly of type @code{double}.  For
6576 example, in:
6577 @smallexample
6578 @group
6579 float area(float radius)
6581    return 3.14159 * radius * radius;
6583 @end group
6584 @end smallexample
6585 the compiler performs the entire computation with @code{double}
6586 because the floating-point literal is a @code{double}.
6588 @opindex Wduplicate-decl-specifier
6589 @opindex Wno-duplicate-decl-specifier
6590 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6591 Warn if a declaration has duplicate @code{const}, @code{volatile},
6592 @code{restrict} or @code{_Atomic} specifier.  This warning is enabled by
6593 @option{-Wall}.
6595 @opindex Wformat
6596 @opindex Wno-format
6597 @opindex ffreestanding
6598 @opindex fno-builtin
6599 @opindex Wformat=
6600 @item -Wformat
6601 @itemx -Wformat=@var{n}
6602 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
6603 the arguments supplied have types appropriate to the format string
6604 specified, and that the conversions specified in the format string make
6605 sense.  This includes standard functions, and others specified by format
6606 attributes (@pxref{Function Attributes}), in the @code{printf},
6607 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
6608 not in the C standard) families (or other target-specific families).
6609 Which functions are checked without format attributes having been
6610 specified depends on the standard version selected, and such checks of
6611 functions without the attribute specified are disabled by
6612 @option{-ffreestanding} or @option{-fno-builtin}.
6614 The formats are checked against the format features supported by GNU
6615 libc version 2.2.  These include all ISO C90 and C99 features, as well
6616 as features from the Single Unix Specification and some BSD and GNU
6617 extensions.  Other library implementations may not support all these
6618 features; GCC does not support warning about features that go beyond a
6619 particular library's limitations.  However, if @option{-Wpedantic} is used
6620 with @option{-Wformat}, warnings are given about format features not
6621 in the selected standard version (but not for @code{strfmon} formats,
6622 since those are not in any version of the C standard).  @xref{C Dialect
6623 Options,,Options Controlling C Dialect}.
6625 @table @gcctabopt
6626 @opindex Wformat
6627 @opindex Wformat=1
6628 @item -Wformat=1
6629 @itemx -Wformat
6630 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
6631 @option{-Wno-format} is equivalent to @option{-Wformat=0}.  Since
6632 @option{-Wformat} also checks for null format arguments for several
6633 functions, @option{-Wformat} also implies @option{-Wnonnull}.  Some
6634 aspects of this level of format checking can be disabled by the
6635 options: @option{-Wno-format-contains-nul},
6636 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
6637 @option{-Wformat} is enabled by @option{-Wall}.
6639 @opindex Wformat=2
6640 @item -Wformat=2
6641 Enable @option{-Wformat} plus additional format checks.  Currently
6642 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
6643 -Wformat-y2k}.
6644 @end table
6646 @opindex Wno-format-contains-nul
6647 @opindex Wformat-contains-nul
6648 @item -Wno-format-contains-nul
6649 If @option{-Wformat} is specified, do not warn about format strings that
6650 contain NUL bytes.
6652 @opindex Wno-format-extra-args
6653 @opindex Wformat-extra-args
6654 @item -Wno-format-extra-args
6655 If @option{-Wformat} is specified, do not warn about excess arguments to a
6656 @code{printf} or @code{scanf} format function.  The C standard specifies
6657 that such arguments are ignored.
6659 Where the unused arguments lie between used arguments that are
6660 specified with @samp{$} operand number specifications, normally
6661 warnings are still given, since the implementation could not know what
6662 type to pass to @code{va_arg} to skip the unused arguments.  However,
6663 in the case of @code{scanf} formats, this option suppresses the
6664 warning if the unused arguments are all pointers, since the Single
6665 Unix Specification says that such unused arguments are allowed.
6667 @opindex Wformat-overflow
6668 @opindex Wno-format-overflow
6669 @item -Wformat-overflow
6670 @itemx -Wformat-overflow=@var{level}
6671 Warn about calls to formatted input/output functions such as @code{sprintf}
6672 and @code{vsprintf} that might overflow the destination buffer.  When the
6673 exact number of bytes written by a format directive cannot be determined
6674 at compile-time it is estimated based on heuristics that depend on the
6675 @var{level} argument and on optimization.  While enabling optimization
6676 will in most cases improve the accuracy of the warning, it may also
6677 result in false positives.
6679 @table @gcctabopt
6680 @opindex Wformat-overflow
6681 @opindex Wno-format-overflow
6682 @item -Wformat-overflow
6683 @itemx -Wformat-overflow=1
6684 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
6685 employs a conservative approach that warns only about calls that most
6686 likely overflow the buffer.  At this level, numeric arguments to format
6687 directives with unknown values are assumed to have the value of one, and
6688 strings of unknown length to be empty.  Numeric arguments that are known
6689 to be bounded to a subrange of their type, or string arguments whose output
6690 is bounded either by their directive's precision or by a finite set of
6691 string literals, are assumed to take on the value within the range that
6692 results in the most bytes on output.  For example, the call to @code{sprintf}
6693 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
6694 the terminating NUL character (@code{'\0'}) appended by the function
6695 to the destination buffer will be written past its end.  Increasing
6696 the size of the buffer by a single byte is sufficient to avoid the
6697 warning, though it may not be sufficient to avoid the overflow.
6699 @smallexample
6700 void f (int a, int b)
6702   char buf [13];
6703   sprintf (buf, "a = %i, b = %i\n", a, b);
6705 @end smallexample
6707 @item -Wformat-overflow=2
6708 Level @var{2} warns also about calls that might overflow the destination
6709 buffer given an argument of sufficient length or magnitude.  At level
6710 @var{2}, unknown numeric arguments are assumed to have the minimum
6711 representable value for signed types with a precision greater than 1, and
6712 the maximum representable value otherwise.  Unknown string arguments whose
6713 length cannot be assumed to be bounded either by the directive's precision,
6714 or by a finite set of string literals they may evaluate to, or the character
6715 array they may point to, are assumed to be 1 character long.
6717 At level @var{2}, the call in the example above is again diagnosed, but
6718 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
6719 @code{%i} directive will write some of its digits beyond the end of
6720 the destination buffer.  To make the call safe regardless of the values
6721 of the two variables, the size of the destination buffer must be increased
6722 to at least 34 bytes.  GCC includes the minimum size of the buffer in
6723 an informational note following the warning.
6725 An alternative to increasing the size of the destination buffer is to
6726 constrain the range of formatted values.  The maximum length of string
6727 arguments can be bounded by specifying the precision in the format
6728 directive.  When numeric arguments of format directives can be assumed
6729 to be bounded by less than the precision of their type, choosing
6730 an appropriate length modifier to the format specifier will reduce
6731 the required buffer size.  For example, if @var{a} and @var{b} in the
6732 example above can be assumed to be within the precision of
6733 the @code{short int} type then using either the @code{%hi} format
6734 directive or casting the argument to @code{short} reduces the maximum
6735 required size of the buffer to 24 bytes.
6737 @smallexample
6738 void f (int a, int b)
6740   char buf [23];
6741   sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
6743 @end smallexample
6744 @end table
6746 @opindex Wno-format-zero-length
6747 @opindex Wformat-zero-length
6748 @item -Wno-format-zero-length
6749 If @option{-Wformat} is specified, do not warn about zero-length formats.
6750 The C standard specifies that zero-length formats are allowed.
6752 @opindex Wformat-nonliteral
6753 @opindex Wno-format-nonliteral
6754 @item -Wformat-nonliteral
6755 If @option{-Wformat} is specified, also warn if the format string is not a
6756 string literal and so cannot be checked, unless the format function
6757 takes its format arguments as a @code{va_list}.
6759 @opindex Wformat-security
6760 @opindex Wno-format-security
6761 @item -Wformat-security
6762 If @option{-Wformat} is specified, also warn about uses of format
6763 functions that represent possible security problems.  At present, this
6764 warns about calls to @code{printf} and @code{scanf} functions where the
6765 format string is not a string literal and there are no format arguments,
6766 as in @code{printf (foo);}.  This may be a security hole if the format
6767 string came from untrusted input and contains @samp{%n}.  (This is
6768 currently a subset of what @option{-Wformat-nonliteral} warns about, but
6769 in future warnings may be added to @option{-Wformat-security} that are not
6770 included in @option{-Wformat-nonliteral}.)
6772 @opindex Wformat-signedness
6773 @opindex Wno-format-signedness
6774 @item -Wformat-signedness
6775 If @option{-Wformat} is specified, also warn if the format string
6776 requires an unsigned argument and the argument is signed and vice versa.
6778 @opindex Wformat-truncation
6779 @opindex Wno-format-truncation
6780 @item -Wformat-truncation
6781 @itemx -Wformat-truncation=@var{level}
6782 Warn about calls to formatted input/output functions such as @code{snprintf}
6783 and @code{vsnprintf} that might result in output truncation.  When the exact
6784 number of bytes written by a format directive cannot be determined at
6785 compile-time it is estimated based on heuristics that depend on
6786 the @var{level} argument and on optimization.  While enabling optimization
6787 will in most cases improve the accuracy of the warning, it may also result
6788 in false positives.  Except as noted otherwise, the option uses the same
6789 logic @option{-Wformat-overflow}.
6791 @table @gcctabopt
6792 @opindex Wformat-truncation
6793 @opindex Wno-format-truncation
6794 @item -Wformat-truncation
6795 @itemx -Wformat-truncation=1
6796 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
6797 employs a conservative approach that warns only about calls to bounded
6798 functions whose return value is unused and that will most likely result
6799 in output truncation.
6801 @item -Wformat-truncation=2
6802 Level @var{2} warns also about calls to bounded functions whose return
6803 value is used and that might result in truncation given an argument of
6804 sufficient length or magnitude.
6805 @end table
6807 @opindex Wformat-y2k
6808 @opindex Wno-format-y2k
6809 @item -Wformat-y2k
6810 If @option{-Wformat} is specified, also warn about @code{strftime}
6811 formats that may yield only a two-digit year.
6813 @opindex Wnonnull
6814 @opindex Wno-nonnull
6815 @item -Wnonnull
6816 Warn about passing a null pointer for arguments marked as
6817 requiring a non-null value by the @code{nonnull} function attribute.
6819 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
6820 can be disabled with the @option{-Wno-nonnull} option.
6822 @opindex Wnonnull-compare
6823 @opindex Wno-nonnull-compare
6824 @item -Wnonnull-compare
6825 Warn when comparing an argument marked with the @code{nonnull}
6826 function attribute against null inside the function.
6828 @option{-Wnonnull-compare} is included in @option{-Wall}.  It
6829 can be disabled with the @option{-Wno-nonnull-compare} option.
6831 @opindex Wnull-dereference
6832 @opindex Wno-null-dereference
6833 @item -Wnull-dereference
6834 Warn if the compiler detects paths that trigger erroneous or
6835 undefined behavior due to dereferencing a null pointer.  This option
6836 is only active when @option{-fdelete-null-pointer-checks} is active,
6837 which is enabled by optimizations in most targets.  The precision of
6838 the warnings depends on the optimization options used.
6840 @opindex Wnrvo
6841 @opindex Wno-nrvo
6842 @item -Wnrvo @r{(C++ and Objective-C++ only)}
6843 Warn if the compiler does not elide the copy from a local variable to
6844 the return value of a function in a context where it is allowed by
6845 [class.copy.elision].  This elision is commonly known as the Named
6846 Return Value Optimization.  For instance, in the example below the
6847 compiler cannot elide copies from both v1 and v2, so it elides neither.
6849 @smallexample
6850 std::vector<int> f()
6852   std::vector<int> v1, v2;
6853   // ...
6854   if (cond) return v1;
6855   else return v2; // warning: not eliding copy
6857 @end smallexample
6859 @opindex Winfinite-recursion
6860 @opindex Wno-infinite-recursion
6861 @item -Winfinite-recursion
6862 Warn about infinitely recursive calls.  The warning is effective at all
6863 optimization levels but requires optimization in order to detect infinite
6864 recursion in calls between two or more functions.
6865 @option{-Winfinite-recursion} is included in @option{-Wall}.
6867 Compare with @option{-Wanalyzer-infinite-recursion} which provides a
6868 similar diagnostic, but is implemented in a different way (as part of
6869 @option{-fanalyzer}).
6871 @opindex Winit-self
6872 @opindex Wno-init-self
6873 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
6874 Warn about uninitialized variables that are initialized with themselves.
6875 Note this option can only be used with the @option{-Wuninitialized} option.
6877 For example, GCC warns about @code{i} being uninitialized in the
6878 following snippet only when @option{-Winit-self} has been specified:
6879 @smallexample
6880 @group
6881 int f()
6883   int i = i;
6884   return i;
6886 @end group
6887 @end smallexample
6889 This warning is enabled by @option{-Wall} in C++.
6891 @opindex Wimplicit-int
6892 @opindex Wno-implicit-int
6893 @item -Wno-implicit-int @r{(C and Objective-C only)}
6894 This option controls warnings when a declaration does not specify a type.
6895 This warning is enabled by default, as an error, in C99 and later
6896 dialects of C, and also by @option{-Wall}.  The error can be downgraded
6897 to a warning using @option{-fpermissive} (along with certain other
6898 errors), or for this error alone, with @option{-Wno-error=implicit-int}.
6900 This warning is upgraded to an error by @option{-pedantic-errors}.
6902 @opindex Wimplicit-function-declaration
6903 @opindex Wno-implicit-function-declaration
6904 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
6905 This option controls warnings when a function is used before being declared.
6906 This warning is enabled by default, as an error, in C99 and later
6907 dialects of C, and also by @option{-Wall}.  The error can be downgraded
6908 to a warning using @option{-fpermissive} (along with certain other
6909 errors), or for this error alone, with
6910 @option{-Wno-error=implicit-function-declaration}.
6912 This warning is upgraded to an error by @option{-pedantic-errors}.
6914 @opindex Wimplicit
6915 @opindex Wno-implicit
6916 @item -Wimplicit @r{(C and Objective-C only)}
6917 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
6918 This warning is enabled by @option{-Wall}.
6920 @opindex Whardened
6921 @opindex Wno-hardened
6922 @item -Whardened
6923 Warn when @option{-fhardened} did not enable an option from its set (for
6924 which see @option{-fhardened}).  For instance, using @option{-fhardened}
6925 and @option{-fstack-protector} at the same time on the command line causes
6926 @option{-Whardened} to warn because @option{-fstack-protector-strong} is
6927 not enabled by @option{-fhardened}.
6929 This warning is enabled by default and has effect only when @option{-fhardened}
6930 is enabled.
6932 @opindex Wimplicit-fallthrough
6933 @opindex Wno-implicit-fallthrough
6934 @item -Wimplicit-fallthrough
6935 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
6936 and @option{-Wno-implicit-fallthrough} is the same as
6937 @option{-Wimplicit-fallthrough=0}.
6939 @opindex Wimplicit-fallthrough=
6940 @item -Wimplicit-fallthrough=@var{n}
6941 Warn when a switch case falls through.  For example:
6943 @smallexample
6944 @group
6945 switch (cond)
6946   @{
6947   case 1:
6948     a = 1;
6949     break;
6950   case 2:
6951     a = 2;
6952   case 3:
6953     a = 3;
6954     break;
6955   @}
6956 @end group
6957 @end smallexample
6959 This warning does not warn when the last statement of a case cannot
6960 fall through, e.g. when there is a return statement or a call to function
6961 declared with the noreturn attribute.  @option{-Wimplicit-fallthrough=}
6962 also takes into account control flow statements, such as ifs, and only
6963 warns when appropriate.  E.g.@:
6965 @smallexample
6966 @group
6967 switch (cond)
6968   @{
6969   case 1:
6970     if (i > 3) @{
6971       bar (5);
6972       break;
6973     @} else if (i < 1) @{
6974       bar (0);
6975     @} else
6976       return;
6977   default:
6978     @dots{}
6979   @}
6980 @end group
6981 @end smallexample
6983 Since there are occasions where a switch case fall through is desirable,
6984 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
6985 to be used along with a null statement to suppress this warning that
6986 would normally occur:
6988 @smallexample
6989 @group
6990 switch (cond)
6991   @{
6992   case 1:
6993     bar (0);
6994     __attribute__ ((fallthrough));
6995   default:
6996     @dots{}
6997   @}
6998 @end group
6999 @end smallexample
7001 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
7002 warning using @code{[[fallthrough]];} instead of the GNU attribute.  In C++11
7003 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
7004 Instead of these attributes, it is also possible to add a fallthrough comment
7005 to silence the warning.  The whole body of the C or C++ style comment should
7006 match the given regular expressions listed below.  The option argument @var{n}
7007 specifies what kind of comments are accepted:
7009 @itemize @bullet
7011 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
7013 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
7014 expression, any comment is used as fallthrough comment.
7016 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
7017 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
7019 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
7020 following regular expressions:
7022 @itemize @bullet
7024 @item @code{-fallthrough}
7026 @item @code{@@fallthrough@@}
7028 @item @code{lint -fallthrough[ \t]*}
7030 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
7032 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
7034 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
7036 @end itemize
7038 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
7039 following regular expressions:
7041 @itemize @bullet
7043 @item @code{-fallthrough}
7045 @item @code{@@fallthrough@@}
7047 @item @code{lint -fallthrough[ \t]*}
7049 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
7051 @end itemize
7053 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
7054 fallthrough comments, only attributes disable the warning.
7056 @end itemize
7058 The comment needs to be followed after optional whitespace and other comments
7059 by @code{case} or @code{default} keywords or by a user label that precedes some
7060 @code{case} or @code{default} label.
7062 @smallexample
7063 @group
7064 switch (cond)
7065   @{
7066   case 1:
7067     bar (0);
7068     /* FALLTHRU */
7069   default:
7070     @dots{}
7071   @}
7072 @end group
7073 @end smallexample
7075 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
7077 @opindex Wif-not-aligned
7078 @opindex Wno-if-not-aligned
7079 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7080 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
7081 should be issued.  These warnings are enabled by default.
7083 @opindex Wignored-qualifiers
7084 @opindex Wno-ignored-qualifiers
7085 @item -Wignored-qualifiers @r{(C and C++ only)}
7086 Warn if the return type of a function has a type qualifier
7087 such as @code{const}.  For ISO C such a type qualifier has no effect,
7088 since the value returned by a function is not an lvalue.
7089 For C++, the warning is only emitted for scalar types or @code{void}.
7090 ISO C prohibits qualified @code{void} return types on function
7091 definitions, so such return types always receive a warning
7092 even without this option.
7094 This warning is also enabled by @option{-Wextra}.
7096 @opindex Wignored-attributes
7097 @opindex Wno-ignored-attributes
7098 @item -Wno-ignored-attributes @r{(C and C++ only)}
7099 This option controls warnings when an attribute is ignored.
7100 This is different from the
7101 @option{-Wattributes} option in that it warns whenever the compiler decides
7102 to drop an attribute, not that the attribute is either unknown, used in a
7103 wrong place, etc.  This warning is enabled by default.
7105 @opindex Wmain
7106 @opindex Wno-main
7107 @item -Wmain
7108 Warn if the type of @code{main} is suspicious.  @code{main} should be
7109 a function with external linkage, returning int, taking either zero
7110 arguments, two, or three arguments of appropriate types.  This warning
7111 is enabled by default in C++ and is enabled by either @option{-Wall}
7112 or @option{-Wpedantic}.
7114 This warning is upgraded to an error by @option{-pedantic-errors}.
7116 @opindex Wmisleading-indentation
7117 @opindex Wno-misleading-indentation
7118 @item -Wmisleading-indentation @r{(C and C++ only)}
7119 Warn when the indentation of the code does not reflect the block structure.
7120 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
7121 @code{for} clauses with a guarded statement that does not use braces,
7122 followed by an unguarded statement with the same indentation.
7124 In the following example, the call to ``bar'' is misleadingly indented as
7125 if it were guarded by the ``if'' conditional.
7127 @smallexample
7128   if (some_condition ())
7129     foo ();
7130     bar ();  /* Gotcha: this is not guarded by the "if".  */
7131 @end smallexample
7133 In the case of mixed tabs and spaces, the warning uses the
7134 @option{-ftabstop=} option to determine if the statements line up
7135 (defaulting to 8).
7137 The warning is not issued for code involving multiline preprocessor logic
7138 such as the following example.
7140 @smallexample
7141   if (flagA)
7142     foo (0);
7143 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
7144   if (flagB)
7145 #endif
7146     foo (1);
7147 @end smallexample
7149 The warning is not issued after a @code{#line} directive, since this
7150 typically indicates autogenerated code, and no assumptions can be made
7151 about the layout of the file that the directive references.
7153 This warning is enabled by @option{-Wall} in C and C++.
7155 @opindex Wmissing-attributes
7156 @opindex Wno-missing-attributes
7157 @item -Wmissing-attributes
7158 Warn when a declaration of a function is missing one or more attributes
7159 that a related function is declared with and whose absence may adversely
7160 affect the correctness or efficiency of generated code.  For example,
7161 the warning is issued for declarations of aliases that use attributes
7162 to specify less restrictive requirements than those of their targets.
7163 This typically represents a potential optimization opportunity.
7164 By contrast, the @option{-Wattribute-alias=2} option controls warnings
7165 issued when the alias is more restrictive than the target, which could
7166 lead to incorrect code generation.
7167 Attributes considered include @code{alloc_align}, @code{alloc_size},
7168 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
7169 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
7170 @code{returns_nonnull}, and @code{returns_twice}.
7172 In C++, the warning is issued when an explicit specialization of a primary
7173 template declared with attribute @code{alloc_align}, @code{alloc_size},
7174 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
7175 or @code{nonnull} is declared without it.  Attributes @code{deprecated},
7176 @code{error}, and @code{warning} suppress the warning.
7177 (@pxref{Function Attributes}).
7179 You can use the @code{copy} attribute to apply the same
7180 set of attributes to a declaration as that on another declaration without
7181 explicitly enumerating the attributes. This attribute can be applied
7182 to declarations of functions (@pxref{Common Function Attributes}),
7183 variables (@pxref{Common Variable Attributes}), or types
7184 (@pxref{Common Type Attributes}).
7186 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
7188 For example, since the declaration of the primary function template
7189 below makes use of both attribute @code{malloc} and @code{alloc_size}
7190 the declaration of the explicit specialization of the template is
7191 diagnosed because it is missing one of the attributes.
7193 @smallexample
7194 template <class T>
7195 T* __attribute__ ((malloc, alloc_size (1)))
7196 allocate (size_t);
7198 template <>
7199 void* __attribute__ ((malloc))   // missing alloc_size
7200 allocate<void> (size_t);
7201 @end smallexample
7203 @opindex Wmissing-braces
7204 @opindex Wno-missing-braces
7205 @item -Wmissing-braces
7206 Warn if an aggregate or union initializer is not fully bracketed.  In
7207 the following example, the initializer for @code{a} is not fully
7208 bracketed, but that for @code{b} is fully bracketed.
7210 @smallexample
7211 int a[2][2] = @{ 0, 1, 2, 3 @};
7212 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
7213 @end smallexample
7215 This warning is enabled by @option{-Wall}.
7217 @opindex Wmissing-include-dirs
7218 @opindex Wno-missing-include-dirs
7219 @item -Wmissing-include-dirs @r{(C, C++, Objective-C, Objective-C++ and Fortran only)}
7220 Warn if a user-supplied include directory does not exist. This option is disabled
7221 by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially
7222 enabled by default by warning for -I and -J, only.
7224 @opindex Wmissing-profile
7225 @opindex Wno-missing-profile
7226 @item -Wno-missing-profile
7227 This option controls warnings if feedback profiles are missing when using the
7228 @option{-fprofile-use} option.
7229 This option diagnoses those cases where a new function or a new file is added
7230 between compiling with @option{-fprofile-generate} and with
7231 @option{-fprofile-use}, without regenerating the profiles.
7232 In these cases, the profile feedback data files do not contain any
7233 profile feedback information for
7234 the newly added function or file respectively.  Also, in the case when profile
7235 count data (.gcda) files are removed, GCC cannot use any profile feedback
7236 information.  In all these cases, warnings are issued to inform you that a
7237 profile generation step is due.
7238 Ignoring the warning can result in poorly optimized code.
7239 @option{-Wno-missing-profile} can be used to
7240 disable the warning, but this is not recommended and should be done only
7241 when non-existent profile data is justified.
7243 @opindex Wmismatched-dealloc
7244 @opindex Wno-mismatched-dealloc
7245 @item -Wmismatched-dealloc
7247 Warn for calls to deallocation functions with pointer arguments returned
7248 from from allocations functions for which the former isn't a suitable
7249 deallocator.  A pair of functions can be associated as matching allocators
7250 and deallocators by use of attribute @code{malloc}.  Unless disabled by
7251 the @option{-fno-builtin} option the standard functions @code{calloc},
7252 @code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding
7253 forms of C++ @code{operator new} and @code{operator delete} are implicitly
7254 associated as matching allocators and deallocators.  In the following
7255 example @code{mydealloc} is the deallocator for pointers returned from
7256 @code{myalloc}.
7258 @smallexample
7259 void mydealloc (void*);
7261 __attribute__ ((malloc (mydealloc, 1))) void*
7262 myalloc (size_t);
7264 void f (void)
7266   void *p = myalloc (32);
7267   // @dots{}use p@dots{}
7268   free (p);   // warning: not a matching deallocator for myalloc
7269   mydealloc (p);   // ok
7271 @end smallexample
7273 In C++, the related option @option{-Wmismatched-new-delete} diagnoses
7274 mismatches involving either @code{operator new} or @code{operator delete}.
7276 Option @option{-Wmismatched-dealloc} is included in @option{-Wall}.
7278 @opindex Wmultistatement-macros
7279 @opindex Wno-multistatement-macros
7280 @item -Wmultistatement-macros
7281 Warn about unsafe multiple statement macros that appear to be guarded
7282 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
7283 @code{while}, in which only the first statement is actually guarded after
7284 the macro is expanded.
7286 For example:
7288 @smallexample
7289 #define DOIT x++; y++
7290 if (c)
7291   DOIT;
7292 @end smallexample
7294 will increment @code{y} unconditionally, not just when @code{c} holds.
7295 The can usually be fixed by wrapping the macro in a do-while loop:
7296 @smallexample
7297 #define DOIT do @{ x++; y++; @} while (0)
7298 if (c)
7299   DOIT;
7300 @end smallexample
7302 This warning is enabled by @option{-Wall} in C and C++.
7304 @opindex Wparentheses
7305 @opindex Wno-parentheses
7306 @item -Wparentheses
7307 Warn if parentheses are omitted in certain contexts, such
7308 as when there is an assignment in a context where a truth value
7309 is expected, or when operators are nested whose precedence people
7310 often get confused about.
7312 Also warn if a comparison like @code{x<=y<=z} appears; this is
7313 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
7314 interpretation from that of ordinary mathematical notation.
7316 Also warn for dangerous uses of the GNU extension to
7317 @code{?:} with omitted middle operand. When the condition
7318 in the @code{?}: operator is a boolean expression, the omitted value is
7319 always 1.  Often programmers expect it to be a value computed
7320 inside the conditional expression instead.
7322 For C++ this also warns for some cases of unnecessary parentheses in
7323 declarations, which can indicate an attempt at a function call instead
7324 of a declaration:
7325 @smallexample
7327   // Declares a local variable called mymutex.
7328   std::unique_lock<std::mutex> (mymutex);
7329   // User meant std::unique_lock<std::mutex> lock (mymutex);
7331 @end smallexample
7333 This warning is enabled by @option{-Wall}.
7335 @opindex Wself-move
7336 @opindex Wno-self-move
7337 @item -Wno-self-move @r{(C++ and Objective-C++ only)}
7338 This warning warns when a value is moved to itself with @code{std::move}.
7339 Such a @code{std::move} typically has no effect.
7341 @smallexample
7342 struct T @{
7343 @dots{}
7345 void fn()
7347   T t;
7348   @dots{}
7349   t = std::move (t);
7351 @end smallexample
7353 This warning is enabled by @option{-Wall}.
7355 @opindex Wsequence-point
7356 @opindex Wno-sequence-point
7357 @item -Wsequence-point
7358 Warn about code that may have undefined semantics because of violations
7359 of sequence point rules in the C and C++ standards.
7361 The C and C++ standards define the order in which expressions in a C/C++
7362 program are evaluated in terms of @dfn{sequence points}, which represent
7363 a partial ordering between the execution of parts of the program: those
7364 executed before the sequence point, and those executed after it.  These
7365 occur after the evaluation of a full expression (one which is not part
7366 of a larger expression), after the evaluation of the first operand of a
7367 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
7368 function is called (but after the evaluation of its arguments and the
7369 expression denoting the called function), and in certain other places.
7370 Other than as expressed by the sequence point rules, the order of
7371 evaluation of subexpressions of an expression is not specified.  All
7372 these rules describe only a partial order rather than a total order,
7373 since, for example, if two functions are called within one expression
7374 with no sequence point between them, the order in which the functions
7375 are called is not specified.  However, the standards committee have
7376 ruled that function calls do not overlap.
7378 It is not specified when between sequence points modifications to the
7379 values of objects take effect.  Programs whose behavior depends on this
7380 have undefined behavior; the C and C++ standards specify that ``Between
7381 the previous and next sequence point an object shall have its stored
7382 value modified at most once by the evaluation of an expression.
7383 Furthermore, the prior value shall be read only to determine the value
7384 to be stored.''.  If a program breaks these rules, the results on any
7385 particular implementation are entirely unpredictable.
7387 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
7388 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
7389 diagnosed by this option, and it may give an occasional false positive
7390 result, but in general it has been found fairly effective at detecting
7391 this sort of problem in programs.
7393 The C++17 standard will define the order of evaluation of operands in
7394 more cases: in particular it requires that the right-hand side of an
7395 assignment be evaluated before the left-hand side, so the above
7396 examples are no longer undefined.  But this option will still warn
7397 about them, to help people avoid writing code that is undefined in C
7398 and earlier revisions of C++.
7400 The standard is worded confusingly, therefore there is some debate
7401 over the precise meaning of the sequence point rules in subtle cases.
7402 Links to discussions of the problem, including proposed formal
7403 definitions, may be found on the GCC readings page, at
7404 @uref{https://gcc.gnu.org/@/readings.html}.
7406 This warning is enabled by @option{-Wall} for C and C++.
7408 @opindex Wno-return-local-addr
7409 @opindex Wreturn-local-addr
7410 @item -Wno-return-local-addr
7411 Do not warn about returning a pointer (or in C++, a reference) to a
7412 variable that goes out of scope after the function returns.
7414 @opindex Wreturn-mismatch
7415 @opindex Wno-return-mismatch
7416 @item -Wreturn-mismatch
7417 Warn about return statements without an expressions in functions which
7418 do not return @code{void}.  Also warn about a @code{return} statement
7419 with an expression in a function whose return type is @code{void},
7420 unless the expression type is also @code{void}.  As a GNU extension, the
7421 latter case is accepted without a warning unless @option{-Wpedantic} is
7422 used.
7424 Attempting to use the return value of a non-@code{void} function other
7425 than @code{main} that flows off the end by reaching the closing curly
7426 brace that terminates the function is undefined.
7428 This warning is specific to C and enabled by default.  In C99 and later
7429 language dialects, it is treated as an error.  It can be downgraded
7430 to a warning using @option{-fpermissive} (along with other warnings),
7431 or for just this warning, with @option{-Wno-error=return-mismatch}.
7433 @opindex Wreturn-type
7434 @opindex Wno-return-type
7435 @item -Wreturn-type
7436 Warn whenever a function is defined with a return type that defaults to
7437 @code{int} (unless @option{-Wimplicit-int} is active, which takes
7438 precedence).  Also warn if execution may reach the end of the function
7439 body, or if the function does not contain any return statement at all.
7441 Attempting to use the return value of a non-@code{void} function other
7442 than @code{main} that flows off the end by reaching the closing curly
7443 brace that terminates the function is undefined.
7445 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
7446 than @code{main} results in undefined behavior even when the value of
7447 the function is not used.
7449 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
7451 @opindex Wshift-count-negative
7452 @opindex Wno-shift-count-negative
7453 @item -Wno-shift-count-negative
7454 Controls warnings if a shift count is negative.
7455 This warning is enabled by default.
7457 @opindex Wshift-count-overflow
7458 @opindex Wno-shift-count-overflow
7459 @item -Wno-shift-count-overflow
7460 Controls warnings if a shift count is greater than or equal to the bit width
7461 of the type.  This warning is enabled by default.
7463 @opindex Wshift-negative-value
7464 @opindex Wno-shift-negative-value
7465 @item -Wshift-negative-value
7466 Warn if left shifting a negative value.  This warning is enabled by
7467 @option{-Wextra} in C99 (and newer) and C++11 to C++17 modes.
7469 @opindex Wshift-overflow
7470 @opindex Wno-shift-overflow
7471 @item -Wno-shift-overflow
7472 @itemx -Wshift-overflow=@var{n}
7473 These options control warnings about left shift overflows.
7475 @table @gcctabopt
7476 @item -Wshift-overflow=1
7477 This is the warning level of @option{-Wshift-overflow} and is enabled
7478 by default in C99 and C++11 modes (and newer).  This warning level does
7479 not warn about left-shifting 1 into the sign bit.  (However, in C, such
7480 an overflow is still rejected in contexts where an integer constant expression
7481 is required.)  No warning is emitted in C++20 mode (and newer), as signed left
7482 shifts always wrap.
7484 @item -Wshift-overflow=2
7485 This warning level also warns about left-shifting 1 into the sign bit,
7486 unless C++14 mode (or newer) is active.
7487 @end table
7489 @opindex Wswitch
7490 @opindex Wno-switch
7491 @item -Wswitch
7492 Warn whenever a @code{switch} statement has an index of enumerated type
7493 and lacks a @code{case} for one or more of the named codes of that
7494 enumeration.  (The presence of a @code{default} label prevents this
7495 warning.)  @code{case} labels outside the enumeration range also
7496 provoke warnings when this option is used (even if there is a
7497 @code{default} label).
7498 This warning is enabled by @option{-Wall}.
7500 @opindex Wswitch-default
7501 @opindex Wno-switch-default
7502 @item -Wswitch-default
7503 Warn whenever a @code{switch} statement does not have a @code{default}
7504 case.
7506 @opindex Wswitch-enum
7507 @opindex Wno-switch-enum
7508 @item -Wswitch-enum
7509 Warn whenever a @code{switch} statement has an index of enumerated type
7510 and lacks a @code{case} for one or more of the named codes of that
7511 enumeration.  @code{case} labels outside the enumeration range also
7512 provoke warnings when this option is used.  The only difference
7513 between @option{-Wswitch} and this option is that this option gives a
7514 warning about an omitted enumeration code even if there is a
7515 @code{default} label.
7517 @opindex Wswitch-bool
7518 @opindex Wno-switch-bool
7519 @item -Wno-switch-bool
7520 Do not warn when a @code{switch} statement has an index of boolean type
7521 and the case values are outside the range of a boolean type.
7522 It is possible to suppress this warning by casting the controlling
7523 expression to a type other than @code{bool}.  For example:
7524 @smallexample
7525 @group
7526 switch ((int) (a == 4))
7527   @{
7528   @dots{}
7529   @}
7530 @end group
7531 @end smallexample
7532 This warning is enabled by default for C and C++ programs.
7534 @opindex Wswitch-outside-range
7535 @opindex Wno-switch-outside-range
7536 @item -Wno-switch-outside-range
7537 This option controls warnings when a @code{switch} case has a value
7538 that is outside of its
7539 respective type range.  This warning is enabled by default for
7540 C and C++ programs.
7542 @opindex Wswitch-unreachable
7543 @opindex Wno-switch-unreachable
7544 @item -Wno-switch-unreachable
7545 Do not warn when a @code{switch} statement contains statements between the
7546 controlling expression and the first case label, which will never be
7547 executed.  For example:
7548 @smallexample
7549 @group
7550 switch (cond)
7551   @{
7552    i = 15;
7553   @dots{}
7554    case 5:
7555   @dots{}
7556   @}
7557 @end group
7558 @end smallexample
7559 @option{-Wswitch-unreachable} does not warn if the statement between the
7560 controlling expression and the first case label is just a declaration:
7561 @smallexample
7562 @group
7563 switch (cond)
7564   @{
7565    int i;
7566   @dots{}
7567    case 5:
7568    i = 5;
7569   @dots{}
7570   @}
7571 @end group
7572 @end smallexample
7573 This warning is enabled by default for C and C++ programs.
7575 @opindex Wsync-nand
7576 @opindex Wno-sync-nand
7577 @item -Wsync-nand @r{(C and C++ only)}
7578 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
7579 built-in functions are used.  These functions changed semantics in GCC 4.4.
7581 @opindex Wtrivial-auto-var-init
7582 @opindex Wno-trivial-auto-var-init
7583 @item -Wtrivial-auto-var-init
7584 Warn when @code{-ftrivial-auto-var-init} cannot initialize the automatic
7585 variable.  A common situation is an automatic variable that is declared
7586 between the controlling expression and the first case label of a @code{switch}
7587 statement.
7589 @opindex Wunused-but-set-parameter
7590 @opindex Wno-unused-but-set-parameter
7591 @item -Wunused-but-set-parameter
7592 Warn whenever a function parameter is assigned to, but otherwise unused
7593 (aside from its declaration).
7595 To suppress this warning use the @code{unused} attribute
7596 (@pxref{Variable Attributes}).
7598 This warning is also enabled by @option{-Wunused} together with
7599 @option{-Wextra}.
7601 @opindex Wunused-but-set-variable
7602 @opindex Wno-unused-but-set-variable
7603 @item -Wunused-but-set-variable
7604 Warn whenever a local variable is assigned to, but otherwise unused
7605 (aside from its declaration).
7606 This warning is enabled by @option{-Wall}.
7608 To suppress this warning use the @code{unused} attribute
7609 (@pxref{Variable Attributes}).
7611 This warning is also enabled by @option{-Wunused}, which is enabled
7612 by @option{-Wall}.
7614 @opindex Wunused-function
7615 @opindex Wno-unused-function
7616 @item -Wunused-function
7617 Warn whenever a static function is declared but not defined or a
7618 non-inline static function is unused.
7619 This warning is enabled by @option{-Wall}.
7621 @opindex Wunused-label
7622 @opindex Wno-unused-label
7623 @item -Wunused-label
7624 Warn whenever a label is declared but not used.
7625 This warning is enabled by @option{-Wall}.
7627 To suppress this warning use the @code{unused} attribute
7628 (@pxref{Variable Attributes}).
7630 @opindex Wunused-local-typedefs
7631 @opindex Wno-unused-local-typedefs
7632 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
7633 Warn when a typedef locally defined in a function is not used.
7634 This warning is enabled by @option{-Wall}.
7636 @opindex Wunused-parameter
7637 @opindex Wno-unused-parameter
7638 @item -Wunused-parameter
7639 Warn whenever a function parameter is unused aside from its declaration.
7640 This option is not enabled by @code{-Wunused} unless @code{-Wextra} is also
7641 specified.
7643 To suppress this warning use the @code{unused} attribute
7644 (@pxref{Variable Attributes}).
7646 @opindex Wunused-result
7647 @opindex Wno-unused-result
7648 @item -Wno-unused-result
7649 Do not warn if a caller of a function marked with attribute
7650 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
7651 its return value. The default is @option{-Wunused-result}.
7653 @opindex Wunused-variable
7654 @opindex Wno-unused-variable
7655 @item -Wunused-variable
7656 Warn whenever a local or static variable is unused aside from its
7657 declaration. This option implies @option{-Wunused-const-variable=1} for C,
7658 but not for C++. This warning is enabled by @option{-Wall}.
7660 To suppress this warning use the @code{unused} attribute
7661 (@pxref{Variable Attributes}).
7663 @opindex Wunused-const-variable
7664 @opindex Wno-unused-const-variable
7665 @item -Wunused-const-variable
7666 @itemx -Wunused-const-variable=@var{n}
7667 Warn whenever a constant static variable is unused aside from its declaration.
7669 To suppress this warning use the @code{unused} attribute
7670 (@pxref{Variable Attributes}).
7672 @table @gcctabopt
7673 @item -Wunused-const-variable=1
7674 Warn about unused static const variables defined in the main
7675 compilation unit, but not about static const variables declared in any
7676 header included.
7678 @option{-Wunused-const-variable=1} is enabled by either
7679 @option{-Wunused-variable} or @option{-Wunused} for C, but not for
7680 C++. In C this declares variable storage, but in C++ this is not an
7681 error since const variables take the place of @code{#define}s.
7683 @item -Wunused-const-variable=2
7684 This warning level also warns for unused constant static variables in
7685 headers (excluding system headers).  It is equivalent to the short form
7686 @option{-Wunused-const-variable}.  This level must be explicitly
7687 requested in both C and C++ because it might be hard to clean up all
7688 headers included.
7689 @end table
7691 @opindex Wunused-value
7692 @opindex Wno-unused-value
7693 @item -Wunused-value
7694 Warn whenever a statement computes a result that is explicitly not
7695 used. To suppress this warning cast the unused expression to
7696 @code{void}. This includes an expression-statement or the left-hand
7697 side of a comma expression that contains no side effects. For example,
7698 an expression such as @code{x[i,j]} causes a warning, while
7699 @code{x[(void)i,j]} does not.
7701 This warning is enabled by @option{-Wall}.
7703 @opindex Wunused
7704 @opindex Wno-unused
7705 @item -Wunused
7706 All the above @option{-Wunused} options combined, except those documented
7707 as needing to be specified explicitly.
7709 In order to get a warning about an unused function parameter, you must
7710 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
7711 @option{-Wunused}), or separately specify @option{-Wunused-parameter} and/or
7712 @option{-Wunused-but-set-parameter}.
7714 @option{-Wunused} enables only @option{-Wunused-const-variable=1} rather than
7715 @option{-Wunused-const-variable}, and only for C, not C++.
7717 @opindex Wuse-after-free
7718 @opindex Wno-use-after-free
7719 @item -Wuse-after-free @r{(C, Objective-C, C++ and Objective-C++ only)}
7720 @itemx -Wuse-after-free=@var{n}
7721 Warn about uses of pointers to dynamically allocated objects that have
7722 been rendered indeterminate by a call to a deallocation function.
7723 The warning is enabled at all optimization levels but may yield different
7724 results with optimization than without.
7726 @table @gcctabopt
7727 @item -Wuse-after-free=1
7728 At level 1 the warning attempts to diagnose only unconditional uses
7729 of pointers made indeterminate by a deallocation call or a successful
7730 call to @code{realloc}, regardless of whether or not the call resulted
7731 in an actual reallocation of memory.  This includes double-@code{free}
7732 calls as well as uses in arithmetic and relational expressions.  Although
7733 undefined, uses of indeterminate pointers in equality (or inequality)
7734 expressions are not diagnosed at this level.
7735 @item -Wuse-after-free=2
7736 At level 2, in addition to unconditional uses, the warning also diagnoses
7737 conditional uses of pointers made indeterminate by a deallocation call.
7738 As at level 2, uses in equality (or inequality) expressions are not
7739 diagnosed.  For example, the second call to @code{free} in the following
7740 function is diagnosed at this level:
7741 @smallexample
7742 struct A @{ int refcount; void *data; @};
7744 void release (struct A *p)
7746   int refcount = --p->refcount;
7747   free (p);
7748   if (refcount == 0)
7749     free (p->data);   // warning: p may be used after free
7751 @end smallexample
7752 @item -Wuse-after-free=3
7753 At level 3, the warning also diagnoses uses of indeterminate pointers in
7754 equality expressions.  All uses of indeterminate pointers are undefined
7755 but equality tests sometimes appear after calls to @code{realloc} as
7756 an attempt to determine whether the call resulted in relocating the object
7757 to a different address.  They are diagnosed at a separate level to aid
7758 gradually transitioning legacy code to safe alternatives.  For example,
7759 the equality test in the function below is diagnosed at this level:
7760 @smallexample
7761 void adjust_pointers (int**, int);
7763 void grow (int **p, int n)
7765   int **q = (int**)realloc (p, n *= 2);
7766   if (q == p)
7767     return;
7768   adjust_pointers ((int**)q, n);
7770 @end smallexample
7771 To avoid the warning at this level, store offsets into allocated memory
7772 instead of pointers.  This approach obviates needing to adjust the stored
7773 pointers after reallocation.
7774 @end table
7776 @option{-Wuse-after-free=2} is included in @option{-Wall}.
7778 @opindex Wuseless-cast
7779 @opindex Wno-useless-cast
7780 @item -Wuseless-cast @r{(C, Objective-C, C++ and Objective-C++ only)}
7781 Warn when an expression is cast to its own type.  This warning does not
7782 occur when a class object is converted to a non-reference type as that
7783 is a way to create a temporary:
7785 @smallexample
7786 struct S @{ @};
7787 void g (S&&);
7788 void f (S&& arg)
7790   g (S(arg)); // make arg prvalue so that it can bind to S&&
7792 @end smallexample
7794 @opindex Wuninitialized
7795 @opindex Wno-uninitialized
7796 @item -Wuninitialized
7797 Warn if an object with automatic or allocated storage duration is used
7798 without having been initialized.  In C++, also warn if a non-static
7799 reference or non-static @code{const} member appears in a class without
7800 constructors.
7802 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7803 object to a @code{const}-qualified argument of a built-in function known to
7804 read the object is also diagnosed by this warning.
7805 (@option{-Wmaybe-uninitialized} is issued for ordinary functions.)
7807 If you want to warn about code that uses the uninitialized value of the
7808 variable in its own initializer, use the @option{-Winit-self} option.
7810 These warnings occur for individual uninitialized elements of
7811 structure, union or array variables as well as for variables that are
7812 uninitialized as a whole.  They do not occur for variables or elements
7813 declared @code{volatile}.  Because these warnings depend on
7814 optimization, the exact variables or elements for which there are
7815 warnings depend on the precise optimization options and version of GCC
7816 used.
7818 Note that there may be no warning about a variable that is used only
7819 to compute a value that itself is never used, because such
7820 computations may be deleted by data flow analysis before the warnings
7821 are printed.
7823 In C++, this warning also warns about using uninitialized objects in
7824 member-initializer-lists.  For example, GCC warns about @code{b} being
7825 uninitialized in the following snippet:
7827 @smallexample
7828 struct A @{
7829   int a;
7830   int b;
7831   A() : a(b) @{ @}
7833 @end smallexample
7835 @opindex Winvalid-memory-model
7836 @opindex Wno-invalid-memory-model
7837 @item -Wno-invalid-memory-model
7838 This option controls warnings
7839 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
7840 and the C11 atomic generic functions with a memory consistency argument
7841 that is either invalid for the operation or outside the range of values
7842 of the @code{memory_order} enumeration.  For example, since the
7843 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
7844 defined for the relaxed, release, and sequentially consistent memory
7845 orders the following code is diagnosed:
7847 @smallexample
7848 void store (int *i)
7850   __atomic_store_n (i, 0, memory_order_consume);
7852 @end smallexample
7854 @option{-Winvalid-memory-model} is enabled by default.
7856 @opindex Wmaybe-uninitialized
7857 @opindex Wno-maybe-uninitialized
7858 @item -Wmaybe-uninitialized
7859 For an object with automatic or allocated storage duration, if there exists
7860 a path from the function entry to a use of the object that is initialized,
7861 but there exist some other paths for which the object is not initialized,
7862 the compiler emits a warning if it cannot prove the uninitialized paths
7863 are not executed at run time.
7865 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7866 object to a @code{const}-qualified function argument is also diagnosed by
7867 this warning.  (@option{-Wuninitialized} is issued for built-in functions
7868 known to read the object.)  Annotating the function with attribute
7869 @code{access (none)} indicates that the argument isn't used to access
7870 the object and avoids the warning (@pxref{Common Function Attributes}).
7872 These warnings are only possible in optimizing compilation, because otherwise
7873 GCC does not keep track of the state of variables.
7875 These warnings are made optional because GCC may not be able to determine when
7876 the code is correct in spite of appearing to have an error.  Here is one
7877 example of how this can happen:
7879 @smallexample
7880 @group
7882   int x;
7883   switch (y)
7884     @{
7885     case 1: x = 1;
7886       break;
7887     case 2: x = 4;
7888       break;
7889     case 3: x = 5;
7890     @}
7891   foo (x);
7893 @end group
7894 @end smallexample
7896 @noindent
7897 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
7898 always initialized, but GCC doesn't know this. To suppress the
7899 warning, you need to provide a default case with assert(0) or
7900 similar code.
7902 @cindex @code{longjmp} warnings
7903 This option also warns when a non-volatile automatic variable might be
7904 changed by a call to @code{longjmp}.
7905 The compiler sees only the calls to @code{setjmp}.  It cannot know
7906 where @code{longjmp} will be called; in fact, a signal handler could
7907 call it at any point in the code.  As a result, you may get a warning
7908 even when there is in fact no problem because @code{longjmp} cannot
7909 in fact be called at the place that would cause a problem.
7911 Some spurious warnings can be avoided if you declare all the functions
7912 you use that never return as @code{noreturn}.  @xref{Function
7913 Attributes}.
7915 This warning is enabled by @option{-Wall} or @option{-Wextra}.
7917 @opindex Wunknown-pragmas
7918 @opindex Wno-unknown-pragmas
7919 @cindex warning for unknown pragmas
7920 @cindex unknown pragmas, warning
7921 @cindex pragmas, warning of unknown
7922 @item -Wunknown-pragmas
7923 Warn when a @code{#pragma} directive is encountered that is not understood by 
7924 GCC@.  If this command-line option is used, warnings are even issued
7925 for unknown pragmas in system header files.  This is not the case if
7926 the warnings are only enabled by the @option{-Wall} command-line option.
7928 @opindex Wno-pragmas
7929 @opindex Wpragmas
7930 @item -Wno-pragmas
7931 Do not warn about misuses of pragmas, such as incorrect parameters,
7932 invalid syntax, or conflicts between pragmas.  See also
7933 @option{-Wunknown-pragmas}.
7935 @opindex Wno-prio-ctor-dtor
7936 @opindex Wprio-ctor-dtor
7937 @item -Wno-prio-ctor-dtor
7938 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
7939 The use of constructor and destructor attributes allow you to assign a
7940 priority to the constructor/destructor to control its order of execution
7941 before @code{main} is called or after it returns.  The priority values must be
7942 greater than 100 as the compiler reserves priority values between 0--100 for
7943 the implementation.
7945 @opindex Wstrict-aliasing
7946 @opindex Wno-strict-aliasing
7947 @item -Wstrict-aliasing
7948 This option is only active when @option{-fstrict-aliasing} is active.
7949 It warns about code that might break the strict aliasing rules that the
7950 compiler is using for optimization.  The warning does not catch all
7951 cases, but does attempt to catch the more common pitfalls.  It is
7952 included in @option{-Wall}.
7953 It is equivalent to @option{-Wstrict-aliasing=3}
7955 @opindex Wstrict-aliasing=n
7956 @item -Wstrict-aliasing=n
7957 This option is only active when @option{-fstrict-aliasing} is active.
7958 It warns about code that might break the strict aliasing rules that the
7959 compiler is using for optimization.
7960 Higher levels correspond to higher accuracy (fewer false positives).
7961 Higher levels also correspond to more effort, similar to the way @option{-O} 
7962 works.
7963 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
7965 Level 1: Most aggressive, quick, least accurate.
7966 Possibly useful when higher levels
7967 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
7968 false negatives.  However, it has many false positives.
7969 Warns for all pointer conversions between possibly incompatible types,
7970 even if never dereferenced.  Runs in the front end only.
7972 Level 2: Aggressive, quick, not too precise.
7973 May still have many false positives (not as many as level 1 though),
7974 and few false negatives (but possibly more than level 1).
7975 Unlike level 1, it only warns when an address is taken.  Warns about
7976 incomplete types.  Runs in the front end only.
7978 Level 3 (default for @option{-Wstrict-aliasing}):
7979 Should have very few false positives and few false
7980 negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
7981 Takes care of the common pun+dereference pattern in the front end:
7982 @code{*(int*)&some_float}.
7983 If optimization is enabled, it also runs in the back end, where it deals
7984 with multiple statement cases using flow-sensitive points-to information.
7985 Only warns when the converted pointer is dereferenced.
7986 Does not warn about incomplete types.
7988 @opindex Wstrict-overflow
7989 @opindex Wno-strict-overflow
7990 @item -Wstrict-overflow
7991 @itemx -Wstrict-overflow=@var{n}
7992 This option is only active when signed overflow is undefined.
7993 It warns about cases where the compiler optimizes based on the
7994 assumption that signed overflow does not occur.  Note that it does not
7995 warn about all cases where the code might overflow: it only warns
7996 about cases where the compiler implements some optimization.  Thus
7997 this warning depends on the optimization level.
7999 An optimization that assumes that signed overflow does not occur is
8000 perfectly safe if the values of the variables involved are such that
8001 overflow never does, in fact, occur.  Therefore this warning can
8002 easily give a false positive: a warning about code that is not
8003 actually a problem.  To help focus on important issues, several
8004 warning levels are defined.  No warnings are issued for the use of
8005 undefined signed overflow when estimating how many iterations a loop
8006 requires, in particular when determining whether a loop will be
8007 executed at all.
8009 @table @gcctabopt
8010 @item -Wstrict-overflow=1
8011 Warn about cases that are both questionable and easy to avoid.  For
8012 example the compiler simplifies
8013 @code{x + 1 > x} to @code{1}.  This level of
8014 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
8015 are not, and must be explicitly requested.
8017 @item -Wstrict-overflow=2
8018 Also warn about other cases where a comparison is simplified to a
8019 constant.  For example: @code{abs (x) >= 0}.  This can only be
8020 simplified when signed integer overflow is undefined, because
8021 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
8022 zero.  @option{-Wstrict-overflow} (with no level) is the same as
8023 @option{-Wstrict-overflow=2}.
8025 @item -Wstrict-overflow=3
8026 Also warn about other cases where a comparison is simplified.  For
8027 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
8029 @item -Wstrict-overflow=4
8030 Also warn about other simplifications not covered by the above cases.
8031 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
8033 @item -Wstrict-overflow=5
8034 Also warn about cases where the compiler reduces the magnitude of a
8035 constant involved in a comparison.  For example: @code{x + 2 > y} is
8036 simplified to @code{x + 1 >= y}.  This is reported only at the
8037 highest warning level because this simplification applies to many
8038 comparisons, so this warning level gives a very large number of
8039 false positives.
8040 @end table
8042 @opindex Wstring-compare
8043 @opindex Wno-string-compare
8044 @item -Wstring-compare
8045 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
8046 determined to be either zero or non-zero in tests for such equality
8047 owing to the length of one argument being greater than the size of
8048 the array the other argument is stored in (or the bound in the case
8049 of @code{strncmp}).  Such calls could be mistakes.  For example,
8050 the call to @code{strcmp} below is diagnosed because its result is
8051 necessarily non-zero irrespective of the contents of the array @code{a}.
8053 @smallexample
8054 extern char a[4];
8055 void f (char *d)
8057   strcpy (d, "string");
8058   @dots{}
8059   if (0 == strcmp (a, d))   // cannot be true
8060     puts ("a and d are the same");
8062 @end smallexample
8064 @option{-Wstring-compare} is enabled by @option{-Wextra}.
8066 @opindex Wstringop-overflow
8067 @opindex Wno-stringop-overflow
8068 @item -Wno-stringop-overflow
8069 @item -Wstringop-overflow
8070 @itemx -Wstringop-overflow=@var{type}
8071 Warn for calls to string manipulation functions such as @code{memcpy} and
8072 @code{strcpy} that are determined to overflow the destination buffer.  The
8073 optional argument is one greater than the type of Object Size Checking to
8074 perform to determine the size of the destination.  @xref{Object Size Checking}.
8075 The argument is meaningful only for functions that operate on character arrays
8076 but not for raw memory functions like @code{memcpy} which always make use
8077 of Object Size type-0.  The option also warns for calls that specify a size
8078 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
8079 The option produces the best results with optimization enabled but can detect
8080 a small subset of simple buffer overflows even without optimization in
8081 calls to the GCC built-in functions like @code{__builtin_memcpy} that
8082 correspond to the standard functions.  In any case, the option warns about
8083 just a subset of buffer overflows detected by the corresponding overflow
8084 checking built-ins.  For example, the option issues a warning for
8085 the @code{strcpy} call below because it copies at least 5 characters
8086 (the string @code{"blue"} including the terminating NUL) into the buffer
8087 of size 4.
8089 @smallexample
8090 enum Color @{ blue, purple, yellow @};
8091 const char* f (enum Color clr)
8093   static char buf [4];
8094   const char *str;
8095   switch (clr)
8096     @{
8097       case blue: str = "blue"; break;
8098       case purple: str = "purple"; break;
8099       case yellow: str = "yellow"; break;
8100     @}
8102   return strcpy (buf, str);   // warning here
8104 @end smallexample
8106 Option @option{-Wstringop-overflow=2} is enabled by default.
8108 @table @gcctabopt
8109 @opindex Wstringop-overflow
8110 @opindex Wno-stringop-overflow
8111 @item -Wstringop-overflow
8112 @itemx -Wstringop-overflow=1
8113 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
8114 to determine the sizes of destination objects.  At this setting the option
8115 does not warn for writes past the end of subobjects of larger objects accessed
8116 by pointers unless the size of the largest surrounding object is known.  When
8117 the destination may be one of several objects it is assumed to be the largest
8118 one of them.  On Linux systems, when optimization is enabled at this setting
8119 the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
8120 is defined to a non-zero value.
8122 @item -Wstringop-overflow=2
8123 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
8124 to determine the sizes of destination objects.  At this setting the option
8125 warns about overflows when writing to members of the largest complete
8126 objects whose exact size is known.  However, it does not warn for excessive
8127 writes to the same members of unknown objects referenced by pointers since
8128 they may point to arrays containing unknown numbers of elements.  This is
8129 the default setting of the option.
8131 @item -Wstringop-overflow=3
8132 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
8133 to determine the sizes of destination objects.  At this setting the option
8134 warns about overflowing the smallest object or data member.  This is the
8135 most restrictive setting of the option that may result in warnings for safe
8136 code.
8138 @item -Wstringop-overflow=4
8139 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
8140 to determine the sizes of destination objects.  At this setting the option
8141 warns about overflowing any data members, and when the destination is
8142 one of several objects it uses the size of the largest of them to decide
8143 whether to issue a warning.  Similarly to @option{-Wstringop-overflow=3} this
8144 setting of the option may result in warnings for benign code.
8145 @end table
8147 @opindex Wstringop-overread
8148 @opindex Wno-stringop-overread
8149 @item -Wno-stringop-overread
8150 Warn for calls to string manipulation functions such as @code{memchr}, or
8151 @code{strcpy} that are determined to read past the end of the source
8152 sequence.
8154 Option @option{-Wstringop-overread} is enabled by default.
8156 @opindex Wstringop-truncation
8157 @opindex Wno-stringop-truncation
8158 @item -Wno-stringop-truncation
8159 Do not warn for calls to bounded string manipulation functions
8160 such as @code{strncat},
8161 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
8162 or leave the destination unchanged.
8164 In the following example, the call to @code{strncat} specifies a bound that
8165 is less than the length of the source string.  As a result, the copy of
8166 the source will be truncated and so the call is diagnosed.  To avoid the
8167 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
8169 @smallexample
8170 void append (char *buf, size_t bufsize)
8172   strncat (buf, ".txt", 3);
8174 @end smallexample
8176 As another example, the following call to @code{strncpy} results in copying
8177 to @code{d} just the characters preceding the terminating NUL, without
8178 appending the NUL to the end.  Assuming the result of @code{strncpy} is
8179 necessarily a NUL-terminated string is a common mistake, and so the call
8180 is diagnosed.  To avoid the warning when the result is not expected to be
8181 NUL-terminated, call @code{memcpy} instead.
8183 @smallexample
8184 void copy (char *d, const char *s)
8186   strncpy (d, s, strlen (s));
8188 @end smallexample
8190 In the following example, the call to @code{strncpy} specifies the size
8191 of the destination buffer as the bound.  If the length of the source
8192 string is equal to or greater than this size the result of the copy will
8193 not be NUL-terminated.  Therefore, the call is also diagnosed.  To avoid
8194 the warning, specify @code{sizeof buf - 1} as the bound and set the last
8195 element of the buffer to @code{NUL}.
8197 @smallexample
8198 void copy (const char *s)
8200   char buf[80];
8201   strncpy (buf, s, sizeof buf);
8202   @dots{}
8204 @end smallexample
8206 In situations where a character array is intended to store a sequence
8207 of bytes with no terminating @code{NUL} such an array may be annotated
8208 with attribute @code{nonstring} to avoid this warning.  Such arrays,
8209 however, are not suitable arguments to functions that expect
8210 @code{NUL}-terminated strings.  To help detect accidental misuses of
8211 such arrays GCC issues warnings unless it can prove that the use is
8212 safe.  @xref{Common Variable Attributes}.
8214 @opindex Wstrict-flex-arrays
8215 @opindex Wno-strict-flex-arrays
8216 @item -Wstrict-flex-arrays @r{(C and C++ only)}
8217 Warn about improper usages of flexible array members
8218 according to the @var{level} of the @code{strict_flex_array (@var{level})}
8219 attribute attached to the trailing array field of a structure if it's
8220 available, otherwise according to the @var{level} of the option
8221 @option{-fstrict-flex-arrays=@var{level}}.  @xref{Common Variable Attributes},
8222 for more information about the attribute, and @ref{C Dialect Options} for
8223 more information about the option.  @code{-Wstrict-flex-arrays}
8224 is effective only when @var{level} is greater than 0.
8226 When @var{level}=1, warnings are issued for a trailing array reference
8227 of a structure that have 2 or more elements if the trailing array is referenced
8228 as a flexible array member.
8230 When @var{level}=2, in addition to @var{level}=1, additional warnings are
8231 issued for a trailing one-element array reference of a structure
8232 if the array is referenced as a flexible array member.
8234 When @var{level}=3, in addition to @var{level}=2, additional warnings are
8235 issued for a trailing zero-length array reference of a structure
8236 if the array is referenced as a flexible array member.
8238 This option is more effective when @option{-ftree-vrp} is active (the
8239 default for @option{-O2} and above) but some warnings may be diagnosed
8240 even without optimization.
8242 @opindex Wsuggest-attribute=
8243 @opindex Wno-suggest-attribute=
8244 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}returns_nonnull@r{|}
8245 Warn for cases where adding an attribute may be beneficial. The
8246 attributes currently supported are listed below.
8248 @table @gcctabopt
8249 @opindex Wsuggest-attribute=pure
8250 @opindex Wno-suggest-attribute=pure
8251 @opindex Wsuggest-attribute=const
8252 @opindex Wno-suggest-attribute=const
8253 @opindex Wsuggest-attribute=noreturn
8254 @opindex Wno-suggest-attribute=noreturn
8255 @opindex Wmissing-noreturn
8256 @opindex Wno-missing-noreturn
8257 @opindex Wsuggest-attribute=malloc
8258 @opindex Wno-suggest-attribute=malloc
8259 @item -Wsuggest-attribute=pure
8260 @itemx -Wsuggest-attribute=const
8261 @itemx -Wsuggest-attribute=noreturn
8262 @itemx -Wmissing-noreturn
8263 @itemx -Wsuggest-attribute=malloc
8264 @itemx -Wsuggest-attribute=returns_nonnull
8265 @itemx -Wno-suggest-attribute=returns_nonnull
8267 Warn about functions that might be candidates for attributes
8268 @code{pure}, @code{const}, @code{noreturn}, @code{malloc} or @code{returns_nonnull}. The compiler
8269 only warns for functions visible in other compilation units or (in the case of
8270 @code{pure} and @code{const}) if it cannot prove that the function returns
8271 normally. A function returns normally if it doesn't contain an infinite loop or
8272 return abnormally by throwing, calling @code{abort} or trapping.  This analysis
8273 requires option @option{-fipa-pure-const}, which is enabled by default at
8274 @option{-O} and higher.  Higher optimization levels improve the accuracy
8275 of the analysis.
8277 @opindex Wsuggest-attribute=format
8278 @opindex Wmissing-format-attribute
8279 @opindex Wno-suggest-attribute=format
8280 @opindex Wno-missing-format-attribute
8281 @opindex Wformat
8282 @opindex Wno-format
8283 @item -Wsuggest-attribute=format
8284 @itemx -Wmissing-format-attribute
8286 Warn about function pointers that might be candidates for @code{format}
8287 attributes.  Note these are only possible candidates, not absolute ones.
8288 GCC guesses that function pointers with @code{format} attributes that
8289 are used in assignment, initialization, parameter passing or return
8290 statements should have a corresponding @code{format} attribute in the
8291 resulting type.  I.e.@: the left-hand side of the assignment or
8292 initialization, the type of the parameter variable, or the return type
8293 of the containing function respectively should also have a @code{format}
8294 attribute to avoid the warning.
8296 GCC also warns about function definitions that might be
8297 candidates for @code{format} attributes.  Again, these are only
8298 possible candidates.  GCC guesses that @code{format} attributes
8299 might be appropriate for any function that calls a function like
8300 @code{vprintf} or @code{vscanf}, but this might not always be the
8301 case, and some functions for which @code{format} attributes are
8302 appropriate may not be detected.
8304 @opindex Wsuggest-attribute=cold
8305 @opindex Wno-suggest-attribute=cold
8306 @item -Wsuggest-attribute=cold
8308 Warn about functions that might be candidates for @code{cold} attribute.  This
8309 is based on static detection and generally only warns about functions which
8310 always leads to a call to another @code{cold} function such as wrappers of
8311 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
8312 @end table
8314 @opindex Wno-alloc-size
8315 @opindex Walloc-size
8316 @item -Walloc-size
8317 Warn about calls to allocation functions decorated with attribute
8318 @code{alloc_size} that specify insufficient size for the target type of
8319 the pointer the result is assigned to, including those to the built-in
8320 forms of the functions @code{aligned_alloc}, @code{alloca},
8321 @code{calloc}, @code{malloc}, and @code{realloc}.
8323 @opindex Wno-alloc-zero
8324 @opindex Walloc-zero
8325 @item -Walloc-zero
8326 Warn about calls to allocation functions decorated with attribute
8327 @code{alloc_size} that specify zero bytes, including those to the built-in
8328 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
8329 @code{malloc}, and @code{realloc}.  Because the behavior of these functions
8330 when called with a zero size differs among implementations (and in the case
8331 of @code{realloc} has been deprecated) relying on it may result in subtle
8332 portability bugs and should be avoided.
8334 @opindex Wcalloc-transposed-args
8335 @opindex Wno-calloc-transposed-args
8336 @item -Wcalloc-transposed-args
8337 Warn about calls to allocation functions decorated with attribute
8338 @code{alloc_size} with two arguments, which use @code{sizeof} operator
8339 as the earlier size argument and don't use it as the later size argument.
8340 This is a coding style warning.  The first argument to @code{calloc} is
8341 documented to be number of elements in array, while the second argument
8342 is size of each element, so @code{calloc (@var{n}, sizeof (int))} is preferred
8343 over @code{calloc (sizeof (int), @var{n})}.  If @code{sizeof} in the earlier
8344 argument and not the latter is intentional, the warning can be suppressed
8345 by using @code{calloc (sizeof (struct @var{S}) + 0, n)} or
8346 @code{calloc (1 * sizeof (struct @var{S}), 4)} or using @code{sizeof} in the
8347 later argument as well.
8349 @opindex Walloc-size-larger-than=
8350 @opindex Wno-alloc-size-larger-than
8351 @item -Walloc-size-larger-than=@var{byte-size}
8352 Warn about calls to functions decorated with attribute @code{alloc_size}
8353 that attempt to allocate objects larger than the specified number of bytes,
8354 or where the result of the size computation in an integer type with infinite
8355 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
8356 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8357 Warnings controlled by the option can be disabled either by specifying
8358 @var{byte-size} of @samp{SIZE_MAX} or more or by
8359 @option{-Wno-alloc-size-larger-than}.
8360 @xref{Function Attributes}.
8362 @opindex Wno-alloc-size-larger-than
8363 @item -Wno-alloc-size-larger-than
8364 Disable @option{-Walloc-size-larger-than=} warnings.  The option is
8365 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
8366 larger.
8368 @opindex Wno-alloca
8369 @opindex Walloca
8370 @item -Walloca
8371 This option warns on all uses of @code{alloca} in the source.
8373 @opindex Walloca-larger-than=
8374 @opindex Wno-alloca-larger-than
8375 @item -Walloca-larger-than=@var{byte-size}
8376 This option warns on calls to @code{alloca} with an integer argument whose
8377 value is either zero, or that is not bounded by a controlling predicate
8378 that limits its value to at most @var{byte-size}.  It also warns for calls
8379 to @code{alloca} where the bound value is unknown.  Arguments of non-integer
8380 types are considered unbounded even if they appear to be constrained to
8381 the expected range.
8383 For example, a bounded case of @code{alloca} could be:
8385 @smallexample
8386 void func (size_t n)
8388   void *p;
8389   if (n <= 1000)
8390     p = alloca (n);
8391   else
8392     p = malloc (n);
8393   f (p);
8395 @end smallexample
8397 In the above example, passing @code{-Walloca-larger-than=1000} would not
8398 issue a warning because the call to @code{alloca} is known to be at most
8399 1000 bytes.  However, if @code{-Walloca-larger-than=500} were passed,
8400 the compiler would emit a warning.
8402 Unbounded uses, on the other hand, are uses of @code{alloca} with no
8403 controlling predicate constraining its integer argument.  For example:
8405 @smallexample
8406 void func ()
8408   void *p = alloca (n);
8409   f (p);
8411 @end smallexample
8413 If @code{-Walloca-larger-than=500} were passed, the above would trigger
8414 a warning, but this time because of the lack of bounds checking.
8416 Note, that even seemingly correct code involving signed integers could
8417 cause a warning:
8419 @smallexample
8420 void func (signed int n)
8422   if (n < 500)
8423     @{
8424       p = alloca (n);
8425       f (p);
8426     @}
8428 @end smallexample
8430 In the above example, @var{n} could be negative, causing a larger than
8431 expected argument to be implicitly cast into the @code{alloca} call.
8433 This option also warns when @code{alloca} is used in a loop.
8435 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
8436 but is usually only effective  when @option{-ftree-vrp} is active (default
8437 for @option{-O2} and above).
8439 See also @option{-Wvla-larger-than=}@samp{byte-size}.
8441 @opindex Wno-alloca-larger-than
8442 @item -Wno-alloca-larger-than
8443 Disable @option{-Walloca-larger-than=} warnings.  The option is
8444 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
8446 @opindex Warith-conversion
8447 @opindex Wno-arith-conversion
8448 @item -Warith-conversion
8449 Do warn about implicit conversions from arithmetic operations even
8450 when conversion of the operands to the same type cannot change their
8451 values.  This affects warnings from @option{-Wconversion},
8452 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
8454 @smallexample
8455 @group
8456 void f (char c, int i)
8458   c = c + i; // warns with @option{-Wconversion}
8459   c = c + 1; // only warns with @option{-Warith-conversion}
8461 @end group
8462 @end smallexample
8464 @opindex Wno-array-bounds
8465 @opindex Warray-bounds
8466 @item -Warray-bounds
8467 @itemx -Warray-bounds=@var{n}
8468 Warn about out of bounds subscripts or offsets into arrays.  This warning
8469 is enabled by @option{-Wall}.  It is more effective when @option{-ftree-vrp}
8470 is active (the default for @option{-O2} and above) but a subset of instances
8471 are issued even without optimization.
8473 By default, the trailing array of a structure will be treated as a flexible
8474 array member by @option{-Warray-bounds} or @option{-Warray-bounds=@var{n}}
8475 if it is declared as either a flexible array member per C99 standard onwards
8476 (@samp{[]}), a GCC zero-length array extension (@samp{[0]}), or an one-element
8477 array (@samp{[1]}). As a result, out of bounds subscripts or offsets into
8478 zero-length arrays or one-element arrays are not warned by default.
8480 You can add the option @option{-fstrict-flex-arrays} or
8481 @option{-fstrict-flex-arrays=@var{level}} to control how this
8482 option treat trailing array of a structure as a flexible array member:
8484 when @var{level}<=1, no change to the default behavior.
8486 when @var{level}=2, additional warnings will be issued for out of bounds
8487 subscripts or offsets into one-element arrays;
8489 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
8490 issued for out of bounds subscripts or offsets into zero-length arrays.
8492 @table @gcctabopt
8493 @item -Warray-bounds=1
8494 This is the default warning level of @option{-Warray-bounds} and is enabled
8495 by @option{-Wall}; higher levels are not, and must be explicitly requested.
8497 @item -Warray-bounds=2
8498 This warning level also warns about the intermediate results of pointer
8499 arithmetic that may yield out of bounds values. This warning level may
8500 give a larger number of false positives and is deactivated by default.
8501 @end table
8503 @opindex Warray-compare
8504 @opindex Wno-array-compare
8505 @item -Warray-compare
8506 Warn about equality and relational comparisons between two operands of array
8507 type.  This comparison was deprecated in C++20.  For example:
8509 @smallexample
8510 int arr1[5];
8511 int arr2[5];
8512 bool same = arr1 == arr2;
8513 @end smallexample
8515 @option{-Warray-compare} is enabled by @option{-Wall}.
8517 @opindex Wno-array-parameter
8518 @opindex Warray-parameter
8519 @item -Warray-parameter
8520 @itemx -Warray-parameter=@var{n}
8521 Warn about redeclarations of functions involving parameters of array or
8522 pointer types of inconsistent kinds or forms, and enable the detection
8523 of out-of-bounds accesses to such parameters by warnings such as
8524 @option{-Warray-bounds}.
8526 If the first function declaration uses the array form for a parameter
8527 declaration, the bound specified
8528 in the array is assumed to be the minimum number of elements expected to
8529 be provided in calls to the function and the maximum number of elements
8530 accessed by it.  Failing to provide arguments of sufficient size or accessing
8531 more than the maximum number of elements may be diagnosed by warnings such
8532 as @option{-Warray-bounds} or @option{-Wstringop-overflow}.
8533 At level 1, the warning diagnoses inconsistencies
8534 involving array parameters declared using the @code{T[static N]} form.
8536 For example, the warning triggers for the second declaration of @code{f}
8537 because the first one with the keyword @code{static} specifies that
8538 the array argument must have at least four elements, while the second
8539 allows an array of any size to be passed to @code{f}.
8541 @smallexample
8542 void f (int[static 4]);
8543 void f (int[]);           // warning (inconsistent array form)
8545 void g (void)
8547   int *p = (int *)malloc (1 * sizeof (int));
8548   f (p);                  // warning (array too small)
8549   @dots{}
8551 @end smallexample
8553 At level 2 the warning also triggers for redeclarations involving any other
8554 inconsistency in array or pointer argument forms denoting array sizes.
8555 Pointers and arrays of unspecified bound are considered equivalent and do
8556 not trigger a warning.
8558 @smallexample
8559 void g (int*);
8560 void g (int[]);     // no warning
8561 void g (int[8]);    // warning (inconsistent array bound)
8562 @end smallexample
8564 @option{-Warray-parameter=2} is included in @option{-Wall}.  The
8565 @option{-Wvla-parameter} option triggers warnings for similar inconsistencies
8566 involving Variable Length Array arguments.
8568 The short form of the option @option{-Warray-parameter} is equivalent to
8569 @option{-Warray-parameter=2}.  The negative form @option{-Wno-array-parameter}
8570 is equivalent to @option{-Warray-parameter=0}.
8572 @opindex Wattribute-alias
8573 @opindex Wno-attribute-alias
8574 @item -Wattribute-alias=@var{n}
8575 @itemx -Wno-attribute-alias
8576 Warn about declarations using the @code{alias} and similar attributes whose
8577 target is incompatible with the type of the alias.
8578 @xref{Function Attributes,,Declaring Attributes of Functions}.
8580 @table @gcctabopt
8581 @item -Wattribute-alias=1
8582 The default warning level of the @option{-Wattribute-alias} option diagnoses
8583 incompatibilities between the type of the alias declaration and that of its
8584 target.  Such incompatibilities are typically indicative of bugs.
8586 @item -Wattribute-alias=2
8588 At this level @option{-Wattribute-alias} also diagnoses cases where
8589 the attributes of the alias declaration are more restrictive than the
8590 attributes applied to its target.  These mismatches can potentially
8591 result in incorrect code generation.  In other cases they may be
8592 benign and could be resolved simply by adding the missing attribute to
8593 the target.  For comparison, see the @option{-Wmissing-attributes}
8594 option, which controls diagnostics when the alias declaration is less
8595 restrictive than the target, rather than more restrictive.
8597 Attributes considered include @code{alloc_align}, @code{alloc_size},
8598 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
8599 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
8600 @code{returns_nonnull}, and @code{returns_twice}.
8601 @end table
8603 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
8604 This is the default.  You can disable these warnings with either
8605 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
8607 @opindex Wbidi-chars=
8608 @opindex Wbidi-chars
8609 @opindex Wno-bidi-chars
8610 @item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
8611 Warn about possibly misleading UTF-8 bidirectional control characters in
8612 comments, string literals, character constants, and identifiers.  Such
8613 characters can change left-to-right writing direction into right-to-left
8614 (and vice versa), which can cause confusion between the logical order and
8615 visual order.  This may be dangerous; for instance, it may seem that a piece
8616 of code is not commented out, whereas it in fact is.
8618 There are three levels of warning supported by GCC@.  The default is
8619 @option{-Wbidi-chars=unpaired}, which warns about improperly terminated
8620 bidi contexts.  @option{-Wbidi-chars=none} turns the warning off.
8621 @option{-Wbidi-chars=any} warns about any use of bidirectional control
8622 characters.
8624 By default, this warning does not warn about UCNs.  It is, however, possible
8625 to turn on such checking by using @option{-Wbidi-chars=unpaired,ucn} or
8626 @option{-Wbidi-chars=any,ucn}.  Using @option{-Wbidi-chars=ucn} is valid,
8627 and is equivalent to @option{-Wbidi-chars=unpaired,ucn}, if no previous
8628 @option{-Wbidi-chars=any} was specified.
8630 @opindex Wno-bool-compare
8631 @opindex Wbool-compare
8632 @item -Wbool-compare
8633 Warn about boolean expression compared with an integer value different from
8634 @code{true}/@code{false}.  For instance, the following comparison is
8635 always false:
8636 @smallexample
8637 int n = 5;
8638 @dots{}
8639 if ((n > 1) == 2) @{ @dots{} @}
8640 @end smallexample
8641 This warning is enabled by @option{-Wall}.
8643 @opindex Wno-bool-operation
8644 @opindex Wbool-operation
8645 @item -Wbool-operation
8646 Warn about suspicious operations on expressions of a boolean type.  For
8647 instance, bitwise negation of a boolean is very likely a bug in the program.
8648 For C, this warning also warns about incrementing or decrementing a boolean,
8649 which rarely makes sense.  (In C++, decrementing a boolean is always invalid.
8650 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
8652 This warning is enabled by @option{-Wall}.
8654 @opindex Wno-duplicated-branches
8655 @opindex Wduplicated-branches
8656 @item -Wduplicated-branches
8657 Warn when an if-else has identical branches.  This warning detects cases like
8658 @smallexample
8659 if (p != NULL)
8660   return 0;
8661 else
8662   return 0;
8663 @end smallexample
8664 It doesn't warn when both branches contain just a null statement.  This warning
8665 also warn for conditional operators:
8666 @smallexample
8667   int i = x ? *p : *p;
8668 @end smallexample
8670 @opindex Wno-duplicated-cond
8671 @opindex Wduplicated-cond
8672 @item -Wduplicated-cond
8673 Warn about duplicated conditions in an if-else-if chain.  For instance,
8674 warn for the following code:
8675 @smallexample
8676 if (p->q != NULL) @{ @dots{} @}
8677 else if (p->q != NULL) @{ @dots{} @}
8678 @end smallexample
8680 @opindex Wno-frame-address
8681 @opindex Wframe-address
8682 @item -Wframe-address
8683 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
8684 is called with an argument greater than 0.  Such calls may return indeterminate
8685 values or crash the program.  The warning is included in @option{-Wall}.
8687 @opindex Wno-discarded-qualifiers
8688 @opindex Wdiscarded-qualifiers
8689 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
8690 Do not warn if type qualifiers on pointers are being discarded.
8691 Typically, the compiler warns if a @code{const char *} variable is
8692 passed to a function that takes a @code{char *} parameter.  This option
8693 can be used to suppress such a warning.
8695 @opindex Wno-discarded-array-qualifiers
8696 @opindex Wdiscarded-array-qualifiers
8697 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
8698 Do not warn if type qualifiers on arrays which are pointer targets
8699 are being discarded.  Typically, the compiler warns if a
8700 @code{const int (*)[]} variable is passed to a function that
8701 takes a @code{int (*)[]} parameter.  This option can be used to
8702 suppress such a warning.
8704 @opindex Wno-incompatible-pointer-types
8705 @opindex Wincompatible-pointer-types
8706 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
8707 Do not warn when there is a conversion between pointers that have incompatible
8708 types.  This warning is for cases not covered by @option{-Wno-pointer-sign},
8709 which warns for pointer argument passing or assignment with different
8710 signedness.
8712 By default, in C99 and later dialects of C, GCC treats this issue as an
8713 error.  The error can be downgraded to a warning using
8714 @option{-fpermissive} (along with certain other errors), or for this
8715 error alone, with @option{-Wno-error=incompatible-pointer-types}.
8717 This warning is upgraded to an error by @option{-pedantic-errors}.
8719 @opindex Wno-int-conversion
8720 @opindex Wint-conversion
8721 @item -Wno-int-conversion @r{(C and Objective-C only)}
8722 Do not warn about incompatible integer to pointer and pointer to integer
8723 conversions.  This warning is about implicit conversions; for explicit
8724 conversions the warnings @option{-Wno-int-to-pointer-cast} and
8725 @option{-Wno-pointer-to-int-cast} may be used.
8727 By default, in C99 and later dialects of C, GCC treats this issue as an
8728 error.  The error can be downgraded to a warning using
8729 @option{-fpermissive} (along with certain other errors), or for this
8730 error alone, with @option{-Wno-error=int-conversion}.
8732 This warning is upgraded to an error by @option{-pedantic-errors}.
8734 @opindex Wzero-length-bounds
8735 @opindex Wzero-length-bounds
8736 @item -Wzero-length-bounds
8737 Warn about accesses to elements of zero-length array members that might
8738 overlap other members of the same object.  Declaring interior zero-length
8739 arrays is discouraged because accesses to them are undefined.
8740 @xref{Zero Length}.
8742 For example, the first two stores in function @code{bad} are diagnosed
8743 because the array elements overlap the subsequent members @code{b} and
8744 @code{c}.  The third store is diagnosed by @option{-Warray-bounds}
8745 because it is beyond the bounds of the enclosing object.
8747 @smallexample
8748 struct X @{ int a[0]; int b, c; @};
8749 struct X x;
8751 void bad (void)
8753   x.a[0] = 0;   // -Wzero-length-bounds
8754   x.a[1] = 1;   // -Wzero-length-bounds
8755   x.a[2] = 2;   // -Warray-bounds
8757 @end smallexample
8759 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
8761 @opindex Wno-div-by-zero
8762 @opindex Wdiv-by-zero
8763 @item -Wno-div-by-zero
8764 Do not warn about compile-time integer division by zero.  Floating-point
8765 division by zero is not warned about, as it can be a legitimate way of
8766 obtaining infinities and NaNs.
8768 @opindex Wsystem-headers
8769 @opindex Wno-system-headers
8770 @cindex warnings from system headers
8771 @cindex system headers, warnings from
8772 @item -Wsystem-headers
8773 Print warning messages for constructs found in system header files.
8774 Warnings from system headers are normally suppressed, on the assumption
8775 that they usually do not indicate real problems and would only make the
8776 compiler output harder to read.  Using this command-line option tells
8777 GCC to emit warnings from system headers as if they occurred in user
8778 code.  However, note that using @option{-Wall} in conjunction with this
8779 option does @emph{not} warn about unknown pragmas in system
8780 headers---for that, @option{-Wunknown-pragmas} must also be used.
8782 @opindex Wtautological-compare
8783 @opindex Wno-tautological-compare
8784 @item -Wtautological-compare
8785 Warn if a self-comparison always evaluates to true or false.  This
8786 warning detects various mistakes such as:
8787 @smallexample
8788 int i = 1;
8789 @dots{}
8790 if (i > i) @{ @dots{} @}
8791 @end smallexample
8793 This warning also warns about bitwise comparisons that always evaluate
8794 to true or false, for instance:
8795 @smallexample
8796 if ((a & 16) == 10) @{ @dots{} @}
8797 @end smallexample
8798 will always be false.
8800 This warning is enabled by @option{-Wall}.
8802 @opindex Wtrampolines
8803 @opindex Wno-trampolines
8804 @item -Wtrampolines
8805 Warn about trampolines generated for pointers to nested functions.
8806 A trampoline is a small piece of data or code that is created at run
8807 time on the stack when the address of a nested function is taken, and is
8808 used to call the nested function indirectly.  For some targets, it is
8809 made up of data only and thus requires no special treatment.  But, for
8810 most targets, it is made up of code and thus requires the stack to be
8811 made executable in order for the program to work properly.
8813 @opindex Wfloat-equal
8814 @opindex Wno-float-equal
8815 @item -Wfloat-equal
8816 Warn if floating-point values are used in equality comparisons.
8818 The idea behind this is that sometimes it is convenient (for the
8819 programmer) to consider floating-point values as approximations to
8820 infinitely precise real numbers.  If you are doing this, then you need
8821 to compute (by analyzing the code, or in some other way) the maximum or
8822 likely maximum error that the computation introduces, and allow for it
8823 when performing comparisons (and when producing output, but that's a
8824 different problem).  In particular, instead of testing for equality, you
8825 should check to see whether the two values have ranges that overlap; and
8826 this is done with the relational operators, so equality comparisons are
8827 probably mistaken.
8829 @opindex Wtraditional
8830 @opindex Wno-traditional
8831 @item -Wtraditional @r{(C and Objective-C only)}
8832 Warn about certain constructs that behave differently in traditional and
8833 ISO C@.  Also warn about ISO C constructs that have no traditional C
8834 equivalent, and/or problematic constructs that should be avoided.
8836 @itemize @bullet
8837 @item
8838 Macro parameters that appear within string literals in the macro body.
8839 In traditional C macro replacement takes place within string literals,
8840 but in ISO C it does not.
8842 @item
8843 In traditional C, some preprocessor directives did not exist.
8844 Traditional preprocessors only considered a line to be a directive
8845 if the @samp{#} appeared in column 1 on the line.  Therefore
8846 @option{-Wtraditional} warns about directives that traditional C
8847 understands but ignores because the @samp{#} does not appear as the
8848 first character on the line.  It also suggests you hide directives like
8849 @code{#pragma} not understood by traditional C by indenting them.  Some
8850 traditional implementations do not recognize @code{#elif}, so this option
8851 suggests avoiding it altogether.
8853 @item
8854 A function-like macro that appears without arguments.
8856 @item
8857 The unary plus operator.
8859 @item
8860 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
8861 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
8862 constants.)  Note, these suffixes appear in macros defined in the system
8863 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
8864 Use of these macros in user code might normally lead to spurious
8865 warnings, however GCC's integrated preprocessor has enough context to
8866 avoid warning in these cases.
8868 @item
8869 A function declared external in one block and then used after the end of
8870 the block.
8872 @item
8873 A @code{switch} statement has an operand of type @code{long}.
8875 @item
8876 A non-@code{static} function declaration follows a @code{static} one.
8877 This construct is not accepted by some traditional C compilers.
8879 @item
8880 The ISO type of an integer constant has a different width or
8881 signedness from its traditional type.  This warning is only issued if
8882 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
8883 typically represent bit patterns, are not warned about.
8885 @item
8886 Usage of ISO string concatenation is detected.
8888 @item
8889 Initialization of automatic aggregates.
8891 @item
8892 Identifier conflicts with labels.  Traditional C lacks a separate
8893 namespace for labels.
8895 @item
8896 Initialization of unions.  If the initializer is zero, the warning is
8897 omitted.  This is done under the assumption that the zero initializer in
8898 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
8899 initializer warnings and relies on default initialization to zero in the
8900 traditional C case.
8902 @item
8903 Conversions by prototypes between fixed/floating-point values and vice
8904 versa.  The absence of these prototypes when compiling with traditional
8905 C causes serious problems.  This is a subset of the possible
8906 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
8908 @item
8909 Use of ISO C style function definitions.  This warning intentionally is
8910 @emph{not} issued for prototype declarations or variadic functions
8911 because these ISO C features appear in your code when using
8912 libiberty's traditional C compatibility macros, @code{PARAMS} and
8913 @code{VPARAMS}.  This warning is also bypassed for nested functions
8914 because that feature is already a GCC extension and thus not relevant to
8915 traditional C compatibility.
8916 @end itemize
8918 @opindex Wtraditional-conversion
8919 @opindex Wno-traditional-conversion
8920 @item -Wtraditional-conversion @r{(C and Objective-C only)}
8921 Warn if a prototype causes a type conversion that is different from what
8922 would happen to the same argument in the absence of a prototype.  This
8923 includes conversions of fixed point to floating and vice versa, and
8924 conversions changing the width or signedness of a fixed-point argument
8925 except when the same as the default promotion.
8927 @opindex Wdeclaration-after-statement
8928 @opindex Wno-declaration-after-statement
8929 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
8930 Warn when a declaration is found after a statement in a block.  This
8931 construct, known from C++, was introduced with ISO C99 and is by default
8932 allowed in GCC@.  It is not supported by ISO C90.  @xref{Mixed Labels and Declarations}.
8934 This warning is upgraded to an error by @option{-pedantic-errors}.
8936 @opindex Wshadow
8937 @opindex Wno-shadow
8938 @item -Wshadow
8939 Warn whenever a local variable or type declaration shadows another
8940 variable, parameter, type, class member (in C++), or instance variable
8941 (in Objective-C) or whenever a built-in function is shadowed.  Note
8942 that in C++, the compiler warns if a local variable shadows an
8943 explicit typedef, but not if it shadows a struct/class/enum.
8944 If this warning is enabled, it includes also all instances of
8945 local shadowing.  This means that @option{-Wno-shadow=local}
8946 and @option{-Wno-shadow=compatible-local} are ignored when
8947 @option{-Wshadow} is used.
8948 Same as @option{-Wshadow=global}.
8950 @opindex Wno-shadow-ivar
8951 @opindex Wshadow-ivar
8952 @item -Wno-shadow-ivar @r{(Objective-C only)}
8953 Do not warn whenever a local variable shadows an instance variable in an
8954 Objective-C method.
8956 @opindex Wshadow=global
8957 @item -Wshadow=global
8958 Warn for any shadowing.
8959 Same as @option{-Wshadow}.
8961 @opindex Wshadow=local
8962 @item -Wshadow=local
8963 Warn when a local variable shadows another local variable or parameter.
8965 @opindex Wshadow=compatible-local
8966 @item -Wshadow=compatible-local
8967 Warn when a local variable shadows another local variable or parameter
8968 whose type is compatible with that of the shadowing variable.  In C++,
8969 type compatibility here means the type of the shadowing variable can be
8970 converted to that of the shadowed variable.  The creation of this flag
8971 (in addition to @option{-Wshadow=local}) is based on the idea that when
8972 a local variable shadows another one of incompatible type, it is most
8973 likely intentional, not a bug or typo, as shown in the following example:
8975 @smallexample
8976 @group
8977 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
8979   for (int i = 0; i < N; ++i)
8980   @{
8981     ...
8982   @}
8983   ...
8985 @end group
8986 @end smallexample
8988 Since the two variable @code{i} in the example above have incompatible types,
8989 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
8990 Because their types are incompatible, if a programmer accidentally uses one
8991 in place of the other, type checking is expected to catch that and emit an
8992 error or warning.  Use of this flag instead of @option{-Wshadow=local} can
8993 possibly reduce the number of warnings triggered by intentional shadowing.
8994 Note that this also means that shadowing @code{const char *i} by
8995 @code{char *i} does not emit a warning.
8997 This warning is also enabled by @option{-Wshadow=local}.
8999 @opindex Wlarger-than=
9000 @opindex Wlarger-than-@var{byte-size}
9001 @item -Wlarger-than=@var{byte-size}
9002 Warn whenever an object is defined whose size exceeds @var{byte-size}.
9003 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
9004 Warnings controlled by the option can be disabled either by specifying
9005 @var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
9007 Also warn for calls to bounded functions such as @code{memchr} or
9008 @code{strnlen} that specify a bound greater than the largest possible
9009 object, which is @samp{PTRDIFF_MAX} bytes by default.  These warnings
9010 can only be disabled by @option{-Wno-larger-than}.
9012 @opindex Wno-larger-than
9013 @item -Wno-larger-than
9014 Disable @option{-Wlarger-than=} warnings.  The option is equivalent
9015 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
9017 @opindex Wframe-larger-than=
9018 @opindex Wno-frame-larger-than
9019 @item -Wframe-larger-than=@var{byte-size}
9020 Warn if the size of a function frame exceeds @var{byte-size}.
9021 The computation done to determine the stack frame size is approximate
9022 and not conservative.
9023 The actual requirements may be somewhat greater than @var{byte-size}
9024 even if you do not get a warning.  In addition, any space allocated
9025 via @code{alloca}, variable-length arrays, or related constructs
9026 is not included by the compiler when determining
9027 whether or not to issue a warning.
9028 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
9029 Warnings controlled by the option can be disabled either by specifying
9030 @var{byte-size} of @samp{SIZE_MAX} or more or by
9031 @option{-Wno-frame-larger-than}.
9033 @opindex Wno-frame-larger-than
9034 @item -Wno-frame-larger-than
9035 Disable @option{-Wframe-larger-than=} warnings.  The option is equivalent
9036 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
9038 @opindex Wfree-nonheap-object
9039 @opindex Wno-free-nonheap-object
9040 @item -Wfree-nonheap-object
9041 Warn when attempting to deallocate an object that was either not allocated
9042 on the heap, or by using a pointer that was not returned from a prior call
9043 to the corresponding allocation function.  For example, because the call
9044 to @code{stpcpy} returns a pointer to the terminating nul character and
9045 not to the beginning of the object, the call to @code{free} below is
9046 diagnosed.
9048 @smallexample
9049 void f (char *p)
9051   p = stpcpy (p, "abc");
9052   // ...
9053   free (p);   // warning
9055 @end smallexample
9057 @option{-Wfree-nonheap-object} is included in @option{-Wall}.
9059 @opindex Wstack-usage
9060 @opindex Wno-stack-usage
9061 @item -Wstack-usage=@var{byte-size}
9062 Warn if the stack usage of a function might exceed @var{byte-size}.
9063 The computation done to determine the stack usage is conservative.
9064 Any space allocated via @code{alloca}, variable-length arrays, or related
9065 constructs is included by the compiler when determining whether or not to
9066 issue a warning.
9068 The message is in keeping with the output of @option{-fstack-usage}.
9070 @itemize
9071 @item
9072 If the stack usage is fully static but exceeds the specified amount, it's:
9074 @smallexample
9075   warning: stack usage is 1120 bytes
9076 @end smallexample
9077 @item
9078 If the stack usage is (partly) dynamic but bounded, it's:
9080 @smallexample
9081   warning: stack usage might be 1648 bytes
9082 @end smallexample
9083 @item
9084 If the stack usage is (partly) dynamic and not bounded, it's:
9086 @smallexample
9087   warning: stack usage might be unbounded
9088 @end smallexample
9089 @end itemize
9091 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
9092 Warnings controlled by the option can be disabled either by specifying
9093 @var{byte-size} of @samp{SIZE_MAX} or more or by
9094 @option{-Wno-stack-usage}.
9096 @opindex Wno-stack-usage
9097 @item -Wno-stack-usage
9098 Disable @option{-Wstack-usage=} warnings.  The option is equivalent
9099 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
9101 @opindex Wunsafe-loop-optimizations
9102 @opindex Wno-unsafe-loop-optimizations
9103 @item -Wunsafe-loop-optimizations
9104 Warn if the loop cannot be optimized because the compiler cannot
9105 assume anything on the bounds of the loop indices.  With
9106 @option{-funsafe-loop-optimizations} warn if the compiler makes
9107 such assumptions.
9109 @opindex Wno-pedantic-ms-format
9110 @opindex Wpedantic-ms-format
9111 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
9112 When used in combination with @option{-Wformat}
9113 and @option{-pedantic} without GNU extensions, this option
9114 disables the warnings about non-ISO @code{printf} / @code{scanf} format
9115 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
9116 which depend on the MS runtime.
9118 @opindex Wpointer-arith
9119 @opindex Wno-pointer-arith
9120 @item -Wpointer-arith
9121 Warn about anything that depends on the ``size of'' a function type or
9122 of @code{void}.  GNU C assigns these types a size of 1, for
9123 convenience in calculations with @code{void *} pointers and pointers
9124 to functions.  In C++, warn also when an arithmetic operation involves
9125 @code{NULL}.  This warning is also enabled by @option{-Wpedantic}.
9127 This warning is upgraded to an error by @option{-pedantic-errors}.
9129 @opindex Wpointer-compare
9130 @opindex Wno-pointer-compare
9131 @item -Wno-pointer-compare
9132 Do not warn if a pointer is compared with a zero character constant.
9133 This usually
9134 means that the pointer was meant to be dereferenced.  For example:
9136 @smallexample
9137 const char *p = foo ();
9138 if (p == '\0')
9139   return 42;
9140 @end smallexample
9142 Note that the code above is invalid in C++11.
9144 This warning is enabled by default.
9146 @opindex Wtsan
9147 @opindex Wno-tsan
9148 @item -Wno-tsan
9150 Disable warnings about unsupported features in ThreadSanitizer.
9152 ThreadSanitizer does not support @code{std::atomic_thread_fence} and
9153 can report false positives.
9155 @opindex Wtype-limits
9156 @opindex Wno-type-limits
9157 @item -Wtype-limits
9158 Warn if a comparison is always true or always false due to the limited
9159 range of the data type, but do not warn for constant expressions.  For
9160 example, warn if an unsigned variable is compared against zero with
9161 @code{<} or @code{>=}.  This warning is also enabled by
9162 @option{-Wextra}.
9164 @opindex Wabsolute-value
9165 @opindex Wno-absolute-value
9166 @item -Wabsolute-value @r{(C and Objective-C only)}
9167 Warn for calls to standard functions that compute the absolute value
9168 of an argument when a more appropriate standard function is available.
9169 For example, calling @code{abs(3.14)} triggers the warning because the
9170 appropriate function to call to compute the absolute value of a double
9171 argument is @code{fabs}.  The option also triggers warnings when the
9172 argument in a call to such a function has an unsigned type.  This
9173 warning can be suppressed with an explicit type cast and it is also
9174 enabled by @option{-Wextra}.
9176 @include cppwarnopts.texi
9178 @opindex Wbad-function-cast
9179 @opindex Wno-bad-function-cast
9180 @item -Wbad-function-cast @r{(C and Objective-C only)}
9181 Warn when a function call is cast to a non-matching type.
9182 For example, warn if a call to a function returning an integer type 
9183 is cast to a pointer type.
9185 @opindex Wc90-c99-compat
9186 @opindex Wno-c90-c99-compat
9187 @item -Wc90-c99-compat @r{(C and Objective-C only)}
9188 Warn about features not present in ISO C90, but present in ISO C99.
9189 For instance, warn about use of variable length arrays, @code{long long}
9190 type, @code{bool} type, compound literals, designated initializers, and so
9191 on.  This option is independent of the standards mode.  Warnings are disabled
9192 in the expression that follows @code{__extension__}.
9194 @opindex Wc99-c11-compat
9195 @opindex Wno-c99-c11-compat
9196 @item -Wc99-c11-compat @r{(C and Objective-C only)}
9197 Warn about features not present in ISO C99, but present in ISO C11.
9198 For instance, warn about use of anonymous structures and unions,
9199 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
9200 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
9201 and so on.  This option is independent of the standards mode.  Warnings are
9202 disabled in the expression that follows @code{__extension__}.
9204 @opindex Wc11-c23-compat
9205 @opindex Wno-c11-c23-compat
9206 @item -Wc11-c23-compat @r{(C and Objective-C only)}
9207 @itemx -Wc11-c2x-compat @r{(C and Objective-C only)}
9208 Warn about features not present in ISO C11, but present in ISO C23.
9209 For instance, warn about omitting the string in @code{_Static_assert},
9210 use of @samp{[[]]} syntax for attributes, use of decimal
9211 floating-point types, and so on.  This option is independent of the
9212 standards mode.  Warnings are disabled in the expression that follows
9213 @code{__extension__}.  The name @option{-Wc11-c2x-compat} is
9214 deprecated.
9216 When not compiling in C23 mode, these warnings are upgraded to errors
9217 by @option{-pedantic-errors}.
9219 @opindex Wc++-compat
9220 @opindex Wno-c++-compat
9221 @item -Wc++-compat @r{(C and Objective-C only)}
9222 Warn about ISO C constructs that are outside of the common subset of
9223 ISO C and ISO C++, e.g.@: request for implicit conversion from
9224 @code{void *} to a pointer to non-@code{void} type.
9226 @opindex Wc++11-compat
9227 @opindex Wno-c++11-compat
9228 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
9229 Warn about C++ constructs whose meaning differs between ISO C++ 1998
9230 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
9231 in ISO C++ 2011.  This warning turns on @option{-Wnarrowing} and is
9232 enabled by @option{-Wall}.
9234 @opindex Wc++14-compat
9235 @opindex Wno-c++14-compat
9236 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
9237 Warn about C++ constructs whose meaning differs between ISO C++ 2011
9238 and ISO C++ 2014.  This warning is enabled by @option{-Wall}.
9240 @opindex Wc++17-compat
9241 @opindex Wno-c++17-compat
9242 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
9243 Warn about C++ constructs whose meaning differs between ISO C++ 2014
9244 and ISO C++ 2017.  This warning is enabled by @option{-Wall}.
9246 @opindex Wc++20-compat
9247 @opindex Wno-c++20-compat
9248 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
9249 Warn about C++ constructs whose meaning differs between ISO C++ 2017
9250 and ISO C++ 2020.  This warning is enabled by @option{-Wall}.
9252 @opindex Wc++11-extensions
9253 @opindex Wno-c++11-extensions
9254 @item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)}
9255 Do not warn about C++11 constructs in code being compiled using
9256 an older C++ standard.  Even without this option, some C++11 constructs
9257 will only be diagnosed if @option{-Wpedantic} is used.
9259 @opindex Wc++14-extensions
9260 @opindex Wno-c++14-extensions
9261 @item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)}
9262 Do not warn about C++14 constructs in code being compiled using
9263 an older C++ standard.  Even without this option, some C++14 constructs
9264 will only be diagnosed if @option{-Wpedantic} is used.
9266 @opindex Wc++17-extensions
9267 @opindex Wno-c++17-extensions
9268 @item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)}
9269 Do not warn about C++17 constructs in code being compiled using
9270 an older C++ standard.  Even without this option, some C++17 constructs
9271 will only be diagnosed if @option{-Wpedantic} is used.
9273 @opindex Wc++20-extensions
9274 @opindex Wno-c++20-extensions
9275 @item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)}
9276 Do not warn about C++20 constructs in code being compiled using
9277 an older C++ standard.  Even without this option, some C++20 constructs
9278 will only be diagnosed if @option{-Wpedantic} is used.
9280 @opindex Wc++23-extensions
9281 @opindex Wno-c++23-extensions
9282 @item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)}
9283 Do not warn about C++23 constructs in code being compiled using
9284 an older C++ standard.  Even without this option, some C++23 constructs
9285 will only be diagnosed if @option{-Wpedantic} is used.
9287 @opindex Wc++26-extensions
9288 @opindex Wno-c++26-extensions
9289 @item -Wno-c++26-extensions @r{(C++ and Objective-C++ only)}
9290 Do not warn about C++26 constructs in code being compiled using
9291 an older C++ standard.  Even without this option, some C++26 constructs
9292 will only be diagnosed if @option{-Wpedantic} is used.
9294 @opindex Wcast-qual
9295 @opindex Wno-cast-qual
9296 @item -Wcast-qual
9297 Warn whenever a pointer is cast so as to remove a type qualifier from
9298 the target type.  For example, warn if a @code{const char *} is cast
9299 to an ordinary @code{char *}.
9301 Also warn when making a cast that introduces a type qualifier in an
9302 unsafe way.  For example, casting @code{char **} to @code{const char **}
9303 is unsafe, as in this example:
9305 @smallexample
9306   /* p is char ** value.  */
9307   const char **q = (const char **) p;
9308   /* Assignment of readonly string to const char * is OK.  */
9309   *q = "string";
9310   /* Now char** pointer points to read-only memory.  */
9311   **p = 'b';
9312 @end smallexample
9314 @opindex Wcast-align
9315 @opindex Wno-cast-align
9316 @item -Wcast-align
9317 Warn whenever a pointer is cast such that the required alignment of the
9318 target is increased.  For example, warn if a @code{char *} is cast to
9319 an @code{int *} on machines where integers can only be accessed at
9320 two- or four-byte boundaries.
9322 @opindex Wcast-align=strict
9323 @item -Wcast-align=strict
9324 Warn whenever a pointer is cast such that the required alignment of the
9325 target is increased.  For example, warn if a @code{char *} is cast to
9326 an @code{int *} regardless of the target machine.
9328 @opindex Wcast-function-type
9329 @opindex Wno-cast-function-type
9330 @item -Wcast-function-type
9331 Warn when a function pointer is cast to an incompatible function pointer.
9332 In a cast involving function types with a variable argument list only
9333 the types of initial arguments that are provided are considered.
9334 Any parameter of pointer-type matches any other pointer-type.  Any benign
9335 differences in integral types are ignored, like @code{int} vs.@: @code{long}
9336 on ILP32 targets.  Likewise type qualifiers are ignored.  The function
9337 type @code{void (*) (void)} is special and matches everything, which can
9338 be used to suppress this warning.
9339 In a cast involving pointer to member types this warning warns whenever
9340 the type cast is changing the pointer to member type.
9341 This warning is enabled by @option{-Wextra}.
9343 @opindex Wwrite-strings
9344 @opindex Wno-write-strings
9345 @item -Wwrite-strings
9346 When compiling C, give string constants the type @code{const
9347 char[@var{length}]} so that copying the address of one into a
9348 non-@code{const} @code{char *} pointer produces a warning.  These
9349 warnings help you find at compile time code that can try to write
9350 into a string constant, but only if you have been very careful about
9351 using @code{const} in declarations and prototypes.  Otherwise, it is
9352 just a nuisance. This is why we did not make @option{-Wall} request
9353 these warnings.
9355 When compiling C++, warn about the deprecated conversion from string
9356 literals to @code{char *}.  This warning is enabled by default for C++
9357 programs.
9359 This warning is upgraded to an error by @option{-pedantic-errors} in
9360 C++11 mode or later.
9362 @opindex Wclobbered
9363 @opindex Wno-clobbered
9364 @item -Wclobbered
9365 Warn for variables that might be changed by @code{longjmp} or
9366 @code{vfork}.  This warning is also enabled by @option{-Wextra}.
9368 @opindex Wcomplain-wrong-lang
9369 @opindex Wno-complain-wrong-lang
9370 @item -Wno-complain-wrong-lang
9371 By default, language front ends complain when a command-line option is
9372 valid, but not applicable to that front end.
9373 This may be disabled with @option{-Wno-complain-wrong-lang},
9374 which is mostly useful when invoking a single compiler driver for
9375 multiple source files written in different languages, for example:
9377 @smallexample
9378 $ g++ -fno-rtti a.cc b.f90
9379 @end smallexample
9381 The driver @file{g++} invokes the C++ front end to compile @file{a.cc}
9382 and the Fortran front end to compile @file{b.f90}.
9383 The latter front end diagnoses
9384 @samp{f951: Warning: command-line option '-fno-rtti' is valid for C++/D/ObjC++ but not for Fortran},
9385 which may be disabled with @option{-Wno-complain-wrong-lang}.
9387 @opindex Wcompare-distinct-pointer-types
9388 @item -Wcompare-distinct-pointer-types @r{(C and Objective-C only)}
9389 Warn if pointers of distinct types are compared without a cast.  This
9390 warning is enabled by default.
9392 @opindex Wconversion
9393 @opindex Wno-conversion
9394 @item -Wconversion
9395 Warn for implicit conversions that may alter a value. This includes
9396 conversions between real and integer, like @code{abs (x)} when
9397 @code{x} is @code{double}; conversions between signed and unsigned,
9398 like @code{unsigned ui = -1}; and conversions to smaller types, like
9399 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
9400 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
9401 changed by the conversion like in @code{abs (2.0)}.  Warnings about
9402 conversions between signed and unsigned integers can be disabled by
9403 using @option{-Wno-sign-conversion}.
9405 For C++, also warn for confusing overload resolution for user-defined
9406 conversions; and conversions that never use a type conversion
9407 operator: conversions to @code{void}, the same type, a base class or a
9408 reference to them. Warnings about conversions between signed and
9409 unsigned integers are disabled by default in C++ unless
9410 @option{-Wsign-conversion} is explicitly enabled.
9412 Warnings about conversion from arithmetic on a small type back to that
9413 type are only given with @option{-Warith-conversion}.
9415 @opindex Wdangling-else
9416 @opindex Wno-dangling-else
9417 @item -Wdangling-else
9418 Warn about constructions where there may be confusion to which
9419 @code{if} statement an @code{else} branch belongs.  Here is an example of
9420 such a case:
9422 @smallexample
9423 @group
9425   if (a)
9426     if (b)
9427       foo ();
9428   else
9429     bar ();
9431 @end group
9432 @end smallexample
9434 In C/C++, every @code{else} branch belongs to the innermost possible
9435 @code{if} statement, which in this example is @code{if (b)}.  This is
9436 often not what the programmer expected, as illustrated in the above
9437 example by indentation the programmer chose.  When there is the
9438 potential for this confusion, GCC issues a warning when this flag
9439 is specified.  To eliminate the warning, add explicit braces around
9440 the innermost @code{if} statement so there is no way the @code{else}
9441 can belong to the enclosing @code{if}.  The resulting code
9442 looks like this:
9444 @smallexample
9445 @group
9447   if (a)
9448     @{
9449       if (b)
9450         foo ();
9451       else
9452         bar ();
9453     @}
9455 @end group
9456 @end smallexample
9458 This warning is enabled by @option{-Wparentheses}.
9460 @opindex Wdangling-pointer
9461 @opindex Wno-dangling-pointer
9462 @item -Wdangling-pointer
9463 @itemx -Wdangling-pointer=@var{n}
9464 Warn about uses of pointers (or C++ references) to objects with automatic
9465 storage duration after their lifetime has ended.  This includes local
9466 variables declared in nested blocks, compound literals and other unnamed
9467 temporary objects.  In addition, warn about storing the address of such
9468 objects in escaped pointers.  The warning is enabled at all optimization
9469 levels but may yield different results with optimization than without.
9471 @table @gcctabopt
9472 @item -Wdangling-pointer=1
9473 At level 1, the warning diagnoses only unconditional uses of dangling pointers.
9475 @item -Wdangling-pointer=2
9476 At level 2, in addition to unconditional uses the warning also diagnoses
9477 conditional uses of dangling pointers.
9478 @end table
9480 The short form @option{-Wdangling-pointer} is equivalent to
9481 @option{-Wdangling-pointer=2}, while @option{-Wno-dangling-pointer} and
9482 @option{-Wdangling-pointer=0} have the same effect of disabling the warnings.
9483 @option{-Wdangling-pointer=2} is included in @option{-Wall}.
9485 This example triggers the warning at level 1; the address of the unnamed
9486 temporary is unconditionally referenced outside of its scope.
9488 @smallexample
9489 char f (char c1, char c2, char c3)
9491   char *p;
9492   @{
9493     p = (char[]) @{ c1, c2, c3 @};
9494   @}
9495   // warning: using dangling pointer 'p' to an unnamed temporary
9496   return *p;
9498 @end smallexample
9500 In the following function the store of the address of the local variable
9501 @code{x} in the escaped pointer @code{*p} triggers the warning at
9502 level 1.
9504 @smallexample
9505 void g (int **p)
9507   int x = 7;
9508   // warning: storing the address of local variable 'x' in '*p'
9509   *p = &x;
9511 @end smallexample
9513 In this example, the array @var{a} is out of
9514 scope when the pointer @var{s} is used.  Since the code that sets @code{s}
9515 is conditional, the warning triggers at level 2.
9517 @smallexample
9518 extern void frob (const char *);
9519 void h (char *s)
9521   if (!s)
9522     @{
9523       char a[12] = "tmpname";
9524       s = a;
9525     @}
9526   // warning: dangling pointer 's' to 'a' may be used
9527   frob (s);
9529 @end smallexample
9531 @opindex Wdate-time
9532 @opindex Wno-date-time
9533 @item -Wdate-time
9534 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
9535 are encountered as they might prevent bit-wise-identical reproducible
9536 compilations.
9538 @opindex Wempty-body
9539 @opindex Wno-empty-body
9540 @item -Wempty-body
9541 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
9542 while} statement.  This warning is also enabled by @option{-Wextra}.
9544 @opindex Wendif-labels
9545 @opindex Wno-endif-labels
9546 @item -Wno-endif-labels
9547 Do not warn about stray tokens after @code{#else} and @code{#endif}.
9549 @opindex Wenum-compare
9550 @opindex Wno-enum-compare
9551 @item -Wenum-compare
9552 Warn about a comparison between values of different enumerated types.
9553 In C++ enumerated type mismatches in conditional expressions are also
9554 diagnosed and the warning is enabled by default.  In C this warning is 
9555 enabled by @option{-Wall}.
9557 @opindex Wenum-conversion
9558 @opindex Wno-enum-conversion
9559 @item -Wenum-conversion
9560 Warn when a value of enumerated type is implicitly converted to a 
9561 different enumerated type.  This warning is enabled by @option{-Wextra}
9562 in C@.
9564 @opindex Wenum-int-mismatch
9565 @opindex Wno-enum-int-mismatch
9566 @item -Wenum-int-mismatch @r{(C and Objective-C only)}
9567 Warn about mismatches between an enumerated type and an integer type in
9568 declarations.  For example:
9570 @smallexample
9571 enum E @{ l = -1, z = 0, g = 1 @};
9572 int foo(void);
9573 enum E foo(void);
9574 @end smallexample
9576 In C, an enumerated type is compatible with @code{char}, a signed
9577 integer type, or an unsigned integer type.  However, since the choice
9578 of the underlying type of an enumerated type is implementation-defined,
9579 such mismatches may cause portability issues.  In C++, such mismatches
9580 are an error.  In C, this warning is enabled by @option{-Wall} and
9581 @option{-Wc++-compat}.
9583 @opindex Wjump-misses-init
9584 @opindex Wno-jump-misses-init
9585 @item -Wjump-misses-init @r{(C, Objective-C only)}
9586 Warn if a @code{goto} statement or a @code{switch} statement jumps
9587 forward across the initialization of a variable, or jumps backward to a
9588 label after the variable has been initialized.  This only warns about
9589 variables that are initialized when they are declared.  This warning is
9590 only supported for C and Objective-C; in C++ this sort of branch is an
9591 error in any case.
9593 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
9594 can be disabled with the @option{-Wno-jump-misses-init} option.
9596 @opindex Wsign-compare
9597 @opindex Wno-sign-compare
9598 @cindex warning for comparison of signed and unsigned values
9599 @cindex comparison of signed and unsigned values, warning
9600 @cindex signed and unsigned values, comparison warning
9601 @item -Wsign-compare
9602 Warn when a comparison between signed and unsigned values could produce
9603 an incorrect result when the signed value is converted to unsigned.
9604 In C++, this warning is also enabled by @option{-Wall}.  In C, it is
9605 also enabled by @option{-Wextra}.
9607 @opindex Wsign-conversion
9608 @opindex Wno-sign-conversion
9609 @item -Wsign-conversion
9610 Warn for implicit conversions that may change the sign of an integer
9611 value, like assigning a signed integer expression to an unsigned
9612 integer variable. An explicit cast silences the warning. In C, this
9613 option is enabled also by @option{-Wconversion}.
9615 @opindex Wflex-array-member-not-at-end
9616 @opindex Wno-flex-array-member-not-at-end
9617 @item -Wflex-array-member-not-at-end @r{(C and C++ only)}
9618 Warn when a structure containing a C99 flexible array member as the last
9619 field is not at the end of another structure.
9620 This warning warns e.g. about
9622 @smallexample
9623 struct flex  @{ int length; char data[]; @};
9624 struct mid_flex @{ int m; struct flex flex_data; int n; @};
9625 @end smallexample
9627 @opindex Wfloat-conversion
9628 @opindex Wno-float-conversion
9629 @item -Wfloat-conversion
9630 Warn for implicit conversions that reduce the precision of a real value.
9631 This includes conversions from real to integer, and from higher precision
9632 real to lower precision real values.  This option is also enabled by
9633 @option{-Wconversion}.
9635 @opindex Wno-scalar-storage-order
9636 @opindex Wscalar-storage-order
9637 @item -Wno-scalar-storage-order
9638 Do not warn on suspicious constructs involving reverse scalar storage order.
9640 @opindex Wsizeof-array-div
9641 @opindex Wno-sizeof-array-div
9642 @item -Wsizeof-array-div
9643 Warn about divisions of two sizeof operators when the first one is applied
9644 to an array and the divisor does not equal the size of the array element.
9645 In such a case, the computation will not yield the number of elements in the
9646 array, which is likely what the user intended.  This warning warns e.g. about
9647 @smallexample
9648 int fn ()
9650   int arr[10];
9651   return sizeof (arr) / sizeof (short);
9653 @end smallexample
9655 This warning is enabled by @option{-Wall}.
9657 @opindex Wsizeof-pointer-div
9658 @opindex Wno-sizeof-pointer-div
9659 @item -Wsizeof-pointer-div
9660 Warn for suspicious divisions of two sizeof expressions that divide
9661 the pointer size by the element size, which is the usual way to compute
9662 the array size but won't work out correctly with pointers.  This warning
9663 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
9664 not an array, but a pointer.  This warning is enabled by @option{-Wall}.
9666 @opindex Wsizeof-pointer-memaccess
9667 @opindex Wno-sizeof-pointer-memaccess
9668 @item -Wsizeof-pointer-memaccess
9669 Warn for suspicious length parameters to certain string and memory built-in
9670 functions if the argument uses @code{sizeof}.  This warning triggers for
9671 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
9672 an array, but a pointer, and suggests a possible fix, or about
9673 @code{memcpy (&foo, ptr, sizeof (&foo));}.  @option{-Wsizeof-pointer-memaccess}
9674 also warns about calls to bounded string copy functions like @code{strncat}
9675 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
9676 the source array.  For example, in the following function the call to
9677 @code{strncat} specifies the size of the source string as the bound.  That
9678 is almost certainly a mistake and so the call is diagnosed.
9679 @smallexample
9680 void make_file (const char *name)
9682   char path[PATH_MAX];
9683   strncpy (path, name, sizeof path - 1);
9684   strncat (path, ".text", sizeof ".text");
9685   @dots{}
9687 @end smallexample
9689 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
9691 @opindex Wsizeof-array-argument
9692 @opindex Wno-sizeof-array-argument
9693 @item -Wno-sizeof-array-argument
9694 Do not warn when the @code{sizeof} operator is applied to a parameter that is
9695 declared as an array in a function definition.  This warning is enabled by
9696 default for C and C++ programs.
9698 @opindex Wmemset-elt-size
9699 @opindex Wno-memset-elt-size
9700 @item -Wmemset-elt-size
9701 Warn for suspicious calls to the @code{memset} built-in function, if the
9702 first argument references an array, and the third argument is a number
9703 equal to the number of elements, but not equal to the size of the array
9704 in memory.  This indicates that the user has omitted a multiplication by
9705 the element size.  This warning is enabled by @option{-Wall}.
9707 @opindex Wmemset-transposed-args
9708 @opindex Wno-memset-transposed-args
9709 @item -Wmemset-transposed-args
9710 Warn for suspicious calls to the @code{memset} built-in function where
9711 the second argument is not zero and the third argument is zero.  For
9712 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
9713 @code{memset (buf, 0, sizeof buf)} was meant instead.  The diagnostic
9714 is only emitted if the third argument is a literal zero.  Otherwise, if
9715 it is an expression that is folded to zero, or a cast of zero to some
9716 type, it is far less likely that the arguments have been mistakenly
9717 transposed and no warning is emitted.  This warning is enabled
9718 by @option{-Wall}.
9720 @opindex Waddress
9721 @opindex Wno-address
9722 @item -Waddress
9723 Warn about suspicious uses of address expressions. These include comparing
9724 the address of a function or a declared object to the null pointer constant
9725 such as in
9726 @smallexample
9727 void f (void);
9728 void g (void)
9730   if (!f)   // warning: expression evaluates to false
9731     abort ();
9733 @end smallexample
9734 comparisons of a pointer to a string literal, such as in
9735 @smallexample
9736 void f (const char *x)
9738   if (x == "abc")   // warning: expression evaluates to false
9739     puts ("equal");
9741 @end smallexample
9742 and tests of the results of pointer addition or subtraction for equality
9743 to null, such as in
9744 @smallexample
9745 void f (const int *p, int i)
9747   return p + i == NULL;
9749 @end smallexample
9750 Such uses typically indicate a programmer error: the address of most
9751 functions and objects necessarily evaluates to true (the exception are
9752 weak symbols), so their use in a conditional might indicate missing
9753 parentheses in a function call or a missing dereference in an array
9754 expression.  The subset of the warning for object pointers can be
9755 suppressed by casting the pointer operand to an integer type such
9756 as @code{intptr_t} or @code{uintptr_t}.
9757 Comparisons against string literals result in unspecified behavior
9758 and are not portable, and suggest the intent was to call @code{strcmp}.
9759 The warning is suppressed if the suspicious expression is the result
9760 of macro expansion.
9761 @option{-Waddress} warning is enabled by @option{-Wall}.
9763 @opindex Waddress-of-packed-member
9764 @opindex Wno-address-of-packed-member
9765 @item -Wno-address-of-packed-member
9766 Do not warn when the address of packed member of struct or union is taken,
9767 which usually results in an unaligned pointer value.  This is
9768 enabled by default.
9770 @opindex Wlogical-op
9771 @opindex Wno-logical-op
9772 @item -Wlogical-op
9773 Warn about suspicious uses of logical operators in expressions.
9774 This includes using logical operators in contexts where a
9775 bit-wise operator is likely to be expected.  Also warns when
9776 the operands of a logical operator are the same:
9777 @smallexample
9778 extern int a;
9779 if (a < 0 && a < 0) @{ @dots{} @}
9780 @end smallexample
9782 @opindex Wlogical-not-parentheses
9783 @opindex Wno-logical-not-parentheses
9784 @item -Wlogical-not-parentheses
9785 Warn about logical not used on the left hand side operand of a comparison.
9786 This option does not warn if the right operand is considered to be a boolean
9787 expression.  Its purpose is to detect suspicious code like the following:
9788 @smallexample
9789 int a;
9790 @dots{}
9791 if (!a > 1) @{ @dots{} @}
9792 @end smallexample
9794 It is possible to suppress the warning by wrapping the LHS into
9795 parentheses:
9796 @smallexample
9797 if ((!a) > 1) @{ @dots{} @}
9798 @end smallexample
9800 This warning is enabled by @option{-Wall}.
9802 @opindex Waggregate-return
9803 @opindex Wno-aggregate-return
9804 @item -Waggregate-return
9805 Warn if any functions that return structures or unions are defined or
9806 called.  (In languages where you can return an array, this also elicits
9807 a warning.)
9809 @opindex Wno-aggressive-loop-optimizations
9810 @opindex Waggressive-loop-optimizations
9811 @item -Wno-aggressive-loop-optimizations
9812 Warn if in a loop with constant number of iterations the compiler detects
9813 undefined behavior in some statement during one or more of the iterations.
9815 @opindex Wno-attributes
9816 @opindex Wattributes
9817 @item -Wno-attributes
9818 Do not warn if an unexpected @code{__attribute__} is used, such as
9819 unrecognized attributes, function attributes applied to variables,
9820 etc.  This does not stop errors for incorrect use of supported
9821 attributes.
9823 Warnings about ill-formed uses of standard attributes are upgraded to
9824 errors by @option{-pedantic-errors}.
9826 Additionally, using @option{-Wno-attributes=}, it is possible to suppress
9827 warnings about unknown scoped attributes (in C++11 and C23).  For example,
9828 @option{-Wno-attributes=vendor::attr} disables warning about the following
9829 declaration:
9831 @smallexample
9832 [[vendor::attr]] void f();
9833 @end smallexample
9835 It is also possible to disable warning about all attributes in a namespace
9836 using @option{-Wno-attributes=vendor::} which prevents warning about both
9837 of these declarations:
9839 @smallexample
9840 [[vendor::safe]] void f();
9841 [[vendor::unsafe]] void f2();
9842 @end smallexample
9844 Note that @option{-Wno-attributes=} does not imply @option{-Wno-attributes}.
9846 @opindex Wno-builtin-declaration-mismatch
9847 @opindex Wbuiltin-declaration-mismatch
9848 @item -Wno-builtin-declaration-mismatch
9849 Warn if a built-in function is declared with an incompatible signature
9850 or as a non-function, or when a built-in function declared with a type
9851 that does not include a prototype is called with arguments whose promoted
9852 types do not match those expected by the function.  When @option{-Wextra}
9853 is specified, also warn when a built-in function that takes arguments is
9854 declared without a prototype.  The @option{-Wbuiltin-declaration-mismatch}
9855 warning is enabled by default.  To avoid the warning include the appropriate
9856 header to bring the prototypes of built-in functions into scope.
9858 For example, the call to @code{memset} below is diagnosed by the warning
9859 because the function expects a value of type @code{size_t} as its argument
9860 but the type of @code{32} is @code{int}.  With @option{-Wextra},
9861 the declaration of the function is diagnosed as well.
9862 @smallexample
9863 extern void* memset ();
9864 void f (void *d)
9866   memset (d, '\0', 32);
9868 @end smallexample
9870 @opindex Wno-builtin-macro-redefined
9871 @opindex Wbuiltin-macro-redefined
9872 @item -Wno-builtin-macro-redefined
9873 Do not warn if certain built-in macros are redefined.  This suppresses
9874 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
9875 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
9877 @opindex Wstrict-prototypes
9878 @opindex Wno-strict-prototypes
9879 @item -Wstrict-prototypes @r{(C and Objective-C only)}
9880 Warn if a function is declared or defined without specifying the
9881 argument types.  (An old-style function definition is permitted without
9882 a warning if preceded by a declaration that specifies the argument
9883 types.)
9885 @opindex Wold-style-declaration
9886 @opindex Wno-old-style-declaration
9887 @item -Wold-style-declaration @r{(C and Objective-C only)}
9888 Warn for obsolescent usages, according to the C Standard, in a
9889 declaration. For example, warn if storage-class specifiers like
9890 @code{static} are not the first things in a declaration.  This warning
9891 is also enabled by @option{-Wextra}.
9893 @opindex Wold-style-definition
9894 @opindex Wno-old-style-definition
9895 @item -Wold-style-definition @r{(C and Objective-C only)}
9896 Warn if an old-style function definition is used.  A warning is given
9897 even if there is a previous prototype.  A definition using @samp{()}
9898 is not considered an old-style definition in C23 mode, because it is
9899 equivalent to @samp{(void)} in that case, but is considered an
9900 old-style definition for older standards.
9902 @opindex Wmissing-parameter-type
9903 @opindex Wno-missing-parameter-type
9904 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
9905 A function parameter is declared without a type specifier in K&R-style
9906 functions:
9908 @smallexample
9909 void foo(bar) @{ @}
9910 @end smallexample
9912 This warning is also enabled by @option{-Wextra}.
9914 @opindex Wno-declaration-missing-parameter-type
9915 @opindex Wdeclaration-missing-parameter-type
9916 @item -Wno-declaration-missing-parameter-type @r{(C and Objective-C only)}
9917 Do not warn if a function declaration contains a parameter name without
9918 a type.  Such function declarations do not provide a function prototype
9919 and prevent most type checking in function calls.
9921 This warning is enabled by default.  In C99 and later dialects of C, it
9922 is treated as an error.  The error can be downgraded to a warning using
9923 @option{-fpermissive} (along with certain other errors), or for this
9924 error alone, with @option{-Wno-error=declaration-missing-parameter-type}.
9926 This warning is upgraded to an error by @option{-pedantic-errors}.
9928 @opindex Wmissing-prototypes
9929 @opindex Wno-missing-prototypes
9930 @item -Wmissing-prototypes @r{(C and Objective-C only)}
9931 Warn if a global function is defined without a previous prototype
9932 declaration.  This warning is issued even if the definition itself
9933 provides a prototype.  Use this option to detect global functions
9934 that do not have a matching prototype declaration in a header file.
9935 This option is not valid for C++ because all function declarations
9936 provide prototypes and a non-matching declaration declares an
9937 overload rather than conflict with an earlier declaration.
9938 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
9940 @opindex Wmissing-variable-declarations
9941 @opindex Wno-missing-variable-declarations
9942 @item -Wmissing-variable-declarations @r{(C and Objective-C only)}
9943 Warn if a global variable is defined without a previous declaration.
9944 Use this option to detect global variables that do not have a matching
9945 extern declaration in a header file.
9947 @opindex Wmissing-declarations
9948 @opindex Wno-missing-declarations
9949 @item -Wmissing-declarations
9950 Warn if a global function is defined without a previous declaration.
9951 Do so even if the definition itself provides a prototype.
9952 Use this option to detect global functions that are not declared in
9953 header files.  In C, no warnings are issued for functions with previous
9954 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
9955 missing prototypes.  In C++, no warnings are issued for function templates,
9956 or for inline functions, or for functions in anonymous namespaces.
9958 @opindex Wmissing-field-initializers
9959 @opindex Wno-missing-field-initializers
9960 @opindex W
9961 @opindex Wextra
9962 @opindex Wno-extra
9963 @item -Wmissing-field-initializers
9964 Warn if a structure's initializer has some fields missing.  For
9965 example, the following code causes such a warning, because
9966 @code{x.h} is implicitly zero:
9968 @smallexample
9969 struct s @{ int f, g, h; @};
9970 struct s x = @{ 3, 4 @};
9971 @end smallexample
9973 @c It's unclear if this behavior is desirable.  See PR39589 and PR96868.
9974 In C this option does not warn about designated initializers, so the
9975 following modification does not trigger a warning:
9977 @smallexample
9978 struct s @{ int f, g, h; @};
9979 struct s x = @{ .f = 3, .g = 4 @};
9980 @end smallexample
9982 In C this option does not warn about the universal zero initializer
9983 @samp{@{ 0 @}}:
9985 @smallexample
9986 struct s @{ int f, g, h; @};
9987 struct s x = @{ 0 @};
9988 @end smallexample
9990 Likewise, in C++ this option does not warn about the empty @{ @}
9991 initializer, for example:
9993 @smallexample
9994 struct s @{ int f, g, h; @};
9995 s x = @{ @};
9996 @end smallexample
9998 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
9999 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
10001 @opindex Wmissing-requires
10002 @opindex Wno-missing-requires
10003 @item -Wno-missing-requires
10005 By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement:
10007 @smallexample
10008 bool satisfied = requires @{ C<T> @};
10009 @end smallexample
10011 Here @samp{satisfied} will be true if @samp{C<T>} is a valid
10012 expression, which it is for all T.  Presumably the user meant to write
10014 @smallexample
10015 bool satisfied = requires @{ requires C<T> @};
10016 @end smallexample
10018 so @samp{satisfied} is only true if concept @samp{C} is satisfied for
10019 type @samp{T}.
10021 This warning can be disabled with @option{-Wno-missing-requires}.
10023 @opindex Wmissing-template-keyword
10024 @opindex Wno-missing-template-keyword
10025 @item -Wno-missing-template-keyword
10027 The member access tokens ., -> and :: must be followed by the @code{template}
10028 keyword if the parent object is dependent and the member being named is a
10029 template.
10031 @smallexample
10032 template <class X>
10033 void DoStuff (X x)
10035   x.template DoSomeOtherStuff<X>(); // Good.
10036   x.DoMoreStuff<X>(); // Warning, x is dependent.
10038 @end smallexample
10040 In rare cases it is possible to get false positives. To silence this, wrap
10041 the expression in parentheses. For example, the following is treated as a
10042 template, even where m and N are integers:
10044 @smallexample
10045 void NotATemplate (my_class t)
10047   int N = 5;
10049   bool test = t.m < N > (0); // Treated as a template.
10050   test = (t.m < N) > (0); // Same meaning, but not treated as a template.
10052 @end smallexample
10054 This warning can be disabled with @option{-Wno-missing-template-keyword}.
10056 @opindex Wno-multichar
10057 @opindex Wmultichar
10058 @item -Wno-multichar
10059 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
10060 Usually they indicate a typo in the user's code, as they have
10061 implementation-defined values, and should not be used in portable code.
10063 @opindex Wnormalized=
10064 @opindex Wnormalized
10065 @opindex Wno-normalized
10066 @cindex NFC
10067 @cindex NFKC
10068 @cindex character set, input normalization
10069 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
10070 In ISO C and ISO C++, two identifiers are different if they are
10071 different sequences of characters.  However, sometimes when characters
10072 outside the basic ASCII character set are used, you can have two
10073 different character sequences that look the same.  To avoid confusion,
10074 the ISO 10646 standard sets out some @dfn{normalization rules} which
10075 when applied ensure that two sequences that look the same are turned into
10076 the same sequence.  GCC can warn you if you are using identifiers that
10077 have not been normalized; this option controls that warning.
10079 There are four levels of warning supported by GCC@.  The default is
10080 @option{-Wnormalized=nfc}, which warns about any identifier that is
10081 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
10082 recommended form for most uses.  It is equivalent to
10083 @option{-Wnormalized}.
10085 Unfortunately, there are some characters allowed in identifiers by
10086 ISO C and ISO C++ that, when turned into NFC, are not allowed in 
10087 identifiers.  That is, there's no way to use these symbols in portable
10088 ISO C or C++ and have all your identifiers in NFC@.
10089 @option{-Wnormalized=id} suppresses the warning for these characters.
10090 It is hoped that future versions of the standards involved will correct
10091 this, which is why this option is not the default.
10093 You can switch the warning off for all characters by writing
10094 @option{-Wnormalized=none} or @option{-Wno-normalized}.  You should
10095 only do this if you are using some other normalization scheme (like
10096 ``D''), because otherwise you can easily create bugs that are
10097 literally impossible to see.
10099 Some characters in ISO 10646 have distinct meanings but look identical
10100 in some fonts or display methodologies, especially once formatting has
10101 been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
10102 LETTER N'', displays just like a regular @code{n} that has been
10103 placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
10104 normalization scheme to convert all these into a standard form as
10105 well, and GCC warns if your code is not in NFKC if you use
10106 @option{-Wnormalized=nfkc}.  This warning is comparable to warning
10107 about every identifier that contains the letter O because it might be
10108 confused with the digit 0, and so is not the default, but may be
10109 useful as a local coding convention if the programming environment 
10110 cannot be fixed to display these characters distinctly.
10112 @opindex Wno-attribute-warning
10113 @opindex Wattribute-warning
10114 @item -Wno-attribute-warning
10115 Do not warn about usage of functions (@pxref{Function Attributes})
10116 declared with @code{warning} attribute.  By default, this warning is
10117 enabled.  @option{-Wno-attribute-warning} can be used to disable the
10118 warning or @option{-Wno-error=attribute-warning} can be used to
10119 disable the error when compiled with @option{-Werror} flag.
10121 @opindex Wno-deprecated
10122 @opindex Wdeprecated
10123 @item -Wno-deprecated
10124 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
10126 @opindex Wno-deprecated-declarations
10127 @opindex Wdeprecated-declarations
10128 @item -Wno-deprecated-declarations
10129 Do not warn about uses of functions (@pxref{Function Attributes}),
10130 variables (@pxref{Variable Attributes}), and types (@pxref{Type
10131 Attributes}) marked as deprecated by using the @code{deprecated}
10132 attribute.
10134 @opindex Wno-overflow
10135 @opindex Woverflow
10136 @item -Wno-overflow
10137 Do not warn about compile-time overflow in constant expressions.
10139 @opindex Wno-odr
10140 @opindex Wodr
10141 @item -Wno-odr
10142 Warn about One Definition Rule violations during link-time optimization.
10143 Enabled by default.
10145 @opindex Wopenacc-parallelism
10146 @opindex Wno-openacc-parallelism
10147 @cindex OpenACC accelerator programming
10148 @item -Wopenacc-parallelism
10149 Warn about potentially suboptimal choices related to OpenACC parallelism.
10151 @opindex Wopenmp
10152 @opindex Wno-openmp
10153 @item -Wno-openmp
10154 Warn about suspicious OpenMP code.
10156 @opindex Wopenmp-simd
10157 @opindex Wno-openmp-simd
10158 @item -Wopenmp-simd
10159 Warn if the vectorizer cost model overrides the OpenMP
10160 simd directive set by user.  The @option{-fsimd-cost-model=unlimited}
10161 option can be used to relax the cost model.
10163 @opindex Woverride-init
10164 @opindex Wno-override-init
10165 @opindex W
10166 @opindex Wextra
10167 @opindex Wno-extra
10168 @item -Woverride-init @r{(C and Objective-C only)}
10169 Warn if an initialized field without side effects is overridden when
10170 using designated initializers (@pxref{Designated Inits, , Designated
10171 Initializers}).
10173 This warning is included in @option{-Wextra}.  To get other
10174 @option{-Wextra} warnings without this one, use @option{-Wextra
10175 -Wno-override-init}.
10177 @opindex Woverride-init-side-effects
10178 @opindex Wno-override-init-side-effects
10179 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
10180 Do not warn if an initialized field with side effects is overridden when
10181 using designated initializers (@pxref{Designated Inits, , Designated
10182 Initializers}).  This warning is enabled by default.
10184 @opindex Wpacked
10185 @opindex Wno-packed
10186 @item -Wpacked
10187 Warn if a structure is given the packed attribute, but the packed
10188 attribute has no effect on the layout or size of the structure.
10189 Such structures may be mis-aligned for little benefit.  For
10190 instance, in this code, the variable @code{f.x} in @code{struct bar}
10191 is misaligned even though @code{struct bar} does not itself
10192 have the packed attribute:
10194 @smallexample
10195 @group
10196 struct foo @{
10197   int x;
10198   char a, b, c, d;
10199 @} __attribute__((packed));
10200 struct bar @{
10201   char z;
10202   struct foo f;
10204 @end group
10205 @end smallexample
10207 @opindex Wpacked-bitfield-compat
10208 @opindex Wno-packed-bitfield-compat
10209 @item -Wnopacked-bitfield-compat
10210 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
10211 on bit-fields of type @code{char}.  This was fixed in GCC 4.4 but
10212 the change can lead to differences in the structure layout.  GCC
10213 informs you when the offset of such a field has changed in GCC 4.4.
10214 For example there is no longer a 4-bit padding between field @code{a}
10215 and @code{b} in this structure:
10217 @smallexample
10218 struct foo
10220   char a:4;
10221   char b:8;
10222 @} __attribute__ ((packed));
10223 @end smallexample
10225 This warning is enabled by default.  Use
10226 @option{-Wno-packed-bitfield-compat} to disable this warning.
10228 @opindex Wpacked-not-aligned
10229 @opindex Wno-packed-not-aligned
10230 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
10231 Warn if a structure field with explicitly specified alignment in a
10232 packed struct or union is misaligned.  For example, a warning will
10233 be issued on @code{struct S}, like, @code{warning: alignment 1 of
10234 'struct S' is less than 8}, in this code:
10236 @smallexample
10237 @group
10238 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
10239 struct __attribute__ ((packed)) S @{
10240   struct S8 s8;
10242 @end group
10243 @end smallexample
10245 This warning is enabled by @option{-Wall}.
10247 @opindex Wpadded
10248 @opindex Wno-padded
10249 @item -Wpadded
10250 Warn if padding is included in a structure, either to align an element
10251 of the structure or to align the whole structure.  Sometimes when this
10252 happens it is possible to rearrange the fields of the structure to
10253 reduce the padding and so make the structure smaller.
10255 @opindex Wredundant-decls
10256 @opindex Wno-redundant-decls
10257 @item -Wredundant-decls
10258 Warn if anything is declared more than once in the same scope, even in
10259 cases where multiple declaration is valid and changes nothing.
10261 @opindex Wrestrict
10262 @opindex Wno-restrict
10263 @item -Wrestrict
10264 Warn when an object referenced by a @code{restrict}-qualified parameter
10265 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
10266 argument, or when copies between such objects overlap.  For example,
10267 the call to the @code{strcpy} function below attempts to truncate the string
10268 by replacing its initial characters with the last four.  However, because
10269 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
10270 the call is diagnosed.
10272 @smallexample
10273 void foo (void)
10275   char a[] = "abcd1234";
10276   strcpy (a, a + 4);
10277   @dots{}
10279 @end smallexample
10280 The @option{-Wrestrict} option detects some instances of simple overlap
10281 even without optimization but works best at @option{-O2} and above.  It
10282 is included in @option{-Wall}.
10284 @opindex Wnested-externs
10285 @opindex Wno-nested-externs
10286 @item -Wnested-externs @r{(C and Objective-C only)}
10287 Warn if an @code{extern} declaration is encountered within a function.
10289 @opindex Winline
10290 @opindex Wno-inline
10291 @item -Winline
10292 Warn if a function that is declared as inline cannot be inlined.
10293 Even with this option, the compiler does not warn about failures to
10294 inline functions declared in system headers.
10296 The compiler uses a variety of heuristics to determine whether or not
10297 to inline a function.  For example, the compiler takes into account
10298 the size of the function being inlined and the amount of inlining
10299 that has already been done in the current function.  Therefore,
10300 seemingly insignificant changes in the source program can cause the
10301 warnings produced by @option{-Winline} to appear or disappear.
10303 @opindex Winterference-size
10304 @item -Winterference-size
10305 Warn about use of C++17 @code{std::hardware_destructive_interference_size}
10306 without specifying its value with @option{--param destructive-interference-size}.
10307 Also warn about questionable values for that option.
10309 This variable is intended to be used for controlling class layout, to
10310 avoid false sharing in concurrent code:
10312 @smallexample
10313 struct independent_fields @{
10314   alignas(std::hardware_destructive_interference_size)
10315     std::atomic<int> one;
10316   alignas(std::hardware_destructive_interference_size)
10317     std::atomic<int> two;
10319 @end smallexample
10321 Here @samp{one} and @samp{two} are intended to be far enough apart
10322 that stores to one won't require accesses to the other to reload the
10323 cache line.
10325 By default, @option{--param destructive-interference-size} and
10326 @option{--param constructive-interference-size} are set based on the
10327 current @option{-mtune} option, typically to the L1 cache line size
10328 for the particular target CPU, sometimes to a range if tuning for a
10329 generic target.  So all translation units that depend on ABI
10330 compatibility for the use of these variables must be compiled with
10331 the same @option{-mtune} (or @option{-mcpu}).
10333 If ABI stability is important, such as if the use is in a header for a
10334 library, you should probably not use the hardware interference size
10335 variables at all.  Alternatively, you can force a particular value
10336 with @option{--param}.
10338 If you are confident that your use of the variable does not affect ABI
10339 outside a single build of your project, you can turn off the warning
10340 with @option{-Wno-interference-size}.
10342 @opindex Wint-in-bool-context
10343 @opindex Wno-int-in-bool-context
10344 @item -Wint-in-bool-context
10345 Warn for suspicious use of integer values where boolean values are expected,
10346 such as conditional expressions (?:) using non-boolean integer constants in
10347 boolean context, like @code{if (a <= b ? 2 : 3)}.  Or left shifting of signed
10348 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}.  Likewise
10349 for all kinds of multiplications regardless of the data type.
10350 This warning is enabled by @option{-Wall}.
10352 @opindex Wno-int-to-pointer-cast
10353 @opindex Wint-to-pointer-cast
10354 @item -Wno-int-to-pointer-cast
10355 Suppress warnings from casts to pointer type of an integer of a
10356 different size. In C++, casting to a pointer type of smaller size is
10357 an error. @option{Wint-to-pointer-cast} is enabled by default.
10360 @opindex Wno-pointer-to-int-cast
10361 @opindex Wpointer-to-int-cast
10362 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
10363 Suppress warnings from casts from a pointer to an integer type of a
10364 different size.
10366 @opindex Winvalid-pch
10367 @opindex Wno-invalid-pch
10368 @item -Winvalid-pch
10369 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
10370 the search path but cannot be used.
10372 @opindex Winvalid-utf8
10373 @opindex Wno-invalid-utf8
10374 @item -Winvalid-utf8
10375 Warn if an invalid UTF-8 character is found.
10376 This warning is on by default for C++23 if @option{-finput-charset=UTF-8}
10377 is used and turned into error with @option{-pedantic-errors}.
10379 @opindex Wunicode
10380 @opindex Wno-unicode
10381 @item -Wno-unicode
10382 Don't diagnose invalid forms of delimited or named escape sequences which are
10383 treated as separate tokens.  @option{Wunicode} is enabled by default.
10385 @opindex Wlong-long
10386 @opindex Wno-long-long
10387 @item -Wlong-long
10388 Warn if @code{long long} type is used.  This is enabled by either
10389 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
10390 modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
10392 This warning is upgraded to an error by @option{-pedantic-errors}.
10394 @opindex Wvariadic-macros
10395 @opindex Wno-variadic-macros
10396 @item -Wvariadic-macros
10397 Warn if variadic macros are used in ISO C90 mode, or if the GNU
10398 alternate syntax is used in ISO C99 mode.  This is enabled by either
10399 @option{-Wpedantic} or @option{-Wtraditional}.  To inhibit the warning
10400 messages, use @option{-Wno-variadic-macros}.
10402 @opindex Wvarargs
10403 @opindex Wno-varargs
10404 @item -Wno-varargs
10405 Do not warn upon questionable usage of the macros used to handle variable
10406 arguments like @code{va_start}.  These warnings are enabled by default.
10408 @opindex Wvector-operation-performance
10409 @opindex Wno-vector-operation-performance
10410 @item -Wvector-operation-performance
10411 Warn if vector operation is not implemented via SIMD capabilities of the
10412 architecture.  Mainly useful for the performance tuning.
10413 Vector operation can be implemented @code{piecewise}, which means that the
10414 scalar operation is performed on every vector element; 
10415 @code{in parallel}, which means that the vector operation is implemented
10416 using scalars of wider type, which normally is more performance efficient;
10417 and @code{as a single scalar}, which means that vector fits into a
10418 scalar type.
10420 @opindex Wvla
10421 @opindex Wno-vla
10422 @item -Wvla
10423 Warn if a variable-length array is used in the code.
10424 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
10425 the variable-length array.
10427 This warning is upgraded to an error by @option{-pedantic-errors}.
10429 @opindex Wvla-larger-than=
10430 @opindex Wno-vla-larger-than
10431 @item -Wvla-larger-than=@var{byte-size}
10432 If this option is used, the compiler warns for declarations of
10433 variable-length arrays whose size is either unbounded, or bounded
10434 by an argument that allows the array size to exceed @var{byte-size}
10435 bytes.  This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
10436 works, but with variable-length arrays.
10438 Note that GCC may optimize small variable-length arrays of a known
10439 value into plain arrays, so this warning may not get triggered for
10440 such arrays.
10442 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
10443 is typically only effective when @option{-ftree-vrp} is active (default
10444 for @option{-O2} and above).
10446 See also @option{-Walloca-larger-than=@var{byte-size}}.
10448 @opindex Wno-vla-larger-than
10449 @item -Wno-vla-larger-than
10450 Disable @option{-Wvla-larger-than=} warnings.  The option is equivalent
10451 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
10453 @opindex Wno-vla-parameter
10454 @item -Wvla-parameter
10455 Warn about redeclarations of functions involving arguments of Variable
10456 Length Array types of inconsistent kinds or forms, and enable the detection
10457 of out-of-bounds accesses to such parameters by warnings such as
10458 @option{-Warray-bounds}.
10460 If the first function declaration uses the VLA form the bound specified
10461 in the array is assumed to be the minimum number of elements expected to
10462 be provided in calls to the function and the maximum number of elements
10463 accessed by it.  Failing to provide arguments of sufficient size or
10464 accessing more than the maximum number of elements may be diagnosed.
10466 For example, the warning triggers for the following redeclarations because
10467 the first one allows an array of any size to be passed to @code{f} while
10468 the second one specifies that the array argument must have at least @code{n}
10469 elements.  In addition, calling @code{f} with the associated VLA bound
10470 parameter in excess of the actual VLA bound triggers a warning as well.
10472 @smallexample
10473 void f (int n, int[n]);
10474 // warning: argument 2 previously declared as a VLA
10475 void f (int, int[]);
10477 void g (int n)
10479     if (n > 4)
10480       return;
10481     int a[n];
10482     // warning: access to a by f may be out of bounds
10483     f (sizeof a, a);
10484   @dots{}
10487 @end smallexample
10489 @option{-Wvla-parameter} is included in @option{-Wall}.  The
10490 @option{-Warray-parameter} option triggers warnings for similar problems
10491 involving ordinary array arguments.
10493 @opindex Wvolatile-register-var
10494 @opindex Wno-volatile-register-var
10495 @item -Wvolatile-register-var
10496 Warn if a register variable is declared volatile.  The volatile
10497 modifier does not inhibit all optimizations that may eliminate reads
10498 and/or writes to register variables.  This warning is enabled by
10499 @option{-Wall}.
10501 @opindex Wxor-used-as-pow
10502 @opindex Wno-xor-used-as-pow
10503 @item -Wno-xor-used-as-pow @r{(C, C++, Objective-C and Objective-C++ only)}
10504 Disable warnings about uses of @code{^}, the exclusive or operator,
10505 where it appears the code meant exponentiation.
10506 Specifically, the warning occurs when the
10507 left-hand side is the decimal constant 2 or 10 and the right-hand side
10508 is also a decimal constant.
10510 In C and C++, @code{^} means exclusive or, whereas in some other languages
10511 (e.g. TeX and some versions of BASIC) it means exponentiation.
10513 This warning can be silenced by converting one of the operands to
10514 hexadecimal as well as by compiling with @option{-Wno-xor-used-as-pow}.
10516 @opindex Wdisabled-optimization
10517 @opindex Wno-disabled-optimization
10518 @item -Wdisabled-optimization
10519 Warn if a requested optimization pass is disabled.  This warning does
10520 not generally indicate that there is anything wrong with your code; it
10521 merely indicates that GCC's optimizers are unable to handle the code
10522 effectively.  Often, the problem is that your code is too big or too
10523 complex; GCC refuses to optimize programs when the optimization
10524 itself is likely to take inordinate amounts of time.
10526 @opindex Wpointer-sign
10527 @opindex Wno-pointer-sign
10528 @item -Wpointer-sign @r{(C and Objective-C only)}
10529 Warn for pointer argument passing or assignment with different signedness.
10530 This option is only supported for C and Objective-C@.  It is implied by
10531 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
10532 @option{-Wno-pointer-sign}.
10534 This warning is upgraded to an error by @option{-pedantic-errors}.
10536 @opindex Wstack-protector
10537 @opindex Wno-stack-protector
10538 @item -Wstack-protector
10539 This option is only active when @option{-fstack-protector} is active.  It
10540 warns about functions that are not protected against stack smashing.
10542 @opindex Woverlength-strings
10543 @opindex Wno-overlength-strings
10544 @item -Woverlength-strings
10545 Warn about string constants that are longer than the ``minimum
10546 maximum'' length specified in the C standard.  Modern compilers
10547 generally allow string constants that are much longer than the
10548 standard's minimum limit, but very portable programs should avoid
10549 using longer strings.
10551 The limit applies @emph{after} string constant concatenation, and does
10552 not count the trailing NUL@.  In C90, the limit was 509 characters; in
10553 C99, it was raised to 4095.  C++98 does not specify a normative
10554 minimum maximum, so we do not diagnose overlength strings in C++@.
10556 This option is implied by @option{-Wpedantic}, and can be disabled with
10557 @option{-Wno-overlength-strings}.
10559 @opindex Wunsuffixed-float-constants
10560 @opindex Wno-unsuffixed-float-constants
10561 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
10563 Issue a warning for any floating constant that does not have
10564 a suffix.  When used together with @option{-Wsystem-headers} it
10565 warns about such constants in system header files.  This can be useful
10566 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
10567 from the decimal floating-point extension to C99.
10569 @opindex Wlto-type-mismatch
10570 @opindex Wno-lto-type-mismatch
10571 @item -Wno-lto-type-mismatch
10573 During the link-time optimization, do not warn about type mismatches in
10574 global declarations from different compilation units.
10575 Requires @option{-flto} to be enabled.  Enabled by default.
10577 @opindex Wdesignated-init
10578 @opindex Wno-designated-init
10579 @item -Wno-designated-init @r{(C and Objective-C only)}
10580 Suppress warnings when a positional initializer is used to initialize
10581 a structure that has been marked with the @code{designated_init}
10582 attribute.
10584 @end table
10586 @node Static Analyzer Options
10587 @section Options That Control Static Analysis
10589 @table @gcctabopt
10590 @opindex analyzer
10591 @opindex fanalyzer
10592 @opindex fno-analyzer
10593 @item -fanalyzer
10594 This option enables an static analysis of program flow which looks
10595 for ``interesting'' interprocedural paths through the
10596 code, and issues warnings for problems found on them.
10598 This analysis is much more expensive than other GCC warnings.
10600 In technical terms, it performs coverage-guided symbolic execution of
10601 the code being compiled.  It is neither sound nor complete: it can
10602 have false positives and false negatives.  It is a bug-finding tool,
10603 rather than a tool for proving program correctness.
10605 The analyzer is only suitable for use on C code in this release.
10607 Enabling this option effectively enables the following warnings:
10609 @gccoptlist{
10610 -Wanalyzer-allocation-size
10611 -Wanalyzer-deref-before-check
10612 -Wanalyzer-double-fclose
10613 -Wanalyzer-double-free
10614 -Wanalyzer-exposure-through-output-file
10615 -Wanalyzer-exposure-through-uninit-copy
10616 -Wanalyzer-fd-access-mode-mismatch
10617 -Wanalyzer-fd-double-close
10618 -Wanalyzer-fd-leak
10619 -Wanalyzer-fd-phase-mismatch
10620 -Wanalyzer-fd-type-mismatch
10621 -Wanalyzer-fd-use-after-close
10622 -Wanalyzer-fd-use-without-check
10623 -Wanalyzer-file-leak
10624 -Wanalyzer-free-of-non-heap
10625 -Wanalyzer-imprecise-fp-arithmetic
10626 -Wanalyzer-infinite-loop
10627 -Wanalyzer-infinite-recursion
10628 -Wanalyzer-jump-through-null
10629 -Wanalyzer-malloc-leak
10630 -Wanalyzer-mismatching-deallocation
10631 -Wanalyzer-null-argument
10632 -Wanalyzer-null-dereference
10633 -Wanalyzer-out-of-bounds
10634 -Wanalyzer-overlapping-buffers
10635 -Wanalyzer-possible-null-argument
10636 -Wanalyzer-possible-null-dereference
10637 -Wanalyzer-putenv-of-auto-var
10638 -Wanalyzer-shift-count-negative
10639 -Wanalyzer-shift-count-overflow
10640 -Wanalyzer-stale-setjmp-buffer
10641 -Wanalyzer-tainted-allocation-size
10642 -Wanalyzer-tainted-array-index
10643 -Wanalyzer-tainted-assertion
10644 -Wanalyzer-tainted-divisor
10645 -Wanalyzer-tainted-offset
10646 -Wanalyzer-tainted-size
10647 -Wanalyzer-undefined-behavior-strtok
10648 -Wanalyzer-unsafe-call-within-signal-handler
10649 -Wanalyzer-use-after-free
10650 -Wanalyzer-use-of-pointer-in-stale-stack-frame
10651 -Wanalyzer-use-of-uninitialized-value
10652 -Wanalyzer-va-arg-type-mismatch
10653 -Wanalyzer-va-list-exhausted
10654 -Wanalyzer-va-list-leak
10655 -Wanalyzer-va-list-use-after-va-end
10656 -Wanalyzer-write-to-const
10657 -Wanalyzer-write-to-string-literal
10660 This option is only available if GCC was configured with analyzer
10661 support enabled.
10663 @opindex Wanalyzer-symbol-too-complex
10664 @opindex Wno-analyzer-symbol-too-complex
10665 @item -Wanalyzer-symbol-too-complex
10666 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
10667 to attempt to track the state of memory, but these can be defeated by
10668 sufficiently complicated code.
10670 By default, the analysis silently stops tracking values of expressions
10671 if they exceed the threshold defined by
10672 @option{--param analyzer-max-svalue-depth=@var{value}}, and falls back
10673 to an imprecise representation for such expressions.
10674 The @option{-Wanalyzer-symbol-too-complex} option warns if this occurs.
10676 @opindex Wanalyzer-too-complex
10677 @opindex Wno-analyzer-too-complex
10678 @item -Wanalyzer-too-complex
10679 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
10680 to attempt to explore the control flow and data flow in the program,
10681 but these can be defeated by sufficiently complicated code.
10683 By default, the analysis silently stops if the code is too
10684 complicated for the analyzer to fully explore and it reaches an internal
10685 limit.  The @option{-Wanalyzer-too-complex} option warns if this occurs.
10687 @opindex Wanalyzer-allocation-size
10688 @opindex Wno-analyzer-allocation-size
10689 @item -Wno-analyzer-allocation-size
10690 This warning requires @option{-fanalyzer}, which enables it;
10691 to disable it, use @option{-Wno-analyzer-allocation-size}.
10693 This diagnostic warns for paths through the code in which a pointer to
10694 a buffer is assigned to point at a buffer with a size that is not a
10695 multiple of @code{sizeof (*pointer)}.
10697 See @uref{https://cwe.mitre.org/data/definitions/131.html, CWE-131: Incorrect Calculation of Buffer Size}.
10699 @opindex Wanalyzer-deref-before-check
10700 @opindex Wno-analyzer-deref-before-check
10701 @item -Wno-analyzer-deref-before-check
10702 This warning requires @option{-fanalyzer}, which enables it; use
10703 @option{-Wno-analyzer-deref-before-check}
10704 to disable it.
10706 This diagnostic warns for paths through the code in which a pointer
10707 is checked for @code{NULL} *after* it has already been
10708 dereferenced, suggesting that the pointer could have been NULL.
10709 Such cases suggest that the check for NULL is either redundant,
10710 or that it needs to be moved to before the pointer is dereferenced.
10712 This diagnostic also considers values passed to a function argument
10713 marked with @code{__attribute__((nonnull))} as requiring a non-NULL
10714 value, and thus will complain if such values are checked for @code{NULL}
10715 after returning from such a function call.
10717 This diagnostic is unlikely to be reported when any level of optimization
10718 is enabled, as GCC's optimization logic will typically consider such
10719 checks for NULL as being redundant, and optimize them away before the
10720 analyzer "sees" them.  Hence optimization should be disabled when
10721 attempting to trigger this diagnostic.
10723 @opindex Wanalyzer-double-fclose
10724 @opindex Wno-analyzer-double-fclose
10725 @item -Wno-analyzer-double-fclose
10726 This warning requires @option{-fanalyzer}, which enables it; use
10727 @option{-Wno-analyzer-double-fclose} to disable it.
10729 This diagnostic warns for paths through the code in which a @code{FILE *}
10730 can have @code{fclose} called on it more than once.
10732 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10734 @opindex Wanalyzer-double-free
10735 @opindex Wno-analyzer-double-free
10736 @item -Wno-analyzer-double-free
10737 This warning requires @option{-fanalyzer}, which enables it; use
10738 @option{-Wno-analyzer-double-free} to disable it.
10740 This diagnostic warns for paths through the code in which a pointer
10741 can have a deallocator called on it more than once, either @code{free},
10742 or a deallocator referenced by attribute @code{malloc}.
10744 See @uref{https://cwe.mitre.org/data/definitions/415.html, CWE-415: Double Free}.
10746 @opindex Wanalyzer-exposure-through-output-file
10747 @opindex Wno-analyzer-exposure-through-output-file
10748 @item -Wno-analyzer-exposure-through-output-file
10749 This warning requires @option{-fanalyzer}, which enables it; use
10750 @option{-Wno-analyzer-exposure-through-output-file}
10751 to disable it.
10753 This diagnostic warns for paths through the code in which a
10754 security-sensitive value is written to an output file
10755 (such as writing a password to a log file).
10757 See @uref{https://cwe.mitre.org/data/definitions/532.html, CWE-532: Information Exposure Through Log Files}.
10759 @opindex Wanalyzer-exposure-through-uninit-copy
10760 @opindex Wno-analyzer-exposure-through-uninit-copy
10761 @item -Wanalyzer-exposure-through-uninit-copy
10762 This warning requires both @option{-fanalyzer} and the use of a plugin
10763 to specify a function that copies across a ``trust boundary''.  Use
10764 @option{-Wno-analyzer-exposure-through-uninit-copy} to disable it.
10766 This diagnostic warns for ``infoleaks'' - paths through the code in which
10767 uninitialized values are copied across a security boundary
10768 (such as code within an OS kernel that copies a partially-initialized
10769 struct on the stack to user space).
10771 See @uref{https://cwe.mitre.org/data/definitions/200.html, CWE-200: Exposure of Sensitive Information to an Unauthorized Actor}.
10773 @opindex Wanalyzer-fd-access-mode-mismatch
10774 @opindex Wno-analyzer-fd-access-mode-mismatch
10775 @item -Wno-analyzer-fd-access-mode-mismatch
10776 This warning requires @option{-fanalyzer}, which enables it; use
10777 @option{-Wno-analyzer-fd-access-mode-mismatch}
10778 to disable it.
10780 This diagnostic warns for paths through code in which a
10781 @code{read} on a write-only file descriptor is attempted, or vice versa.
10783 This diagnostic also warns for code paths in a which a function with attribute
10784 @code{fd_arg_read (N)} is called with a file descriptor opened with
10785 @code{O_WRONLY} at referenced argument @code{N} or a function with attribute
10786 @code{fd_arg_write (N)} is called with a file descriptor opened with
10787 @code{O_RDONLY} at referenced argument @var{N}.
10789 @opindex Wanalyzer-fd-double-close
10790 @opindex Wno-analyzer-fd-double-close
10791 @item -Wno-analyzer-fd-double-close
10792 This warning requires @option{-fanalyzer}, which enables it; use
10793 @option{-Wno-analyzer-fd-double-close}
10794 to disable it.
10796 This diagnostic warns for paths through code in which a
10797 file descriptor can be closed more than once.
10799 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10801 @opindex Wanalyzer-fd-leak
10802 @opindex Wno-analyzer-fd-leak
10803 @item -Wno-analyzer-fd-leak
10804 This warning requires @option{-fanalyzer}, which enables it; use
10805 @option{-Wno-analyzer-fd-leak}
10806 to disable it.
10808 This diagnostic warns for paths through code in which an
10809 open file descriptor is leaked.
10811 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10813 @opindex Wanalyzer-fd-phase-mismatch
10814 @opindex Wno-analyzer-fd-phase-mismatch
10815 @item -Wno-analyzer-fd-phase-mismatch
10816 This warning requires @option{-fanalyzer}, which enables it; use
10817 @option{-Wno-analyzer-fd-phase-mismatch}
10818 to disable it.
10820 This diagnostic warns for paths through code in which an operation is
10821 attempted in the wrong phase of a file descriptor's lifetime.
10822 For example, it will warn on attempts to call @code{accept} on a stream
10823 socket that has not yet had @code{listen} successfully called on it.
10825 See @uref{https://cwe.mitre.org/data/definitions/666.html, CWE-666: Operation on Resource in Wrong Phase of Lifetime}.
10827 @opindex Wanalyzer-fd-type-mismatch
10828 @opindex Wno-analyzer-fd-type-mismatch
10829 @item -Wno-analyzer-fd-type-mismatch
10830 This warning requires @option{-fanalyzer}, which enables it; use
10831 @option{-Wno-analyzer-fd-type-mismatch}
10832 to disable it.
10834 This diagnostic warns for paths through code in which an
10835 operation is attempted on the wrong type of file descriptor.
10836 For example, it will warn on attempts to use socket operations
10837 on a file descriptor obtained via @code{open}, or when attempting
10838 to use a stream socket operation on a datagram socket.
10840 @opindex Wanalyzer-fd-use-after-close
10841 @opindex Wno-analyzer-fd-use-after-close
10842 @item -Wno-analyzer-fd-use-after-close
10843 This warning requires @option{-fanalyzer}, which enables it; use
10844 @option{-Wno-analyzer-fd-use-after-close}
10845 to disable it.
10847 This diagnostic warns for paths through code in which a
10848 read or write is called on a closed file descriptor.
10850 This diagnostic also warns for paths through code in which
10851 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10852 or @code{fd_arg_write (N)} is called with a closed file descriptor at
10853 referenced argument @code{N}.
10855 @opindex Wanalyzer-fd-use-without-check
10856 @opindex Wno-analyzer-fd-use-without-check
10857 @item -Wno-analyzer-fd-use-without-check
10858 This warning requires @option{-fanalyzer}, which enables it; use
10859 @option{-Wno-analyzer-fd-use-without-check}
10860 to disable it.
10862 This diagnostic warns for paths through code in which a
10863 file descriptor is used without being checked for validity.
10865 This diagnostic also warns for paths through code in which
10866 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10867 or @code{fd_arg_write (N)} is called with a file descriptor, at referenced
10868 argument @code{N}, without being checked for validity.
10870 @opindex Wanalyzer-file-leak
10871 @opindex Wno-analyzer-file-leak
10872 @item -Wno-analyzer-file-leak
10873 This warning requires @option{-fanalyzer}, which enables it; use
10874 @option{-Wno-analyzer-file-leak}
10875 to disable it.
10877 This diagnostic warns for paths through the code in which a
10878 @code{<stdio.h>} @code{FILE *} stream object is leaked.
10880 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10882 @opindex Wanalyzer-free-of-non-heap
10883 @opindex Wno-analyzer-free-of-non-heap
10884 @item -Wno-analyzer-free-of-non-heap
10885 This warning requires @option{-fanalyzer}, which enables it; use
10886 @option{-Wno-analyzer-free-of-non-heap}
10887 to disable it.
10889 This diagnostic warns for paths through the code in which @code{free}
10890 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
10892 See @uref{https://cwe.mitre.org/data/definitions/590.html, CWE-590: Free of Memory not on the Heap}.
10894 @opindex Wanalyzer-imprecise-fp-arithmetic
10895 @opindex Wno-analyzer-imprecise-fp-arithmetic
10896 @item -Wno-analyzer-imprecise-fp-arithmetic
10897 This warning requires @option{-fanalyzer}, which enables it; use
10898 @option{-Wno-analyzer-imprecise-fp-arithmetic}
10899 to disable it.
10901 This diagnostic warns for paths through the code in which floating-point
10902 arithmetic is used in locations where precise computation is needed.  This
10903 diagnostic only warns on use of floating-point operands inside the
10904 calculation of an allocation size at the moment.
10906 @opindex Wanalyzer-infinite-loop
10907 @opindex Wno-analyzer-infinite-loop
10908 @item -Wno-analyzer-infinite-loop
10909 This warning requires @option{-fanalyzer}, which enables it; use
10910 @option{-Wno-analyzer-infinite-loop} to disable it.
10912 This diagnostics warns for paths through the code which appear to
10913 lead to an infinite loop.
10915 Specifically, the analyzer will issue this warning when it "sees" a loop
10916 in which:
10917 @itemize @bullet
10918 @item
10919 no externally-visible work could be being done within the loop
10920 @item
10921 there is no way to escape from the loop
10922 @item
10923 the analyzer is sufficiently confident about the program state
10924 throughout the loop to know that the above are true
10925 @end itemize
10927 One way for this warning to be emitted is when there is an execution
10928 path through a loop for which taking the path on one iteration implies
10929 that the same path will be taken on all subsequent iterations.
10931 For example, consider:
10933 @smallexample
10934   while (1)
10935     @{
10936       char opcode = *cpu_state.pc;
10937       switch (opcode)
10938        @{
10939        case OPCODE_FOO:
10940          handle_opcode_foo (&cpu_state);
10941          break;
10942        case OPCODE_BAR:
10943          handle_opcode_bar (&cpu_state);
10944          break;
10945        @}
10946     @}
10947 @end smallexample
10949 The analyzer will complain for the above case because if @code{opcode}
10950 ever matches none of the cases, the @code{switch} will follow the
10951 implicit @code{default} case, making the body of the loop be a ``no-op''
10952 with @code{cpu_state.pc} unchanged, and thus using the same value of
10953 @code{opcode} on all subseqent iterations, leading to an infinite loop.
10955 See @uref{https://cwe.mitre.org/data/definitions/835.html, CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')}.
10957 @opindex Wanalyzer-infinite-recursion
10958 @opindex Wno-analyzer-infinite-recursion
10959 @item -Wno-analyzer-infinite-recursion
10960 This warning requires @option{-fanalyzer}, which enables it; use
10961 @option{-Wno-analyzer-infinite-recursion} to disable it.
10963 This diagnostics warns for paths through the code which appear to
10964 lead to infinite recursion.
10966 Specifically, when the analyzer "sees" a recursive call, it will compare
10967 the state of memory at the entry to the new frame with that at the entry
10968 to the previous frame of that function on the stack.  The warning is
10969 issued if nothing in memory appears to be changing; any changes observed
10970 to parameters or globals are assumed to lead to termination of the
10971 recursion and thus suppress the warning.
10973 This diagnostic is likely to miss cases of infinite recursion that
10974 are convered to iteration by the optimizer before the analyzer "sees"
10975 them.  Hence optimization should be disabled when attempting to trigger
10976 this diagnostic.
10978 Compare with @option{-Winfinite-recursion}, which provides a similar
10979 diagnostic, but is implemented in a different way.
10981 See @uref{https://cwe.mitre.org/data/definitions/674.html, CWE-674: Uncontrolled Recursion}.
10983 @opindex Wanalyzer-jump-through-null
10984 @opindex Wno-analyzer-jump-through-null
10985 @item -Wno-analyzer-jump-through-null
10986 This warning requires @option{-fanalyzer}, which enables it; use
10987 @option{-Wno-analyzer-jump-through-null}
10988 to disable it.
10990 This diagnostic warns for paths through the code in which a @code{NULL}
10991 function pointer is called.
10993 @opindex Wanalyzer-malloc-leak
10994 @opindex Wno-analyzer-malloc-leak
10995 @item -Wno-analyzer-malloc-leak
10996 This warning requires @option{-fanalyzer}, which enables it; use
10997 @option{-Wno-analyzer-malloc-leak}
10998 to disable it.
11000 This diagnostic warns for paths through the code in which a
11001 pointer allocated via an allocator is leaked: either @code{malloc},
11002 or a function marked with attribute @code{malloc}.
11004 See @uref{https://cwe.mitre.org/data/definitions/401.html, CWE-401: Missing Release of Memory after Effective Lifetime}.
11006 @opindex Wanalyzer-mismatching-deallocation
11007 @opindex Wno-analyzer-mismatching-deallocation
11008 @item -Wno-analyzer-mismatching-deallocation
11009 This warning requires @option{-fanalyzer}, which enables it; use
11010 @option{-Wno-analyzer-mismatching-deallocation}
11011 to disable it.
11013 This diagnostic warns for paths through the code in which the
11014 wrong deallocation function is called on a pointer value, based on
11015 which function was used to allocate the pointer value.  The diagnostic
11016 will warn about mismatches between @code{free}, scalar @code{delete}
11017 and vector @code{delete[]}, and those marked as allocator/deallocator
11018 pairs using attribute @code{malloc}.
11020 See @uref{https://cwe.mitre.org/data/definitions/762.html, CWE-762: Mismatched Memory Management Routines}.
11022 @opindex Wanalyzer-out-of-bounds
11023 @opindex Wno-analyzer-out-of-bounds
11024 @item -Wno-analyzer-out-of-bounds
11025 This warning requires @option{-fanalyzer}, which enables it; use
11026 @option{-Wno-analyzer-out-of-bounds} to disable it.
11028 This diagnostic warns for paths through the code in which a buffer is
11029 definitely read or written out-of-bounds.  The diagnostic applies for
11030 cases where the analyzer is able to determine a constant offset and for
11031 accesses past the end of a buffer, also a constant capacity.  Further,
11032 the diagnostic does limited checking for accesses past the end when the
11033 offset as well as the capacity is symbolic.
11035 See @uref{https://cwe.mitre.org/data/definitions/119.html, CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer}.
11037 For cases where the analyzer is able, it will emit a text art diagram
11038 visualizing the spatial relationship between the memory region that the
11039 analyzer predicts would be accessed, versus the range of memory that is
11040 valid to access: whether they overlap, are touching, are close or far
11041 apart; which one is before or after in memory, the relative sizes
11042 involved, the direction of the access (read vs write), and, in some
11043 cases, the values of data involved.  This diagram can be suppressed
11044 using @option{-fdiagnostics-text-art-charset=none}.
11046 @opindex Wanalyzer-overlapping-buffers
11047 @opindex Wno-analyzer-overlapping-buffers
11048 @item -Wno-analyzer-overlapping-buffers
11049 This warning requires @option{-fanalyzer}, which enables it; use
11050 @option{-Wno-analyzer-overlapping-buffers} to disable it.
11052 This diagnostic warns for paths through the code in which overlapping
11053 buffers are passed to an API for which the behavior on such buffers
11054 is undefined.
11056 Specifically, the diagnostic occurs on calls to the following functions
11057 @itemize @bullet
11058 @item @code{memcpy}
11059 @item @code{strcat}
11060 @item @code{strcpy}
11061 @end itemize
11062 for cases where the buffers are known to overlap.
11064 @opindex Wanalyzer-possible-null-argument
11065 @opindex Wno-analyzer-possible-null-argument
11066 @item -Wno-analyzer-possible-null-argument
11067 This warning requires @option{-fanalyzer}, which enables it; use
11068 @option{-Wno-analyzer-possible-null-argument} to disable it.
11070 This diagnostic warns for paths through the code in which a
11071 possibly-NULL value is passed to a function argument marked
11072 with @code{__attribute__((nonnull))} as requiring a non-NULL
11073 value.
11075 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
11077 @opindex Wanalyzer-possible-null-dereference
11078 @opindex Wno-analyzer-possible-null-dereference
11079 @item -Wno-analyzer-possible-null-dereference
11080 This warning requires @option{-fanalyzer}, which enables it; use
11081 @option{-Wno-analyzer-possible-null-dereference} to disable it.
11083 This diagnostic warns for paths through the code in which a
11084 possibly-NULL value is dereferenced.
11086 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
11088 @opindex Wanalyzer-null-argument
11089 @opindex Wno-analyzer-null-argument
11090 @item -Wno-analyzer-null-argument
11091 This warning requires @option{-fanalyzer}, which enables it; use
11092 @option{-Wno-analyzer-null-argument} to disable it.
11094 This diagnostic warns for paths through the code in which a
11095 value known to be NULL is passed to a function argument marked
11096 with @code{__attribute__((nonnull))} as requiring a non-NULL
11097 value.
11099 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
11101 @opindex Wanalyzer-null-dereference
11102 @opindex Wno-analyzer-null-dereference
11103 @item -Wno-analyzer-null-dereference
11104 This warning requires @option{-fanalyzer}, which enables it; use
11105 @option{-Wno-analyzer-null-dereference} to disable it.
11107 This diagnostic warns for paths through the code in which a
11108 value known to be NULL is dereferenced.
11110 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
11112 @opindex Wanalyzer-putenv-of-auto-var
11113 @opindex Wno-analyzer-putenv-of-auto-var
11114 @item -Wno-analyzer-putenv-of-auto-var
11115 This warning requires @option{-fanalyzer}, which enables it; use
11116 @option{-Wno-analyzer-putenv-of-auto-var} to disable it.
11118 This diagnostic warns for paths through the code in which a
11119 call to @code{putenv} is passed a pointer to an automatic variable
11120 or an on-stack buffer.
11122 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}.
11124 @opindex Wanalyzer-shift-count-negative
11125 @opindex Wno-analyzer-shift-count-negative
11126 @item -Wno-analyzer-shift-count-negative
11127 This warning requires @option{-fanalyzer}, which enables it; use
11128 @option{-Wno-analyzer-shift-count-negative} to disable it.
11130 This diagnostic warns for paths through the code in which a
11131 shift is attempted with a negative count.  It is analogous to
11132 the @option{-Wshift-count-negative} diagnostic implemented in
11133 the C/C++ front ends, but is implemented based on analyzing
11134 interprocedural paths, rather than merely parsing the syntax tree.
11135 However, the analyzer does not prioritize detection of such paths, so
11136 false negatives are more likely relative to other warnings.
11138 @opindex Wanalyzer-shift-count-overflow
11139 @opindex Wno-analyzer-shift-count-overflow
11140 @item -Wno-analyzer-shift-count-overflow
11141 This warning requires @option{-fanalyzer}, which enables it; use
11142 @option{-Wno-analyzer-shift-count-overflow} to disable it.
11144 This diagnostic warns for paths through the code in which a
11145 shift is attempted with a count greater than or equal to the
11146 precision of the operand's type.  It is analogous to
11147 the @option{-Wshift-count-overflow} diagnostic implemented in
11148 the C/C++ front ends, but is implemented based on analyzing
11149 interprocedural paths, rather than merely parsing the syntax tree.
11150 However, the analyzer does not prioritize detection of such paths, so
11151 false negatives are more likely relative to other warnings.
11153 @opindex Wanalyzer-stale-setjmp-buffer
11154 @opindex Wno-analyzer-stale-setjmp-buffer
11155 @item -Wno-analyzer-stale-setjmp-buffer
11156 This warning requires @option{-fanalyzer}, which enables it; use
11157 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
11159 This diagnostic warns for paths through the code in which
11160 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
11161 to a @code{setjmp} call in a function that has returned.
11163 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
11164 location, it records the stack frame.  The stack frame becomes invalid
11165 when the function containing the @code{setjmp} call returns.  Attempting
11166 to rewind to it via @code{longjmp} would reference a stack frame that
11167 no longer exists, and likely lead to a crash (or worse).
11169 @opindex Wanalyzer-tainted-allocation-size
11170 @opindex Wno-analyzer-tainted-allocation-size
11171 @item -Wno-analyzer-tainted-allocation-size
11172 This warning requires @option{-fanalyzer} which enables it;
11173 use @option{-Wno-analyzer-tainted-allocation-size} to disable it.
11175 This diagnostic warns for paths through the code in which a value
11176 that could be under an attacker's control is used as the size
11177 of an allocation without being sanitized, so that an attacker could
11178 inject an excessively large allocation and potentially cause a denial
11179 of service attack.
11181 See @uref{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}.
11183 @opindex Wanalyzer-tainted-assertion
11184 @opindex Wno-analyzer-tainted-assertion
11185 @item -Wno-analyzer-tainted-assertion
11187 This warning requires @option{-fanalyzer} which enables it;
11188 use @option{-Wno-analyzer-tainted-assertion} to disable it.
11190 This diagnostic warns for paths through the code in which a value
11191 that could be under an attacker's control is used as part of a
11192 condition without being first sanitized, and that condition guards a
11193 call to a function marked with attribute @code{noreturn}
11194 (such as the function @code{__builtin_unreachable}).  Such functions
11195 typically indicate abnormal termination of the program, such as for
11196 assertion failure handlers.  For example:
11198 @smallexample
11199 assert (some_tainted_value < SOME_LIMIT);
11200 @end smallexample
11202 In such cases:
11204 @itemize
11205 @item
11206 when assertion-checking is enabled: an attacker could trigger
11207 a denial of service by injecting an assertion failure
11209 @item
11210 when assertion-checking is disabled, such as by defining @code{NDEBUG},
11211 an attacker could inject data that subverts the process, since it
11212 presumably violates a precondition that is being assumed by the code.
11214 @end itemize
11216 Note that when assertion-checking is disabled, the assertions are
11217 typically removed by the preprocessor before the analyzer has a chance
11218 to "see" them, so this diagnostic can only generate warnings on builds
11219 in which assertion-checking is enabled.
11221 For the purpose of this warning, any function marked with attribute
11222 @code{noreturn} is considered as a possible assertion failure
11223 handler, including @code{__builtin_unreachable}.  Note that these functions
11224 are sometimes removed by the optimizer before the analyzer "sees" them.
11225 Hence optimization should be disabled when attempting to trigger this
11226 diagnostic.
11228 See @uref{https://cwe.mitre.org/data/definitions/617.html, CWE-617: Reachable Assertion}.
11230 The warning can also report problematic constructions such as
11232 @smallexample
11233 switch (some_tainted_value) @{
11234 case 0:
11235   /* [...etc; various valid cases omitted...] */
11236   break;
11238 default:
11239   __builtin_unreachable (); /* BUG: attacker can trigger this  */
11241 @end smallexample
11243 despite the above not being an assertion failure, strictly speaking.
11245 @opindex Wanalyzer-tainted-array-index
11246 @opindex Wno-analyzer-tainted-array-index
11247 @item -Wno-analyzer-tainted-array-index
11248 This warning requires @option{-fanalyzer} which enables it;
11249 use @option{-Wno-analyzer-tainted-array-index} to disable it.
11251 This diagnostic warns for paths through the code in which a value
11252 that could be under an attacker's control is used as the index
11253 of an array access without being sanitized, so that an attacker
11254 could inject an out-of-bounds access.
11256 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
11258 @opindex Wanalyzer-tainted-divisor
11259 @opindex Wno-analyzer-tainted-divisor
11260 @item -Wno-analyzer-tainted-divisor
11261 This warning requires @option{-fanalyzer} which enables it;
11262 use @option{-Wno-analyzer-tainted-divisor} to disable it.
11264 This diagnostic warns for paths through the code in which a value
11265 that could be under an attacker's control is used as the divisor
11266 in a division or modulus operation without being sanitized, so that
11267 an attacker could inject a division-by-zero.
11269 See @uref{https://cwe.mitre.org/data/definitions/369.html, CWE-369: Divide By Zero}.
11271 @opindex Wanalyzer-tainted-offset
11272 @opindex Wno-analyzer-tainted-offset
11273 @item -Wno-analyzer-tainted-offset
11274 This warning requires @option{-fanalyzer} which enables it;
11275 use @option{-Wno-analyzer-tainted-offset} to disable it.
11277 This diagnostic warns for paths through the code in which a value
11278 that could be under an attacker's control is used as a pointer offset
11279 without being sanitized, so that an attacker could inject an out-of-bounds
11280 access.
11282 See @uref{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}.
11284 @opindex Wanalyzer-tainted-size
11285 @opindex Wno-analyzer-tainted-size
11286 @item -Wno-analyzer-tainted-size
11287 This warning requires @option{-fanalyzer} which enables it;
11288 use @option{-Wno-analyzer-tainted-size} to disable it.
11290 This diagnostic warns for paths through the code in which a value
11291 that could be under an attacker's control is used as the size of
11292 an operation such as @code{memset} without being sanitized, so that an
11293 attacker could inject an out-of-bounds access.
11295 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
11297 @opindex Wanalyzer-undefined-behavior-strtok
11298 @opindex Wno-analyzer-undefined-behavior-strtok
11299 @item -Wno-analyzer-undefined-behavior-strtok
11300 This warning requires @option{-fanalyzer}, which enables it; use
11301 @option{-Wno-analyzer-undefined-behavior-strtok} to disable it.
11303 This diagnostic warns for paths through the code in which a
11304 call is made to @code{strtok} with undefined behavior.
11306 Specifically, passing NULL as the first parameter for the initial
11307 call to @code{strtok} within a process has undefined behavior.
11309 @opindex Wanalyzer-unsafe-call-within-signal-handler
11310 @opindex Wno-analyzer-unsafe-call-within-signal-handler
11311 @item -Wno-analyzer-unsafe-call-within-signal-handler
11312 This warning requires @option{-fanalyzer}, which enables it; use
11313 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
11315 This diagnostic warns for paths through the code in which a
11316 function known to be async-signal-unsafe (such as @code{fprintf}) is
11317 called from a signal handler.
11319 See @uref{https://cwe.mitre.org/data/definitions/479.html, CWE-479: Signal Handler Use of a Non-reentrant Function}.
11321 @opindex Wanalyzer-use-after-free
11322 @opindex Wno-analyzer-use-after-free
11323 @item -Wno-analyzer-use-after-free
11324 This warning requires @option{-fanalyzer}, which enables it; use
11325 @option{-Wno-analyzer-use-after-free} to disable it.
11327 This diagnostic warns for paths through the code in which a
11328 pointer is used after a deallocator is called on it: either @code{free},
11329 or a deallocator referenced by attribute @code{malloc}.
11331 See @uref{https://cwe.mitre.org/data/definitions/416.html, CWE-416: Use After Free}.
11333 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
11334 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
11335 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
11336 This warning requires @option{-fanalyzer}, which enables it; use
11337 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
11338 to disable it.
11340 This diagnostic warns for paths through the code in which a pointer
11341 is dereferenced that points to a variable in a stale stack frame.
11343 @opindex Wanalyzer-va-arg-type-mismatch
11344 @opindex Wno-analyzer-va-arg-type-mismatch
11345 @item -Wno-analyzer-va-arg-type-mismatch
11346 This warning requires @option{-fanalyzer}, which enables it; use
11347 @option{-Wno-analyzer-va-arg-type-mismatch}
11348 to disable it.
11350 This diagnostic warns for interprocedural paths through the code for which
11351 the analyzer detects an attempt to use @code{va_arg} to extract a value
11352 passed to a variadic call, but uses a type that does not match that of
11353 the expression passed to the call.
11355 See @uref{https://cwe.mitre.org/data/definitions/686.html, CWE-686: Function Call With Incorrect Argument Type}.
11357 @opindex Wanalyzer-va-list-exhausted
11358 @opindex Wno-analyzer-va-list-exhausted
11359 @item -Wno-analyzer-va-list-exhausted
11360 This warning requires @option{-fanalyzer}, which enables it; use
11361 @option{-Wno-analyzer-va-list-exhausted}
11362 to disable it.
11364 This diagnostic warns for interprocedural paths through the code for which
11365 the analyzer detects an attempt to use @code{va_arg} to access the next
11366 value passed to a variadic call, but all of the values in the
11367 @code{va_list} have already been consumed.
11369 See @uref{https://cwe.mitre.org/data/definitions/685.html, CWE-685: Function Call With Incorrect Number of Arguments}.
11371 @opindex Wanalyzer-va-list-leak
11372 @opindex Wno-analyzer-va-list-leak
11373 @item -Wno-analyzer-va-list-leak
11374 This warning requires @option{-fanalyzer}, which enables it; use
11375 @option{-Wno-analyzer-va-list-leak}
11376 to disable it.
11378 This diagnostic warns for interprocedural paths through the code for which
11379 the analyzer detects that @code{va_start} or @code{va_copy} has been called
11380 on a @code{va_list} without a corresponding call to @code{va_end}.
11382 @opindex Wanalyzer-va-list-use-after-va-end
11383 @opindex Wno-analyzer-va-list-use-after-va-end
11384 @item -Wno-analyzer-va-list-use-after-va-end
11385 This warning requires @option{-fanalyzer}, which enables it; use
11386 @option{-Wno-analyzer-va-list-use-after-va-end}
11387 to disable it.
11389 This diagnostic warns for interprocedural paths through the code for which
11390 the analyzer detects an attempt to use a @code{va_list}  after
11391 @code{va_end} has been called on it.
11392 @code{va_list}.
11394 @opindex Wanalyzer-write-to-const
11395 @opindex Wno-analyzer-write-to-const
11396 @item -Wno-analyzer-write-to-const
11397 This warning requires @option{-fanalyzer}, which enables it; use
11398 @option{-Wno-analyzer-write-to-const}
11399 to disable it.
11401 This diagnostic warns for paths through the code in which the analyzer
11402 detects an attempt to write through a pointer to a @code{const} object.
11403 However, the analyzer does not prioritize detection of such paths, so
11404 false negatives are more likely relative to other warnings.
11406 @opindex Wanalyzer-write-to-string-literal
11407 @opindex Wno-analyzer-write-to-string-literal
11408 @item -Wno-analyzer-write-to-string-literal
11409 This warning requires @option{-fanalyzer}, which enables it; use
11410 @option{-Wno-analyzer-write-to-string-literal}
11411 to disable it.
11413 This diagnostic warns for paths through the code in which the analyzer
11414 detects an attempt to write through a pointer to a string literal.
11415 However, the analyzer does not prioritize detection of such paths, so
11416 false negatives are more likely relative to other warnings.
11418 @opindex Wanalyzer-use-of-uninitialized-value
11419 @opindex Wno-analyzer-use-of-uninitialized-value
11420 @item -Wno-analyzer-use-of-uninitialized-value
11421 This warning requires @option{-fanalyzer}, which enables it; use
11422 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
11424 This diagnostic warns for paths through the code in which an uninitialized
11425 value is used.
11427 See @uref{https://cwe.mitre.org/data/definitions/457.html, CWE-457: Use of Uninitialized Variable}.
11429 @end table
11431 The analyzer has hardcoded knowledge about the behavior of the following
11432 memory-management functions:
11434 @itemize @bullet
11435 @item @code{alloca}
11436 @item The built-in functions @code{__builtin_alloc},
11437 @code{__builtin_alloc_with_align}, @item @code{__builtin_calloc},
11438 @code{__builtin_free}, @code{__builtin_malloc}, @code{__builtin_memcpy},
11439 @code{__builtin_memcpy_chk}, @code{__builtin_memset},
11440 @code{__builtin_memset_chk}, @code{__builtin_realloc},
11441 @code{__builtin_stack_restore}, and @code{__builtin_stack_save}
11442 @item @code{calloc}
11443 @item @code{free}
11444 @item @code{malloc}
11445 @item @code{memset}
11446 @item @code{operator delete}
11447 @item @code{operator delete []}
11448 @item @code{operator new}
11449 @item @code{operator new []}
11450 @item @code{realloc}
11451 @item @code{strdup}
11452 @item @code{strndup}
11453 @end itemize
11455 @noindent
11456 of the following functions for working with file descriptors:
11458 @itemize @bullet
11459 @item @code{open}
11460 @item @code{close}
11461 @item @code{creat}
11462 @item @code{dup}, @code{dup2} and @code{dup3}
11463 @item @code{isatty}
11464 @item @code{pipe}, and @code{pipe2}
11465 @item @code{read}
11466 @item @code{write}
11467 @item @code{socket}, @code{bind}, @code{listen}, @code{accept}, and @code{connect}
11468 @end itemize
11470 @noindent
11471 of the following functions for working with @code{<stdio.h>} streams:
11472 @itemize @bullet
11473 @item The built-in functions @code{__builtin_fprintf},
11474 @code{__builtin_fprintf_unlocked}, @code{__builtin_fputc},
11475 @code{__builtin_fputc_unlocked}, @code{__builtin_fputs},
11476 @code{__builtin_fputs_unlocked}, @code{__builtin_fwrite},
11477 @code{__builtin_fwrite_unlocked}, @code{__builtin_printf},
11478 @code{__builtin_printf_unlocked}, @code{__builtin_putc},
11479 @code{__builtin_putchar}, @code{__builtin_putchar_unlocked},
11480 @code{__builtin_putc_unlocked}, @code{__builtin_puts},
11481 @code{__builtin_puts_unlocked}, @code{__builtin_vfprintf}, and
11482 @code{__builtin_vprintf}
11483 @item @code{fopen}
11484 @item @code{fclose}
11485 @item @code{ferror}
11486 @item @code{fgets}
11487 @item @code{fgets_unlocked}
11488 @item @code{fileno}
11489 @item @code{fread}
11490 @item @code{getc}
11491 @item @code{getchar}
11492 @item @code{fprintf}
11493 @item @code{printf}
11494 @item @code{fwrite}
11495 @end itemize
11497 @noindent
11498 and of the following functions:
11500 @itemize @bullet
11501 @item The built-in functions @code{__builtin_expect},
11502 @code{__builtin_expect_with_probability}, @code{__builtin_strchr},
11503 @code{__builtin_strcpy}, @code{__builtin_strcpy_chk},
11504 @code{__builtin_strlen}, @code{__builtin_va_copy}, and
11505 @code{__builtin_va_start}
11506 @item The GNU extensions @code{error} and @code{error_at_line}
11507 @item @code{getpass}
11508 @item @code{longjmp}
11509 @item @code{putenv}
11510 @item @code{setjmp}
11511 @item @code{siglongjmp}
11512 @item @code{signal}
11513 @item @code{sigsetjmp}
11514 @item @code{strcat}
11515 @item @code{strchr}
11516 @item @code{strlen}
11517 @end itemize
11519 In addition, various functions with an @code{__analyzer_} prefix have
11520 special meaning to the analyzer, described in the GCC Internals manual.
11522 Pertinent parameters for controlling the exploration are:
11523 @itemize @bullet
11524 @item @option{--param analyzer-bb-explosion-factor=@var{value}}
11525 @item @option{--param analyzer-max-enodes-per-program-point=@var{value}}
11526 @item @option{--param analyzer-max-recursion-depth=@var{value}}
11527 @item @option{--param analyzer-min-snodes-for-call-summary=@var{value}}
11528 @end itemize
11530 The following options control the analyzer.
11532 @table @gcctabopt
11534 @opindex fanalyzer-call-summaries
11535 @opindex fno-analyzer-call-summaries
11536 @item -fanalyzer-call-summaries
11537 Simplify interprocedural analysis by computing the effect of certain calls,
11538 rather than exploring all paths through the function from callsite to each
11539 possible return.
11541 If enabled, call summaries are only used for functions with more than one
11542 call site, and that are sufficiently complicated (as per
11543 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
11545 @opindex fanalyzer-checker
11546 @item -fanalyzer-checker=@var{name}
11547 Restrict the analyzer to run just the named checker, and enable it.
11549 @opindex fanalyzer-debug-text-art
11550 @opindex fno-analyzer-debug-text-art
11551 @item -fanalyzer-debug-text-art-headings
11552 This option is intended for analyzer developers.  If enabled,
11553 the analyzer will add extra annotations to any diagrams it generates.
11555 @opindex fanalyzer-feasibility
11556 @opindex fno-analyzer-feasibility
11557 @item -fno-analyzer-feasibility
11558 This option is intended for analyzer developers.
11560 By default the analyzer verifies that there is a feasible control flow path
11561 for each diagnostic it emits: that the conditions that hold are not mutually
11562 exclusive.  Diagnostics for which no feasible path can be found are rejected.
11563 This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
11564 debugging issues in this code.
11566 @opindex fanalyzer-fine-grained
11567 @opindex fno-analyzer-fine-grained
11568 @item -fanalyzer-fine-grained
11569 This option is intended for analyzer developers.
11571 Internally the analyzer builds an ``exploded graph'' that combines
11572 control flow graphs with data flow information.
11574 By default, an edge in this graph can contain the effects of a run
11575 of multiple statements within a basic block.  With
11576 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
11578 @opindex fanalyzer-show-duplicate-count
11579 @opindex fno-analyzer-show-duplicate-count
11580 @item -fanalyzer-show-duplicate-count
11581 This option is intended for analyzer developers: if multiple diagnostics
11582 have been detected as being duplicates of each other, it emits a note when
11583 reporting the best diagnostic, giving the number of additional diagnostics
11584 that were suppressed by the deduplication logic.
11586 @opindex fanalyzer-show-events-in-system-headers
11587 @opindex fno-analyzer-show-events-in-system-headers
11588 @item -fanalyzer-show-events-in-system-headers
11589 By default the analyzer emits simplified diagnostics paths by hiding
11590 events fully located within a system header.
11591 With @option{-fanalyzer-show-events-in-system-headers} such
11592 events are no longer suppressed.
11594 @opindex fanalyzer-state-merge
11595 @opindex fno-analyzer-state-merge
11596 @item -fno-analyzer-state-merge
11597 This option is intended for analyzer developers.
11599 By default the analyzer attempts to simplify analysis by merging
11600 sufficiently similar states at each program point as it builds its
11601 ``exploded graph''.  With @option{-fno-analyzer-state-merge} this
11602 merging can be suppressed, for debugging state-handling issues.
11604 @opindex fanalyzer-state-purge
11605 @opindex fno-analyzer-state-purge
11606 @item -fno-analyzer-state-purge
11607 This option is intended for analyzer developers.
11609 By default the analyzer attempts to simplify analysis by purging
11610 aspects of state at a program point that appear to no longer be relevant
11611 e.g. the values of locals that aren't accessed later in the function
11612 and which aren't relevant to leak analysis.
11614 With @option{-fno-analyzer-state-purge} this purging of state can
11615 be suppressed, for debugging state-handling issues.
11617 @opindex fanalyzer-suppress-followups
11618 @opindex fno-analyzer-suppress-followups
11619 @item -fno-analyzer-suppress-followups
11620 This option is intended for analyzer developers.
11622 By default the analyzer will stop exploring an execution path after
11623 encountering certain diagnostics, in order to avoid potentially issuing a
11624 cascade of follow-up diagnostics.
11626 The diagnostics that terminate analysis along a path are:
11628 @itemize
11629 @item @option{-Wanalyzer-null-argument}
11630 @item @option{-Wanalyzer-null-dereference}
11631 @item @option{-Wanalyzer-use-after-free}
11632 @item @option{-Wanalyzer-use-of-pointer-in-stale-stack-frame}
11633 @item @option{-Wanalyzer-use-of-uninitialized-value}
11634 @end itemize
11636 With @option{-fno-analyzer-suppress-followups} the analyzer will
11637 continue to explore such paths even after such diagnostics, which may
11638 be helpful for debugging issues in the analyzer, or for microbenchmarks
11639 for detecting undefined behavior.
11641 @opindex fanalyzer-transitivity
11642 @opindex fno-analyzer-transitivity
11643 @item -fanalyzer-transitivity
11644 This option enables transitivity of constraints within the analyzer.
11646 @opindex fanalyzer-undo-inlining
11647 @opindex fno-analyzer-undo-inlining
11648 @item -fno-analyzer-undo-inlining
11649 This option is intended for analyzer developers.
11651 @option{-fanalyzer} runs relatively late compared to other code analysis
11652 tools, and some optimizations have already been applied to the code.  In
11653 particular function inlining may have occurred, leading to the
11654 interprocedural execution paths emitted by the analyzer containing
11655 function frames that don't correspond to those in the original source
11656 code.
11658 By default the analyzer attempts to reconstruct the original function
11659 frames, and to emit events showing the inlined calls.
11661 With @option{-fno-analyzer-undo-inlining} this attempt to reconstruct
11662 the original frame information can be be disabled, which may be of help
11663 when debugging issues in the analyzer.
11665 @item -fanalyzer-verbose-edges
11666 This option is intended for analyzer developers.  It enables more
11667 verbose, lower-level detail in the descriptions of control flow
11668 within diagnostic paths.
11670 @item -fanalyzer-verbose-state-changes
11671 This option is intended for analyzer developers.  It enables more
11672 verbose, lower-level detail in the descriptions of events relating
11673 to state machines within diagnostic paths.
11675 @item -fanalyzer-verbosity=@var{level}
11676 This option controls the complexity of the control flow paths that are
11677 emitted for analyzer diagnostics.
11679 The @var{level} can be one of:
11681 @table @samp
11682 @item 0
11683 At this level, interprocedural call and return events are displayed,
11684 along with the most pertinent state-change events relating to
11685 a diagnostic.  For example, for a double-@code{free} diagnostic,
11686 both calls to @code{free} will be shown.
11688 @item 1
11689 As per the previous level, but also show events for the entry
11690 to each function.
11692 @item 2
11693 As per the previous level, but also show events relating to
11694 control flow that are significant to triggering the issue
11695 (e.g. ``true path taken'' at a conditional).
11697 This level is the default.
11699 @item 3
11700 As per the previous level, but show all control flow events, not
11701 just significant ones.
11703 @item 4
11704 This level is intended for analyzer developers; it adds various
11705 other events intended for debugging the analyzer.
11707 @end table
11709 @opindex fdump-analyzer
11710 @item -fdump-analyzer
11711 Dump internal details about what the analyzer is doing to
11712 @file{@var{file}.analyzer.txt}.
11713 @option{-fdump-analyzer-stderr} overrides this option.
11715 @opindex fdump-analyzer-stderr
11716 @item -fdump-analyzer-stderr
11717 Dump internal details about what the analyzer is doing to stderr.
11718 This option overrides @option{-fdump-analyzer}.
11720 @opindex fdump-analyzer-callgraph
11721 @item -fdump-analyzer-callgraph
11722 Dump a representation of the call graph suitable for viewing with
11723 GraphViz to @file{@var{file}.callgraph.dot}.
11725 @opindex fdump-analyzer-exploded-graph
11726 @item -fdump-analyzer-exploded-graph
11727 Dump a representation of the ``exploded graph'' suitable for viewing with
11728 GraphViz to @file{@var{file}.eg.dot}.
11729 Nodes are color-coded based on state-machine states to emphasize
11730 state changes.
11732 @opindex dump-analyzer-exploded-nodes
11733 @item -fdump-analyzer-exploded-nodes
11734 Emit diagnostics showing where nodes in the ``exploded graph'' are
11735 in relation to the program source.
11737 @opindex dump-analyzer-exploded-nodes-2
11738 @item -fdump-analyzer-exploded-nodes-2
11739 Dump a textual representation of the ``exploded graph'' to
11740 @file{@var{file}.eg.txt}.
11742 @opindex dump-analyzer-exploded-nodes-3
11743 @item -fdump-analyzer-exploded-nodes-3
11744 Dump a textual representation of the ``exploded graph'' to
11745 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
11746 This is typically a large number of dump files.
11748 @opindex fdump-analyzer-exploded-paths
11749 @item -fdump-analyzer-exploded-paths
11750 Dump a textual representation of the ``exploded path'' for each
11751 diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}.
11753 @opindex dump-analyzer-feasibility
11754 @item -fdump-analyzer-feasibility
11755 Dump internal details about the analyzer's search for feasible paths.
11756 The details are written in a form suitable for viewing with GraphViz
11757 to filenames of the form @file{@var{file}.*.fg.dot},
11758 @file{@var{file}.*.tg.dot}, and @file{@var{file}.*.fpath.txt}.
11760 @opindex dump-analyzer-infinite-loop
11761 @item -fdump-analyzer-infinite-loop
11762 Dump internal details about the analyzer's search for infinite loops.
11763 The details are written in a form suitable for viewing with GraphViz
11764 to filenames of the form @file{@var{file}.*.infinite-loop.dot}.
11766 @opindex fdump-analyzer-json
11767 @item -fdump-analyzer-json
11768 Dump a compressed JSON representation of analyzer internals to
11769 @file{@var{file}.analyzer.json.gz}.  The precise format is subject
11770 to change.
11772 @opindex fdump-analyzer-state-purge
11773 @item -fdump-analyzer-state-purge
11774 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
11775 ``supergraph'' suitable for viewing with GraphViz, but annotate the
11776 graph with information on what state will be purged at each node.
11777 The graph is written to @file{@var{file}.state-purge.dot}.
11779 @opindex fdump-analyzer-supergraph
11780 @item -fdump-analyzer-supergraph
11781 Dump representations of the ``supergraph'' suitable for viewing with
11782 GraphViz to @file{@var{file}.supergraph.dot} and to
11783 @file{@var{file}.supergraph-eg.dot}.  These show all of the
11784 control flow graphs in the program, with interprocedural edges for
11785 calls and returns.  The second dump contains annotations showing nodes
11786 in the ``exploded graph'' and diagnostics associated with them.
11788 @opindex fdump-analyzer-untracked
11789 @item -fdump-analyzer-untracked
11790 Emit custom warnings with internal details intended for analyzer developers.
11792 @end table
11794 @node Debugging Options
11795 @section Options for Debugging Your Program
11796 @cindex options, debugging
11797 @cindex debugging information options
11799 To tell GCC to emit extra information for use by a debugger, in almost 
11800 all cases you need only to add @option{-g} to your other options.  Some debug
11801 formats can co-exist (like DWARF with CTF) when each of them is enabled
11802 explicitly by adding the respective command line option to your other options.
11804 GCC allows you to use @option{-g} with
11805 @option{-O}.  The shortcuts taken by optimized code may occasionally
11806 be surprising: some variables you declared may not exist
11807 at all; flow of control may briefly move where you did not expect it;
11808 some statements may not be executed because they compute constant
11809 results or their values are already at hand; some statements may
11810 execute in different places because they have been moved out of loops.
11811 Nevertheless it is possible to debug optimized output.  This makes
11812 it reasonable to use the optimizer for programs that might have bugs.
11814 If you are not using some other optimization option, consider
11815 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.  
11816 With no @option{-O} option at all, some compiler passes that collect
11817 information useful for debugging do not run at all, so that
11818 @option{-Og} may result in a better debugging experience.
11820 @table @gcctabopt
11821 @opindex g
11822 @item -g
11823 Produce debugging information in the operating system's native format
11824 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
11825 information.
11827 On most systems that use stabs format, @option{-g} enables use of extra
11828 debugging information that only GDB can use; this extra information
11829 makes debugging work better in GDB but probably makes other debuggers
11830 crash or refuse to read the program.  If you want to control for certain whether
11831 to generate the extra information, use @option{-gvms} (see below).
11833 @opindex ggdb
11834 @item -ggdb
11835 Produce debugging information for use by GDB@.  This means to use the
11836 most expressive format available (DWARF, stabs, or the native format
11837 if neither of those are supported), including GDB extensions if at all
11838 possible.
11840 @opindex gdwarf
11841 @item -gdwarf
11842 @itemx -gdwarf-@var{version}
11843 Produce debugging information in DWARF format (if that is supported).
11844 The value of @var{version} may be either 2, 3, 4 or 5; the default
11845 version for most targets is 5 (with the exception of VxWorks, TPF and
11846 Darwin / macOS, which default to version 2, and AIX, which defaults
11847 to version 4).
11849 Note that with DWARF Version 2, some ports require and always
11850 use some non-conflicting DWARF 3 extensions in the unwind tables.
11852 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
11853 for maximum benefit. Version 5 requires GDB 8.0 or higher.
11855 GCC no longer supports DWARF Version 1, which is substantially
11856 different than Version 2 and later.  For historical reasons, some
11857 other DWARF-related options such as
11858 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
11859 in their names, but apply to all currently-supported versions of DWARF.
11861 @opindex gbtf
11862 @item -gbtf
11863 Request BTF debug information.  BTF is the default debugging format for the
11864 eBPF target.  On other targets, like x86, BTF debug information can be
11865 generated along with DWARF debug information when both of the debug formats are
11866 enabled explicitly via their respective command line options.
11868 @opindex gctf
11869 @item -gctf
11870 @itemx -gctf@var{level}
11871 Request CTF debug information and use level to specify how much CTF debug
11872 information should be produced.  If @option{-gctf} is specified
11873 without a value for level, the default level of CTF debug information is 2.
11875 CTF debug information can be generated along with DWARF debug information when
11876 both of the debug formats are enabled explicitly via their respective command
11877 line options.
11879 Level 0 produces no CTF debug information at all.  Thus, @option{-gctf0}
11880 negates @option{-gctf}.
11882 Level 1 produces CTF information for tracebacks only.  This includes callsite
11883 information, but does not include type information.
11885 Level 2 produces type information for entities (functions, data objects etc.)
11886 at file-scope or global-scope only.
11888 @opindex gvms
11889 @item -gvms
11890 Produce debugging information in Alpha/VMS debug format (if that is
11891 supported).  This is the format used by DEBUG on Alpha/VMS systems.
11893 @item -gcodeview
11894 @opindex gcodeview
11895 Produce debugging information in CodeView debug format (if that is
11896 supported).  This is the format used by Microsoft Visual C++ on
11897 Windows.
11899 @item -g@var{level}
11900 @itemx -ggdb@var{level}
11901 @itemx -gvms@var{level}
11902 Request debugging information and also use @var{level} to specify how
11903 much information.  The default level is 2.
11905 Level 0 produces no debug information at all.  Thus, @option{-g0} negates
11906 @option{-g}.
11908 Level 1 produces minimal information, enough for making backtraces in
11909 parts of the program that you don't plan to debug.  This includes
11910 descriptions of functions and external variables, and line number
11911 tables, but no information about local variables.
11913 Level 3 includes extra information, such as all the macro definitions
11914 present in the program.  Some debuggers support macro expansion when
11915 you use @option{-g3}.
11917 If you use multiple @option{-g} options, with or without level numbers,
11918 the last such option is the one that is effective.
11920 @option{-gdwarf} does not accept a concatenated debug level, to avoid
11921 confusion with @option{-gdwarf-@var{level}}.
11922 Instead use an additional @option{-g@var{level}} option to change the
11923 debug level for DWARF.
11925 @opindex feliminate-unused-debug-symbols
11926 @opindex fno-eliminate-unused-debug-symbols
11927 @item -fno-eliminate-unused-debug-symbols
11928 By default, no debug information is produced for symbols that are not actually
11929 used. Use this option if you want debug information for all symbols.
11931 @opindex femit-class-debug-always
11932 @item -femit-class-debug-always
11933 Instead of emitting debugging information for a C++ class in only one
11934 object file, emit it in all object files using the class.  This option
11935 should be used only with debuggers that are unable to handle the way GCC
11936 normally emits debugging information for classes because using this
11937 option increases the size of debugging information by as much as a
11938 factor of two.
11940 @opindex fmerge-debug-strings
11941 @opindex fno-merge-debug-strings
11942 @item -fno-merge-debug-strings
11943 Direct the linker to not merge together strings in the debugging
11944 information that are identical in different object files.  Merging is
11945 not supported by all assemblers or linkers.  Merging decreases the size
11946 of the debug information in the output file at the cost of increasing
11947 link processing time.  Merging is enabled by default.
11949 @opindex fdebug-prefix-map
11950 @item -fdebug-prefix-map=@var{old}=@var{new}
11951 When compiling files residing in directory @file{@var{old}}, record
11952 debugging information describing them as if the files resided in
11953 directory @file{@var{new}} instead.  This can be used to replace a
11954 build-time path with an install-time path in the debug info.  It can
11955 also be used to change an absolute path to a relative path by using
11956 @file{.} for @var{new}.  This can give more reproducible builds, which
11957 are location independent, but may require an extra command to tell GDB
11958 where to find the source files. See also @option{-ffile-prefix-map}
11959 and @option{-fcanon-prefix-map}.
11961 @opindex fvar-tracking
11962 @item -fvar-tracking
11963 Run variable tracking pass.  It computes where variables are stored at each
11964 position in code.  Better debugging information is then generated
11965 (if the debugging information format supports this information).
11967 It is enabled by default when compiling with optimization (@option{-Os},
11968 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
11969 the debug info format supports it.
11971 @opindex fvar-tracking-assignments
11972 @opindex fno-var-tracking-assignments
11973 @item -fvar-tracking-assignments
11974 Annotate assignments to user variables early in the compilation and
11975 attempt to carry the annotations over throughout the compilation all the
11976 way to the end, in an attempt to improve debug information while
11977 optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
11979 It can be enabled even if var-tracking is disabled, in which case
11980 annotations are created and maintained, but discarded at the end.
11981 By default, this flag is enabled together with @option{-fvar-tracking},
11982 except when selective scheduling is enabled.
11984 @opindex gsplit-dwarf
11985 @item -gsplit-dwarf
11986 If DWARF debugging information is enabled, separate as much debugging
11987 information as possible into a separate output file with the extension
11988 @file{.dwo}.  This option allows the build system to avoid linking files with
11989 debug information.  To be useful, this option requires a debugger capable of
11990 reading @file{.dwo} files.
11992 @opindex gdwarf32
11993 @opindex gdwarf64
11994 @item -gdwarf32
11995 @itemx -gdwarf64
11996 If DWARF debugging information is enabled, the @option{-gdwarf32} selects
11997 the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
11998 DWARF format.  The default is target specific, on most targets it is
11999 @option{-gdwarf32} though.  The 32-bit DWARF format is smaller, but
12000 can't support more than 2GiB of debug information in any of the DWARF
12001 debug information sections.  The 64-bit DWARF format allows larger debug
12002 information and might not be well supported by all consumers yet.
12004 @opindex gdescribe-dies
12005 @item -gdescribe-dies
12006 Add description attributes to some DWARF DIEs that have no name attribute,
12007 such as artificial variables, external references and call site
12008 parameter DIEs.
12010 @opindex gpubnames
12011 @item -gpubnames
12012 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
12014 @opindex ggnu-pubnames
12015 @item -ggnu-pubnames
12016 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
12017 suitable for conversion into a GDB@ index.  This option is only useful
12018 with a linker that can produce GDB@ index version 7.
12020 @opindex fdebug-types-section
12021 @opindex fno-debug-types-section
12022 @item -fdebug-types-section
12023 When using DWARF Version 4 or higher, type DIEs can be put into
12024 their own @code{.debug_types} section instead of making them part of the
12025 @code{.debug_info} section.  It is more efficient to put them in a separate
12026 comdat section since the linker can then remove duplicates.
12027 But not all DWARF consumers support @code{.debug_types} sections yet
12028 and on some objects @code{.debug_types} produces larger instead of smaller
12029 debugging information.
12031 @opindex grecord-gcc-switches
12032 @opindex gno-record-gcc-switches
12033 @item -grecord-gcc-switches
12034 @itemx -gno-record-gcc-switches
12035 This switch causes the command-line options used to invoke the
12036 compiler that may affect code generation to be appended to the
12037 DW_AT_producer attribute in DWARF debugging information.  The options
12038 are concatenated with spaces separating them from each other and from
12039 the compiler version.  
12040 It is enabled by default.
12041 See also @option{-frecord-gcc-switches} for another
12042 way of storing compiler options into the object file.  
12044 @opindex gstrict-dwarf
12045 @item -gstrict-dwarf
12046 Disallow using extensions of later DWARF standard version than selected
12047 with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
12048 DWARF extensions from later standard versions is allowed.
12050 @opindex gno-strict-dwarf
12051 @item -gno-strict-dwarf
12052 Allow using extensions of later DWARF standard version than selected with
12053 @option{-gdwarf-@var{version}}.
12055 @opindex gas-loc-support
12056 @item -gas-loc-support
12057 Inform the compiler that the assembler supports @code{.loc} directives.
12058 It may then use them for the assembler to generate DWARF2+ line number
12059 tables.
12061 This is generally desirable, because assembler-generated line-number
12062 tables are a lot more compact than those the compiler can generate
12063 itself.
12065 This option will be enabled by default if, at GCC configure time, the
12066 assembler was found to support such directives.
12068 @opindex gno-as-loc-support
12069 @item -gno-as-loc-support
12070 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
12071 line number tables are to be generated.
12073 @opindex gas-locview-support
12074 @item -gas-locview-support
12075 Inform the compiler that the assembler supports @code{view} assignment
12076 and reset assertion checking in @code{.loc} directives.
12078 This option will be enabled by default if, at GCC configure time, the
12079 assembler was found to support them.
12081 @item -gno-as-locview-support
12082 Force GCC to assign view numbers internally, if
12083 @option{-gvariable-location-views} are explicitly requested.
12085 @opindex gcolumn-info
12086 @opindex gno-column-info
12087 @item -gcolumn-info
12088 @itemx -gno-column-info
12089 Emit location column information into DWARF debugging information, rather
12090 than just file and line.
12091 This option is enabled by default.
12093 @opindex gstatement-frontiers
12094 @opindex gno-statement-frontiers
12095 @item -gstatement-frontiers
12096 @itemx -gno-statement-frontiers
12097 This option causes GCC to create markers in the internal representation
12098 at the beginning of statements, and to keep them roughly in place
12099 throughout compilation, using them to guide the output of @code{is_stmt}
12100 markers in the line number table.  This is enabled by default when
12101 compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2},
12102 @dots{}), and outputting DWARF 2 debug information at the normal level.
12104 @opindex gvariable-location-views
12105 @opindex gvariable-location-views=incompat5
12106 @opindex gno-variable-location-views
12107 @item -gvariable-location-views
12108 @itemx -gvariable-location-views=incompat5
12109 @itemx -gno-variable-location-views
12110 Augment variable location lists with progressive view numbers implied
12111 from the line number table.  This enables debug information consumers to
12112 inspect state at certain points of the program, even if no instructions
12113 associated with the corresponding source locations are present at that
12114 point.  If the assembler lacks support for view numbers in line number
12115 tables, this will cause the compiler to emit the line number table,
12116 which generally makes them somewhat less compact.  The augmented line
12117 number tables and location lists are fully backward-compatible, so they
12118 can be consumed by debug information consumers that are not aware of
12119 these augmentations, but they won't derive any benefit from them either.
12121 This is enabled by default when outputting DWARF 2 debug information at
12122 the normal level, as long as there is assembler support,
12123 @option{-fvar-tracking-assignments} is enabled and
12124 @option{-gstrict-dwarf} is not.  When assembler support is not
12125 available, this may still be enabled, but it will force GCC to output
12126 internal line number tables, and if
12127 @option{-ginternal-reset-location-views} is not enabled, that will most
12128 certainly lead to silently mismatching location views.
12130 There is a proposed representation for view numbers that is not backward
12131 compatible with the location list format introduced in DWARF 5, that can
12132 be enabled with @option{-gvariable-location-views=incompat5}.  This
12133 option may be removed in the future, is only provided as a reference
12134 implementation of the proposed representation.  Debug information
12135 consumers are not expected to support this extended format, and they
12136 would be rendered unable to decode location lists using it.
12138 @opindex ginternal-reset-location-views
12139 @opindex gno-internal-reset-location-views
12140 @item -ginternal-reset-location-views
12141 @itemx -gno-internal-reset-location-views
12142 Attempt to determine location views that can be omitted from location
12143 view lists.  This requires the compiler to have very accurate insn
12144 length estimates, which isn't always the case, and it may cause
12145 incorrect view lists to be generated silently when using an assembler
12146 that does not support location view lists.  The GNU assembler will flag
12147 any such error as a @code{view number mismatch}.  This is only enabled
12148 on ports that define a reliable estimation function.
12150 @opindex ginline-points
12151 @opindex gno-inline-points
12152 @item -ginline-points
12153 @itemx -gno-inline-points
12154 Generate extended debug information for inlined functions.  Location
12155 view tracking markers are inserted at inlined entry points, so that
12156 address and view numbers can be computed and output in debug
12157 information.  This can be enabled independently of location views, in
12158 which case the view numbers won't be output, but it can only be enabled
12159 along with statement frontiers, and it is only enabled by default if
12160 location views are enabled.
12162 @opindex gz
12163 @item -gz@r{[}=@var{type}@r{]}
12164 Produce compressed debug sections in DWARF format, if that is supported.
12165 If @var{type} is not given, the default type depends on the capabilities
12166 of the assembler and linker used.  @var{type} may be one of
12167 @samp{none} (don't compress debug sections), or @samp{zlib} (use zlib
12168 compression in ELF gABI format).  If the linker doesn't support writing
12169 compressed debug sections, the option is rejected.  Otherwise, if the
12170 assembler does not support them, @option{-gz} is silently ignored when
12171 producing object files.
12173 @opindex femit-struct-debug-baseonly
12174 @item -femit-struct-debug-baseonly
12175 Emit debug information for struct-like types
12176 only when the base name of the compilation source file
12177 matches the base name of file in which the struct is defined.
12179 This option substantially reduces the size of debugging information,
12180 but at significant potential loss in type information to the debugger.
12181 See @option{-femit-struct-debug-reduced} for a less aggressive option.
12182 See @option{-femit-struct-debug-detailed} for more detailed control.
12184 This option works only with DWARF debug output.
12186 @opindex femit-struct-debug-reduced
12187 @item -femit-struct-debug-reduced
12188 Emit debug information for struct-like types
12189 only when the base name of the compilation source file
12190 matches the base name of file in which the type is defined,
12191 unless the struct is a template or defined in a system header.
12193 This option significantly reduces the size of debugging information,
12194 with some potential loss in type information to the debugger.
12195 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
12196 See @option{-femit-struct-debug-detailed} for more detailed control.
12198 This option works only with DWARF debug output.
12200 @opindex femit-struct-debug-detailed
12201 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
12202 Specify the struct-like types
12203 for which the compiler generates debug information.
12204 The intent is to reduce duplicate struct debug information
12205 between different object files within the same program.
12207 This option is a detailed version of
12208 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
12209 which serves for most needs.
12211 A specification has the syntax@*
12212 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
12214 The optional first word limits the specification to
12215 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
12216 A struct type is used directly when it is the type of a variable, member.
12217 Indirect uses arise through pointers to structs.
12218 That is, when use of an incomplete struct is valid, the use is indirect.
12219 An example is
12220 @samp{struct one direct; struct two * indirect;}.
12222 The optional second word limits the specification to
12223 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
12224 Generic structs are a bit complicated to explain.
12225 For C++, these are non-explicit specializations of template classes,
12226 or non-template classes within the above.
12227 Other programming languages have generics,
12228 but @option{-femit-struct-debug-detailed} does not yet implement them.
12230 The third word specifies the source files for those
12231 structs for which the compiler should emit debug information.
12232 The values @samp{none} and @samp{any} have the normal meaning.
12233 The value @samp{base} means that
12234 the base of name of the file in which the type declaration appears
12235 must match the base of the name of the main compilation file.
12236 In practice, this means that when compiling @file{foo.c}, debug information
12237 is generated for types declared in that file and @file{foo.h},
12238 but not other header files.
12239 The value @samp{sys} means those types satisfying @samp{base}
12240 or declared in system or compiler headers.
12242 You may need to experiment to determine the best settings for your application.
12244 The default is @option{-femit-struct-debug-detailed=all}.
12246 This option works only with DWARF debug output.
12248 @opindex fdwarf2-cfi-asm
12249 @opindex fno-dwarf2-cfi-asm
12250 @item -fno-dwarf2-cfi-asm
12251 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
12252 instead of using GAS @code{.cfi_*} directives.
12254 @opindex feliminate-unused-debug-types
12255 @opindex fno-eliminate-unused-debug-types
12256 @item -fno-eliminate-unused-debug-types
12257 Normally, when producing DWARF output, GCC avoids producing debug symbol 
12258 output for types that are nowhere used in the source file being compiled.
12259 Sometimes it is useful to have GCC emit debugging
12260 information for all types declared in a compilation
12261 unit, regardless of whether or not they are actually used
12262 in that compilation unit, for example 
12263 if, in the debugger, you want to cast a value to a type that is
12264 not actually used in your program (but is declared).  More often,
12265 however, this results in a significant amount of wasted space.
12266 @end table
12268 @node Optimize Options
12269 @section Options That Control Optimization
12270 @cindex optimize options
12271 @cindex options, optimization
12273 These options control various sorts of optimizations.
12275 Without any optimization option, the compiler's goal is to reduce the
12276 cost of compilation and to make debugging produce the expected
12277 results.  Statements are independent: if you stop the program with a
12278 breakpoint between statements, you can then assign a new value to any
12279 variable or change the program counter to any other statement in the
12280 function and get exactly the results you expect from the source
12281 code.
12283 Turning on optimization flags makes the compiler attempt to improve
12284 the performance and/or code size at the expense of compilation time
12285 and possibly the ability to debug the program.
12287 The compiler performs optimization based on the knowledge it has of the
12288 program.  Compiling multiple files at once to a single output file mode allows
12289 the compiler to use information gained from all of the files when compiling
12290 each of them.
12292 Not all optimizations are controlled directly by a flag.  Only
12293 optimizations that have a flag are listed in this section.
12295 Most optimizations are completely disabled at @option{-O0} or if an
12296 @option{-O} level is not set on the command line, even if individual
12297 optimization flags are specified.  Similarly, @option{-Og} suppresses
12298 many optimization passes.
12300 Depending on the target and how GCC was configured, a slightly different
12301 set of optimizations may be enabled at each @option{-O} level than
12302 those listed here.  You can invoke GCC with @option{-Q --help=optimizers}
12303 to find out the exact set of optimizations that are enabled at each level.
12304 @xref{Overall Options}, for examples.
12306 @table @gcctabopt
12307 @opindex O
12308 @opindex O1
12309 @item -O
12310 @itemx -O1
12311 Optimize.  Optimizing compilation takes somewhat more time, and a lot
12312 more memory for a large function.
12314 With @option{-O}, the compiler tries to reduce code size and execution
12315 time, without performing any optimizations that take a great deal of
12316 compilation time.
12318 @c Note that in addition to the default_options_table list in opts.cc,
12319 @c several optimization flags default to true but control optimization
12320 @c passes that are explicitly disabled at -O0.
12322 @option{-O} turns on the following optimization flags:
12324 @c Please keep the following list alphabetized.
12325 @gccoptlist{-fauto-inc-dec
12326 -fbranch-count-reg
12327 -fcombine-stack-adjustments
12328 -fcompare-elim
12329 -fcprop-registers
12330 -fdce
12331 -fdefer-pop
12332 -fdelayed-branch
12333 -fdse
12334 -fforward-propagate
12335 -fguess-branch-probability
12336 -fif-conversion
12337 -fif-conversion2
12338 -finline-functions-called-once
12339 -fipa-modref
12340 -fipa-profile
12341 -fipa-pure-const
12342 -fipa-reference
12343 -fipa-reference-addressable
12344 -fmerge-constants
12345 -fmove-loop-invariants
12346 -fmove-loop-stores
12347 -fomit-frame-pointer
12348 -freorder-blocks
12349 -fshrink-wrap
12350 -fshrink-wrap-separate
12351 -fsplit-wide-types
12352 -fssa-backprop
12353 -fssa-phiopt
12354 -ftree-bit-ccp
12355 -ftree-ccp
12356 -ftree-ch
12357 -ftree-coalesce-vars
12358 -ftree-copy-prop
12359 -ftree-dce
12360 -ftree-dominator-opts
12361 -ftree-dse
12362 -ftree-forwprop
12363 -ftree-fre
12364 -ftree-phiprop
12365 -ftree-pta
12366 -ftree-scev-cprop
12367 -ftree-sink
12368 -ftree-slsr
12369 -ftree-sra
12370 -ftree-ter
12371 -funit-at-a-time}
12373 @opindex O2
12374 @item -O2
12375 Optimize even more.  GCC performs nearly all supported optimizations
12376 that do not involve a space-speed tradeoff.
12377 As compared to @option{-O}, this option increases both compilation time
12378 and the performance of the generated code.
12380 @option{-O2} turns on all optimization flags specified by @option{-O1}.  It
12381 also turns on the following optimization flags:
12383 @c Please keep the following list alphabetized!
12384 @gccoptlist{-falign-functions  -falign-jumps
12385 -falign-labels  -falign-loops
12386 -fcaller-saves
12387 -fcode-hoisting
12388 -fcrossjumping
12389 -fcse-follow-jumps  -fcse-skip-blocks
12390 -fdelete-null-pointer-checks
12391 -fdevirtualize  -fdevirtualize-speculatively
12392 -fexpensive-optimizations
12393 -ffinite-loops
12394 -fgcse  -fgcse-lm
12395 -fhoist-adjacent-loads
12396 -finline-functions
12397 -finline-small-functions
12398 -findirect-inlining
12399 -fipa-bit-cp  -fipa-cp  -fipa-icf
12400 -fipa-ra  -fipa-sra  -fipa-vrp
12401 -fisolate-erroneous-paths-dereference
12402 -flra-remat
12403 -foptimize-sibling-calls
12404 -foptimize-strlen
12405 -fpartial-inlining
12406 -fpeephole2
12407 -freorder-blocks-algorithm=stc
12408 -freorder-blocks-and-partition  -freorder-functions
12409 -frerun-cse-after-loop
12410 -fschedule-insns  -fschedule-insns2
12411 -fsched-interblock  -fsched-spec
12412 -fstore-merging
12413 -fstrict-aliasing
12414 -fthread-jumps
12415 -ftree-builtin-call-dce
12416 -ftree-loop-vectorize
12417 -ftree-pre
12418 -ftree-slp-vectorize
12419 -ftree-switch-conversion  -ftree-tail-merge
12420 -ftree-vrp
12421 -fvect-cost-model=very-cheap}
12423 Please note the warning under @option{-fgcse} about
12424 invoking @option{-O2} on programs that use computed gotos.
12426 @opindex O3
12427 @item -O3
12428 Optimize yet more.  @option{-O3} turns on all optimizations specified
12429 by @option{-O2} and also turns on the following optimization flags:
12431 @c Please keep the following list alphabetized!
12432 @gccoptlist{-fgcse-after-reload
12433 -fipa-cp-clone
12434 -floop-interchange
12435 -floop-unroll-and-jam
12436 -fpeel-loops
12437 -fpredictive-commoning
12438 -fsplit-loops
12439 -fsplit-paths
12440 -ftree-loop-distribution
12441 -ftree-partial-pre
12442 -funswitch-loops
12443 -fvect-cost-model=dynamic
12444 -fversion-loops-for-strides}
12446 @opindex O0
12447 @item -O0
12448 Reduce compilation time and make debugging produce the expected
12449 results.  This is the default.
12451 @opindex Os
12452 @item -Os
12453 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations 
12454 except those that often increase code size:
12456 @gccoptlist{-falign-functions  -falign-jumps
12457 -falign-labels  -falign-loops
12458 -fprefetch-loop-arrays  -freorder-blocks-algorithm=stc}
12460 It also enables @option{-finline-functions}, causes the compiler to tune for
12461 code size rather than execution speed, and performs further optimizations
12462 designed to reduce code size.
12464 @opindex Ofast
12465 @item -Ofast
12466 Disregard strict standards compliance.  @option{-Ofast} enables all
12467 @option{-O3} optimizations.  It also enables optimizations that are not
12468 valid for all standard-compliant programs.
12469 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
12470 and the Fortran-specific @option{-fstack-arrays}, unless
12471 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
12472 It turns off @option{-fsemantic-interposition}.
12474 @opindex Og
12475 @item -Og
12476 Optimize debugging experience.  @option{-Og} should be the optimization
12477 level of choice for the standard edit-compile-debug cycle, offering
12478 a reasonable level of optimization while maintaining fast compilation
12479 and a good debugging experience.  It is a better choice than @option{-O0}
12480 for producing debuggable code because some compiler passes
12481 that collect debug information are disabled at @option{-O0}.
12483 Like @option{-O0}, @option{-Og} completely disables a number of 
12484 optimization passes so that individual options controlling them have
12485 no effect.  Otherwise @option{-Og} enables all @option{-O1} 
12486 optimization flags except for those that may interfere with debugging:
12488 @gccoptlist{-fbranch-count-reg  -fdelayed-branch
12489 -fdse  -fif-conversion  -fif-conversion2
12490 -finline-functions-called-once
12491 -fmove-loop-invariants  -fmove-loop-stores  -fssa-phiopt
12492 -ftree-bit-ccp  -ftree-dse  -ftree-pta  -ftree-sra}
12494 @opindex Oz
12495 @item -Oz
12496 Optimize aggressively for size rather than speed.  This may increase
12497 the number of instructions executed if those instructions require
12498 fewer bytes to encode.  @option{-Oz} behaves similarly to @option{-Os}
12499 including enabling most @option{-O2} optimizations.
12501 @end table
12503 If you use multiple @option{-O} options, with or without level numbers,
12504 the last such option is the one that is effective.
12506 Options of the form @option{-f@var{flag}} specify machine-independent
12507 flags.  Most flags have both positive and negative forms; the negative
12508 form of @option{-ffoo} is @option{-fno-foo}.  In the table
12509 below, only one of the forms is listed---the one you typically 
12510 use.  You can figure out the other form by either removing @samp{no-}
12511 or adding it.
12513 The following options control specific optimizations.  They are either
12514 activated by @option{-O} options or are related to ones that are.  You
12515 can use the following flags in the rare cases when ``fine-tuning'' of
12516 optimizations to be performed is desired.
12518 @table @gcctabopt
12519 @opindex fno-defer-pop
12520 @opindex fdefer-pop
12521 @item -fno-defer-pop
12522 For machines that must pop arguments after a function call, always pop 
12523 the arguments as soon as each function returns.  
12524 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
12525 this allows the compiler to let arguments accumulate on the stack for several
12526 function calls and pop them all at once.
12528 @opindex fforward-propagate
12529 @item -fforward-propagate
12530 Perform a forward propagation pass on RTL@.  The pass tries to combine two
12531 instructions and checks if the result can be simplified.  If loop unrolling
12532 is active, two passes are performed and the second is scheduled after
12533 loop unrolling.
12535 This option is enabled by default at optimization levels @option{-O1},
12536 @option{-O2}, @option{-O3}, @option{-Os}.
12538 @opindex ffp-contract
12539 @item -ffp-contract=@var{style}
12540 @option{-ffp-contract=off} disables floating-point expression contraction.
12541 @option{-ffp-contract=fast} enables floating-point expression contraction
12542 such as forming of fused multiply-add operations if the target has
12543 native support for them.
12544 @option{-ffp-contract=on} enables floating-point expression contraction
12545 if allowed by the language standard.  This is implemented for C and C++,
12546 where it enables contraction within one expression, but not across
12547 different statements.
12549 The default is @option{-ffp-contract=off} for C in a standards compliant mode
12550 (@option{-std=c11} or similar), @option{-ffp-contract=fast} otherwise.
12552 @opindex fomit-frame-pointer
12553 @item -fomit-frame-pointer
12554 Omit the frame pointer in functions that don't need one.  This avoids the
12555 instructions to save, set up and restore the frame pointer; on many targets
12556 it also makes an extra register available.
12558 On some targets this flag has no effect because the standard calling sequence
12559 always uses a frame pointer, so it cannot be omitted.
12561 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
12562 is used in all functions.  Several targets always omit the frame pointer in
12563 leaf functions.
12565 Enabled by default at @option{-O1} and higher.
12567 @opindex foptimize-sibling-calls
12568 @item -foptimize-sibling-calls
12569 Optimize sibling and tail recursive calls.
12571 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12573 @opindex foptimize-strlen
12574 @item -foptimize-strlen
12575 Optimize various standard C string functions (e.g.@: @code{strlen},
12576 @code{strchr} or @code{strcpy}) and
12577 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
12579 Enabled at levels @option{-O2}, @option{-O3}.
12581 @opindex finline-stringops
12582 @item -finline-stringops[=@var{fn}]
12583 Expand memory and string operations (for now, only @code{memset})
12584 inline, even when the length is variable or big enough as to require
12585 looping.  This is most useful along with @option{-ffreestanding} and
12586 @option{-fno-builtin}.
12588 In some circumstances, it enables the compiler to generate code that
12589 takes advantage of known alignment and length multipliers, but even then
12590 it may be less efficient than optimized runtime implementations, and
12591 grow code size so much that even a less performant but shared
12592 implementation runs faster due to better use of code caches.  This
12593 option is disabled by default.
12595 @opindex fno-inline
12596 @opindex finline
12597 @item -fno-inline
12598 Do not expand any functions inline apart from those marked with
12599 the @code{always_inline} attribute.  This is the default when not
12600 optimizing.
12602 Single functions can be exempted from inlining by marking them
12603 with the @code{noinline} attribute.
12605 @opindex finline-small-functions
12606 @item -finline-small-functions
12607 Integrate functions into their callers when their body is smaller than expected
12608 function call code (so overall size of program gets smaller).  The compiler
12609 heuristically decides which functions are simple enough to be worth integrating
12610 in this way.  This inlining applies to all functions, even those not declared
12611 inline.
12613 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12615 @opindex findirect-inlining
12616 @item -findirect-inlining
12617 Inline also indirect calls that are discovered to be known at compile
12618 time thanks to previous inlining.  This option has any effect only
12619 when inlining itself is turned on by the @option{-finline-functions}
12620 or @option{-finline-small-functions} options.
12622 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12624 @opindex finline-functions
12625 @item -finline-functions
12626 Consider all functions for inlining, even if they are not declared inline.
12627 The compiler heuristically decides which functions are worth integrating
12628 in this way.
12630 If all calls to a given function are integrated, and the function is
12631 declared @code{static}, then the function is normally not output as
12632 assembler code in its own right.
12634 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.  Also enabled
12635 by @option{-fprofile-use} and @option{-fauto-profile}.
12637 @opindex finline-functions-called-once
12638 @item -finline-functions-called-once
12639 Consider all @code{static} functions called once for inlining into their
12640 caller even if they are not marked @code{inline}.  If a call to a given
12641 function is integrated, then the function is not output as assembler code
12642 in its own right.
12644 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
12645 but not @option{-Og}.
12647 @opindex fearly-inlining
12648 @item -fearly-inlining
12649 Inline functions marked by @code{always_inline} and functions whose body seems
12650 smaller than the function call overhead early before doing
12651 @option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
12652 makes profiling significantly cheaper and usually inlining faster on programs
12653 having large chains of nested wrapper functions.
12655 Enabled by default.
12657 @opindex fipa-sra
12658 @item -fipa-sra
12659 Perform interprocedural scalar replacement of aggregates, removal of
12660 unused parameters and replacement of parameters passed by reference
12661 by parameters passed by value.
12663 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
12665 @opindex finline-limit
12666 @item -finline-limit=@var{n}
12667 By default, GCC limits the size of functions that can be inlined.  This flag
12668 allows coarse control of this limit.  @var{n} is the size of functions that
12669 can be inlined in number of pseudo instructions.
12671 Inlining is actually controlled by a number of parameters, which may be
12672 specified individually by using @option{--param @var{name}=@var{value}}.
12673 The @option{-finline-limit=@var{n}} option sets some of these parameters
12674 as follows:
12676 @table @gcctabopt
12677 @item max-inline-insns-single
12678 is set to @var{n}/2.
12679 @item max-inline-insns-auto
12680 is set to @var{n}/2.
12681 @end table
12683 See below for a documentation of the individual
12684 parameters controlling inlining and for the defaults of these parameters.
12686 @emph{Note:} there may be no value to @option{-finline-limit} that results
12687 in default behavior.
12689 @emph{Note:} pseudo instruction represents, in this particular context, an
12690 abstract measurement of function's size.  In no way does it represent a count
12691 of assembly instructions and as such its exact meaning might change from one
12692 release to an another.
12694 @opindex fno-keep-inline-dllexport
12695 @opindex fkeep-inline-dllexport
12696 @item -fno-keep-inline-dllexport
12697 This is a more fine-grained version of @option{-fkeep-inline-functions},
12698 which applies only to functions that are declared using the @code{dllexport}
12699 attribute or declspec.  @xref{Function Attributes,,Declaring Attributes of
12700 Functions}.
12702 @opindex fkeep-inline-functions
12703 @item -fkeep-inline-functions
12704 In C, emit @code{static} functions that are declared @code{inline}
12705 into the object file, even if the function has been inlined into all
12706 of its callers.  This switch does not affect functions using the
12707 @code{extern inline} extension in GNU C90@.  In C++, emit any and all
12708 inline functions into the object file.
12710 @opindex fkeep-static-functions
12711 @item -fkeep-static-functions
12712 Emit @code{static} functions into the object file, even if the function
12713 is never used.
12715 @opindex fkeep-static-consts
12716 @item -fkeep-static-consts
12717 Emit variables declared @code{static const} when optimization isn't turned
12718 on, even if the variables aren't referenced.
12720 GCC enables this option by default.  If you want to force the compiler to
12721 check if a variable is referenced, regardless of whether or not
12722 optimization is turned on, use the @option{-fno-keep-static-consts} option.
12724 @opindex fmerge-constants
12725 @item -fmerge-constants
12726 Attempt to merge identical constants (string constants and floating-point
12727 constants) across compilation units.
12729 This option is the default for optimized compilation if the assembler and
12730 linker support it.  Use @option{-fno-merge-constants} to inhibit this
12731 behavior.
12733 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12735 @opindex fmerge-all-constants
12736 @item -fmerge-all-constants
12737 Attempt to merge identical constants and identical variables.
12739 This option implies @option{-fmerge-constants}.  In addition to
12740 @option{-fmerge-constants} this considers e.g.@: even constant initialized
12741 arrays or initialized constant variables with integral or floating-point
12742 types.  Languages like C or C++ require each variable, including multiple
12743 instances of the same variable in recursive calls, to have distinct locations,
12744 so using this option results in non-conforming
12745 behavior.
12747 @opindex fmodulo-sched
12748 @item -fmodulo-sched
12749 Perform swing modulo scheduling immediately before the first scheduling
12750 pass.  This pass looks at innermost loops and reorders their
12751 instructions by overlapping different iterations.
12753 @opindex fmodulo-sched-allow-regmoves
12754 @item -fmodulo-sched-allow-regmoves
12755 Perform more aggressive SMS-based modulo scheduling with register moves
12756 allowed.  By setting this flag certain anti-dependences edges are
12757 deleted, which triggers the generation of reg-moves based on the
12758 life-range analysis.  This option is effective only with
12759 @option{-fmodulo-sched} enabled.
12761 @opindex fno-branch-count-reg
12762 @opindex fbranch-count-reg
12763 @item -fno-branch-count-reg
12764 Disable the optimization pass that scans for opportunities to use 
12765 ``decrement and branch'' instructions on a count register instead of
12766 instruction sequences that decrement a register, compare it against zero, and
12767 then branch based upon the result.  This option is only meaningful on
12768 architectures that support such instructions, which include x86, PowerPC,
12769 IA-64 and S/390.  Note that the @option{-fno-branch-count-reg} option
12770 doesn't remove the decrement and branch instructions from the generated
12771 instruction stream introduced by other optimization passes.
12773 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
12774 except for @option{-Og}.
12776 @opindex fno-function-cse
12777 @opindex ffunction-cse
12778 @item -fno-function-cse
12779 Do not put function addresses in registers; make each instruction that
12780 calls a constant function contain the function's address explicitly.
12782 This option results in less efficient code, but some strange hacks
12783 that alter the assembler output may be confused by the optimizations
12784 performed when this option is not used.
12786 The default is @option{-ffunction-cse}
12788 @opindex fno-zero-initialized-in-bss
12789 @opindex fzero-initialized-in-bss
12790 @item -fno-zero-initialized-in-bss
12791 If the target supports a BSS section, GCC by default puts variables that
12792 are initialized to zero into BSS@.  This can save space in the resulting
12793 code.
12795 This option turns off this behavior because some programs explicitly
12796 rely on variables going to the data section---e.g., so that the
12797 resulting executable can find the beginning of that section and/or make
12798 assumptions based on that.
12800 The default is @option{-fzero-initialized-in-bss}.
12802 @opindex fthread-jumps
12803 @item -fthread-jumps
12804 Perform optimizations that check to see if a jump branches to a
12805 location where another comparison subsumed by the first is found.  If
12806 so, the first branch is redirected to either the destination of the
12807 second branch or a point immediately following it, depending on whether
12808 the condition is known to be true or false.
12810 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12812 @opindex fsplit-wide-types
12813 @item -fsplit-wide-types
12814 When using a type that occupies multiple registers, such as @code{long
12815 long} on a 32-bit system, split the registers apart and allocate them
12816 independently.  This normally generates better code for those types,
12817 but may make debugging more difficult.
12819 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3},
12820 @option{-Os}.
12822 @opindex fsplit-wide-types-early
12823 @item -fsplit-wide-types-early
12824 Fully split wide types early, instead of very late.
12825 This option has no effect unless @option{-fsplit-wide-types} is turned on.
12827 This is the default on some targets.
12829 @opindex fcse-follow-jumps
12830 @item -fcse-follow-jumps
12831 In common subexpression elimination (CSE), scan through jump instructions
12832 when the target of the jump is not reached by any other path.  For
12833 example, when CSE encounters an @code{if} statement with an
12834 @code{else} clause, CSE follows the jump when the condition
12835 tested is false.
12837 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12839 @opindex fcse-skip-blocks
12840 @item -fcse-skip-blocks
12841 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
12842 follow jumps that conditionally skip over blocks.  When CSE
12843 encounters a simple @code{if} statement with no else clause,
12844 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
12845 body of the @code{if}.
12847 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12849 @opindex frerun-cse-after-loop
12850 @item -frerun-cse-after-loop
12851 Re-run common subexpression elimination after loop optimizations are
12852 performed.
12854 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12856 @opindex fgcse
12857 @item -fgcse
12858 Perform a global common subexpression elimination pass.
12859 This pass also performs global constant and copy propagation.
12861 @emph{Note:} When compiling a program using computed gotos, a GCC
12862 extension, you may get better run-time performance if you disable
12863 the global common subexpression elimination pass by adding
12864 @option{-fno-gcse} to the command line.
12866 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12868 @opindex fgcse-lm
12869 @item -fgcse-lm
12870 When @option{-fgcse-lm} is enabled, global common subexpression elimination
12871 attempts to move loads that are only killed by stores into themselves.  This
12872 allows a loop containing a load/store sequence to be changed to a load outside
12873 the loop, and a copy/store within the loop.
12875 Enabled by default when @option{-fgcse} is enabled.
12877 @opindex fgcse-sm
12878 @item -fgcse-sm
12879 When @option{-fgcse-sm} is enabled, a store motion pass is run after
12880 global common subexpression elimination.  This pass attempts to move
12881 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
12882 loops containing a load/store sequence can be changed to a load before
12883 the loop and a store after the loop.
12885 Not enabled at any optimization level.
12887 @opindex fgcse-las
12888 @item -fgcse-las
12889 When @option{-fgcse-las} is enabled, the global common subexpression
12890 elimination pass eliminates redundant loads that come after stores to the
12891 same memory location (both partial and full redundancies).
12893 Not enabled at any optimization level.
12895 @opindex fgcse-after-reload
12896 @item -fgcse-after-reload
12897 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
12898 pass is performed after reload.  The purpose of this pass is to clean up
12899 redundant spilling.
12901 Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}.
12903 @opindex faggressive-loop-optimizations
12904 @item -faggressive-loop-optimizations
12905 This option tells the loop optimizer to use language constraints to
12906 derive bounds for the number of iterations of a loop.  This assumes that
12907 loop code does not invoke undefined behavior by for example causing signed
12908 integer overflows or out-of-bound array accesses.  The bounds for the
12909 number of iterations of a loop are used to guide loop unrolling and peeling
12910 and loop exit test optimizations.
12911 This option is enabled by default.
12913 @opindex funconstrained-commons
12914 @item -funconstrained-commons
12915 This option tells the compiler that variables declared in common blocks
12916 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
12917 prevents certain optimizations that depend on knowing the array bounds.
12919 @opindex fcrossjumping
12920 @item -fcrossjumping
12921 Perform cross-jumping transformation.
12922 This transformation unifies equivalent code and saves code size.  The
12923 resulting code may or may not perform better than without cross-jumping.
12925 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12927 @opindex fauto-inc-dec
12928 @item -fauto-inc-dec
12929 Combine increments or decrements of addresses with memory accesses.
12930 This pass is always skipped on architectures that do not have
12931 instructions to support this.  Enabled by default at @option{-O1} and
12932 higher on architectures that support this.
12934 @opindex fdce
12935 @item -fdce
12936 Perform dead code elimination (DCE) on RTL@.
12937 Enabled by default at @option{-O1} and higher.
12939 @opindex fdse
12940 @item -fdse
12941 Perform dead store elimination (DSE) on RTL@.
12942 Enabled by default at @option{-O1} and higher.
12944 @opindex fif-conversion
12945 @item -fif-conversion
12946 Attempt to transform conditional jumps into branch-less equivalents.  This
12947 includes use of conditional moves, min, max, set flags and abs instructions, and
12948 some tricks doable by standard arithmetics.  The use of conditional execution
12949 on chips where it is available is controlled by @option{-fif-conversion2}.
12951 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12952 not with @option{-Og}.
12954 @opindex fif-conversion2
12955 @item -fif-conversion2
12956 Use conditional execution (where available) to transform conditional jumps into
12957 branch-less equivalents.
12959 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12960 not with @option{-Og}.
12962 @opindex fdeclone-ctor-dtor
12963 @item -fdeclone-ctor-dtor
12964 The C++ ABI requires multiple entry points for constructors and
12965 destructors: one for a base subobject, one for a complete object, and
12966 one for a virtual destructor that calls operator delete afterwards.
12967 For a hierarchy with virtual bases, the base and complete variants are
12968 clones, which means two copies of the function.  With this option, the
12969 base and complete variants are changed to be thunks that call a common
12970 implementation.
12972 Enabled by @option{-Os}.
12974 @opindex fdelete-null-pointer-checks
12975 @item -fdelete-null-pointer-checks
12976 Assume that programs cannot safely dereference null pointers, and that
12977 no code or data element resides at address zero.
12978 This option enables simple constant
12979 folding optimizations at all optimization levels.  In addition, other
12980 optimization passes in GCC use this flag to control global dataflow
12981 analyses that eliminate useless checks for null pointers; these assume
12982 that a memory access to address zero always results in a trap, so
12983 that if a pointer is checked after it has already been dereferenced,
12984 it cannot be null.
12986 Note however that in some environments this assumption is not true.
12987 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
12988 for programs that depend on that behavior.
12990 This option is enabled by default on most targets.  On Nios II ELF, it
12991 defaults to off.  On AVR and MSP430, this option is completely disabled.
12993 Passes that use the dataflow information
12994 are enabled independently at different optimization levels.
12996 @opindex fdevirtualize
12997 @item -fdevirtualize
12998 Attempt to convert calls to virtual functions to direct calls.  This
12999 is done both within a procedure and interprocedurally as part of
13000 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
13001 propagation (@option{-fipa-cp}).
13002 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13004 @opindex fdevirtualize-speculatively
13005 @item -fdevirtualize-speculatively
13006 Attempt to convert calls to virtual functions to speculative direct calls.
13007 Based on the analysis of the type inheritance graph, determine for a given call
13008 the set of likely targets. If the set is small, preferably of size 1, change
13009 the call into a conditional deciding between direct and indirect calls.  The
13010 speculative calls enable more optimizations, such as inlining.  When they seem
13011 useless after further optimization, they are converted back into original form.
13013 @opindex fdevirtualize-at-ltrans
13014 @item -fdevirtualize-at-ltrans
13015 Stream extra information needed for aggressive devirtualization when running
13016 the link-time optimizer in local transformation mode.  
13017 This option enables more devirtualization but
13018 significantly increases the size of streamed data. For this reason it is
13019 disabled by default.
13021 @opindex fexpensive-optimizations
13022 @item -fexpensive-optimizations
13023 Perform a number of minor optimizations that are relatively expensive.
13025 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13027 @opindex free
13028 @item -free
13029 Attempt to remove redundant extension instructions.  This is especially
13030 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
13031 registers after writing to their lower 32-bit half.
13033 Enabled for Alpha, AArch64, LoongArch, PowerPC, RISC-V, SPARC, h83000 and x86 at
13034 levels @option{-O2}, @option{-O3}, @option{-Os}.
13036 @opindex fno-lifetime-dse
13037 @opindex flifetime-dse
13038 @item -fno-lifetime-dse
13039 In C++ the value of an object is only affected by changes within its
13040 lifetime: when the constructor begins, the object has an indeterminate
13041 value, and any changes during the lifetime of the object are dead when
13042 the object is destroyed.  Normally dead store elimination will take
13043 advantage of this; if your code relies on the value of the object
13044 storage persisting beyond the lifetime of the object, you can use this
13045 flag to disable this optimization.  To preserve stores before the
13046 constructor starts (e.g.@: because your operator new clears the object
13047 storage) but still treat the object as dead after the destructor, you
13048 can use @option{-flifetime-dse=1}.  The default behavior can be
13049 explicitly selected with @option{-flifetime-dse=2}.
13050 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
13052 @opindex flive-range-shrinkage
13053 @item -flive-range-shrinkage
13054 Attempt to decrease register pressure through register live range
13055 shrinkage.  This is helpful for fast processors with small or moderate
13056 size register sets.
13058 @opindex fira-algorithm
13059 @item -fira-algorithm=@var{algorithm}
13060 Use the specified coloring algorithm for the integrated register
13061 allocator.  The @var{algorithm} argument can be @samp{priority}, which
13062 specifies Chow's priority coloring, or @samp{CB}, which specifies
13063 Chaitin-Briggs coloring.  Chaitin-Briggs coloring is not implemented
13064 for all architectures, but for those targets that do support it, it is
13065 the default because it generates better code.
13067 @opindex fira-region
13068 @item -fira-region=@var{region}
13069 Use specified regions for the integrated register allocator.  The
13070 @var{region} argument should be one of the following:
13072 @table @samp
13074 @item all
13075 Use all loops as register allocation regions.
13076 This can give the best results for machines with a small and/or
13077 irregular register set.
13079 @item mixed
13080 Use all loops except for loops with small register pressure 
13081 as the regions.  This value usually gives
13082 the best results in most cases and for most architectures,
13083 and is enabled by default when compiling with optimization for speed
13084 (@option{-O}, @option{-O2}, @dots{}).
13086 @item one
13087 Use all functions as a single region.  
13088 This typically results in the smallest code size, and is enabled by default for
13089 @option{-Os} or @option{-O0}.
13091 @end table
13093 @opindex fira-hoist-pressure
13094 @item -fira-hoist-pressure
13095 Use IRA to evaluate register pressure in the code hoisting pass for
13096 decisions to hoist expressions.  This option usually results in smaller
13097 code, but it can slow the compiler down.
13099 This option is enabled at level @option{-Os} for all targets.
13101 @opindex fira-loop-pressure
13102 @item -fira-loop-pressure
13103 Use IRA to evaluate register pressure in loops for decisions to move
13104 loop invariants.  This option usually results in generation
13105 of faster and smaller code on machines with large register files (>= 32
13106 registers), but it can slow the compiler down.
13108 This option is enabled at level @option{-O3} for some targets.
13110 @opindex fno-ira-share-save-slots
13111 @opindex fira-share-save-slots
13112 @item -fno-ira-share-save-slots
13113 Disable sharing of stack slots used for saving call-used hard
13114 registers living through a call.  Each hard register gets a
13115 separate stack slot, and as a result function stack frames are
13116 larger.
13118 @opindex fno-ira-share-spill-slots
13119 @opindex fira-share-spill-slots
13120 @item -fno-ira-share-spill-slots
13121 Disable sharing of stack slots allocated for pseudo-registers.  Each
13122 pseudo-register that does not get a hard register gets a separate
13123 stack slot, and as a result function stack frames are larger.
13125 @opindex flra-remat
13126 @item -flra-remat
13127 Enable CFG-sensitive rematerialization in LRA.  Instead of loading
13128 values of spilled pseudos, LRA tries to rematerialize (recalculate)
13129 values if it is profitable.
13131 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13133 @opindex fdelayed-branch
13134 @item -fdelayed-branch
13135 If supported for the target machine, attempt to reorder instructions
13136 to exploit instruction slots available after delayed branch
13137 instructions.
13139 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os},
13140 but not at @option{-Og}.
13142 @opindex fschedule-insns
13143 @item -fschedule-insns
13144 If supported for the target machine, attempt to reorder instructions to
13145 eliminate execution stalls due to required data being unavailable.  This
13146 helps machines that have slow floating point or memory load instructions
13147 by allowing other instructions to be issued until the result of the load
13148 or floating-point instruction is required.
13150 Enabled at levels @option{-O2}, @option{-O3}.
13152 @opindex fschedule-insns2
13153 @item -fschedule-insns2
13154 Similar to @option{-fschedule-insns}, but requests an additional pass of
13155 instruction scheduling after register allocation has been done.  This is
13156 especially useful on machines with a relatively small number of
13157 registers and where memory load instructions take more than one cycle.
13159 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13161 @opindex fno-sched-interblock
13162 @opindex fsched-interblock
13163 @item -fno-sched-interblock
13164 Disable instruction scheduling across basic blocks, which
13165 is normally enabled when scheduling before register allocation, i.e.@:
13166 with @option{-fschedule-insns} or at @option{-O2} or higher.
13168 @opindex fno-sched-spec
13169 @opindex fsched-spec
13170 @item -fno-sched-spec
13171 Disable speculative motion of non-load instructions, which
13172 is normally enabled when scheduling before register allocation, i.e.@:
13173 with @option{-fschedule-insns} or at @option{-O2} or higher.
13175 @opindex fsched-pressure
13176 @item -fsched-pressure
13177 Enable register pressure sensitive insn scheduling before register
13178 allocation.  This only makes sense when scheduling before register
13179 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
13180 @option{-O2} or higher.  Usage of this option can improve the
13181 generated code and decrease its size by preventing register pressure
13182 increase above the number of available hard registers and subsequent
13183 spills in register allocation.
13185 @opindex fsched-spec-load
13186 @item -fsched-spec-load
13187 Allow speculative motion of some load instructions.  This only makes
13188 sense when scheduling before register allocation, i.e.@: with
13189 @option{-fschedule-insns} or at @option{-O2} or higher.
13191 @opindex fsched-spec-load-dangerous
13192 @item -fsched-spec-load-dangerous
13193 Allow speculative motion of more load instructions.  This only makes
13194 sense when scheduling before register allocation, i.e.@: with
13195 @option{-fschedule-insns} or at @option{-O2} or higher.
13197 @opindex fsched-stalled-insns
13198 @item -fsched-stalled-insns
13199 @itemx -fsched-stalled-insns=@var{n}
13200 Define how many insns (if any) can be moved prematurely from the queue
13201 of stalled insns into the ready list during the second scheduling pass.
13202 @option{-fno-sched-stalled-insns} means that no insns are moved
13203 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
13204 on how many queued insns can be moved prematurely.
13205 @option{-fsched-stalled-insns} without a value is equivalent to
13206 @option{-fsched-stalled-insns=1}.
13208 @opindex fsched-stalled-insns-dep
13209 @item -fsched-stalled-insns-dep
13210 @itemx -fsched-stalled-insns-dep=@var{n}
13211 Define how many insn groups (cycles) are examined for a dependency
13212 on a stalled insn that is a candidate for premature removal from the queue
13213 of stalled insns.  This has an effect only during the second scheduling pass,
13214 and only if @option{-fsched-stalled-insns} is used.
13215 @option{-fno-sched-stalled-insns-dep} is equivalent to
13216 @option{-fsched-stalled-insns-dep=0}.
13217 @option{-fsched-stalled-insns-dep} without a value is equivalent to
13218 @option{-fsched-stalled-insns-dep=1}.
13220 @opindex fsched2-use-superblocks
13221 @item -fsched2-use-superblocks
13222 When scheduling after register allocation, use superblock scheduling.
13223 This allows motion across basic block boundaries,
13224 resulting in faster schedules.  This option is experimental, as not all machine
13225 descriptions used by GCC model the CPU closely enough to avoid unreliable
13226 results from the algorithm.
13228 This only makes sense when scheduling after register allocation, i.e.@: with
13229 @option{-fschedule-insns2} or at @option{-O2} or higher.
13231 @opindex fsched-group-heuristic
13232 @item -fsched-group-heuristic
13233 Enable the group heuristic in the scheduler.  This heuristic favors
13234 the instruction that belongs to a schedule group.  This is enabled
13235 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
13236 or @option{-fschedule-insns2} or at @option{-O2} or higher.
13238 @opindex fsched-critical-path-heuristic
13239 @item -fsched-critical-path-heuristic
13240 Enable the critical-path heuristic in the scheduler.  This heuristic favors
13241 instructions on the critical path.  This is enabled by default when
13242 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
13243 or @option{-fschedule-insns2} or at @option{-O2} or higher.
13245 @opindex fsched-spec-insn-heuristic
13246 @item -fsched-spec-insn-heuristic
13247 Enable the speculative instruction heuristic in the scheduler.  This
13248 heuristic favors speculative instructions with greater dependency weakness.
13249 This is enabled by default when scheduling is enabled, i.e.@:
13250 with @option{-fschedule-insns} or @option{-fschedule-insns2}
13251 or at @option{-O2} or higher.
13253 @opindex fsched-rank-heuristic
13254 @item -fsched-rank-heuristic
13255 Enable the rank heuristic in the scheduler.  This heuristic favors
13256 the instruction belonging to a basic block with greater size or frequency.
13257 This is enabled by default when scheduling is enabled, i.e.@:
13258 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
13259 at @option{-O2} or higher.
13261 @opindex fsched-last-insn-heuristic
13262 @item -fsched-last-insn-heuristic
13263 Enable the last-instruction heuristic in the scheduler.  This heuristic
13264 favors the instruction that is less dependent on the last instruction
13265 scheduled.  This is enabled by default when scheduling is enabled,
13266 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
13267 at @option{-O2} or higher.
13269 @opindex fsched-dep-count-heuristic
13270 @item -fsched-dep-count-heuristic
13271 Enable the dependent-count heuristic in the scheduler.  This heuristic
13272 favors the instruction that has more instructions depending on it.
13273 This is enabled by default when scheduling is enabled, i.e.@:
13274 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
13275 at @option{-O2} or higher.
13277 @opindex freschedule-modulo-scheduled-loops
13278 @item -freschedule-modulo-scheduled-loops
13279 Modulo scheduling is performed before traditional scheduling.  If a loop
13280 is modulo scheduled, later scheduling passes may change its schedule.  
13281 Use this option to control that behavior.
13283 @opindex fselective-scheduling
13284 @item -fselective-scheduling
13285 Schedule instructions using selective scheduling algorithm.  Selective
13286 scheduling runs instead of the first scheduler pass.
13288 @opindex fselective-scheduling2
13289 @item -fselective-scheduling2
13290 Schedule instructions using selective scheduling algorithm.  Selective
13291 scheduling runs instead of the second scheduler pass.
13293 @opindex fsel-sched-pipelining
13294 @item -fsel-sched-pipelining
13295 Enable software pipelining of innermost loops during selective scheduling.
13296 This option has no effect unless one of @option{-fselective-scheduling} or
13297 @option{-fselective-scheduling2} is turned on.
13299 @opindex fsel-sched-pipelining-outer-loops
13300 @item -fsel-sched-pipelining-outer-loops
13301 When pipelining loops during selective scheduling, also pipeline outer loops.
13302 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
13304 @opindex fsemantic-interposition
13305 @item -fsemantic-interposition
13306 Some object formats, like ELF, allow interposing of symbols by the 
13307 dynamic linker.
13308 This means that for symbols exported from the DSO, the compiler cannot perform
13309 interprocedural propagation, inlining and other optimizations in anticipation
13310 that the function or variable in question may change. While this feature is
13311 useful, for example, to rewrite memory allocation functions by a debugging
13312 implementation, it is expensive in the terms of code quality.
13313 With @option{-fno-semantic-interposition} the compiler assumes that 
13314 if interposition happens for functions the overwriting function will have 
13315 precisely the same semantics (and side effects). 
13316 Similarly if interposition happens
13317 for variables, the constructor of the variable will be the same. The flag
13318 has no effect for functions explicitly declared inline 
13319 (where it is never allowed for interposition to change semantics) 
13320 and for symbols explicitly declared weak.
13322 @opindex fshrink-wrap
13323 @item -fshrink-wrap
13324 Emit function prologues only before parts of the function that need it,
13325 rather than at the top of the function.  This flag is enabled by default at
13326 @option{-O} and higher.
13328 @opindex fshrink-wrap-separate
13329 @item -fshrink-wrap-separate
13330 Shrink-wrap separate parts of the prologue and epilogue separately, so that
13331 those parts are only executed when needed.
13332 This option is on by default, but has no effect unless @option{-fshrink-wrap}
13333 is also turned on and the target supports this.
13335 @opindex fcaller-saves
13336 @item -fcaller-saves
13337 Enable allocation of values to registers that are clobbered by
13338 function calls, by emitting extra instructions to save and restore the
13339 registers around such calls.  Such allocation is done only when it
13340 seems to result in better code.
13342 This option is always enabled by default on certain machines, usually
13343 those which have no call-preserved registers to use instead.
13345 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13347 @opindex fcombine-stack-adjustments
13348 @item -fcombine-stack-adjustments
13349 Tracks stack adjustments (pushes and pops) and stack memory references
13350 and then tries to find ways to combine them.
13352 Enabled by default at @option{-O1} and higher.
13354 @opindex fipa-ra
13355 @item -fipa-ra
13356 Use caller save registers for allocation if those registers are not used by
13357 any called function.  In that case it is not necessary to save and restore
13358 them around calls.  This is only possible if called functions are part of
13359 same compilation unit as current function and they are compiled before it.
13361 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
13362 is disabled if generated code will be instrumented for profiling
13363 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
13364 exactly (this happens on targets that do not expose prologues
13365 and epilogues in RTL).
13367 @opindex fconserve-stack
13368 @item -fconserve-stack
13369 Attempt to minimize stack usage.  The compiler attempts to use less
13370 stack space, even if that makes the program slower.  This option
13371 implies setting the @option{large-stack-frame} parameter to 100
13372 and the @option{large-stack-frame-growth} parameter to 400.
13374 @opindex ftree-reassoc
13375 @item -ftree-reassoc
13376 Perform reassociation on trees.  This flag is enabled by default
13377 at @option{-O1} and higher.
13379 @opindex fcode-hoisting
13380 @item -fcode-hoisting
13381 Perform code hoisting.  Code hoisting tries to move the
13382 evaluation of expressions executed on all paths to the function exit
13383 as early as possible.  This is especially useful as a code size
13384 optimization, but it often helps for code speed as well.
13385 This flag is enabled by default at @option{-O2} and higher.
13387 @opindex ftree-pre
13388 @item -ftree-pre
13389 Perform partial redundancy elimination (PRE) on trees.  This flag is
13390 enabled by default at @option{-O2} and @option{-O3}.
13392 @opindex ftree-partial-pre
13393 @item -ftree-partial-pre
13394 Make partial redundancy elimination (PRE) more aggressive.  This flag is
13395 enabled by default at @option{-O3}.
13397 @opindex ftree-forwprop
13398 @item -ftree-forwprop
13399 Perform forward propagation on trees.  This flag is enabled by default
13400 at @option{-O1} and higher.
13402 @opindex ftree-fre
13403 @item -ftree-fre
13404 Perform full redundancy elimination (FRE) on trees.  The difference
13405 between FRE and PRE is that FRE only considers expressions
13406 that are computed on all paths leading to the redundant computation.
13407 This analysis is faster than PRE, though it exposes fewer redundancies.
13408 This flag is enabled by default at @option{-O1} and higher.
13410 @opindex ftree-phiprop
13411 @item -ftree-phiprop
13412 Perform hoisting of loads from conditional pointers on trees.  This
13413 pass is enabled by default at @option{-O1} and higher.
13415 @opindex fhoist-adjacent-loads
13416 @item -fhoist-adjacent-loads
13417 Speculatively hoist loads from both branches of an if-then-else if the
13418 loads are from adjacent locations in the same structure and the target
13419 architecture has a conditional move instruction.  This flag is enabled
13420 by default at @option{-O2} and higher.
13422 @opindex ftree-copy-prop
13423 @item -ftree-copy-prop
13424 Perform copy propagation on trees.  This pass eliminates unnecessary
13425 copy operations.  This flag is enabled by default at @option{-O1} and
13426 higher.
13428 @opindex fipa-pure-const
13429 @item -fipa-pure-const
13430 Discover which functions are pure or constant.
13431 Enabled by default at @option{-O1} and higher.
13433 @opindex fipa-reference
13434 @item -fipa-reference
13435 Discover which static variables do not escape the
13436 compilation unit.
13437 Enabled by default at @option{-O1} and higher.
13439 @opindex fipa-reference-addressable
13440 @item -fipa-reference-addressable
13441 Discover read-only, write-only and non-addressable static variables.
13442 Enabled by default at @option{-O1} and higher.
13444 @opindex fipa-stack-alignment
13445 @item -fipa-stack-alignment
13446 Reduce stack alignment on call sites if possible.
13447 Enabled by default.
13449 @opindex fipa-pta
13450 @item -fipa-pta
13451 Perform interprocedural pointer analysis and interprocedural modification
13452 and reference analysis.  This option can cause excessive memory and
13453 compile-time usage on large compilation units.  It is not enabled by
13454 default at any optimization level.
13456 @opindex fipa-profile
13457 @item -fipa-profile
13458 Perform interprocedural profile propagation.  The functions called only from
13459 cold functions are marked as cold. Also functions executed once (such as
13460 @code{cold}, @code{noreturn}, static constructors or destructors) are
13461 identified. Cold functions and loop less parts of functions executed once are
13462 then optimized for size.
13463 Enabled by default at @option{-O1} and higher.
13465 @opindex fipa-modref
13466 @item -fipa-modref
13467 Perform interprocedural mod/ref analysis.  This optimization analyzes the side
13468 effects of functions (memory locations that are modified or referenced) and
13469 enables better optimization across the function call boundary.  This flag is
13470 enabled by default at @option{-O1} and higher.
13472 @opindex fipa-cp
13473 @item -fipa-cp
13474 Perform interprocedural constant propagation.
13475 This optimization analyzes the program to determine when values passed
13476 to functions are constants and then optimizes accordingly.
13477 This optimization can substantially increase performance
13478 if the application has constants passed to functions.
13479 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
13480 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13482 @opindex fipa-cp-clone
13483 @item -fipa-cp-clone
13484 Perform function cloning to make interprocedural constant propagation stronger.
13485 When enabled, interprocedural constant propagation performs function cloning
13486 when externally visible function can be called with constant arguments.
13487 Because this optimization can create multiple copies of functions,
13488 it may significantly increase code size
13489 (see @option{--param ipa-cp-unit-growth=@var{value}}).
13490 This flag is enabled by default at @option{-O3}.
13491 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13493 @opindex fipa-bit-cp
13494 @item -fipa-bit-cp
13495 When enabled, perform interprocedural bitwise constant
13496 propagation. This flag is enabled by default at @option{-O2} and
13497 by @option{-fprofile-use} and @option{-fauto-profile}.
13498 It requires that @option{-fipa-cp} is enabled.  
13500 @opindex fipa-vrp
13501 @item -fipa-vrp
13502 When enabled, perform interprocedural propagation of value
13503 ranges. This flag is enabled by default at @option{-O2}. It requires
13504 that @option{-fipa-cp} is enabled.
13506 @opindex fipa-icf
13507 @item -fipa-icf
13508 Perform Identical Code Folding for functions and read-only variables.
13509 The optimization reduces code size and may disturb unwind stacks by replacing
13510 a function by equivalent one with a different name. The optimization works
13511 more effectively with link-time optimization enabled.
13513 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
13514 works on different levels and thus the optimizations are not same - there are
13515 equivalences that are found only by GCC and equivalences found only by Gold.
13517 This flag is enabled by default at @option{-O2} and @option{-Os}.
13519 @opindex flive-patching
13520 @item -flive-patching=@var{level}
13521 Control GCC's optimizations to produce output suitable for live-patching.
13523 If the compiler's optimization uses a function's body or information extracted
13524 from its body to optimize/change another function, the latter is called an
13525 impacted function of the former.  If a function is patched, its impacted
13526 functions should be patched too.
13528 The impacted functions are determined by the compiler's interprocedural
13529 optimizations.  For example, a caller is impacted when inlining a function
13530 into its caller,
13531 cloning a function and changing its caller to call this new clone,
13532 or extracting a function's pureness/constness information to optimize
13533 its direct or indirect callers, etc.
13535 Usually, the more IPA optimizations enabled, the larger the number of
13536 impacted functions for each function.  In order to control the number of
13537 impacted functions and more easily compute the list of impacted function,
13538 IPA optimizations can be partially enabled at two different levels.
13540 The @var{level} argument should be one of the following:
13542 @table @samp
13544 @item inline-clone
13546 Only enable inlining and cloning optimizations, which includes inlining,
13547 cloning, interprocedural scalar replacement of aggregates and partial inlining.
13548 As a result, when patching a function, all its callers and its clones'
13549 callers are impacted, therefore need to be patched as well.
13551 @option{-flive-patching=inline-clone} disables the following optimization flags:
13552 @gccoptlist{-fwhole-program  -fipa-pta  -fipa-reference  -fipa-ra
13553 -fipa-icf  -fipa-icf-functions  -fipa-icf-variables
13554 -fipa-bit-cp  -fipa-vrp  -fipa-pure-const
13555 -fipa-reference-addressable
13556 -fipa-stack-alignment -fipa-modref}
13558 @item inline-only-static
13560 Only enable inlining of static functions.
13561 As a result, when patching a static function, all its callers are impacted
13562 and so need to be patched as well.
13564 In addition to all the flags that @option{-flive-patching=inline-clone}
13565 disables,
13566 @option{-flive-patching=inline-only-static} disables the following additional
13567 optimization flags:
13568 @gccoptlist{-fipa-cp-clone  -fipa-sra  -fpartial-inlining  -fipa-cp}
13570 @end table
13572 When @option{-flive-patching} is specified without any value, the default value
13573 is @var{inline-clone}.
13575 This flag is disabled by default.
13577 Note that @option{-flive-patching} is not supported with link-time optimization
13578 (@option{-flto}).
13580 @opindex fisolate-erroneous-paths-dereference
13581 @item -fisolate-erroneous-paths-dereference
13582 Detect paths that trigger erroneous or undefined behavior due to
13583 dereferencing a null pointer.  Isolate those paths from the main control
13584 flow and turn the statement with erroneous or undefined behavior into a trap.
13585 This flag is enabled by default at @option{-O2} and higher and depends on
13586 @option{-fdelete-null-pointer-checks} also being enabled.
13588 @opindex fisolate-erroneous-paths-attribute
13589 @item -fisolate-erroneous-paths-attribute
13590 Detect paths that trigger erroneous or undefined behavior due to a null value
13591 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
13592 attribute.  Isolate those paths from the main control flow and turn the
13593 statement with erroneous or undefined behavior into a trap.  This is not
13594 currently enabled, but may be enabled by @option{-O2} in the future.
13596 @opindex ftree-sink
13597 @item -ftree-sink
13598 Perform forward store motion on trees.  This flag is
13599 enabled by default at @option{-O1} and higher.
13601 @opindex ftree-bit-ccp
13602 @item -ftree-bit-ccp
13603 Perform sparse conditional bit constant propagation on trees and propagate
13604 pointer alignment information.
13605 This pass only operates on local scalar variables and is enabled by default
13606 at @option{-O1} and higher, except for @option{-Og}.
13607 It requires that @option{-ftree-ccp} is enabled.
13609 @opindex ftree-ccp
13610 @item -ftree-ccp
13611 Perform sparse conditional constant propagation (CCP) on trees.  This
13612 pass only operates on local scalar variables and is enabled by default
13613 at @option{-O1} and higher.
13615 @opindex fssa-backprop
13616 @item -fssa-backprop
13617 Propagate information about uses of a value up the definition chain
13618 in order to simplify the definitions.  For example, this pass strips
13619 sign operations if the sign of a value never matters.  The flag is
13620 enabled by default at @option{-O1} and higher.
13622 @opindex fssa-phiopt
13623 @item -fssa-phiopt
13624 Perform pattern matching on SSA PHI nodes to optimize conditional
13625 code.  This pass is enabled by default at @option{-O1} and higher,
13626 except for @option{-Og}.
13628 @opindex ftree-switch-conversion
13629 @item -ftree-switch-conversion
13630 Perform conversion of simple initializations in a switch to
13631 initializations from a scalar array.  This flag is enabled by default
13632 at @option{-O2} and higher.
13634 @opindex ftree-tail-merge
13635 @item -ftree-tail-merge
13636 Look for identical code sequences.  When found, replace one with a jump to the
13637 other.  This optimization is known as tail merging or cross jumping.  This flag
13638 is enabled by default at @option{-O2} and higher.  The compilation time
13639 in this pass can
13640 be limited using @option{max-tail-merge-comparisons} parameter and
13641 @option{max-tail-merge-iterations} parameter.
13643 @opindex ftree-dce
13644 @item -ftree-dce
13645 Perform dead code elimination (DCE) on trees.  This flag is enabled by
13646 default at @option{-O1} and higher.
13648 @opindex ftree-builtin-call-dce
13649 @item -ftree-builtin-call-dce
13650 Perform conditional dead code elimination (DCE) for calls to built-in functions
13651 that may set @code{errno} but are otherwise free of side effects.  This flag is
13652 enabled by default at @option{-O2} and higher if @option{-Os} is not also
13653 specified.
13655 @opindex ffinite-loops
13656 @opindex fno-finite-loops
13657 @item -ffinite-loops
13658 Assume that a loop with an exit will eventually take the exit and not loop
13659 indefinitely.  This allows the compiler to remove loops that otherwise have
13660 no side-effects, not considering eventual endless looping as such.
13662 This option is enabled by default at @option{-O2} for C++ with -std=c++11
13663 or higher.
13665 @opindex ftree-dominator-opts
13666 @item -ftree-dominator-opts
13667 Perform a variety of simple scalar cleanups (constant/copy
13668 propagation, redundancy elimination, range propagation and expression
13669 simplification) based on a dominator tree traversal.  This also
13670 performs jump threading (to reduce jumps to jumps). This flag is
13671 enabled by default at @option{-O1} and higher.
13673 @opindex ftree-dse
13674 @item -ftree-dse
13675 Perform dead store elimination (DSE) on trees.  A dead store is a store into
13676 a memory location that is later overwritten by another store without
13677 any intervening loads.  In this case the earlier store can be deleted.  This
13678 flag is enabled by default at @option{-O1} and higher.
13680 @opindex ftree-ch
13681 @item -ftree-ch
13682 Perform loop header copying on trees.  This is beneficial since it increases
13683 effectiveness of code motion optimizations.  It also saves one jump.  This flag
13684 is enabled by default at @option{-O1} and higher.  It is not enabled
13685 for @option{-Os}, since it usually increases code size.
13687 @opindex ftree-loop-optimize
13688 @item -ftree-loop-optimize
13689 Perform loop optimizations on trees.  This flag is enabled by default
13690 at @option{-O1} and higher.
13692 @opindex ftree-loop-linear
13693 @opindex floop-strip-mine
13694 @opindex floop-block
13695 @item -ftree-loop-linear
13696 @itemx -floop-strip-mine
13697 @itemx -floop-block
13698 Perform loop nest optimizations.  Same as
13699 @option{-floop-nest-optimize}.  To use this code transformation, GCC has
13700 to be configured with @option{--with-isl} to enable the Graphite loop
13701 transformation infrastructure.
13703 @opindex fgraphite-identity
13704 @item -fgraphite-identity
13705 Enable the identity transformation for graphite.  For every SCoP we generate
13706 the polyhedral representation and transform it back to gimple.  Using
13707 @option{-fgraphite-identity} we can check the costs or benefits of the
13708 GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
13709 are also performed by the code generator isl, like index splitting and
13710 dead code elimination in loops.
13712 @opindex floop-nest-optimize
13713 @item -floop-nest-optimize
13714 Enable the isl based loop nest optimizer.  This is a generic loop nest
13715 optimizer based on the Pluto optimization algorithms.  It calculates a loop
13716 structure optimized for data-locality and parallelism.  This option
13717 is experimental.
13719 @opindex floop-parallelize-all
13720 @item -floop-parallelize-all
13721 Use the Graphite data dependence analysis to identify loops that can
13722 be parallelized.  Parallelize all the loops that can be analyzed to
13723 not contain loop carried dependences without checking that it is
13724 profitable to parallelize the loops.
13726 @opindex ftree-coalesce-vars
13727 @item -ftree-coalesce-vars
13728 While transforming the program out of the SSA representation, attempt to
13729 reduce copying by coalescing versions of different user-defined
13730 variables, instead of just compiler temporaries.  This may severely
13731 limit the ability to debug an optimized program compiled with
13732 @option{-fno-var-tracking-assignments}.  In the negated form, this flag
13733 prevents SSA coalescing of user variables.  This option is enabled by
13734 default if optimization is enabled, and it does very little otherwise.
13736 @opindex ftree-loop-if-convert
13737 @item -ftree-loop-if-convert
13738 Attempt to transform conditional jumps in the innermost loops to
13739 branch-less equivalents.  The intent is to remove control-flow from
13740 the innermost loops in order to improve the ability of the
13741 vectorization pass to handle these loops.  This is enabled by default
13742 if vectorization is enabled.
13744 @opindex ftree-loop-distribution
13745 @item -ftree-loop-distribution
13746 Perform loop distribution.  This flag can improve cache performance on
13747 big loop bodies and allow further loop optimizations, like
13748 parallelization or vectorization, to take place.  For example, the loop
13749 @smallexample
13750 DO I = 1, N
13751   A(I) = B(I) + C
13752   D(I) = E(I) * F
13753 ENDDO
13754 @end smallexample
13755 is transformed to
13756 @smallexample
13757 DO I = 1, N
13758    A(I) = B(I) + C
13759 ENDDO
13760 DO I = 1, N
13761    D(I) = E(I) * F
13762 ENDDO
13763 @end smallexample
13764 This flag is enabled by default at @option{-O3}.
13765 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13767 @opindex ftree-loop-distribute-patterns
13768 @item -ftree-loop-distribute-patterns
13769 Perform loop distribution of patterns that can be code generated with
13770 calls to a library.  This flag is enabled by default at @option{-O2} and
13771 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
13773 This pass distributes the initialization loops and generates a call to
13774 memset zero.  For example, the loop
13775 @smallexample
13776 DO I = 1, N
13777   A(I) = 0
13778   B(I) = A(I) + I
13779 ENDDO
13780 @end smallexample
13781 is transformed to
13782 @smallexample
13783 DO I = 1, N
13784    A(I) = 0
13785 ENDDO
13786 DO I = 1, N
13787    B(I) = A(I) + I
13788 ENDDO
13789 @end smallexample
13790 and the initialization loop is transformed into a call to memset zero.
13791 This flag is enabled by default at @option{-O3}.
13792 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13794 @opindex floop-interchange
13795 @item -floop-interchange
13796 Perform loop interchange outside of graphite.  This flag can improve cache
13797 performance on loop nest and allow further loop optimizations, like
13798 vectorization, to take place.  For example, the loop
13799 @smallexample
13800 for (int i = 0; i < N; i++)
13801   for (int j = 0; j < N; j++)
13802     for (int k = 0; k < N; k++)
13803       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13804 @end smallexample
13805 is transformed to
13806 @smallexample
13807 for (int i = 0; i < N; i++)
13808   for (int k = 0; k < N; k++)
13809     for (int j = 0; j < N; j++)
13810       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13811 @end smallexample
13812 This flag is enabled by default at @option{-O3}.
13813 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13815 @opindex floop-unroll-and-jam
13816 @item -floop-unroll-and-jam
13817 Apply unroll and jam transformations on feasible loops.  In a loop
13818 nest this unrolls the outer loop by some factor and fuses the resulting
13819 multiple inner loops.  This flag is enabled by default at @option{-O3}.
13820 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13822 @opindex ftree-loop-im
13823 @item -ftree-loop-im
13824 Perform loop invariant motion on trees.  This pass moves only invariants that
13825 are hard to handle at RTL level (function calls, operations that expand to
13826 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
13827 operands of conditions that are invariant out of the loop, so that we can use
13828 just trivial invariantness analysis in loop unswitching.  The pass also includes
13829 store motion.
13831 @opindex ftree-loop-ivcanon
13832 @item -ftree-loop-ivcanon
13833 Create a canonical counter for number of iterations in loops for which
13834 determining number of iterations requires complicated analysis.  Later
13835 optimizations then may determine the number easily.  Useful especially
13836 in connection with unrolling.
13838 @opindex ftree-scev-cprop
13839 @item -ftree-scev-cprop
13840 Perform final value replacement.  If a variable is modified in a loop
13841 in such a way that its value when exiting the loop can be determined using
13842 only its initial value and the number of loop iterations, replace uses of
13843 the final value by such a computation, provided it is sufficiently cheap.
13844 This reduces data dependencies and may allow further simplifications.
13845 Enabled by default at @option{-O1} and higher.
13847 @opindex fivopts
13848 @item -fivopts
13849 Perform induction variable optimizations (strength reduction, induction
13850 variable merging and induction variable elimination) on trees.
13852 @opindex ftree-parallelize-loops
13853 @item -ftree-parallelize-loops=n
13854 Parallelize loops, i.e., split their iteration space to run in n threads.
13855 This is only possible for loops whose iterations are independent
13856 and can be arbitrarily reordered.  The optimization is only
13857 profitable on multiprocessor machines, for loops that are CPU-intensive,
13858 rather than constrained e.g.@: by memory bandwidth.  This option
13859 implies @option{-pthread}, and thus is only supported on targets
13860 that have support for @option{-pthread}.
13862 @opindex ftree-pta
13863 @item -ftree-pta
13864 Perform function-local points-to analysis on trees.  This flag is
13865 enabled by default at @option{-O1} and higher, except for @option{-Og}.
13867 @opindex ftree-sra
13868 @item -ftree-sra
13869 Perform scalar replacement of aggregates.  This pass replaces structure
13870 references with scalars to prevent committing structures to memory too
13871 early.  This flag is enabled by default at @option{-O1} and higher,
13872 except for @option{-Og}.
13874 @opindex fstore-merging
13875 @item -fstore-merging
13876 Perform merging of narrow stores to consecutive memory addresses.  This pass
13877 merges contiguous stores of immediate values narrower than a word into fewer
13878 wider stores to reduce the number of instructions.  This is enabled by default
13879 at @option{-O2} and higher as well as @option{-Os}.
13881 @opindex ftree-ter
13882 @item -ftree-ter
13883 Perform temporary expression replacement during the SSA->normal phase.  Single
13884 use/single def temporaries are replaced at their use location with their
13885 defining expression.  This results in non-GIMPLE code, but gives the expanders
13886 much more complex trees to work on resulting in better RTL generation.  This is
13887 enabled by default at @option{-O1} and higher.
13889 @opindex ftree-slsr
13890 @item -ftree-slsr
13891 Perform straight-line strength reduction on trees.  This recognizes related
13892 expressions involving multiplications and replaces them by less expensive
13893 calculations when possible.  This is enabled by default at @option{-O1} and
13894 higher.
13896 @opindex ftree-vectorize
13897 @item -ftree-vectorize
13898 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
13899 and @option{-ftree-slp-vectorize} if not explicitly specified.
13901 @opindex ftree-loop-vectorize
13902 @item -ftree-loop-vectorize
13903 Perform loop vectorization on trees. This flag is enabled by default at
13904 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13905 and @option{-fauto-profile}.
13907 @opindex ftree-slp-vectorize
13908 @item -ftree-slp-vectorize
13909 Perform basic block vectorization on trees. This flag is enabled by default at
13910 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13911 and @option{-fauto-profile}.
13913 @opindex ftrivial-auto-var-init
13914 @item -ftrivial-auto-var-init=@var{choice}
13915 Initialize automatic variables with either a pattern or with zeroes to increase
13916 the security and predictability of a program by preventing uninitialized memory
13917 disclosure and use.
13918 GCC still considers an automatic variable that doesn't have an explicit
13919 initializer as uninitialized, @option{-Wuninitialized} and
13920 @option{-Wanalyzer-use-of-uninitialized-value} will still report
13921 warning messages on such automatic variables and the compiler will
13922 perform optimization as if the variable were uninitialized.
13923 With this option, GCC will also initialize any padding of automatic variables
13924 that have structure or union types to zeroes.
13925 However, the current implementation cannot initialize automatic variables that
13926 are declared between the controlling expression and the first case of a
13927 @code{switch} statement.  Using @option{-Wtrivial-auto-var-init} to report all
13928 such cases.
13930 The three values of @var{choice} are:
13932 @itemize @bullet
13933 @item
13934 @samp{uninitialized} doesn't initialize any automatic variables.
13935 This is C and C++'s default.
13937 @item
13938 @samp{pattern} Initialize automatic variables with values which will likely
13939 transform logic bugs into crashes down the line, are easily recognized in a
13940 crash dump and without being values that programmers can rely on for useful
13941 program semantics.
13942 The current value is byte-repeatable pattern with byte "0xFE".
13943 The values used for pattern initialization might be changed in the future.
13945 @item
13946 @samp{zero} Initialize automatic variables with zeroes.
13947 @end itemize
13949 The default is @samp{uninitialized}.
13951 Note that the initializer values, whether @samp{zero} or @samp{pattern},
13952 refer to data representation (in memory or machine registers), rather
13953 than to their interpretation as numerical values.  This distinction may
13954 be important in languages that support types with biases or implicit
13955 multipliers, and with such extensions as @samp{hardbool} (@pxref{Type
13956 Attributes}).  For example, a variable that uses 8 bits to represent
13957 (biased) quantities in the @code{range 160..400} will be initialized
13958 with the bit patterns @code{0x00} or @code{0xFE}, depending on
13959 @var{choice}, whether or not these representations stand for values in
13960 that range, and even if they do, the interpretation of the value held by
13961 the variable will depend on the bias.  A @samp{hardbool} variable that
13962 uses say @code{0X5A} and @code{0xA5} for @code{false} and @code{true},
13963 respectively, will trap with either @samp{choice} of trivial
13964 initializer, i.e., @samp{zero} initialization will not convert to the
13965 representation for @code{false}, even if it would for a @code{static}
13966 variable of the same type.  This means the initializer pattern doesn't
13967 generally depend on the type of the initialized variable.  One notable
13968 exception is that (non-hardened) boolean variables that fit in registers
13969 are initialized with @code{false} (zero), even when @samp{pattern} is
13970 requested.
13972 You can control this behavior for a specific variable by using the variable
13973 attribute @code{uninitialized} (@pxref{Variable Attributes}).
13975 @opindex fvect-cost-model
13976 @item -fvect-cost-model=@var{model}
13977 Alter the cost model used for vectorization.  The @var{model} argument
13978 should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
13979 @samp{very-cheap}.
13980 With the @samp{unlimited} model the vectorized code-path is assumed
13981 to be profitable while with the @samp{dynamic} model a runtime check
13982 guards the vectorized code-path to enable it only for iteration
13983 counts that will likely execute faster than when executing the original
13984 scalar loop.  The @samp{cheap} model disables vectorization of
13985 loops where doing so would be cost prohibitive for example due to
13986 required runtime checks for data dependence or alignment but otherwise
13987 is equal to the @samp{dynamic} model.  The @samp{very-cheap} model only
13988 allows vectorization if the vector code would entirely replace the
13989 scalar code that is being vectorized.  For example, if each iteration
13990 of a vectorized loop would only be able to handle exactly four iterations
13991 of the scalar loop, the @samp{very-cheap} model would only allow
13992 vectorization if the scalar iteration count is known to be a multiple
13993 of four.
13995 The default cost model depends on other optimization flags and is
13996 either @samp{dynamic} or @samp{cheap}.
13998 @opindex fsimd-cost-model
13999 @item -fsimd-cost-model=@var{model}
14000 Alter the cost model used for vectorization of loops marked with the OpenMP
14001 simd directive.  The @var{model} argument should be one of
14002 @samp{unlimited}, @samp{dynamic}, @samp{cheap}.  All values of @var{model}
14003 have the same meaning as described in @option{-fvect-cost-model} and by
14004 default a cost model defined with @option{-fvect-cost-model} is used.
14006 @opindex ftree-vrp
14007 @item -ftree-vrp
14008 Perform Value Range Propagation on trees.  This is similar to the
14009 constant propagation pass, but instead of values, ranges of values are
14010 propagated.  This allows the optimizers to remove unnecessary range
14011 checks like array bound checks and null pointer checks.  This is
14012 enabled by default at @option{-O2} and higher.  Null pointer check
14013 elimination is only done if @option{-fdelete-null-pointer-checks} is
14014 enabled.
14016 @opindex fsplit-paths
14017 @item -fsplit-paths
14018 Split paths leading to loop backedges.  This can improve dead code
14019 elimination and common subexpression elimination.  This is enabled by
14020 default at @option{-O3} and above.
14022 @opindex fsplit-ivs-in-unroller
14023 @item -fsplit-ivs-in-unroller
14024 Enables expression of values of induction variables in later iterations
14025 of the unrolled loop using the value in the first iteration.  This breaks
14026 long dependency chains, thus improving efficiency of the scheduling passes.
14028 A combination of @option{-fweb} and CSE is often sufficient to obtain the
14029 same effect.  However, that is not reliable in cases where the loop body
14030 is more complicated than a single basic block.  It also does not work at all
14031 on some architectures due to restrictions in the CSE pass.
14033 This optimization is enabled by default.
14035 @opindex fvariable-expansion-in-unroller
14036 @item -fvariable-expansion-in-unroller
14037 With this option, the compiler creates multiple copies of some
14038 local variables when unrolling a loop, which can result in superior code.
14040 This optimization is enabled by default for PowerPC targets, but disabled
14041 by default otherwise.
14043 @opindex fpartial-inlining
14044 @item -fpartial-inlining
14045 Inline parts of functions.  This option has any effect only
14046 when inlining itself is turned on by the @option{-finline-functions}
14047 or @option{-finline-small-functions} options.
14049 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14051 @opindex fpredictive-commoning
14052 @item -fpredictive-commoning
14053 Perform predictive commoning optimization, i.e., reusing computations
14054 (especially memory loads and stores) performed in previous
14055 iterations of loops.
14057 This option is enabled at level @option{-O3}.
14058 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14060 @opindex fprefetch-loop-arrays
14061 @item -fprefetch-loop-arrays
14062 If supported by the target machine, generate instructions to prefetch
14063 memory to improve the performance of loops that access large arrays.
14065 This option may generate better or worse code; results are highly
14066 dependent on the structure of loops within the source code.
14068 Disabled at level @option{-Os}.
14070 @opindex fno-printf-return-value
14071 @opindex fprintf-return-value
14072 @item -fno-printf-return-value
14073 Do not substitute constants for known return value of formatted output
14074 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
14075 @code{vsnprintf} (but not @code{printf} of @code{fprintf}).  This
14076 transformation allows GCC to optimize or even eliminate branches based
14077 on the known return value of these functions called with arguments that
14078 are either constant, or whose values are known to be in a range that
14079 makes determining the exact return value possible.  For example, when
14080 @option{-fprintf-return-value} is in effect, both the branch and the
14081 body of the @code{if} statement (but not the call to @code{snprint})
14082 can be optimized away when @code{i} is a 32-bit or smaller integer
14083 because the return value is guaranteed to be at most 8.
14085 @smallexample
14086 char buf[9];
14087 if (snprintf (buf, "%08x", i) >= sizeof buf)
14088   @dots{}
14089 @end smallexample
14091 The @option{-fprintf-return-value} option relies on other optimizations
14092 and yields best results with @option{-O2} and above.  It works in tandem
14093 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
14094 options.  The @option{-fprintf-return-value} option is enabled by default.
14096 @opindex fno-peephole
14097 @opindex fpeephole
14098 @opindex fno-peephole2
14099 @opindex fpeephole2
14100 @item -fno-peephole
14101 @itemx -fno-peephole2
14102 Disable any machine-specific peephole optimizations.  The difference
14103 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
14104 are implemented in the compiler; some targets use one, some use the
14105 other, a few use both.
14107 @option{-fpeephole} is enabled by default.
14108 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14110 @opindex fno-guess-branch-probability
14111 @opindex fguess-branch-probability
14112 @item -fno-guess-branch-probability
14113 Do not guess branch probabilities using heuristics.
14115 GCC uses heuristics to guess branch probabilities if they are
14116 not provided by profiling feedback (@option{-fprofile-arcs}).  These
14117 heuristics are based on the control flow graph.  If some branch probabilities
14118 are specified by @code{__builtin_expect}, then the heuristics are
14119 used to guess branch probabilities for the rest of the control flow graph,
14120 taking the @code{__builtin_expect} info into account.  The interactions
14121 between the heuristics and @code{__builtin_expect} can be complex, and in
14122 some cases, it may be useful to disable the heuristics so that the effects
14123 of @code{__builtin_expect} are easier to understand.
14125 It is also possible to specify expected probability of the expression
14126 with @code{__builtin_expect_with_probability} built-in function.
14128 The default is @option{-fguess-branch-probability} at levels
14129 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
14131 @opindex freorder-blocks
14132 @item -freorder-blocks
14133 Reorder basic blocks in the compiled function in order to reduce number of
14134 taken branches and improve code locality.
14136 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14138 @opindex freorder-blocks-algorithm
14139 @item -freorder-blocks-algorithm=@var{algorithm}
14140 Use the specified algorithm for basic block reordering.  The
14141 @var{algorithm} argument can be @samp{simple}, which does not increase
14142 code size (except sometimes due to secondary effects like alignment),
14143 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
14144 put all often executed code together, minimizing the number of branches
14145 executed by making extra copies of code.
14147 The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and
14148 @samp{stc} at levels @option{-O2}, @option{-O3}.
14150 @opindex freorder-blocks-and-partition
14151 @item -freorder-blocks-and-partition
14152 In addition to reordering basic blocks in the compiled function, in order
14153 to reduce number of taken branches, partitions hot and cold basic blocks
14154 into separate sections of the assembly and @file{.o} files, to improve
14155 paging and cache locality performance.
14157 This optimization is automatically turned off in the presence of
14158 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
14159 section attribute and on any architecture that does not support named
14160 sections.  When @option{-fsplit-stack} is used this option is not
14161 enabled by default (to avoid linker errors), but may be enabled
14162 explicitly (if using a working linker).
14164 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
14166 @opindex freorder-functions
14167 @item -freorder-functions
14168 Reorder functions in the object file in order to
14169 improve code locality.  This is implemented by using special
14170 subsections @code{.text.hot} for most frequently executed functions and
14171 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
14172 the linker so object file format must support named sections and linker must
14173 place them in a reasonable way.
14175 This option isn't effective unless you either provide profile feedback
14176 (see @option{-fprofile-arcs} for details) or manually annotate functions with 
14177 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
14179 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14181 @opindex fstrict-aliasing
14182 @item -fstrict-aliasing
14183 Allow the compiler to assume the strictest aliasing rules applicable to
14184 the language being compiled.  For C (and C++), this activates
14185 optimizations based on the type of expressions.  In particular, an
14186 object of one type is assumed never to reside at the same address as an
14187 object of a different type, unless the types are almost the same.  For
14188 example, an @code{unsigned int} can alias an @code{int}, but not a
14189 @code{void*} or a @code{double}.  A character type may alias any other
14190 type.
14192 @anchor{Type-punning}Pay special attention to code like this:
14193 @smallexample
14194 union a_union @{
14195   int i;
14196   double d;
14199 int f() @{
14200   union a_union t;
14201   t.d = 3.0;
14202   return t.i;
14204 @end smallexample
14205 The practice of reading from a different union member than the one most
14206 recently written to (called ``type-punning'') is common.  Even with
14207 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
14208 is accessed through the union type.  So, the code above works as
14209 expected.  @xref{Structures unions enumerations and bit-fields
14210 implementation}.  However, this code might not:
14211 @smallexample
14212 int f() @{
14213   union a_union t;
14214   int* ip;
14215   t.d = 3.0;
14216   ip = &t.i;
14217   return *ip;
14219 @end smallexample
14221 Similarly, access by taking the address, casting the resulting pointer
14222 and dereferencing the result has undefined behavior, even if the cast
14223 uses a union type, e.g.:
14224 @smallexample
14225 int f() @{
14226   double d = 3.0;
14227   return ((union a_union *) &d)->i;
14229 @end smallexample
14231 The @option{-fstrict-aliasing} option is enabled at levels
14232 @option{-O2}, @option{-O3}, @option{-Os}.
14234 @opindex fipa-strict-aliasing
14235 @item -fipa-strict-aliasing
14236 Controls whether rules of @option{-fstrict-aliasing} are applied across
14237 function boundaries.  Note that if multiple functions gets inlined into a
14238 single function the memory accesses are no longer considered to be crossing a
14239 function boundary.
14241 The @option{-fipa-strict-aliasing} option is enabled by default and is
14242 effective only in combination with @option{-fstrict-aliasing}.
14244 @opindex falign-functions
14245 @item -falign-functions
14246 @itemx -falign-functions=@var{n}
14247 @itemx -falign-functions=@var{n}:@var{m}
14248 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
14249 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
14250 Align the start of functions to the next power-of-two greater than or
14251 equal to @var{n}, skipping up to @var{m}-1 bytes.  This ensures that at
14252 least the first @var{m} bytes of the function can be fetched by the CPU
14253 without crossing an @var{n}-byte alignment boundary.
14254 This is an optimization of code performance and alignment is ignored for
14255 functions considered cold.  If alignment is required for all functions,
14256 use @option{-fmin-function-alignment}.
14258 If @var{m} is not specified, it defaults to @var{n}.
14260 Examples: @option{-falign-functions=32} aligns functions to the next
14261 32-byte boundary, @option{-falign-functions=24} aligns to the next
14262 32-byte boundary only if this can be done by skipping 23 bytes or less,
14263 @option{-falign-functions=32:7} aligns to the next
14264 32-byte boundary only if this can be done by skipping 6 bytes or less.
14266 The second pair of @var{n2}:@var{m2} values allows you to specify
14267 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
14268 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
14269 otherwise aligns to the next 32-byte boundary if this can be done
14270 by skipping 2 bytes or less.
14271 If @var{m2} is not specified, it defaults to @var{n2}.
14273 Some assemblers only support this flag when @var{n} is a power of two;
14274 in that case, it is rounded up.
14276 @option{-fno-align-functions} and @option{-falign-functions=1} are
14277 equivalent and mean that functions are not aligned.
14279 If @var{n} is not specified or is zero, use a machine-dependent default.
14280 The maximum allowed @var{n} option value is 65536.
14282 Enabled at levels @option{-O2}, @option{-O3}.
14284 @item -flimit-function-alignment
14285 If this option is enabled, the compiler tries to avoid unnecessarily
14286 overaligning functions. It attempts to instruct the assembler to align
14287 by the amount specified by @option{-falign-functions}, but not to
14288 skip more bytes than the size of the function.
14290 @opindex falign-labels
14291 @item -falign-labels
14292 @itemx -falign-labels=@var{n}
14293 @itemx -falign-labels=@var{n}:@var{m}
14294 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
14295 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
14296 Align all branch targets to a power-of-two boundary.
14298 Parameters of this option are analogous to the @option{-falign-functions} option.
14299 @option{-fno-align-labels} and @option{-falign-labels=1} are
14300 equivalent and mean that labels are not aligned.
14302 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
14303 are greater than this value, then their values are used instead.
14305 If @var{n} is not specified or is zero, use a machine-dependent default
14306 which is very likely to be @samp{1}, meaning no alignment.
14307 The maximum allowed @var{n} option value is 65536.
14309 Enabled at levels @option{-O2}, @option{-O3}.
14311 @opindex falign-loops
14312 @item -falign-loops
14313 @itemx -falign-loops=@var{n}
14314 @itemx -falign-loops=@var{n}:@var{m}
14315 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
14316 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
14317 Align loops to a power-of-two boundary.  If the loops are executed
14318 many times, this makes up for any execution of the dummy padding
14319 instructions.
14320 This is an optimization of code performance and alignment is ignored for
14321 loops considered cold.
14323 If @option{-falign-labels} is greater than this value, then its value
14324 is used instead.
14326 Parameters of this option are analogous to the @option{-falign-functions} option.
14327 @option{-fno-align-loops} and @option{-falign-loops=1} are
14328 equivalent and mean that loops are not aligned.
14329 The maximum allowed @var{n} option value is 65536.
14331 If @var{n} is not specified or is zero, use a machine-dependent default.
14333 Enabled at levels @option{-O2}, @option{-O3}.
14335 @opindex falign-jumps
14336 @item -falign-jumps
14337 @itemx -falign-jumps=@var{n}
14338 @itemx -falign-jumps=@var{n}:@var{m}
14339 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
14340 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
14341 Align branch targets to a power-of-two boundary, for branch targets
14342 where the targets can only be reached by jumping.  In this case,
14343 no dummy operations need be executed.
14344 This is an optimization of code performance and alignment is ignored for
14345 jumps considered cold.
14347 If @option{-falign-labels} is greater than this value, then its value
14348 is used instead.
14350 Parameters of this option are analogous to the @option{-falign-functions} option.
14351 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
14352 equivalent and mean that loops are not aligned.
14354 If @var{n} is not specified or is zero, use a machine-dependent default.
14355 The maximum allowed @var{n} option value is 65536.
14357 Enabled at levels @option{-O2}, @option{-O3}.
14359 @opindex fmin-function-alignment=@var{n}
14360 @item -fmin-function-alignment
14361 Specify minimal alignment of functions to the next power-of-two greater than or
14362 equal to @var{n}. Unlike @option{-falign-functions} this alignment is applied
14363 also to all functions (even those considered cold).  The alignment is also not
14364 affected by @option{-flimit-function-alignment}
14367 @opindex fno-allocation-dce
14368 @item -fno-allocation-dce
14369 Do not remove unused C++ allocations in dead code elimination.
14371 @opindex fallow-store-data-races
14372 @item -fallow-store-data-races
14373 Allow the compiler to perform optimizations that may introduce new data races
14374 on stores, without proving that the variable cannot be concurrently accessed
14375 by other threads.  Does not affect optimization of local data.  It is safe to
14376 use this option if it is known that global data will not be accessed by
14377 multiple threads.
14379 Examples of optimizations enabled by @option{-fallow-store-data-races} include
14380 hoisting or if-conversions that may cause a value that was already in memory
14381 to be re-written with that same value.  Such re-writing is safe in a single
14382 threaded context but may be unsafe in a multi-threaded context.  Note that on
14383 some processors, if-conversions may be required in order to enable
14384 vectorization.
14386 Enabled at level @option{-Ofast}.
14388 @opindex funit-at-a-time
14389 @item -funit-at-a-time
14390 This option is left for compatibility reasons. @option{-funit-at-a-time}
14391 has no effect, while @option{-fno-unit-at-a-time} implies
14392 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
14394 Enabled by default.
14396 @opindex fno-toplevel-reorder
14397 @opindex ftoplevel-reorder
14398 @item -fno-toplevel-reorder
14399 Do not reorder top-level functions, variables, and @code{asm}
14400 statements.  Output them in the same order that they appear in the
14401 input file.  When this option is used, unreferenced static variables
14402 are not removed.  This option is intended to support existing code
14403 that relies on a particular ordering.  For new code, it is better to
14404 use attributes when possible.
14406 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
14407 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
14408 Additionally @option{-fno-toplevel-reorder} implies
14409 @option{-fno-section-anchors}.
14411 @opindex funreachable-traps
14412 @item -funreachable-traps
14413 With this option, the compiler turns calls to
14414 @code{__builtin_unreachable} into traps, instead of using them for
14415 optimization.  This also affects any such calls implicitly generated
14416 by the compiler.
14418 This option has the same effect as @option{-fsanitize=unreachable
14419 -fsanitize-trap=unreachable}, but does not affect the values of those
14420 options.  If @option{-fsanitize=unreachable} is enabled, that option
14421 takes priority over this one.
14423 This option is enabled by default at @option{-O0} and @option{-Og}.
14425 @opindex fweb
14426 @item -fweb
14427 Constructs webs as commonly used for register allocation purposes and assign
14428 each web individual pseudo register.  This allows the register allocation pass
14429 to operate on pseudos directly, but also strengthens several other optimization
14430 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
14431 however, make debugging impossible, since variables no longer stay in a
14432 ``home register''.
14434 Enabled by default with @option{-funroll-loops}.
14436 @opindex fwhole-program
14437 @item -fwhole-program
14438 Assume that the current compilation unit represents the whole program being
14439 compiled.  All public functions and variables with the exception of @code{main}
14440 and those merged by attribute @code{externally_visible} become static functions
14441 and in effect are optimized more aggressively by interprocedural optimizers.
14443 With @option{-flto} this option has a limited use.  In most cases the
14444 precise list of symbols used or exported from the binary is known the
14445 resolution info passed to the link-time optimizer by the linker plugin.  It is
14446 still useful if no linker plugin is used or during incremental link step when
14447 final code is produced (with @option{-flto}
14448 @option{-flinker-output=nolto-rel}).
14450 @opindex flto
14451 @item -flto[=@var{n}]
14452 This option runs the standard link-time optimizer.  When invoked
14453 with source code, it generates GIMPLE (one of GCC's internal
14454 representations) and writes it to special ELF sections in the object
14455 file.  When the object files are linked together, all the function
14456 bodies are read from these ELF sections and instantiated as if they
14457 had been part of the same translation unit.
14459 To use the link-time optimizer, @option{-flto} and optimization
14460 options should be specified at compile time and during the final link.
14461 It is recommended that you compile all the files participating in the
14462 same link with the same options and also specify those options at
14463 link time.
14464 For example:
14466 @smallexample
14467 gcc -c -O2 -flto foo.c
14468 gcc -c -O2 -flto bar.c
14469 gcc -o myprog -flto -O2 foo.o bar.o
14470 @end smallexample
14472 The first two invocations to GCC save a bytecode representation
14473 of GIMPLE into special ELF sections inside @file{foo.o} and
14474 @file{bar.o}.  The final invocation reads the GIMPLE bytecode from
14475 @file{foo.o} and @file{bar.o}, merges the two files into a single
14476 internal image, and compiles the result as usual.  Since both
14477 @file{foo.o} and @file{bar.o} are merged into a single image, this
14478 causes all the interprocedural analyses and optimizations in GCC to
14479 work across the two files as if they were a single one.  This means,
14480 for example, that the inliner is able to inline functions in
14481 @file{bar.o} into functions in @file{foo.o} and vice-versa.
14483 Another (simpler) way to enable link-time optimization is:
14485 @smallexample
14486 gcc -o myprog -flto -O2 foo.c bar.c
14487 @end smallexample
14489 The above generates bytecode for @file{foo.c} and @file{bar.c},
14490 merges them together into a single GIMPLE representation and optimizes
14491 them as usual to produce @file{myprog}.
14493 The important thing to keep in mind is that to enable link-time
14494 optimizations you need to use the GCC driver to perform the link step.
14495 GCC automatically performs link-time optimization if any of the
14496 objects involved were compiled with the @option{-flto} command-line option.  
14497 You can always override
14498 the automatic decision to do link-time optimization
14499 by passing @option{-fno-lto} to the link command.
14501 To make whole program optimization effective, it is necessary to make
14502 certain whole program assumptions.  The compiler needs to know
14503 what functions and variables can be accessed by libraries and runtime
14504 outside of the link-time optimized unit.  When supported by the linker,
14505 the linker plugin (see @option{-fuse-linker-plugin}) passes information
14506 to the compiler about used and externally visible symbols.  When
14507 the linker plugin is not available, @option{-fwhole-program} should be
14508 used to allow the compiler to make these assumptions, which leads
14509 to more aggressive optimization decisions.
14511 When a file is compiled with @option{-flto} without
14512 @option{-fuse-linker-plugin}, the generated object file is larger than
14513 a regular object file because it contains GIMPLE bytecodes and the usual
14514 final code (see @option{-ffat-lto-objects}).  This means that
14515 object files with LTO information can be linked as normal object
14516 files; if @option{-fno-lto} is passed to the linker, no
14517 interprocedural optimizations are applied.  Note that when
14518 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
14519 but you cannot perform a regular, non-LTO link on them.
14521 When producing the final binary, GCC only
14522 applies link-time optimizations to those files that contain bytecode.
14523 Therefore, you can mix and match object files and libraries with
14524 GIMPLE bytecodes and final object code.  GCC automatically selects
14525 which files to optimize in LTO mode and which files to link without
14526 further processing.
14528 Generally, options specified at link time override those
14529 specified at compile time, although in some cases GCC attempts to infer
14530 link-time options from the settings used to compile the input files.
14532 If you do not specify an optimization level option @option{-O} at
14533 link time, then GCC uses the highest optimization level 
14534 used when compiling the object files.  Note that it is generally 
14535 ineffective to specify an optimization level option only at link time and 
14536 not at compile time, for two reasons.  First, compiling without 
14537 optimization suppresses compiler passes that gather information 
14538 needed for effective optimization at link time.  Second, some early
14539 optimization passes can be performed only at compile time and 
14540 not at link time.
14542 There are some code generation flags preserved by GCC when
14543 generating bytecodes, as they need to be used during the final link.
14544 Currently, the following options and their settings are taken from
14545 the first object file that explicitly specifies them: 
14546 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
14547 @option{-fgnu-tm} and all the @option{-m} target flags.
14549 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
14550 @option{-fPIE} are combined based on the following scheme:
14552 @smallexample
14553 @option{-fPIC} + @option{-fpic} = @option{-fpic}
14554 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
14555 @option{-fpic/-fPIC} + (no option) = (no option)
14556 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
14557 @option{-fpic} + @option{-fPIE} = @option{-fpie}
14558 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
14559 @end smallexample
14561 Certain ABI-changing flags are required to match in all compilation units,
14562 and trying to override this at link time with a conflicting value
14563 is ignored.  This includes options such as @option{-freg-struct-return}
14564 and @option{-fpcc-struct-return}. 
14566 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
14567 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
14568 are passed through to the link stage and merged conservatively for
14569 conflicting translation units.  Specifically
14570 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
14571 precedence; and for example @option{-ffp-contract=off} takes precedence
14572 over @option{-ffp-contract=fast}.  You can override them at link time.
14574 Diagnostic options such as @option{-Wstringop-overflow} are passed
14575 through to the link stage and their setting matches that of the
14576 compile-step at function granularity.  Note that this matters only
14577 for diagnostics emitted during optimization.  Note that code
14578 transforms such as inlining can lead to warnings being enabled
14579 or disabled for regions if code not consistent with the setting
14580 at compile time.
14582 When you need to pass options to the assembler via @option{-Wa} or
14583 @option{-Xassembler} make sure to either compile such translation
14584 units with @option{-fno-lto} or consistently use the same assembler
14585 options on all translation units.  You can alternatively also
14586 specify assembler options at LTO link time.
14588 To enable debug info generation you need to supply @option{-g} at
14589 compile time.  If any of the input files at link time were built
14590 with debug info generation enabled the link will enable debug info
14591 generation as well.  Any elaborate debug info settings
14592 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
14593 at the linker command line and mixing different settings in different
14594 translation units is discouraged.
14596 If LTO encounters objects with C linkage declared with incompatible
14597 types in separate translation units to be linked together (undefined
14598 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
14599 issued.  The behavior is still undefined at run time.  Similar
14600 diagnostics may be raised for other languages.
14602 Another feature of LTO is that it is possible to apply interprocedural
14603 optimizations on files written in different languages:
14605 @smallexample
14606 gcc -c -flto foo.c
14607 g++ -c -flto bar.cc
14608 gfortran -c -flto baz.f90
14609 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
14610 @end smallexample
14612 Notice that the final link is done with @command{g++} to get the C++
14613 runtime libraries and @option{-lgfortran} is added to get the Fortran
14614 runtime libraries.  In general, when mixing languages in LTO mode, you
14615 should use the same link command options as when mixing languages in a
14616 regular (non-LTO) compilation.
14618 If object files containing GIMPLE bytecode are stored in a library archive, say
14619 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
14620 are using a linker with plugin support.  To create static libraries suitable
14621 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
14622 and @command{ranlib}; 
14623 to show the symbols of object files with GIMPLE bytecode, use
14624 @command{gcc-nm}.  Those commands require that @command{ar}, @command{ranlib}
14625 and @command{nm} have been compiled with plugin support.  At link time, use the
14626 flag @option{-fuse-linker-plugin} to ensure that the library participates in
14627 the LTO optimization process:
14629 @smallexample
14630 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
14631 @end smallexample
14633 With the linker plugin enabled, the linker extracts the needed
14634 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
14635 to make them part of the aggregated GIMPLE image to be optimized.
14637 If you are not using a linker with plugin support and/or do not
14638 enable the linker plugin, then the objects inside @file{libfoo.a}
14639 are extracted and linked as usual, but they do not participate
14640 in the LTO optimization process.  In order to make a static library suitable
14641 for both LTO optimization and usual linkage, compile its object files with
14642 @option{-flto} @option{-ffat-lto-objects}.
14644 Link-time optimizations do not require the presence of the whole program to
14645 operate.  If the program does not require any symbols to be exported, it is
14646 possible to combine @option{-flto} and @option{-fwhole-program} to allow
14647 the interprocedural optimizers to use more aggressive assumptions which may
14648 lead to improved optimization opportunities.
14649 Use of @option{-fwhole-program} is not needed when linker plugin is
14650 active (see @option{-fuse-linker-plugin}).
14652 The current implementation of LTO makes no
14653 attempt to generate bytecode that is portable between different
14654 types of hosts.  The bytecode files are versioned and there is a
14655 strict version check, so bytecode files generated in one version of
14656 GCC do not work with an older or newer version of GCC.
14658 Link-time optimization does not work well with generation of debugging
14659 information on systems other than those using a combination of ELF and
14660 DWARF.
14662 If you specify the optional @var{n}, the optimization and code
14663 generation done at link time is executed in parallel using @var{n}
14664 parallel jobs by utilizing an installed @command{make} program.  The
14665 environment variable @env{MAKE} may be used to override the program
14666 used.
14668 You can also specify @option{-flto=jobserver} to use GNU make's
14669 job server mode to determine the number of parallel jobs. This
14670 is useful when the Makefile calling GCC is already executing in parallel.
14671 You must prepend a @samp{+} to the command recipe in the parent Makefile
14672 for this to work.  This option likely only works if @env{MAKE} is
14673 GNU make.  Even without the option value, GCC tries to automatically
14674 detect a running GNU make's job server.
14676 Use @option{-flto=auto} to use GNU make's job server, if available,
14677 or otherwise fall back to autodetection of the number of CPU threads
14678 present in your system.
14680 @opindex flto-partition
14681 @item -flto-partition=@var{alg}
14682 Specify the partitioning algorithm used by the link-time optimizer.
14683 The value is either @samp{1to1} to specify a partitioning mirroring
14684 the original source files or @samp{balanced} to specify partitioning
14685 into equally sized chunks (whenever possible) or @samp{max} to create
14686 new partition for every symbol where possible.  Specifying @samp{none}
14687 as an algorithm disables partitioning and streaming completely. 
14688 The default value is @samp{balanced}. While @samp{1to1} can be used
14689 as an workaround for various code ordering issues, the @samp{max}
14690 partitioning is intended for internal testing only.
14691 The value @samp{one} specifies that exactly one partition should be
14692 used while the value @samp{none} bypasses partitioning and executes
14693 the link-time optimization step directly from the WPA phase.
14695 @opindex flto-compression-level
14696 @item -flto-compression-level=@var{n}
14697 This option specifies the level of compression used for intermediate
14698 language written to LTO object files, and is only meaningful in
14699 conjunction with LTO mode (@option{-flto}).  GCC currently supports two
14700 LTO compression algorithms. For zstd, valid values are 0 (no compression)
14701 to 19 (maximum compression), while zlib supports values from 0 to 9.
14702 Values outside this range are clamped to either minimum or maximum
14703 of the supported values.  If the option is not given,
14704 a default balanced compression setting is used.
14706 @opindex fuse-linker-plugin
14707 @item -fuse-linker-plugin
14708 Enables the use of a linker plugin during link-time optimization.  This
14709 option relies on plugin support in the linker, which is available in gold
14710 or in GNU ld 2.21 or newer.
14712 This option enables the extraction of object files with GIMPLE bytecode out
14713 of library archives. This improves the quality of optimization by exposing
14714 more code to the link-time optimizer.  This information specifies what
14715 symbols can be accessed externally (by non-LTO object or during dynamic
14716 linking).  Resulting code quality improvements on binaries (and shared
14717 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
14718 See @option{-flto} for a description of the effect of this flag and how to
14719 use it.
14721 This option is enabled by default when LTO support in GCC is enabled
14722 and GCC was configured for use with
14723 a linker supporting plugins (GNU ld 2.21 or newer or gold).
14725 @opindex ffat-lto-objects
14726 @item -ffat-lto-objects
14727 Fat LTO objects are object files that contain both the intermediate language
14728 and the object code. This makes them usable for both LTO linking and normal
14729 linking. This option is effective only when compiling with @option{-flto}
14730 and is ignored at link time.
14732 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
14733 requires the complete toolchain to be aware of LTO. It requires a linker with
14734 linker plugin support for basic functionality.  Additionally,
14735 @command{nm}, @command{ar} and @command{ranlib}
14736 need to support linker plugins to allow a full-featured build environment
14737 (capable of building static libraries etc).  GCC provides the @command{gcc-ar},
14738 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
14739 to these tools. With non fat LTO makefiles need to be modified to use them.
14741 Note that modern binutils provide plugin auto-load mechanism.
14742 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
14743 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
14744 @command{gcc-ranlib}).
14746 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
14747 support.
14749 @opindex fcompare-elim
14750 @item -fcompare-elim
14751 After register allocation and post-register allocation instruction splitting,
14752 identify arithmetic instructions that compute processor flags similar to a
14753 comparison operation based on that arithmetic.  If possible, eliminate the
14754 explicit comparison operation.
14756 This pass only applies to certain targets that cannot explicitly represent
14757 the comparison operation before register allocation is complete.
14759 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14761 @opindex ffold-mem-offsets
14762 @item -ffold-mem-offsets
14763 @itemx -fno-fold-mem-offsets
14764 Try to eliminate add instructions by folding them in memory loads/stores.
14766 Enabled at levels @option{-O2}, @option{-O3}.
14768 @opindex fcprop-registers
14769 @item -fcprop-registers
14770 After register allocation and post-register allocation instruction splitting,
14771 perform a copy-propagation pass to try to reduce scheduling dependencies
14772 and occasionally eliminate the copy.
14774 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14776 @opindex fprofile-correction
14777 @item -fprofile-correction
14778 Profiles collected using an instrumented binary for multi-threaded programs may
14779 be inconsistent due to missed counter updates. When this option is specified,
14780 GCC uses heuristics to correct or smooth out such inconsistencies. By
14781 default, GCC emits an error message when an inconsistent profile is detected.
14783 This option is enabled by @option{-fauto-profile}.
14785 @opindex fprofile-partial-training
14786 @item -fprofile-partial-training
14787 With @code{-fprofile-use} all portions of programs not executed during train
14788 run are optimized agressively for size rather than speed.  In some cases it is
14789 not practical to train all possible hot paths in the program. (For
14790 example, program may contain functions specific for a given hardware and
14791 trianing may not cover all hardware configurations program is run on.)  With
14792 @code{-fprofile-partial-training} profile feedback will be ignored for all
14793 functions not executed during the train run leading them to be optimized as if
14794 they were compiled without profile feedback. This leads to better performance
14795 when train run is not representative but also leads to significantly bigger
14796 code.
14798 @opindex fprofile-use
14799 @item -fprofile-use
14800 @itemx -fprofile-use=@var{path}
14801 Enable profile feedback-directed optimizations, 
14802 and the following optimizations, many of which
14803 are generally profitable only with profile feedback available:
14805 @gccoptlist{-fbranch-probabilities  -fprofile-values
14806 -funroll-loops  -fpeel-loops  -ftracer  -fvpt
14807 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp
14808 -fpredictive-commoning  -fsplit-loops  -funswitch-loops
14809 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize
14810 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns
14811 -fprofile-reorder-functions}
14813 Before you can use this option, you must first generate profiling information.
14814 @xref{Instrumentation Options}, for information about the
14815 @option{-fprofile-generate} option.
14817 By default, GCC emits an error message if the feedback profiles do not
14818 match the source code.  This error can be turned into a warning by using
14819 @option{-Wno-error=coverage-mismatch}.  Note this may result in poorly
14820 optimized code.  Additionally, by default, GCC also emits a warning message if
14821 the feedback profiles do not exist (see @option{-Wmissing-profile}).
14823 If @var{path} is specified, GCC looks at the @var{path} to find
14824 the profile feedback data files. See @option{-fprofile-dir}.
14826 @opindex fauto-profile
14827 @item -fauto-profile
14828 @itemx -fauto-profile=@var{path}
14829 Enable sampling-based feedback-directed optimizations, 
14830 and the following optimizations,
14831 many of which are generally profitable only with profile feedback available:
14833 @gccoptlist{-fbranch-probabilities  -fprofile-values
14834 -funroll-loops  -fpeel-loops  -ftracer  -fvpt
14835 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp
14836 -fpredictive-commoning  -fsplit-loops  -funswitch-loops
14837 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize
14838 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns
14839 -fprofile-correction}
14841 @var{path} is the name of a file containing AutoFDO profile information.
14842 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
14844 Producing an AutoFDO profile data file requires running your program
14845 with the @command{perf} utility on a supported GNU/Linux target system.
14846 For more information, see @uref{https://perf.wiki.kernel.org/}.
14848 E.g.
14849 @smallexample
14850 perf record -e br_inst_retired:near_taken -b -o perf.data \
14851     -- your_program
14852 @end smallexample
14854 Then use the @command{create_gcov} tool to convert the raw profile data
14855 to a format that can be used by GCC.@  You must also supply the 
14856 unstripped binary for your program to this tool.  
14857 See @uref{https://github.com/google/autofdo}.
14859 E.g.
14860 @smallexample
14861 create_gcov --binary=your_program.unstripped --profile=perf.data \
14862     --gcov=profile.afdo
14863 @end smallexample
14864 @end table
14866 The following options control compiler behavior regarding floating-point 
14867 arithmetic.  These options trade off between speed and
14868 correctness.  All must be specifically enabled.
14870 @table @gcctabopt
14871 @opindex ffloat-store
14872 @item -ffloat-store
14873 Do not store floating-point variables in registers, and inhibit other
14874 options that might change whether a floating-point value is taken from a
14875 register or memory.
14877 @cindex floating-point precision
14878 This option prevents undesirable excess precision on machines such as
14879 the 68000 where the floating registers (of the 68881) keep more
14880 precision than a @code{double} is supposed to have.  Similarly for the
14881 x86 architecture.  For most programs, the excess precision does only
14882 good, but a few programs rely on the precise definition of IEEE floating
14883 point.  Use @option{-ffloat-store} for such programs, after modifying
14884 them to store all pertinent intermediate computations into variables.
14886 @opindex fexcess-precision
14887 @item -fexcess-precision=@var{style}
14888 This option allows further control over excess precision on machines
14889 where floating-point operations occur in a format with more precision or
14890 range than the IEEE standard and interchange floating-point types.  By
14891 default, @option{-fexcess-precision=fast} is in effect; this means that
14892 operations may be carried out in a wider precision than the types specified
14893 in the source if that would result in faster code, and it is unpredictable
14894 when rounding to the types specified in the source code takes place.
14895 When compiling C or C++, if @option{-fexcess-precision=standard} is specified
14896 then excess precision follows the rules specified in ISO C99 or C++; in particular,
14897 both casts and assignments cause values to be rounded to their
14898 semantic types (whereas @option{-ffloat-store} only affects
14899 assignments).  This option is enabled by default for C or C++ if a strict
14900 conformance option such as @option{-std=c99} or @option{-std=c++17} is used.
14901 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
14902 regardless of whether a strict conformance option is used.
14904 @opindex mfpmath
14905 @option{-fexcess-precision=standard} is not implemented for languages
14906 other than C or C++.  On the x86, it has no effect if @option{-mfpmath=sse}
14907 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
14908 semantics apply without excess precision, and in the latter, rounding
14909 is unpredictable.
14911 @opindex ffast-math
14912 @item -ffast-math
14913 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
14914 @option{-ffinite-math-only}, @option{-fno-rounding-math},
14915 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
14916 @option{-fexcess-precision=fast}.
14918 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
14920 This option is not turned on by any @option{-O} option besides
14921 @option{-Ofast} since it can result in incorrect output for programs
14922 that depend on an exact implementation of IEEE or ISO rules/specifications
14923 for math functions. It may, however, yield faster code for programs
14924 that do not require the guarantees of these specifications.
14926 @opindex fno-math-errno
14927 @opindex fmath-errno
14928 @item -fno-math-errno
14929 Do not set @code{errno} after calling math functions that are executed
14930 with a single instruction, e.g., @code{sqrt}.  A program that relies on
14931 IEEE exceptions for math error handling may want to use this flag
14932 for speed while maintaining IEEE arithmetic compatibility.
14934 This option is not turned on by any @option{-O} option since
14935 it can result in incorrect output for programs that depend on
14936 an exact implementation of IEEE or ISO rules/specifications for
14937 math functions. It may, however, yield faster code for programs
14938 that do not require the guarantees of these specifications.
14940 The default is @option{-fmath-errno}.
14942 On Darwin systems, the math library never sets @code{errno}.  There is
14943 therefore no reason for the compiler to consider the possibility that
14944 it might, and @option{-fno-math-errno} is the default.
14946 @opindex funsafe-math-optimizations
14947 @item -funsafe-math-optimizations
14949 Allow optimizations for floating-point arithmetic that (a) assume
14950 that arguments and results are valid and (b) may violate IEEE or
14951 ANSI standards.  When used at link time, it may include libraries
14952 or startup files that change the default FPU control word or other
14953 similar optimizations.
14955 This option is not turned on by any @option{-O} option since
14956 it can result in incorrect output for programs that depend on
14957 an exact implementation of IEEE or ISO rules/specifications for
14958 math functions. It may, however, yield faster code for programs
14959 that do not require the guarantees of these specifications.
14960 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
14961 @option{-fassociative-math} and @option{-freciprocal-math}.
14963 The default is @option{-fno-unsafe-math-optimizations}.
14965 @opindex fassociative-math
14966 @item -fassociative-math
14968 Allow re-association of operands in series of floating-point operations.
14969 This violates the ISO C and C++ language standard by possibly changing
14970 computation result.  NOTE: re-ordering may change the sign of zero as
14971 well as ignore NaNs and inhibit or create underflow or overflow (and
14972 thus cannot be used on code that relies on rounding behavior like
14973 @code{(x + 2**52) - 2**52}.  May also reorder floating-point comparisons
14974 and thus may not be used when ordered comparisons are required.
14975 This option requires that both @option{-fno-signed-zeros} and
14976 @option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
14977 much sense with @option{-frounding-math}. For Fortran the option
14978 is automatically enabled when both @option{-fno-signed-zeros} and
14979 @option{-fno-trapping-math} are in effect.
14981 The default is @option{-fno-associative-math}.
14983 @opindex freciprocal-math
14984 @item -freciprocal-math
14986 Allow the reciprocal of a value to be used instead of dividing by
14987 the value if this enables optimizations.  For example @code{x / y}
14988 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
14989 is subject to common subexpression elimination.  Note that this loses
14990 precision and increases the number of flops operating on the value.
14992 The default is @option{-fno-reciprocal-math}.
14994 @opindex ffinite-math-only
14995 @item -ffinite-math-only
14996 Allow optimizations for floating-point arithmetic that assume
14997 that arguments and results are not NaNs or +-Infs.
14999 This option is not turned on by any @option{-O} option since
15000 it can result in incorrect output for programs that depend on
15001 an exact implementation of IEEE or ISO rules/specifications for
15002 math functions. It may, however, yield faster code for programs
15003 that do not require the guarantees of these specifications.
15005 The default is @option{-fno-finite-math-only}.
15007 @opindex fno-signed-zeros
15008 @opindex fsigned-zeros
15009 @item -fno-signed-zeros
15010 Allow optimizations for floating-point arithmetic that ignore the
15011 signedness of zero.  IEEE arithmetic specifies the behavior of
15012 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
15013 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
15014 This option implies that the sign of a zero result isn't significant.
15016 The default is @option{-fsigned-zeros}.
15018 @opindex fno-trapping-math
15019 @opindex ftrapping-math
15020 @item -fno-trapping-math
15021 Compile code assuming that floating-point operations cannot generate
15022 user-visible traps.  These traps include division by zero, overflow,
15023 underflow, inexact result and invalid operation.  This option requires
15024 that @option{-fno-signaling-nans} be in effect.  Setting this option may
15025 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
15027 This option should never be turned on by any @option{-O} option since
15028 it can result in incorrect output for programs that depend on
15029 an exact implementation of IEEE or ISO rules/specifications for
15030 math functions.
15032 The default is @option{-ftrapping-math}.
15034 Future versions of GCC may provide finer control of this setting
15035 using C99's @code{FENV_ACCESS} pragma.  This command-line option
15036 will be used along with @option{-frounding-math} to specify the
15037 default state for @code{FENV_ACCESS}.
15039 @opindex frounding-math
15040 @item -frounding-math
15041 Disable transformations and optimizations that assume default floating-point
15042 rounding behavior.  This is round-to-zero for all floating point
15043 to integer conversions, and round-to-nearest for all other arithmetic
15044 truncations.  This option should be specified for programs that change
15045 the FP rounding mode dynamically, or that may be executed with a
15046 non-default rounding mode.  This option disables constant folding of
15047 floating-point expressions at compile time (which may be affected by
15048 rounding mode) and arithmetic transformations that are unsafe in the
15049 presence of sign-dependent rounding modes.
15051 The default is @option{-fno-rounding-math}.
15053 This option is experimental and does not currently guarantee to
15054 disable all GCC optimizations that are affected by rounding mode.
15055 Future versions of GCC may provide finer control of this setting
15056 using C99's @code{FENV_ACCESS} pragma.  This command-line option
15057 will be used along with @option{-ftrapping-math} to specify the
15058 default state for @code{FENV_ACCESS}.
15060 @opindex fsignaling-nans
15061 @item -fsignaling-nans
15062 Compile code assuming that IEEE signaling NaNs may generate user-visible
15063 traps during floating-point operations.  Setting this option disables
15064 optimizations that may change the number of exceptions visible with
15065 signaling NaNs.  This option implies @option{-ftrapping-math}.
15067 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
15068 be defined.
15070 The default is @option{-fno-signaling-nans}.
15072 This option is experimental and does not currently guarantee to
15073 disable all GCC optimizations that affect signaling NaN behavior.
15075 @opindex fno-fp-int-builtin-inexact
15076 @opindex ffp-int-builtin-inexact
15077 @item -fno-fp-int-builtin-inexact
15078 Do not allow the built-in functions @code{ceil}, @code{floor},
15079 @code{round} and @code{trunc}, and their @code{float} and @code{long
15080 double} variants, to generate code that raises the ``inexact''
15081 floating-point exception for noninteger arguments.  ISO C99 and C11
15082 allow these functions to raise the ``inexact'' exception, but ISO/IEC
15083 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
15084 ISO C23, does not allow these functions to do so.
15086 The default is @option{-ffp-int-builtin-inexact}, allowing the
15087 exception to be raised, unless C23 or a later C standard is selected.
15088 This option does nothing unless @option{-ftrapping-math} is in effect.
15090 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
15091 generate a call to a library function then the ``inexact'' exception
15092 may be raised if the library implementation does not follow TS 18661.
15094 @opindex fsingle-precision-constant
15095 @item -fsingle-precision-constant
15096 Treat floating-point constants as single precision instead of
15097 implicitly converting them to double-precision constants.
15099 @opindex fcx-limited-range
15100 @item -fcx-limited-range
15101 When enabled, this option states that a range reduction step is not
15102 needed when performing complex division.  Also, there is no checking
15103 whether the result of a complex multiplication or division is @code{NaN
15104 + I*NaN}, with an attempt to rescue the situation in that case.  The
15105 default is @option{-fno-cx-limited-range}, but is enabled by
15106 @option{-ffast-math}.
15108 This option controls the default setting of the ISO C99
15109 @code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
15110 all languages.
15112 @opindex fcx-fortran-rules
15113 @item -fcx-fortran-rules
15114 Complex multiplication and division follow Fortran rules.  Range
15115 reduction is done as part of complex division, but there is no checking
15116 whether the result of a complex multiplication or division is @code{NaN
15117 + I*NaN}, with an attempt to rescue the situation in that case.
15119 The default is @option{-fno-cx-fortran-rules}.
15121 @end table
15123 The following options control optimizations that may improve
15124 performance, but are not enabled by any @option{-O} options.  This
15125 section includes experimental options that may produce broken code.
15127 @table @gcctabopt
15128 @opindex fbranch-probabilities
15129 @item -fbranch-probabilities
15130 After running a program compiled with @option{-fprofile-arcs}
15131 (@pxref{Instrumentation Options}),
15132 you can compile it a second time using
15133 @option{-fbranch-probabilities}, to improve optimizations based on
15134 the number of times each branch was taken.  When a program
15135 compiled with @option{-fprofile-arcs} exits, it saves arc execution
15136 counts to a file called @file{@var{sourcename}.gcda} for each source
15137 file.  The information in this data file is very dependent on the
15138 structure of the generated code, so you must use the same source code
15139 and the same optimization options for both compilations.
15140 See details about the file naming in @option{-fprofile-arcs}.
15142 With @option{-fbranch-probabilities}, GCC puts a
15143 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
15144 These can be used to improve optimization.  Currently, they are only
15145 used in one place: in @file{reorg.cc}, instead of guessing which path a
15146 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
15147 exactly determine which path is taken more often.
15149 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15151 @opindex fprofile-values
15152 @item -fprofile-values
15153 If combined with @option{-fprofile-arcs}, it adds code so that some
15154 data about values of expressions in the program is gathered.
15156 With @option{-fbranch-probabilities}, it reads back the data gathered
15157 from profiling values of expressions for usage in optimizations.
15159 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
15160 @option{-fauto-profile}.
15162 @opindex fprofile-reorder-functions
15163 @item -fprofile-reorder-functions
15164 Function reordering based on profile instrumentation collects
15165 first time of execution of a function and orders these functions
15166 in ascending order.
15168 Enabled with @option{-fprofile-use}.
15170 @opindex fvpt
15171 @item -fvpt
15172 If combined with @option{-fprofile-arcs}, this option instructs the compiler
15173 to add code to gather information about values of expressions.
15175 With @option{-fbranch-probabilities}, it reads back the data gathered
15176 and actually performs the optimizations based on them.
15177 Currently the optimizations include specialization of division operations
15178 using the knowledge about the value of the denominator.
15180 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
15182 @opindex frename-registers
15183 @item -frename-registers
15184 Attempt to avoid false dependencies in scheduled code by making use
15185 of registers left over after register allocation.  This optimization
15186 most benefits processors with lots of registers.  Depending on the
15187 debug information format adopted by the target, however, it can
15188 make debugging impossible, since variables no longer stay in
15189 a ``home register''.
15191 Enabled by default with @option{-funroll-loops}.
15193 @opindex fschedule-fusion
15194 @item -fschedule-fusion
15195 Performs a target dependent pass over the instruction stream to schedule
15196 instructions of same type together because target machine can execute them
15197 more efficiently if they are adjacent to each other in the instruction flow.
15199 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
15201 @opindex ftracer
15202 @item -ftracer
15203 Perform tail duplication to enlarge superblock size.  This transformation
15204 simplifies the control flow of the function allowing other optimizations to do
15205 a better job.
15207 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15209 @opindex funroll-loops
15210 @item -funroll-loops
15211 Unroll loops whose number of iterations can be determined at compile time or
15212 upon entry to the loop.  @option{-funroll-loops} implies
15213 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
15214 It also turns on complete loop peeling (i.e.@: complete removal of loops with
15215 a small constant number of iterations).  This option makes code larger, and may
15216 or may not make it run faster.
15218 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15220 @opindex funroll-all-loops
15221 @item -funroll-all-loops
15222 Unroll all loops, even if their number of iterations is uncertain when
15223 the loop is entered.  This usually makes programs run more slowly.
15224 @option{-funroll-all-loops} implies the same options as
15225 @option{-funroll-loops}.
15227 @opindex fpeel-loops
15228 @item -fpeel-loops
15229 Peels loops for which there is enough information that they do not
15230 roll much (from profile feedback or static analysis).  It also turns on
15231 complete loop peeling (i.e.@: complete removal of loops with small constant
15232 number of iterations).
15234 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
15236 @opindex fmove-loop-invariants
15237 @item -fmove-loop-invariants
15238 Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
15239 at level @option{-O1} and higher, except for @option{-Og}.
15241 @opindex fmove-loop-stores
15242 @item -fmove-loop-stores
15243 Enables the loop store motion pass in the GIMPLE loop optimizer.  This
15244 moves invariant stores to after the end of the loop in exchange for
15245 carrying the stored value in a register across the iteration.
15246 Note for this option to have an effect @option{-ftree-loop-im} has to
15247 be enabled as well.  Enabled at level @option{-O1} and higher, except
15248 for @option{-Og}.
15250 @opindex fsplit-loops
15251 @item -fsplit-loops
15252 Split a loop into two if it contains a condition that's always true
15253 for one side of the iteration space and false for the other.
15255 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15257 @opindex funswitch-loops
15258 @item -funswitch-loops
15259 Move branches with loop invariant conditions out of the loop, with duplicates
15260 of the loop on both branches (modified according to result of the condition).
15262 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15264 @opindex fversion-loops-for-strides
15265 @item -fversion-loops-for-strides
15266 If a loop iterates over an array with a variable stride, create another
15267 version of the loop that assumes the stride is always one.  For example:
15269 @smallexample
15270 for (int i = 0; i < n; ++i)
15271   x[i * stride] = @dots{};
15272 @end smallexample
15274 becomes:
15276 @smallexample
15277 if (stride == 1)
15278   for (int i = 0; i < n; ++i)
15279     x[i] = @dots{};
15280 else
15281   for (int i = 0; i < n; ++i)
15282     x[i * stride] = @dots{};
15283 @end smallexample
15285 This is particularly useful for assumed-shape arrays in Fortran where
15286 (for example) it allows better vectorization assuming contiguous accesses.
15287 This flag is enabled by default at @option{-O3}.
15288 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15290 @opindex ffunction-sections
15291 @opindex fdata-sections
15292 @item -ffunction-sections
15293 @itemx -fdata-sections
15294 Place each function or data item into its own section in the output
15295 file if the target supports arbitrary sections.  The name of the
15296 function or the name of the data item determines the section's name
15297 in the output file.
15299 Use these options on systems where the linker can perform optimizations to
15300 improve locality of reference in the instruction space.  Most systems using the
15301 ELF object format have linkers with such optimizations.  On AIX, the linker
15302 rearranges sections (CSECTs) based on the call graph.  The performance impact
15303 varies.
15305 Together with a linker garbage collection (linker @option{--gc-sections}
15306 option) these options may lead to smaller statically-linked executables (after
15307 stripping).
15309 On ELF/DWARF systems these options do not degenerate the quality of the debug
15310 information.  There could be issues with other object files/debug info formats.
15312 Only use these options when there are significant benefits from doing so.  When
15313 you specify these options, the assembler and linker create larger object and
15314 executable files and are also slower.  These options affect code generation.
15315 They prevent optimizations by the compiler and assembler using relative
15316 locations inside a translation unit since the locations are unknown until
15317 link time.  An example of such an optimization is relaxing calls to short call
15318 instructions.
15320 @opindex fstdarg-opt
15321 @item -fstdarg-opt
15322 Optimize the prologue of variadic argument functions with respect to usage of
15323 those arguments.
15325 @opindex fsection-anchors
15326 @item -fsection-anchors
15327 Try to reduce the number of symbolic address calculations by using
15328 shared ``anchor'' symbols to address nearby objects.  This transformation
15329 can help to reduce the number of GOT entries and GOT accesses on some
15330 targets.
15332 For example, the implementation of the following function @code{foo}:
15334 @smallexample
15335 static int a, b, c;
15336 int foo (void) @{ return a + b + c; @}
15337 @end smallexample
15339 @noindent
15340 usually calculates the addresses of all three variables, but if you
15341 compile it with @option{-fsection-anchors}, it accesses the variables
15342 from a common anchor point instead.  The effect is similar to the
15343 following pseudocode (which isn't valid C):
15345 @smallexample
15346 int foo (void)
15348   register int *xr = &x;
15349   return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
15351 @end smallexample
15353 Not all targets support this option.
15355 @opindex fzero-call-used-regs
15356 @item -fzero-call-used-regs=@var{choice}
15357 Zero call-used registers at function return to increase program
15358 security by either mitigating Return-Oriented Programming (ROP)
15359 attacks or preventing information leakage through registers.
15361 The possible values of @var{choice} are the same as for the
15362 @code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
15363 The default is @samp{skip}.
15365 You can control this behavior for a specific function by using the function
15366 attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
15368 @opindex param
15369 @item --param @var{name}=@var{value}
15370 In some places, GCC uses various constants to control the amount of
15371 optimization that is done.  For example, GCC does not inline functions
15372 that contain more than a certain number of instructions.  You can
15373 control some of these constants on the command line using the
15374 @option{--param} option.
15376 The names of specific parameters, and the meaning of the values, are
15377 tied to the internals of the compiler, and are subject to change
15378 without notice in future releases.
15380 In order to get the minimal, maximal and default values of a parameter,
15381 use the @option{--help=param -Q} options.
15383 In each case, the @var{value} is an integer.  The following choices
15384 of @var{name} are recognized for all targets:
15386 @table @gcctabopt
15387 @item predictable-branch-outcome
15388 When branch is predicted to be taken with probability lower than this threshold
15389 (in percent), then it is considered well predictable.
15391 @item max-rtl-if-conversion-insns
15392 RTL if-conversion tries to remove conditional branches around a block and
15393 replace them with conditionally executed instructions.  This parameter
15394 gives the maximum number of instructions in a block which should be
15395 considered for if-conversion.  The compiler will
15396 also use other heuristics to decide whether if-conversion is likely to be
15397 profitable.
15399 @item max-rtl-if-conversion-predictable-cost
15400 RTL if-conversion will try to remove conditional branches around a block
15401 and replace them with conditionally executed instructions.  These parameters
15402 give the maximum permissible cost for the sequence that would be generated
15403 by if-conversion depending on whether the branch is statically determined
15404 to be predictable or not.  The units for this parameter are the same as
15405 those for the GCC internal seq_cost metric.  The compiler will try to
15406 provide a reasonable default for this parameter using the BRANCH_COST
15407 target macro.
15409 @item max-crossjump-edges
15410 The maximum number of incoming edges to consider for cross-jumping.
15411 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
15412 the number of edges incoming to each block.  Increasing values mean
15413 more aggressive optimization, making the compilation time increase with
15414 probably small improvement in executable size.
15416 @item min-crossjump-insns
15417 The minimum number of instructions that must be matched at the end
15418 of two blocks before cross-jumping is performed on them.  This
15419 value is ignored in the case where all instructions in the block being
15420 cross-jumped from are matched.
15422 @item max-grow-copy-bb-insns
15423 The maximum code size expansion factor when copying basic blocks
15424 instead of jumping.  The expansion is relative to a jump instruction.
15426 @item max-goto-duplication-insns
15427 The maximum number of instructions to duplicate to a block that jumps
15428 to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
15429 passes, GCC factors computed gotos early in the compilation process,
15430 and unfactors them as late as possible.  Only computed jumps at the
15431 end of a basic blocks with no more than max-goto-duplication-insns are
15432 unfactored.
15434 @item max-delay-slot-insn-search
15435 The maximum number of instructions to consider when looking for an
15436 instruction to fill a delay slot.  If more than this arbitrary number of
15437 instructions are searched, the time savings from filling the delay slot
15438 are minimal, so stop searching.  Increasing values mean more
15439 aggressive optimization, making the compilation time increase with probably
15440 small improvement in execution time.
15442 @item max-delay-slot-live-search
15443 When trying to fill delay slots, the maximum number of instructions to
15444 consider when searching for a block with valid live register
15445 information.  Increasing this arbitrarily chosen value means more
15446 aggressive optimization, increasing the compilation time.  This parameter
15447 should be removed when the delay slot code is rewritten to maintain the
15448 control-flow graph.
15450 @item max-gcse-memory
15451 The approximate maximum amount of memory in @code{kB} that can be allocated in
15452 order to perform the global common subexpression elimination
15453 optimization.  If more memory than specified is required, the
15454 optimization is not done.
15456 @item max-gcse-insertion-ratio
15457 If the ratio of expression insertions to deletions is larger than this value
15458 for any expression, then RTL PRE inserts or removes the expression and thus
15459 leaves partially redundant computations in the instruction stream.
15461 @item max-pending-list-length
15462 The maximum number of pending dependencies scheduling allows
15463 before flushing the current state and starting over.  Large functions
15464 with few branches or calls can create excessively large lists which
15465 needlessly consume memory and resources.
15467 @item max-modulo-backtrack-attempts
15468 The maximum number of backtrack attempts the scheduler should make
15469 when modulo scheduling a loop.  Larger values can exponentially increase
15470 compilation time.
15472 @item max-inline-functions-called-once-loop-depth
15473 Maximal loop depth of a call considered by inline heuristics that tries to
15474 inline all functions called once.
15476 @item max-inline-functions-called-once-insns
15477 Maximal estimated size of functions produced while inlining functions called
15478 once.
15480 @item max-inline-insns-single
15481 Several parameters control the tree inliner used in GCC@.  This number sets the
15482 maximum number of instructions (counted in GCC's internal representation) in a
15483 single function that the tree inliner considers for inlining.  This only
15484 affects functions declared inline and methods implemented in a class
15485 declaration (C++). 
15488 @item max-inline-insns-auto
15489 When you use @option{-finline-functions} (included in @option{-O3}),
15490 a lot of functions that would otherwise not be considered for inlining
15491 by the compiler are investigated.  To those functions, a different
15492 (more restrictive) limit compared to functions declared inline can
15493 be applied (@option{--param max-inline-insns-auto}).
15495 @item max-inline-insns-small
15496 This is bound applied to calls which are considered relevant with
15497 @option{-finline-small-functions}.
15499 @item max-inline-insns-size
15500 This is bound applied to calls which are optimized for size. Small growth
15501 may be desirable to anticipate optimization oppurtunities exposed by inlining.
15503 @item uninlined-function-insns
15504 Number of instructions accounted by inliner for function overhead such as
15505 function prologue and epilogue.
15507 @item uninlined-function-time
15508 Extra time accounted by inliner for function overhead such as time needed to
15509 execute function prologue and epilogue.
15511 @item inline-heuristics-hint-percent
15512 The scale (in percents) applied to @option{inline-insns-single},
15513 @option{inline-insns-single-O2}, @option{inline-insns-auto}
15514 when inline heuristics hints that inlining is
15515 very profitable (will enable later optimizations).
15517 @item uninlined-thunk-insns
15518 @item uninlined-thunk-time
15519 Same as @option{--param uninlined-function-insns} and
15520 @option{--param uninlined-function-time} but applied to function thunks.
15522 @item inline-min-speedup
15523 When estimated performance improvement of caller + callee runtime exceeds this
15524 threshold (in percent), the function can be inlined regardless of the limit on
15525 @option{--param max-inline-insns-single} and @option{--param
15526 max-inline-insns-auto}.
15528 @item large-function-insns
15529 The limit specifying really large functions.  For functions larger than this
15530 limit after inlining, inlining is constrained by
15531 @option{--param large-function-growth}.  This parameter is useful primarily
15532 to avoid extreme compilation time caused by non-linear algorithms used by the
15533 back end.
15535 @item large-function-growth
15536 Specifies maximal growth of large function caused by inlining in percents.
15537 For example, parameter value 100 limits large function growth to 2.0 times
15538 the original size.
15540 @item large-unit-insns
15541 The limit specifying large translation unit.  Growth caused by inlining of
15542 units larger than this limit is limited by @option{--param inline-unit-growth}.
15543 For small units this might be too tight.
15544 For example, consider a unit consisting of function A
15545 that is inline and B that just calls A three times.  If B is small relative to
15546 A, the growth of unit is 300\% and yet such inlining is very sane.  For very
15547 large units consisting of small inlineable functions, however, the overall unit
15548 growth limit is needed to avoid exponential explosion of code size.  Thus for
15549 smaller units, the size is increased to @option{--param large-unit-insns}
15550 before applying @option{--param inline-unit-growth}.
15552 @item lazy-modules
15553 Maximum number of concurrently open C++ module files when lazy loading.
15555 @item inline-unit-growth
15556 Specifies maximal overall growth of the compilation unit caused by inlining.
15557 For example, parameter value 20 limits unit growth to 1.2 times the original
15558 size. Cold functions (either marked cold via an attribute or by profile
15559 feedback) are not accounted into the unit size.
15561 @item ipa-cp-unit-growth
15562 Specifies maximal overall growth of the compilation unit caused by
15563 interprocedural constant propagation.  For example, parameter value 10 limits
15564 unit growth to 1.1 times the original size.
15566 @item ipa-cp-large-unit-insns
15567 The size of translation unit that IPA-CP pass considers large.
15569 @item large-stack-frame
15570 The limit specifying large stack frames.  While inlining the algorithm is trying
15571 to not grow past this limit too much.
15573 @item large-stack-frame-growth
15574 Specifies maximal growth of large stack frames caused by inlining in percents.
15575 For example, parameter value 1000 limits large stack frame growth to 11 times
15576 the original size.
15578 @item max-inline-insns-recursive
15579 @itemx max-inline-insns-recursive-auto
15580 Specifies the maximum number of instructions an out-of-line copy of a
15581 self-recursive inline
15582 function can grow into by performing recursive inlining.
15584 @option{--param max-inline-insns-recursive} applies to functions
15585 declared inline.
15586 For functions not declared inline, recursive inlining
15587 happens only when @option{-finline-functions} (included in @option{-O3}) is
15588 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
15590 @item max-inline-recursive-depth
15591 @itemx max-inline-recursive-depth-auto
15592 Specifies the maximum recursion depth used for recursive inlining.
15594 @option{--param max-inline-recursive-depth} applies to functions
15595 declared inline.  For functions not declared inline, recursive inlining
15596 happens only when @option{-finline-functions} (included in @option{-O3}) is
15597 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
15599 @item min-inline-recursive-probability
15600 Recursive inlining is profitable only for function having deep recursion
15601 in average and can hurt for function having little recursion depth by
15602 increasing the prologue size or complexity of function body to other
15603 optimizers.
15605 When profile feedback is available (see @option{-fprofile-generate}) the actual
15606 recursion depth can be guessed from the probability that function recurses
15607 via a given call expression.  This parameter limits inlining only to call
15608 expressions whose probability exceeds the given threshold (in percents).
15610 @item early-inlining-insns
15611 Specify growth that the early inliner can make.  In effect it increases
15612 the amount of inlining for code having a large abstraction penalty.
15614 @item max-early-inliner-iterations
15615 Limit of iterations of the early inliner.  This basically bounds
15616 the number of nested indirect calls the early inliner can resolve.
15617 Deeper chains are still handled by late inlining.
15619 @item comdat-sharing-probability
15620 Probability (in percent) that C++ inline function with comdat visibility
15621 are shared across multiple compilation units.
15623 @item modref-max-bases
15624 @item modref-max-refs
15625 @item modref-max-accesses
15626 Specifies the maximal number of base pointers, references and accesses stored
15627 for a single function by mod/ref analysis.
15629 @item modref-max-tests
15630 Specifies the maxmal number of tests alias oracle can perform to disambiguate
15631 memory locations using the mod/ref information.  This parameter ought to be
15632 bigger than @option{--param modref-max-bases} and @option{--param
15633 modref-max-refs}.
15635 @item modref-max-depth
15636 Specifies the maximum depth of DFS walk used by modref escape analysis.
15637 Setting to 0 disables the analysis completely.
15639 @item modref-max-escape-points
15640 Specifies the maximum number of escape points tracked by modref per SSA-name.
15642 @item modref-max-adjustments
15643 Specifies the maximum number the access range is enlarged during modref dataflow
15644 analysis.
15646 @item profile-func-internal-id
15647 A parameter to control whether to use function internal id in profile
15648 database lookup. If the value is 0, the compiler uses an id that
15649 is based on function assembler name and filename, which makes old profile
15650 data more tolerant to source changes such as function reordering etc.
15652 @item min-vect-loop-bound
15653 The minimum number of iterations under which loops are not vectorized
15654 when @option{-ftree-vectorize} is used.  The number of iterations after
15655 vectorization needs to be greater than the value specified by this option
15656 to allow vectorization.
15658 @item gcse-cost-distance-ratio
15659 Scaling factor in calculation of maximum distance an expression
15660 can be moved by GCSE optimizations.  This is currently supported only in the
15661 code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
15662 is with simple expressions, i.e., the expressions that have cost
15663 less than @option{gcse-unrestricted-cost}.  Specifying 0 disables
15664 hoisting of simple expressions.
15666 @item gcse-unrestricted-cost
15667 Cost, roughly measured as the cost of a single typical machine
15668 instruction, at which GCSE optimizations do not constrain
15669 the distance an expression can travel.  This is currently
15670 supported only in the code hoisting pass.  The lesser the cost,
15671 the more aggressive code hoisting is.  Specifying 0 
15672 allows all expressions to travel unrestricted distances.
15674 @item max-hoist-depth
15675 The depth of search in the dominator tree for expressions to hoist.
15676 This is used to avoid quadratic behavior in hoisting algorithm.
15677 The value of 0 does not limit on the search, but may slow down compilation
15678 of huge functions.
15680 @item max-tail-merge-comparisons
15681 The maximum amount of similar bbs to compare a bb with.  This is used to
15682 avoid quadratic behavior in tree tail merging.
15684 @item max-tail-merge-iterations
15685 The maximum amount of iterations of the pass over the function.  This is used to
15686 limit compilation time in tree tail merging.
15688 @item store-merging-allow-unaligned
15689 Allow the store merging pass to introduce unaligned stores if it is legal to
15690 do so.
15692 @item max-stores-to-merge
15693 The maximum number of stores to attempt to merge into wider stores in the store
15694 merging pass.
15696 @item max-store-chains-to-track
15697 The maximum number of store chains to track at the same time in the attempt
15698 to merge them into wider stores in the store merging pass.
15700 @item max-stores-to-track
15701 The maximum number of stores to track at the same time in the attemt to
15702 to merge them into wider stores in the store merging pass.
15704 @item max-unrolled-insns
15705 The maximum number of instructions that a loop may have to be unrolled.
15706 If a loop is unrolled, this parameter also determines how many times
15707 the loop code is unrolled.
15709 @item max-average-unrolled-insns
15710 The maximum number of instructions biased by probabilities of their execution
15711 that a loop may have to be unrolled.  If a loop is unrolled,
15712 this parameter also determines how many times the loop code is unrolled.
15714 @item max-unroll-times
15715 The maximum number of unrollings of a single loop.
15717 @item max-peeled-insns
15718 The maximum number of instructions that a loop may have to be peeled.
15719 If a loop is peeled, this parameter also determines how many times
15720 the loop code is peeled.
15722 @item max-peel-times
15723 The maximum number of peelings of a single loop.
15725 @item max-peel-branches
15726 The maximum number of branches on the hot path through the peeled sequence.
15728 @item max-completely-peeled-insns
15729 The maximum number of insns of a completely peeled loop.
15731 @item max-completely-peel-times
15732 The maximum number of iterations of a loop to be suitable for complete peeling.
15734 @item max-completely-peel-loop-nest-depth
15735 The maximum depth of a loop nest suitable for complete peeling.
15737 @item max-unswitch-insns
15738 The maximum number of insns of an unswitched loop.
15740 @item max-unswitch-depth
15741 The maximum depth of a loop nest to be unswitched.
15743 @item lim-expensive
15744 The minimum cost of an expensive expression in the loop invariant motion.
15746 @item min-loop-cond-split-prob
15747 When FDO profile information is available, @option{min-loop-cond-split-prob}
15748 specifies minimum threshold for probability of semi-invariant condition
15749 statement to trigger loop split.
15751 @item iv-consider-all-candidates-bound
15752 Bound on number of candidates for induction variables, below which
15753 all candidates are considered for each use in induction variable
15754 optimizations.  If there are more candidates than this,
15755 only the most relevant ones are considered to avoid quadratic time complexity.
15757 @item iv-max-considered-uses
15758 The induction variable optimizations give up on loops that contain more
15759 induction variable uses.
15761 @item iv-always-prune-cand-set-bound
15762 If the number of candidates in the set is smaller than this value,
15763 always try to remove unnecessary ivs from the set
15764 when adding a new one.
15766 @item avg-loop-niter
15767 Average number of iterations of a loop.
15769 @item dse-max-object-size
15770 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
15771 Larger values may result in larger compilation times.
15773 @item dse-max-alias-queries-per-store
15774 Maximum number of queries into the alias oracle per store.
15775 Larger values result in larger compilation times and may result in more
15776 removed dead stores.
15778 @item scev-max-expr-size
15779 Bound on size of expressions used in the scalar evolutions analyzer.
15780 Large expressions slow the analyzer.
15782 @item scev-max-expr-complexity
15783 Bound on the complexity of the expressions in the scalar evolutions analyzer.
15784 Complex expressions slow the analyzer.
15786 @item max-tree-if-conversion-phi-args
15787 Maximum number of arguments in a PHI supported by TREE if conversion
15788 unless the loop is marked with simd pragma.
15790 @item vect-max-layout-candidates
15791 The maximum number of possible vector layouts (such as permutations)
15792 to consider when optimizing to-be-vectorized code.
15794 @item vect-max-version-for-alignment-checks
15795 The maximum number of run-time checks that can be performed when
15796 doing loop versioning for alignment in the vectorizer.
15798 @item vect-max-version-for-alias-checks
15799 The maximum number of run-time checks that can be performed when
15800 doing loop versioning for alias in the vectorizer.
15802 @item vect-max-peeling-for-alignment
15803 The maximum number of loop peels to enhance access alignment
15804 for vectorizer. Value -1 means no limit.
15806 @item max-iterations-to-track
15807 The maximum number of iterations of a loop the brute-force algorithm
15808 for analysis of the number of iterations of the loop tries to evaluate.
15810 @item hot-bb-count-fraction
15811 The denominator n of fraction 1/n of the maximal execution count of a
15812 basic block in the entire program that a basic block needs to at least
15813 have in order to be considered hot.  The default is 10000, which means
15814 that a basic block is considered hot if its execution count is greater
15815 than 1/10000 of the maximal execution count.  0 means that it is never
15816 considered hot.  Used in non-LTO mode.
15818 @item hot-bb-count-ws-permille
15819 The number of most executed permilles, ranging from 0 to 1000, of the
15820 profiled execution of the entire program to which the execution count
15821 of a basic block must be part of in order to be considered hot.  The
15822 default is 990, which means that a basic block is considered hot if
15823 its execution count contributes to the upper 990 permilles, or 99.0%,
15824 of the profiled execution of the entire program.  0 means that it is
15825 never considered hot.  Used in LTO mode.
15827 @item hot-bb-frequency-fraction
15828 The denominator n of fraction 1/n of the execution frequency of the
15829 entry block of a function that a basic block of this function needs
15830 to at least have in order to be considered hot.  The default is 1000,
15831 which means that a basic block is considered hot in a function if it
15832 is executed more frequently than 1/1000 of the frequency of the entry
15833 block of the function.  0 means that it is never considered hot.
15835 @item unlikely-bb-count-fraction
15836 The denominator n of fraction 1/n of the number of profiled runs of
15837 the entire program below which the execution count of a basic block
15838 must be in order for the basic block to be considered unlikely executed.
15839 The default is 20, which means that a basic block is considered unlikely
15840 executed if it is executed in fewer than 1/20, or 5%, of the runs of
15841 the program.  0 means that it is always considered unlikely executed.
15843 @item max-predicted-iterations
15844 The maximum number of loop iterations we predict statically.  This is useful
15845 in cases where a function contains a single loop with known bound and
15846 another loop with unknown bound.
15847 The known number of iterations is predicted correctly, while
15848 the unknown number of iterations average to roughly 10.  This means that the
15849 loop without bounds appears artificially cold relative to the other one.
15851 @item builtin-expect-probability
15852 Control the probability of the expression having the specified value. This
15853 parameter takes a percentage (i.e.@: 0 ... 100) as input.
15855 @item builtin-string-cmp-inline-length
15856 The maximum length of a constant string for a builtin string cmp call 
15857 eligible for inlining.
15859 @item align-threshold
15861 Select fraction of the maximal frequency of executions of a basic block in
15862 a function to align the basic block.
15864 @item align-loop-iterations
15866 A loop expected to iterate at least the selected number of iterations is
15867 aligned.
15869 @item tracer-dynamic-coverage
15870 @itemx tracer-dynamic-coverage-feedback
15872 This value is used to limit superblock formation once the given percentage of
15873 executed instructions is covered.  This limits unnecessary code size
15874 expansion.
15876 The @option{tracer-dynamic-coverage-feedback} parameter
15877 is used only when profile
15878 feedback is available.  The real profiles (as opposed to statically estimated
15879 ones) are much less balanced allowing the threshold to be larger value.
15881 @item tracer-max-code-growth
15882 Stop tail duplication once code growth has reached given percentage.  This is
15883 a rather artificial limit, as most of the duplicates are eliminated later in
15884 cross jumping, so it may be set to much higher values than is the desired code
15885 growth.
15887 @item tracer-min-branch-ratio
15889 Stop reverse growth when the reverse probability of best edge is less than this
15890 threshold (in percent).
15892 @item tracer-min-branch-probability
15893 @itemx tracer-min-branch-probability-feedback
15895 Stop forward growth if the best edge has probability lower than this
15896 threshold.
15898 Similarly to @option{tracer-dynamic-coverage} two parameters are
15899 provided.  @option{tracer-min-branch-probability-feedback} is used for
15900 compilation with profile feedback and @option{tracer-min-branch-probability}
15901 compilation without.  The value for compilation with profile feedback
15902 needs to be more conservative (higher) in order to make tracer
15903 effective.
15905 @item stack-clash-protection-guard-size
15906 Specify the size of the operating system provided stack guard as
15907 2 raised to @var{num} bytes.  Higher values may reduce the
15908 number of explicit probes, but a value larger than the operating system
15909 provided guard will leave code vulnerable to stack clash style attacks.
15911 @item stack-clash-protection-probe-interval
15912 Stack clash protection involves probing stack space as it is allocated.  This
15913 param controls the maximum distance between probes into the stack as 2 raised
15914 to @var{num} bytes.  Higher values may reduce the number of explicit probes, but a value
15915 larger than the operating system provided guard will leave code vulnerable to
15916 stack clash style attacks.
15918 @item max-cse-path-length
15920 The maximum number of basic blocks on path that CSE considers.
15922 @item max-cse-insns
15923 The maximum number of instructions CSE processes before flushing.
15925 @item ggc-min-expand
15927 GCC uses a garbage collector to manage its own memory allocation.  This
15928 parameter specifies the minimum percentage by which the garbage
15929 collector's heap should be allowed to expand between collections.
15930 Tuning this may improve compilation speed; it has no effect on code
15931 generation.
15933 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
15934 RAM >= 1GB@.  If @code{getrlimit} is available, the notion of ``RAM'' is
15935 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
15936 GCC is not able to calculate RAM on a particular platform, the lower
15937 bound of 30% is used.  Setting this parameter and
15938 @option{ggc-min-heapsize} to zero causes a full collection to occur at
15939 every opportunity.  This is extremely slow, but can be useful for
15940 debugging.
15942 @item ggc-min-heapsize
15944 Minimum size of the garbage collector's heap before it begins bothering
15945 to collect garbage.  The first collection occurs after the heap expands
15946 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
15947 tuning this may improve compilation speed, and has no effect on code
15948 generation.
15950 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
15951 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
15952 with a lower bound of 4096 (four megabytes) and an upper bound of
15953 131072 (128 megabytes).  If GCC is not able to calculate RAM on a
15954 particular platform, the lower bound is used.  Setting this parameter
15955 very large effectively disables garbage collection.  Setting this
15956 parameter and @option{ggc-min-expand} to zero causes a full collection
15957 to occur at every opportunity.
15959 @item max-reload-search-insns
15960 The maximum number of instruction reload should look backward for equivalent
15961 register.  Increasing values mean more aggressive optimization, making the
15962 compilation time increase with probably slightly better performance.
15964 @item max-cselib-memory-locations
15965 The maximum number of memory locations cselib should take into account.
15966 Increasing values mean more aggressive optimization, making the compilation time
15967 increase with probably slightly better performance.
15969 @item max-sched-ready-insns
15970 The maximum number of instructions ready to be issued the scheduler should
15971 consider at any given time during the first scheduling pass.  Increasing
15972 values mean more thorough searches, making the compilation time increase
15973 with probably little benefit.
15975 @item max-sched-region-blocks
15976 The maximum number of blocks in a region to be considered for
15977 interblock scheduling.
15979 @item max-pipeline-region-blocks
15980 The maximum number of blocks in a region to be considered for
15981 pipelining in the selective scheduler.
15983 @item max-sched-region-insns
15984 The maximum number of insns in a region to be considered for
15985 interblock scheduling.
15987 @item max-pipeline-region-insns
15988 The maximum number of insns in a region to be considered for
15989 pipelining in the selective scheduler.
15991 @item min-spec-prob
15992 The minimum probability (in percents) of reaching a source block
15993 for interblock speculative scheduling.
15995 @item max-sched-extend-regions-iters
15996 The maximum number of iterations through CFG to extend regions.
15997 A value of 0 disables region extensions.
15999 @item max-sched-insn-conflict-delay
16000 The maximum conflict delay for an insn to be considered for speculative motion.
16002 @item sched-spec-prob-cutoff
16003 The minimal probability of speculation success (in percents), so that
16004 speculative insns are scheduled.
16006 @item sched-state-edge-prob-cutoff
16007 The minimum probability an edge must have for the scheduler to save its
16008 state across it.
16010 @item sched-mem-true-dep-cost
16011 Minimal distance (in CPU cycles) between store and load targeting same
16012 memory locations.
16014 @item selsched-max-lookahead
16015 The maximum size of the lookahead window of selective scheduling.  It is a
16016 depth of search for available instructions.
16018 @item selsched-max-sched-times
16019 The maximum number of times that an instruction is scheduled during
16020 selective scheduling.  This is the limit on the number of iterations
16021 through which the instruction may be pipelined.
16023 @item selsched-insns-to-rename
16024 The maximum number of best instructions in the ready list that are considered
16025 for renaming in the selective scheduler.
16027 @item sms-min-sc
16028 The minimum value of stage count that swing modulo scheduler
16029 generates.
16031 @item max-last-value-rtl
16032 The maximum size measured as number of RTLs that can be recorded in an expression
16033 in combiner for a pseudo register as last known value of that register.
16035 @item max-combine-insns
16036 The maximum number of instructions the RTL combiner tries to combine.
16038 @item integer-share-limit
16039 Small integer constants can use a shared data structure, reducing the
16040 compiler's memory usage and increasing its speed.  This sets the maximum
16041 value of a shared integer constant.
16043 @item ssp-buffer-size
16044 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
16045 protection when @option{-fstack-protector} is used.
16047 @item min-size-for-stack-sharing
16048 The minimum size of variables taking part in stack slot sharing when not
16049 optimizing.
16051 @item max-jump-thread-duplication-stmts
16052 Maximum number of statements allowed in a block that needs to be
16053 duplicated when threading jumps.
16055 @item max-jump-thread-paths
16056 The maximum number of paths to consider when searching for jump threading
16057 opportunities.  When arriving at a block, incoming edges are only considered
16058 if the number of paths to be searched so far multiplied by the number of
16059 incoming edges does not exhaust the specified maximum number of paths to
16060 consider.
16062 @item max-fields-for-field-sensitive
16063 Maximum number of fields in a structure treated in
16064 a field sensitive manner during pointer analysis.
16066 @item prefetch-latency
16067 Estimate on average number of instructions that are executed before
16068 prefetch finishes.  The distance prefetched ahead is proportional
16069 to this constant.  Increasing this number may also lead to less
16070 streams being prefetched (see @option{simultaneous-prefetches}).
16072 @item simultaneous-prefetches
16073 Maximum number of prefetches that can run at the same time.
16075 @item l1-cache-line-size
16076 The size of cache line in L1 data cache, in bytes.
16078 @item l1-cache-size
16079 The size of L1 data cache, in kilobytes.
16081 @item l2-cache-size
16082 The size of L2 data cache, in kilobytes.
16084 @item prefetch-dynamic-strides
16085 Whether the loop array prefetch pass should issue software prefetch hints
16086 for strides that are non-constant.  In some cases this may be
16087 beneficial, though the fact the stride is non-constant may make it
16088 hard to predict when there is clear benefit to issuing these hints.
16090 Set to 1 if the prefetch hints should be issued for non-constant
16091 strides.  Set to 0 if prefetch hints should be issued only for strides that
16092 are known to be constant and below @option{prefetch-minimum-stride}.
16094 @item prefetch-minimum-stride
16095 Minimum constant stride, in bytes, to start using prefetch hints for.  If
16096 the stride is less than this threshold, prefetch hints will not be issued.
16098 This setting is useful for processors that have hardware prefetchers, in
16099 which case there may be conflicts between the hardware prefetchers and
16100 the software prefetchers.  If the hardware prefetchers have a maximum
16101 stride they can handle, it should be used here to improve the use of
16102 software prefetchers.
16104 A value of -1 means we don't have a threshold and therefore
16105 prefetch hints can be issued for any constant stride.
16107 This setting is only useful for strides that are known and constant.
16109 @item destructive-interference-size
16110 @item constructive-interference-size
16111 The values for the C++17 variables
16112 @code{std::hardware_destructive_interference_size} and
16113 @code{std::hardware_constructive_interference_size}.  The destructive
16114 interference size is the minimum recommended offset between two
16115 independent concurrently-accessed objects; the constructive
16116 interference size is the maximum recommended size of contiguous memory
16117 accessed together.  Typically both will be the size of an L1 cache
16118 line for the target, in bytes.  For a generic target covering a range of L1
16119 cache line sizes, typically the constructive interference size will be
16120 the small end of the range and the destructive size will be the large
16121 end.
16123 The destructive interference size is intended to be used for layout,
16124 and thus has ABI impact.  The default value is not expected to be
16125 stable, and on some targets varies with @option{-mtune}, so use of
16126 this variable in a context where ABI stability is important, such as
16127 the public interface of a library, is strongly discouraged; if it is
16128 used in that context, users can stabilize the value using this
16129 option.
16131 The constructive interference size is less sensitive, as it is
16132 typically only used in a @samp{static_assert} to make sure that a type
16133 fits within a cache line.
16135 See also @option{-Winterference-size}.
16137 @item loop-interchange-max-num-stmts
16138 The maximum number of stmts in a loop to be interchanged.
16140 @item loop-interchange-stride-ratio
16141 The minimum ratio between stride of two loops for interchange to be profitable.
16143 @item min-insn-to-prefetch-ratio
16144 The minimum ratio between the number of instructions and the
16145 number of prefetches to enable prefetching in a loop.
16147 @item prefetch-min-insn-to-mem-ratio
16148 The minimum ratio between the number of instructions and the
16149 number of memory references to enable prefetching in a loop.
16151 @item use-canonical-types
16152 Whether the compiler should use the ``canonical'' type system.
16153 Should always be 1, which uses a more efficient internal
16154 mechanism for comparing types in C++ and Objective-C++.  However, if
16155 bugs in the canonical type system are causing compilation failures,
16156 set this value to 0 to disable canonical types.
16158 @item switch-conversion-max-branch-ratio
16159 Switch initialization conversion refuses to create arrays that are
16160 bigger than @option{switch-conversion-max-branch-ratio} times the number of
16161 branches in the switch.
16163 @item max-partial-antic-length
16164 Maximum length of the partial antic set computed during the tree
16165 partial redundancy elimination optimization (@option{-ftree-pre}) when
16166 optimizing at @option{-O3} and above.  For some sorts of source code
16167 the enhanced partial redundancy elimination optimization can run away,
16168 consuming all of the memory available on the host machine.  This
16169 parameter sets a limit on the length of the sets that are computed,
16170 which prevents the runaway behavior.  Setting a value of 0 for
16171 this parameter allows an unlimited set length.
16173 @item rpo-vn-max-loop-depth
16174 Maximum loop depth that is value-numbered optimistically.
16175 When the limit hits the innermost
16176 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
16177 loop nest are value-numbered optimistically and the remaining ones not.
16179 @item sccvn-max-alias-queries-per-access
16180 Maximum number of alias-oracle queries we perform when looking for
16181 redundancies for loads and stores.  If this limit is hit the search
16182 is aborted and the load or store is not considered redundant.  The
16183 number of queries is algorithmically limited to the number of
16184 stores on all paths from the load to the function entry.
16186 @item ira-max-loops-num
16187 IRA uses regional register allocation by default.  If a function
16188 contains more loops than the number given by this parameter, only at most
16189 the given number of the most frequently-executed loops form regions
16190 for regional register allocation.
16192 @item ira-max-conflict-table-size 
16193 Although IRA uses a sophisticated algorithm to compress the conflict
16194 table, the table can still require excessive amounts of memory for
16195 huge functions.  If the conflict table for a function could be more
16196 than the size in MB given by this parameter, the register allocator
16197 instead uses a faster, simpler, and lower-quality
16198 algorithm that does not require building a pseudo-register conflict table.  
16200 @item ira-loop-reserved-regs
16201 IRA can be used to evaluate more accurate register pressure in loops
16202 for decisions to move loop invariants (see @option{-O3}).  The number
16203 of available registers reserved for some other purposes is given
16204 by this parameter.  Default of the parameter
16205 is the best found from numerous experiments.
16207 @item ira-consider-dup-in-all-alts
16208 Make IRA to consider matching constraint (duplicated operand number)
16209 heavily in all available alternatives for preferred register class.
16210 If it is set as zero, it means IRA only respects the matching
16211 constraint when it's in the only available alternative with an
16212 appropriate register class.  Otherwise, it means IRA will check all
16213 available alternatives for preferred register class even if it has
16214 found some choice with an appropriate register class and respect the
16215 found qualified matching constraint.
16217 @item ira-simple-lra-insn-threshold
16218 Approximate function insn number in 1K units triggering simple local RA.
16220 @item lra-inheritance-ebb-probability-cutoff
16221 LRA tries to reuse values reloaded in registers in subsequent insns.
16222 This optimization is called inheritance.  EBB is used as a region to
16223 do this optimization.  The parameter defines a minimal fall-through
16224 edge probability in percentage used to add BB to inheritance EBB in
16225 LRA.  The default value was chosen
16226 from numerous runs of SPEC2000 on x86-64.
16228 @item loop-invariant-max-bbs-in-loop
16229 Loop invariant motion can be very expensive, both in compilation time and
16230 in amount of needed compile-time memory, with very large loops.  Loops
16231 with more basic blocks than this parameter won't have loop invariant
16232 motion optimization performed on them.
16234 @item loop-max-datarefs-for-datadeps
16235 Building data dependencies is expensive for very large loops.  This
16236 parameter limits the number of data references in loops that are
16237 considered for data dependence analysis.  These large loops are no
16238 handled by the optimizations using loop data dependencies.
16240 @item max-vartrack-size
16241 Sets a maximum number of hash table slots to use during variable
16242 tracking dataflow analysis of any function.  If this limit is exceeded
16243 with variable tracking at assignments enabled, analysis for that
16244 function is retried without it, after removing all debug insns from
16245 the function.  If the limit is exceeded even without debug insns, var
16246 tracking analysis is completely disabled for the function.  Setting
16247 the parameter to zero makes it unlimited.
16249 @item max-vartrack-expr-depth
16250 Sets a maximum number of recursion levels when attempting to map
16251 variable names or debug temporaries to value expressions.  This trades
16252 compilation time for more complete debug information.  If this is set too
16253 low, value expressions that are available and could be represented in
16254 debug information may end up not being used; setting this higher may
16255 enable the compiler to find more complex debug expressions, but compile
16256 time and memory use may grow.
16258 @item max-debug-marker-count
16259 Sets a threshold on the number of debug markers (e.g.@: begin stmt
16260 markers) to avoid complexity explosion at inlining or expanding to RTL.
16261 If a function has more such gimple stmts than the set limit, such stmts
16262 will be dropped from the inlined copy of a function, and from its RTL
16263 expansion.
16265 @item min-nondebug-insn-uid
16266 Use uids starting at this parameter for nondebug insns.  The range below
16267 the parameter is reserved exclusively for debug insns created by
16268 @option{-fvar-tracking-assignments}, but debug insns may get
16269 (non-overlapping) uids above it if the reserved range is exhausted.
16271 @item ipa-sra-deref-prob-threshold
16272 IPA-SRA replaces a pointer which is known not be NULL with one or more
16273 new parameters only when the probability (in percent, relative to
16274 function entry) of it being dereferenced is higher than this parameter.
16276 @item ipa-sra-ptr-growth-factor
16277 IPA-SRA replaces a pointer to an aggregate with one or more new
16278 parameters only when their cumulative size is less or equal to
16279 @option{ipa-sra-ptr-growth-factor} times the size of the original
16280 pointer parameter.
16282 @item ipa-sra-ptrwrap-growth-factor
16283 Additional maximum allowed growth of total size of new parameters
16284 that ipa-sra replaces a pointer to an aggregate with,
16285 if it points to a local variable that the caller only writes to and
16286 passes it as an argument to other functions.
16288 @item ipa-sra-max-replacements
16289 Maximum pieces of an aggregate that IPA-SRA tracks.  As a
16290 consequence, it is also the maximum number of replacements of a formal
16291 parameter.
16293 @item sra-max-scalarization-size-Ospeed
16294 @itemx sra-max-scalarization-size-Osize
16295 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
16296 replace scalar parts of aggregates with uses of independent scalar
16297 variables.  These parameters control the maximum size, in storage units,
16298 of aggregate which is considered for replacement when compiling for
16299 speed
16300 (@option{sra-max-scalarization-size-Ospeed}) or size
16301 (@option{sra-max-scalarization-size-Osize}) respectively.
16303 @item sra-max-propagations
16304 The maximum number of artificial accesses that Scalar Replacement of
16305 Aggregates (SRA) will track, per one local variable, in order to
16306 facilitate copy propagation.
16308 @item tm-max-aggregate-size
16309 When making copies of thread-local variables in a transaction, this
16310 parameter specifies the size in bytes after which variables are
16311 saved with the logging functions as opposed to save/restore code
16312 sequence pairs.  This option only applies when using
16313 @option{-fgnu-tm}.
16315 @item graphite-max-nb-scop-params
16316 To avoid exponential effects in the Graphite loop transforms, the
16317 number of parameters in a Static Control Part (SCoP) is bounded.
16318 A value of zero can be used to lift
16319 the bound.  A variable whose value is unknown at compilation time and
16320 defined outside a SCoP is a parameter of the SCoP.
16322 @item hardcfr-max-blocks
16323 Disable @option{-fharden-control-flow-redundancy} for functions with a
16324 larger number of blocks than the specified value.  Zero removes any
16325 limit.
16327 @item hardcfr-max-inline-blocks
16328 Force @option{-fharden-control-flow-redundancy} to use out-of-line
16329 checking for functions with a larger number of basic blocks than the
16330 specified value.
16332 @item loop-block-tile-size
16333 Loop blocking or strip mining transforms, enabled with
16334 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
16335 loop in the loop nest by a given number of iterations.  The strip
16336 length can be changed using the @option{loop-block-tile-size}
16337 parameter.
16339 @item ipa-jump-function-lookups
16340 Specifies number of statements visited during jump function offset discovery.
16342 @item ipa-cp-value-list-size
16343 IPA-CP attempts to track all possible values and types passed to a function's
16344 parameter in order to propagate them and perform devirtualization.
16345 @option{ipa-cp-value-list-size} is the maximum number of values and types it
16346 stores per one formal parameter of a function.
16348 @item ipa-cp-eval-threshold
16349 IPA-CP calculates its own score of cloning profitability heuristics
16350 and performs those cloning opportunities with scores that exceed
16351 @option{ipa-cp-eval-threshold}.
16353 @item ipa-cp-max-recursive-depth
16354 Maximum depth of recursive cloning for self-recursive function.
16356 @item ipa-cp-min-recursive-probability
16357 Recursive cloning only when the probability of call being executed exceeds
16358 the parameter.
16360 @item ipa-cp-profile-count-base
16361 When using @option{-fprofile-use} option, IPA-CP will consider the measured
16362 execution count of a call graph edge at this percentage position in their
16363 histogram as the basis for its heuristics calculation.
16365 @item ipa-cp-recursive-freq-factor
16366 The number of times interprocedural copy propagation expects recursive
16367 functions to call themselves.
16369 @item ipa-cp-recursion-penalty
16370 Percentage penalty the recursive functions will receive when they
16371 are evaluated for cloning.
16373 @item ipa-cp-single-call-penalty
16374 Percentage penalty functions containing a single call to another
16375 function will receive when they are evaluated for cloning.
16377 @item ipa-max-agg-items
16378 IPA-CP is also capable to propagate a number of scalar values passed
16379 in an aggregate. @option{ipa-max-agg-items} controls the maximum
16380 number of such values per one parameter.
16382 @item ipa-cp-loop-hint-bonus
16383 When IPA-CP determines that a cloning candidate would make the number
16384 of iterations of a loop known, it adds a bonus of
16385 @option{ipa-cp-loop-hint-bonus} to the profitability score of
16386 the candidate.
16388 @item ipa-max-loop-predicates
16389 The maximum number of different predicates IPA will use to describe when
16390 loops in a function have known properties.
16392 @item ipa-max-aa-steps
16393 During its analysis of function bodies, IPA-CP employs alias analysis
16394 in order to track values pointed to by function parameters.  In order
16395 not spend too much time analyzing huge functions, it gives up and
16396 consider all memory clobbered after examining
16397 @option{ipa-max-aa-steps} statements modifying memory.
16399 @item ipa-max-switch-predicate-bounds
16400 Maximal number of boundary endpoints of case ranges of switch statement.
16401 For switch exceeding this limit, IPA-CP will not construct cloning cost
16402 predicate, which is used to estimate cloning benefit, for default case
16403 of the switch statement.
16405 @item ipa-max-param-expr-ops
16406 IPA-CP will analyze conditional statement that references some function
16407 parameter to estimate benefit for cloning upon certain constant value.
16408 But if number of operations in a parameter expression exceeds
16409 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
16410 one, and is not handled by IPA analysis.
16412 @item lto-partitions
16413 Specify desired number of partitions produced during WHOPR compilation.
16414 The number of partitions should exceed the number of CPUs used for compilation.
16416 @item lto-min-partition
16417 Size of minimal partition for WHOPR (in estimated instructions).
16418 This prevents expenses of splitting very small programs into too many
16419 partitions.
16421 @item lto-max-partition
16422 Size of max partition for WHOPR (in estimated instructions).
16423 to provide an upper bound for individual size of partition.
16424 Meant to be used only with balanced partitioning.
16426 @item lto-max-streaming-parallelism
16427 Maximal number of parallel processes used for LTO streaming.
16429 @item cxx-max-namespaces-for-diagnostic-help
16430 The maximum number of namespaces to consult for suggestions when C++
16431 name lookup fails for an identifier.
16433 @item sink-frequency-threshold
16434 The maximum relative execution frequency (in percents) of the target block
16435 relative to a statement's original block to allow statement sinking of a
16436 statement.  Larger numbers result in more aggressive statement sinking.
16437 A small positive adjustment is applied for
16438 statements with memory operands as those are even more profitable so sink.
16440 @item max-stores-to-sink
16441 The maximum number of conditional store pairs that can be sunk.  Set to 0
16442 if either vectorization (@option{-ftree-vectorize}) or if-conversion
16443 (@option{-ftree-loop-if-convert}) is disabled.
16445 @item case-values-threshold
16446 The smallest number of different values for which it is best to use a
16447 jump-table instead of a tree of conditional branches.  If the value is
16448 0, use the default for the machine.
16450 @item jump-table-max-growth-ratio-for-size
16451 The maximum code size growth ratio when expanding
16452 into a jump table (in percent).  The parameter is used when
16453 optimizing for size.
16455 @item jump-table-max-growth-ratio-for-speed
16456 The maximum code size growth ratio when expanding
16457 into a jump table (in percent).  The parameter is used when
16458 optimizing for speed.
16460 @item tree-reassoc-width
16461 Set the maximum number of instructions executed in parallel in
16462 reassociated tree. This parameter overrides target dependent
16463 heuristics used by default if has non zero value.
16465 @item sched-pressure-algorithm
16466 Choose between the two available implementations of
16467 @option{-fsched-pressure}.  Algorithm 1 is the original implementation
16468 and is the more likely to prevent instructions from being reordered.
16469 Algorithm 2 was designed to be a compromise between the relatively
16470 conservative approach taken by algorithm 1 and the rather aggressive
16471 approach taken by the default scheduler.  It relies more heavily on
16472 having a regular register file and accurate register pressure classes.
16473 See @file{haifa-sched.cc} in the GCC sources for more details.
16475 The default choice depends on the target.
16477 @item max-slsr-cand-scan
16478 Set the maximum number of existing candidates that are considered when
16479 seeking a basis for a new straight-line strength reduction candidate.
16481 @item asan-globals
16482 Enable buffer overflow detection for global objects.  This kind
16483 of protection is enabled by default if you are using
16484 @option{-fsanitize=address} option.
16485 To disable global objects protection use @option{--param asan-globals=0}.
16487 @item asan-stack
16488 Enable buffer overflow detection for stack objects.  This kind of
16489 protection is enabled by default when using @option{-fsanitize=address}.
16490 To disable stack protection use @option{--param asan-stack=0} option.
16492 @item asan-instrument-reads
16493 Enable buffer overflow detection for memory reads.  This kind of
16494 protection is enabled by default when using @option{-fsanitize=address}.
16495 To disable memory reads protection use
16496 @option{--param asan-instrument-reads=0}.
16498 @item asan-instrument-writes
16499 Enable buffer overflow detection for memory writes.  This kind of
16500 protection is enabled by default when using @option{-fsanitize=address}.
16501 To disable memory writes protection use
16502 @option{--param asan-instrument-writes=0} option.
16504 @item asan-memintrin
16505 Enable detection for built-in functions.  This kind of protection
16506 is enabled by default when using @option{-fsanitize=address}.
16507 To disable built-in functions protection use
16508 @option{--param asan-memintrin=0}.
16510 @item asan-use-after-return
16511 Enable detection of use-after-return.  This kind of protection
16512 is enabled by default when using the @option{-fsanitize=address} option.
16513 To disable it use @option{--param asan-use-after-return=0}.
16515 Note: By default the check is disabled at run time.  To enable it,
16516 add @code{detect_stack_use_after_return=1} to the environment variable
16517 @env{ASAN_OPTIONS}.
16519 @item asan-instrumentation-with-call-threshold
16520 If number of memory accesses in function being instrumented
16521 is greater or equal to this number, use callbacks instead of inline checks.
16522 E.g. to disable inline code use
16523 @option{--param asan-instrumentation-with-call-threshold=0}.
16525 @item asan-kernel-mem-intrinsic-prefix
16526 If nonzero, prefix calls to @code{memcpy}, @code{memset} and @code{memmove}
16527 with @samp{__asan_} or @samp{__hwasan_}
16528 for @option{-fsanitize=kernel-address} or @samp{-fsanitize=kernel-hwaddress},
16529 respectively.
16531 @item hwasan-instrument-stack
16532 Enable hwasan instrumentation of statically sized stack-allocated variables.
16533 This kind of instrumentation is enabled by default when using
16534 @option{-fsanitize=hwaddress} and disabled by default when using
16535 @option{-fsanitize=kernel-hwaddress}.
16536 To disable stack instrumentation use
16537 @option{--param hwasan-instrument-stack=0}, and to enable it use
16538 @option{--param hwasan-instrument-stack=1}.
16540 @item hwasan-random-frame-tag
16541 When using stack instrumentation, decide tags for stack variables using a
16542 deterministic sequence beginning at a random tag for each frame.  With this
16543 parameter unset tags are chosen using the same sequence but beginning from 1.
16544 This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
16545 for @option{-fsanitize=kernel-hwaddress}.
16546 To disable it use @option{--param hwasan-random-frame-tag=0}.
16548 @item hwasan-instrument-allocas
16549 Enable hwasan instrumentation of dynamically sized stack-allocated variables.
16550 This kind of instrumentation is enabled by default when using
16551 @option{-fsanitize=hwaddress} and disabled by default when using
16552 @option{-fsanitize=kernel-hwaddress}.
16553 To disable instrumentation of such variables use
16554 @option{--param hwasan-instrument-allocas=0}, and to enable it use
16555 @option{--param hwasan-instrument-allocas=1}.
16557 @item hwasan-instrument-reads
16558 Enable hwasan checks on memory reads.  Instrumentation of reads is enabled by
16559 default for both @option{-fsanitize=hwaddress} and
16560 @option{-fsanitize=kernel-hwaddress}.
16561 To disable checking memory reads use
16562 @option{--param hwasan-instrument-reads=0}.
16564 @item hwasan-instrument-writes
16565 Enable hwasan checks on memory writes.  Instrumentation of writes is enabled by
16566 default for both @option{-fsanitize=hwaddress} and
16567 @option{-fsanitize=kernel-hwaddress}.
16568 To disable checking memory writes use
16569 @option{--param hwasan-instrument-writes=0}.
16571 @item hwasan-instrument-mem-intrinsics
16572 Enable hwasan instrumentation of builtin functions.  Instrumentation of these
16573 builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
16574 and @option{-fsanitize=kernel-hwaddress}.
16575 To disable instrumentation of builtin functions use
16576 @option{--param hwasan-instrument-mem-intrinsics=0}.
16578 @item use-after-scope-direct-emission-threshold
16579 If the size of a local variable in bytes is smaller or equal to this
16580 number, directly poison (or unpoison) shadow memory instead of using
16581 run-time callbacks.
16583 @item tsan-distinguish-volatile
16584 Emit special instrumentation for accesses to volatiles.
16586 @item tsan-instrument-func-entry-exit
16587 Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
16589 @item max-fsm-thread-path-insns
16590 Maximum number of instructions to copy when duplicating blocks on a
16591 finite state automaton jump thread path.
16593 @item threader-debug
16594 threader-debug=[none|all] Enables verbose dumping of the threader solver.
16596 @item parloops-chunk-size
16597 Chunk size of omp schedule for loops parallelized by parloops.
16599 @item parloops-schedule
16600 Schedule type of omp schedule for loops parallelized by parloops (static,
16601 dynamic, guided, auto, runtime).
16603 @item parloops-min-per-thread
16604 The minimum number of iterations per thread of an innermost parallelized
16605 loop for which the parallelized variant is preferred over the single threaded
16606 one.  Note that for a parallelized loop nest the
16607 minimum number of iterations of the outermost loop per thread is two.
16609 @item max-ssa-name-query-depth
16610 Maximum depth of recursion when querying properties of SSA names in things
16611 like fold routines.  One level of recursion corresponds to following a
16612 use-def chain.
16614 @item max-speculative-devirt-maydefs
16615 The maximum number of may-defs we analyze when looking for a must-def
16616 specifying the dynamic type of an object that invokes a virtual call
16617 we may be able to devirtualize speculatively.
16619 @item ranger-debug
16620 Specifies the type of debug output to be issued for ranges.
16622 @item unroll-jam-min-percent
16623 The minimum percentage of memory references that must be optimized
16624 away for the unroll-and-jam transformation to be considered profitable.
16626 @item unroll-jam-max-unroll
16627 The maximum number of times the outer loop should be unrolled by
16628 the unroll-and-jam transformation.
16630 @item max-rtl-if-conversion-unpredictable-cost
16631 Maximum permissible cost for the sequence that would be generated
16632 by the RTL if-conversion pass for a branch that is considered unpredictable.
16634 @item max-variable-expansions-in-unroller
16635 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
16636 of times that an individual variable will be expanded during loop unrolling.
16638 @item partial-inlining-entry-probability
16639 Maximum probability of the entry BB of split region
16640 (in percent relative to entry BB of the function)
16641 to make partial inlining happen.
16643 @item max-tracked-strlens
16644 Maximum number of strings for which strlen optimization pass will
16645 track string lengths.
16647 @item gcse-after-reload-partial-fraction
16648 The threshold ratio for performing partial redundancy
16649 elimination after reload.
16651 @item gcse-after-reload-critical-fraction
16652 The threshold ratio of critical edges execution count that
16653 permit performing redundancy elimination after reload.
16655 @item max-loop-header-insns
16656 The maximum number of insns in loop header duplicated
16657 by the copy loop headers pass.
16659 @item vect-epilogues-nomask
16660 Enable loop epilogue vectorization using smaller vector size.
16662 @item vect-partial-vector-usage
16663 Controls when the loop vectorizer considers using partial vector loads
16664 and stores as an alternative to falling back to scalar code.  0 stops
16665 the vectorizer from ever using partial vector loads and stores.  1 allows
16666 partial vector loads and stores if vectorization removes the need for the
16667 code to iterate.  2 allows partial vector loads and stores in all loops.
16668 The parameter only has an effect on targets that support partial
16669 vector loads and stores.
16671 @item vect-inner-loop-cost-factor
16672 The maximum factor which the loop vectorizer applies to the cost of statements
16673 in an inner loop relative to the loop being vectorized.  The factor applied
16674 is the maximum of the estimated number of iterations of the inner loop and
16675 this parameter.  The default value of this parameter is 50.
16677 @item vect-induction-float
16678 Enable loop vectorization of floating point inductions.
16680 @item vrp-sparse-threshold
16681 Maximum number of basic blocks before VRP uses a sparse bitmap cache.
16683 @item vrp-switch-limit
16684 Maximum number of outgoing edges in a switch before VRP will not process it.
16686 @item vrp-vector-threshold
16687 Maximum number of basic blocks for VRP to use a basic cache vector.
16689 @item avoid-fma-max-bits
16690 Maximum number of bits for which we avoid creating FMAs.
16692 @item fully-pipelined-fma
16693 Whether the target fully pipelines FMA instructions.  If non-zero,
16694 reassociation considers the benefit of parallelizing FMA's multiplication
16695 part and addition part, assuming FMUL and FMA use the same units that can
16696 also do FADD.
16698 @item sms-loop-average-count-threshold
16699 A threshold on the average loop count considered by the swing modulo scheduler.
16701 @item sms-dfa-history
16702 The number of cycles the swing modulo scheduler considers when checking
16703 conflicts using DFA.
16705 @item graphite-allow-codegen-errors
16706 Whether codegen errors should be ICEs when @option{-fchecking}.
16708 @item sms-max-ii-factor
16709 A factor for tuning the upper bound that swing modulo scheduler
16710 uses for scheduling a loop.
16712 @item lra-max-considered-reload-pseudos
16713 The max number of reload pseudos which are considered during
16714 spilling a non-reload pseudo.
16716 @item max-pow-sqrt-depth
16717 Maximum depth of sqrt chains to use when synthesizing exponentiation
16718 by a real constant.
16720 @item max-dse-active-local-stores
16721 Maximum number of active local stores in RTL dead store elimination.
16723 @item asan-instrument-allocas
16724 Enable asan allocas/VLAs protection.
16726 @item max-iterations-computation-cost
16727 Bound on the cost of an expression to compute the number of iterations.
16729 @item max-isl-operations
16730 Maximum number of isl operations, 0 means unlimited.
16732 @item graphite-max-arrays-per-scop
16733 Maximum number of arrays per scop.
16735 @item max-vartrack-reverse-op-size
16736 Max. size of loc list for which reverse ops should be added.
16738 @item fsm-scale-path-stmts
16739 Scale factor to apply to the number of statements in a threading path
16740 crossing a loop backedge when comparing to
16741 @option{--param=max-jump-thread-duplication-stmts}.
16743 @item uninit-control-dep-attempts
16744 Maximum number of nested calls to search for control dependencies
16745 during uninitialized variable analysis.
16747 @item uninit-max-chain-len
16748 Maximum number of predicates anded for each predicate ored in the normalized
16749 predicate chain.
16751 @item uninit-max-num-chains
16752 Maximum number of predicates ored in the normalized predicate chain.
16754 @item sched-autopref-queue-depth
16755 Hardware autoprefetcher scheduler model control flag.
16756 Number of lookahead cycles the model looks into; at '
16757 ' only enable instruction sorting heuristic.
16759 @item loop-versioning-max-inner-insns
16760 The maximum number of instructions that an inner loop can have
16761 before the loop versioning pass considers it too big to copy.
16763 @item loop-versioning-max-outer-insns
16764 The maximum number of instructions that an outer loop can have
16765 before the loop versioning pass considers it too big to copy,
16766 discounting any instructions in inner loops that directly benefit
16767 from versioning.
16769 @item ssa-name-def-chain-limit
16770 The maximum number of SSA_NAME assignments to follow in determining
16771 a property of a variable such as its value.  This limits the number
16772 of iterations or recursive calls GCC performs when optimizing certain
16773 statements or when determining their validity prior to issuing
16774 diagnostics.
16776 @item store-merging-max-size
16777 Maximum size of a single store merging region in bytes.
16779 @item hash-table-verification-limit
16780 The number of elements for which hash table verification is done
16781 for each searched element.
16783 @item max-find-base-term-values
16784 Maximum number of VALUEs handled during a single find_base_term call.
16786 @item analyzer-max-enodes-per-program-point
16787 The maximum number of exploded nodes per program point within
16788 the analyzer, before terminating analysis of that point.
16790 @item analyzer-max-constraints
16791 The maximum number of constraints per state.
16793 @item analyzer-min-snodes-for-call-summary
16794 The minimum number of supernodes within a function for the
16795 analyzer to consider summarizing its effects at call sites.
16797 @item analyzer-max-enodes-for-full-dump
16798 The maximum depth of exploded nodes that should appear in a dot dump
16799 before switching to a less verbose format.
16801 @item analyzer-max-recursion-depth
16802 The maximum number of times a callsite can appear in a call stack
16803 within the analyzer, before terminating analysis of a call that would
16804 recurse deeper.
16806 @item analyzer-max-svalue-depth
16807 The maximum depth of a symbolic value, before approximating
16808 the value as unknown.
16810 @item analyzer-max-infeasible-edges
16811 The maximum number of infeasible edges to reject before declaring
16812 a diagnostic as infeasible.
16814 @item gimple-fe-computed-hot-bb-threshold
16815 The number of executions of a basic block which is considered hot.
16816 The parameter is used only in GIMPLE FE.
16818 @item analyzer-bb-explosion-factor
16819 The maximum number of 'after supernode' exploded nodes within the analyzer
16820 per supernode, before terminating analysis.
16822 @item analyzer-text-art-string-ellipsis-threshold
16823 The number of bytes at which to ellipsize string literals in analyzer text art diagrams.
16825 @item analyzer-text-art-ideal-canvas-width
16826 The ideal width in characters of text art diagrams generated by the analyzer.
16828 @item analyzer-text-art-string-ellipsis-head-len
16829 The number of literal bytes to show at the head of a string literal in text art when ellipsizing it.
16831 @item analyzer-text-art-string-ellipsis-tail-len
16832 The number of literal bytes to show at the tail of a string literal in text art when ellipsizing it.
16834 @item ranger-logical-depth
16835 Maximum depth of logical expression evaluation ranger will look through
16836 when evaluating outgoing edge ranges.
16838 @item ranger-recompute-depth
16839 Maximum depth of instruction chains to consider for recomputation
16840 in the outgoing range calculator.
16842 @item relation-block-limit
16843 Maximum number of relations the oracle will register in a basic block.
16845 @item min-pagesize
16846 Minimum page size for warning purposes.
16848 @item openacc-kernels
16849 Specify mode of OpenACC `kernels' constructs handling.
16850 With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
16851 constructs are decomposed into parts, a sequence of compute
16852 constructs, each then handled individually.
16853 This is work in progress.
16854 With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
16855 constructs are handled by the @samp{parloops} pass, en bloc.
16856 This is the current default.
16858 @item openacc-privatization
16859 Control whether the @option{-fopt-info-omp-note} and applicable
16860 @option{-fdump-tree-*-details} options emit OpenACC privatization diagnostics.
16861 With @option{--param=openacc-privatization=quiet}, don't diagnose.
16862 This is the current default.
16863 With @option{--param=openacc-privatization=noisy}, do diagnose.
16865 @end table
16867 The following choices of @var{name} are available on AArch64 targets:
16869 @table @gcctabopt
16870 @item aarch64-vect-compare-costs
16871 When vectorizing, consider using multiple different approaches and use
16872 the cost model to choose the cheapest one.  This includes:
16874 @itemize
16875 @item
16876 Trying both SVE and Advanced SIMD, when SVE is available.
16878 @item
16879 Trying to use 64-bit Advanced SIMD vectors for the smallest data elements,
16880 rather than using 128-bit vectors for everything.
16882 @item
16883 Trying to use ``unpacked'' SVE vectors for smaller elements.  This includes
16884 storing smaller elements in larger containers and accessing elements with
16885 extending loads and truncating stores.
16886 @end itemize
16888 @item aarch64-float-recp-precision
16889 The number of Newton iterations for calculating the reciprocal for float type.
16890 The precision of division is proportional to this param when division
16891 approximation is enabled.  The default value is 1.
16893 @item aarch64-double-recp-precision
16894 The number of Newton iterations for calculating the reciprocal for double type.
16895 The precision of division is propotional to this param when division
16896 approximation is enabled.  The default value is 2.
16898 @item aarch64-autovec-preference
16899 Force an ISA selection strategy for auto-vectorization.  Accepts values from
16900 0 to 4, inclusive.
16901 @table @samp
16902 @item 0
16903 Use the default heuristics.
16904 @item 1
16905 Use only Advanced SIMD for auto-vectorization.
16906 @item 2
16907 Use only SVE for auto-vectorization.
16908 @item 3
16909 Use both Advanced SIMD and SVE.  Prefer Advanced SIMD when the costs are
16910 deemed equal.
16911 @item 4
16912 Use both Advanced SIMD and SVE.  Prefer SVE when the costs are deemed equal.
16913 @end table
16914 The default value is 0.
16916 @item aarch64-ldp-policy
16917 Fine-grained policy for load pairs.
16918 With @option{--param=aarch64-ldp-policy=default}, use the policy of the
16919 tuning structure.  This is the current default.
16920 With @option{--param=aarch64-ldp-policy=always}, emit ldp regardless
16921 of alignment.
16922 With @option{--param=aarch64-ldp-policy=never}, do not emit ldp.
16923 With @option{--param=aarch64-ldp-policy=aligned}, emit ldp only if the
16924 source pointer is aligned to at least double the alignment of the type.
16926 @item aarch64-stp-policy
16927 Fine-grained policy for store pairs.
16928 With @option{--param=aarch64-stp-policy=default}, use the policy of the
16929 tuning structure.  This is the current default.
16930 With @option{--param=aarch64-stp-policy=always}, emit stp regardless
16931 of alignment.
16932 With @option{--param=aarch64-stp-policy=never}, do not emit stp.
16933 With @option{--param=aarch64-stp-policy=aligned}, emit stp only if the
16934 source pointer is aligned to at least double the alignment of the type.
16936 @item aarch64-ldp-alias-check-limit
16937 Limit on the number of alias checks performed by the AArch64 load/store pair
16938 fusion pass when attempting to form an ldp/stp.  Higher values make the pass
16939 more aggressive at re-ordering loads over stores, at the expense of increased
16940 compile time.
16942 @item aarch64-ldp-writeback
16943 Param to control which writeback opportunities we try to handle in the AArch64
16944 load/store pair fusion pass.  A value of zero disables writeback handling.  One
16945 means we try to form pairs involving one or more existing individual writeback
16946 accesses where possible.  A value of two means we also try to opportunistically
16947 form writeback opportunities by folding in trailing destructive updates of the
16948 base register used by a pair.
16950 @item aarch64-loop-vect-issue-rate-niters
16951 The tuning for some AArch64 CPUs tries to take both latencies and issue
16952 rates into account when deciding whether a loop should be vectorized
16953 using SVE, vectorized using Advanced SIMD, or not vectorized at all.
16954 If this parameter is set to @var{n}, GCC will not use this heuristic
16955 for loops that are known to execute in fewer than @var{n} Advanced
16956 SIMD iterations.
16958 @item aarch64-vect-unroll-limit
16959 The vectorizer will use available tuning information to determine whether it
16960 would be beneficial to unroll the main vectorized loop and by how much.  This
16961 parameter set's the upper bound of how much the vectorizer will unroll the main
16962 loop.  The default value is four.
16964 @end table
16966 The following choices of @var{name} are available on i386 and x86_64 targets:
16968 @table @gcctabopt
16969 @item x86-stlf-window-ninsns
16970 Instructions number above which STFL stall penalty can be compensated.
16972 @item x86-stv-max-visits
16973 The maximum number of use and def visits when discovering a STV chain before
16974 the discovery is aborted.
16976 @end table
16978 @end table
16980 @node Instrumentation Options
16981 @section Program Instrumentation Options
16982 @cindex instrumentation options
16983 @cindex program instrumentation options
16984 @cindex run-time error checking options
16985 @cindex profiling options
16986 @cindex options, program instrumentation
16987 @cindex options, run-time error checking
16988 @cindex options, profiling
16990 GCC supports a number of command-line options that control adding
16991 run-time instrumentation to the code it normally generates.  
16992 For example, one purpose of instrumentation is collect profiling
16993 statistics for use in finding program hot spots, code coverage
16994 analysis, or profile-guided optimizations.
16995 Another class of program instrumentation is adding run-time checking 
16996 to detect programming errors like invalid pointer
16997 dereferences or out-of-bounds array accesses, as well as deliberately
16998 hostile attacks such as stack smashing or C++ vtable hijacking.
16999 There is also a general hook which can be used to implement other
17000 forms of tracing or function-level instrumentation for debug or
17001 program analysis purposes.
17003 @table @gcctabopt
17004 @cindex @command{prof}
17005 @cindex @command{gprof}
17006 @opindex p
17007 @opindex pg
17008 @item -p
17009 @itemx -pg
17010 Generate extra code to write profile information suitable for the
17011 analysis program @command{prof} (for @option{-p}) or @command{gprof}
17012 (for @option{-pg}).  You must use this option when compiling
17013 the source files you want data about, and you must also use it when
17014 linking.
17016 You can use the function attribute @code{no_instrument_function} to
17017 suppress profiling of individual functions when compiling with these options.
17018 @xref{Common Function Attributes}.
17020 @opindex fprofile-arcs
17021 @item -fprofile-arcs
17022 Add code so that program flow @dfn{arcs} are instrumented.  During
17023 execution the program records how many times each branch and call is
17024 executed and how many times it is taken or returns.  On targets that support
17025 constructors with priority support, profiling properly handles constructors,
17026 destructors and C++ constructors (and destructors) of classes which are used
17027 as a type of a global variable.
17029 When the compiled
17030 program exits it saves this data to a file called
17031 @file{@var{auxname}.gcda} for each source file.  The data may be used for
17032 profile-directed optimizations (@option{-fbranch-probabilities}), or for
17033 test coverage analysis (@option{-ftest-coverage}).  Each object file's
17034 @var{auxname} is generated from the name of the output file, if
17035 explicitly specified and it is not the final executable, otherwise it is
17036 the basename of the source file.  In both cases any suffix is removed
17037 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
17038 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
17040 Note that if a command line directly links source files, the corresponding
17041 @var{.gcda} files will be prefixed with the unsuffixed name of the output file.
17042 E.g. @code{gcc a.c b.c -o binary} would generate @file{binary-a.gcda} and
17043 @file{binary-b.gcda} files.
17045 @xref{Cross-profiling}.
17047 @cindex @command{gcov}
17048 @opindex coverage
17049 @item --coverage
17051 This option is used to compile and link code instrumented for coverage
17052 analysis.  The option is a synonym for @option{-fprofile-arcs}
17053 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
17054 linking).  See the documentation for those options for more details.
17056 @itemize
17058 @item
17059 Compile the source files with @option{-fprofile-arcs} plus optimization
17060 and code generation options.  For test coverage analysis, use the
17061 additional @option{-ftest-coverage} option.  You do not need to profile
17062 every source file in a program.
17064 @item
17065 Compile the source files additionally with @option{-fprofile-abs-path}
17066 to create absolute path names in the @file{.gcno} files.  This allows
17067 @command{gcov} to find the correct sources in projects where compilations
17068 occur with different working directories.
17070 @item
17071 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
17072 (the latter implies the former).
17074 @item
17075 Run the program on a representative workload to generate the arc profile
17076 information.  This may be repeated any number of times.  You can run
17077 concurrent instances of your program, and provided that the file system
17078 supports locking, the data files will be correctly updated.  Unless
17079 a strict ISO C dialect option is in effect, @code{fork} calls are
17080 detected and correctly handled without double counting.
17082 Moreover, an object file can be recompiled multiple times
17083 and the corresponding @file{.gcda} file merges as long as
17084 the source file and the compiler options are unchanged.
17086 @item
17087 For profile-directed optimizations, compile the source files again with
17088 the same optimization and code generation options plus
17089 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
17090 Control Optimization}).
17092 @item
17093 For test coverage analysis, use @command{gcov} to produce human readable
17094 information from the @file{.gcno} and @file{.gcda} files.  Refer to the
17095 @command{gcov} documentation for further information.
17097 @end itemize
17099 With @option{-fprofile-arcs}, for each function of your program GCC
17100 creates a program flow graph, then finds a spanning tree for the graph.
17101 Only arcs that are not on the spanning tree have to be instrumented: the
17102 compiler adds code to count the number of times that these arcs are
17103 executed.  When an arc is the only exit or only entrance to a block, the
17104 instrumentation code can be added to the block; otherwise, a new basic
17105 block must be created to hold the instrumentation code.
17107 @need 2000
17108 @opindex ftest-coverage
17109 @item -ftest-coverage
17110 Produce a notes file that the @command{gcov} code-coverage utility
17111 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
17112 show program coverage.  Each source file's note file is called
17113 @file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
17114 above for a description of @var{auxname} and instructions on how to
17115 generate test coverage data.  Coverage data matches the source files
17116 more closely if you do not optimize.
17118 @opindex fprofile-abs-path
17119 @item -fprofile-abs-path
17120 Automatically convert relative source file names to absolute path names
17121 in the @file{.gcno} files.  This allows @command{gcov} to find the correct
17122 sources in projects where compilations occur with different working
17123 directories.
17125 @opindex fprofile-dir
17126 @item -fprofile-dir=@var{path}
17128 Set the directory to search for the profile data files in to @var{path}.
17129 This option affects only the profile data generated by
17130 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
17131 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
17132 and its related options.  Both absolute and relative paths can be used.
17133 By default, GCC uses the current directory as @var{path}, thus the
17134 profile data file appears in the same directory as the object file.
17135 In order to prevent the file name clashing, if the object file name is
17136 not an absolute path, we mangle the absolute path of the
17137 @file{@var{sourcename}.gcda} file and use it as the file name of a
17138 @file{.gcda} file.  See details about the file naming in @option{-fprofile-arcs}.
17139 See similar option @option{-fprofile-note}.
17141 When an executable is run in a massive parallel environment, it is recommended
17142 to save profile to different folders.  That can be done with variables
17143 in @var{path} that are exported during run-time:
17145 @table @gcctabopt
17147 @item %p
17148 process ID.
17150 @item %q@{VAR@}
17151 value of environment variable @var{VAR}
17153 @end table
17155 @opindex fprofile-generate
17156 @item -fprofile-generate
17157 @itemx -fprofile-generate=@var{path}
17159 Enable options usually used for instrumenting application to produce
17160 profile useful for later recompilation with profile feedback based
17161 optimization.  You must use @option{-fprofile-generate} both when
17162 compiling and when linking your program.
17164 The following options are enabled:
17165 @option{-fprofile-arcs}, @option{-fprofile-values},
17166 @option{-finline-functions}, and @option{-fipa-bit-cp}.
17168 If @var{path} is specified, GCC looks at the @var{path} to find
17169 the profile feedback data files. See @option{-fprofile-dir}.
17171 To optimize the program based on the collected profile information, use
17172 @option{-fprofile-use}.  @xref{Optimize Options}, for more information.
17174 @opindex fprofile-info-section
17175 @item -fprofile-info-section
17176 @itemx -fprofile-info-section=@var{name}
17178 Register the profile information in the specified section instead of using a
17179 constructor/destructor.  The section name is @var{name} if it is specified,
17180 otherwise the section name defaults to @code{.gcov_info}.  A pointer to the
17181 profile information generated by @option{-fprofile-arcs} is placed in the
17182 specified section for each translation unit.  This option disables the profile
17183 information registration through a constructor and it disables the profile
17184 information processing through a destructor.  This option is not intended to be
17185 used in hosted environments such as GNU/Linux.  It targets freestanding
17186 environments (for example embedded systems) with limited resources which do not
17187 support constructors/destructors or the C library file I/O.
17189 The linker could collect the input sections in a continuous memory block and
17190 define start and end symbols.  A GNU linker script example which defines a
17191 linker output section follows:
17193 @smallexample
17194   .gcov_info      :
17195   @{
17196     PROVIDE (__gcov_info_start = .);
17197     KEEP (*(.gcov_info))
17198     PROVIDE (__gcov_info_end = .);
17199   @}
17200 @end smallexample
17202 The program could dump the profiling information registered in this linker set
17203 for example like this:
17205 @smallexample
17206 #include <gcov.h>
17207 #include <stdio.h>
17208 #include <stdlib.h>
17210 extern const struct gcov_info *const __gcov_info_start[];
17211 extern const struct gcov_info *const __gcov_info_end[];
17213 static void
17214 dump (const void *d, unsigned n, void *arg)
17216   const unsigned char *c = d;
17218   for (unsigned i = 0; i < n; ++i)
17219     printf ("%02x", c[i]);
17222 static void
17223 filename (const char *f, void *arg)
17225   __gcov_filename_to_gcfn (f, dump, arg );
17228 static void *
17229 allocate (unsigned length, void *arg)
17231   return malloc (length);
17234 static void
17235 dump_gcov_info (void)
17237   const struct gcov_info *const *info = __gcov_info_start;
17238   const struct gcov_info *const *end = __gcov_info_end;
17240   /* Obfuscate variable to prevent compiler optimizations.  */
17241   __asm__ ("" : "+r" (info));
17243   while (info != end)
17244   @{
17245     void *arg = NULL;
17246     __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
17247     putchar ('\n');
17248     ++info;
17249   @}
17253 main (void)
17255   dump_gcov_info ();
17256   return 0;
17258 @end smallexample
17260 The @command{merge-stream} subcommand of @command{gcov-tool} may be used to
17261 deserialize the data stream generated by the @code{__gcov_filename_to_gcfn} and
17262 @code{__gcov_info_to_gcda} functions and merge the profile information into
17263 @file{.gcda} files on the host filesystem.
17265 @opindex fprofile-note
17266 @item -fprofile-note=@var{path}
17268 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
17269 location.  If you combine the option with multiple source files,
17270 the @file{.gcno} file will be overwritten.
17272 @opindex fprofile-prefix-path
17273 @item -fprofile-prefix-path=@var{path}
17275 This option can be used in combination with
17276 @option{profile-generate=}@var{profile_dir} and
17277 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
17278 directory of built source tree.  By default @var{profile_dir} will contain
17279 files with mangled absolute paths of all object files in the built project.
17280 This is not desirable when directory used to build the instrumented binary
17281 differs from the directory used to build the binary optimized with profile
17282 feedback because the profile data will not be found during the optimized build.
17283 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
17284 pointing to the base directory of the build can be used to strip the irrelevant
17285 part of the path and keep all file names relative to the main build directory.
17287 @opindex fprofile-prefix-map
17288 @item -fprofile-prefix-map=@var{old}=@var{new}
17289 When compiling files residing in directory @file{@var{old}}, record
17290 profiling information (with @option{--coverage})
17291 describing them as if the files resided in
17292 directory @file{@var{new}} instead.
17293 See also @option{-ffile-prefix-map} and @option{-fcanon-prefix-map}.
17295 @opindex fprofile-update
17296 @item -fprofile-update=@var{method}
17298 Alter the update method for an application instrumented for profile
17299 feedback based optimization.  The @var{method} argument should be one of
17300 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
17301 The first one is useful for single-threaded applications,
17302 while the second one prevents profile corruption by emitting thread-safe code.
17304 @strong{Warning:} When an application does not properly join all threads
17305 (or creates an detached thread), a profile file can be still corrupted.
17307 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
17308 when supported by a target, or to @samp{single} otherwise.  The GCC driver
17309 automatically selects @samp{prefer-atomic} when @option{-pthread}
17310 is present in the command line, otherwise the default method is @samp{single}.
17312 If @samp{atomic} is selected, then the profile information is updated using
17313 atomic operations on a best-effort basis.  Ideally, the profile information is
17314 updated through atomic operations in hardware.  If the target platform does not
17315 support the required atomic operations in hardware, however, @file{libatomic}
17316 is available, then the profile information is updated through calls to
17317 @file{libatomic}.  If the target platform neither supports the required atomic
17318 operations in hardware nor @file{libatomic}, then the profile information is
17319 not atomically updated and a warning is issued.  In this case, the obtained
17320 profiling information may be corrupt for multi-threaded applications.
17322 For performance reasons, if 64-bit counters are used for the profiling
17323 information and the target platform only supports 32-bit atomic operations in
17324 hardware, then the performance critical profiling updates are done using two
17325 32-bit atomic operations for each counter update.  If a signal interrupts these
17326 two operations updating a counter, then the profiling information may be in an
17327 inconsistent state.
17329 @opindex fprofile-filter-files
17330 @item -fprofile-filter-files=@var{regex}
17332 Instrument only functions from files whose name matches
17333 any of the regular expressions (separated by semi-colons).
17335 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
17336 only @file{main.c} and all C files starting with 'module'.
17338 @opindex fprofile-exclude-files
17339 @item -fprofile-exclude-files=@var{regex}
17341 Instrument only functions from files whose name does not match
17342 any of the regular expressions (separated by semi-colons).
17344 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
17345 of all files that are located in the @file{/usr/} folder.
17347 @opindex fprofile-reproducible
17348 @item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
17349 Control level of reproducibility of profile gathered by
17350 @code{-fprofile-generate}.  This makes it possible to rebuild program
17351 with same outcome which is useful, for example, for distribution
17352 packages.
17354 With @option{-fprofile-reproducible=serial} the profile gathered by
17355 @option{-fprofile-generate} is reproducible provided the trained program
17356 behaves the same at each invocation of the train run, it is not
17357 multi-threaded and profile data streaming is always done in the same
17358 order.  Note that profile streaming happens at the end of program run but
17359 also before @code{fork} function is invoked.
17361 Note that it is quite common that execution counts of some part of
17362 programs depends, for example, on length of temporary file names or
17363 memory space randomization (that may affect hash-table collision rate).
17364 Such non-reproducible part of programs may be annotated by
17365 @code{no_instrument_function} function attribute. @command{gcov-dump} with
17366 @option{-l} can be used to dump gathered data and verify that they are
17367 indeed reproducible.
17369 With @option{-fprofile-reproducible=parallel-runs} collected profile
17370 stays reproducible regardless the order of streaming of the data into
17371 gcda files.  This setting makes it possible to run multiple instances of
17372 instrumented program in parallel (such as with @code{make -j}). This
17373 reduces quality of gathered data, in particular of indirect call
17374 profiling.
17376 @opindex fsanitize=address
17377 @item -fsanitize=address
17378 Enable AddressSanitizer, a fast memory error detector.
17379 Memory access instructions are instrumented to detect
17380 out-of-bounds and use-after-free bugs.
17381 The option enables @option{-fsanitize-address-use-after-scope}.
17382 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
17383 more details.  The run-time behavior can be influenced using the
17384 @env{ASAN_OPTIONS} environment variable.  When set to @code{help=1},
17385 the available options are shown at startup of the instrumented program.  See
17386 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
17387 for a list of supported options.
17388 The option cannot be combined with @option{-fsanitize=thread} or
17389 @option{-fsanitize=hwaddress}.  Note that the only target
17390 @option{-fsanitize=hwaddress} is currently supported on is AArch64.
17392 To get more accurate stack traces, it is possible to use options such as
17393 @option{-O0}, @option{-O1}, or @option{-Og} (which, for instance, prevent
17394 most function inlining), @option{-fno-optimize-sibling-calls} (which prevents
17395 optimizing sibling and tail recursive calls; this option is implicit for
17396 @option{-O0}, @option{-O1}, or @option{-Og}), or @option{-fno-ipa-icf} (which
17397 disables Identical Code Folding for functions).  Since multiple runs of the
17398 program may yield backtraces with different addresses due to ASLR (Address
17399 Space Layout Randomization), it may be desirable to turn ASLR off.  On Linux,
17400 this can be achieved with @samp{setarch `uname -m` -R ./prog}.
17402 @opindex fsanitize=kernel-address
17403 @item -fsanitize=kernel-address
17404 Enable AddressSanitizer for Linux kernel.
17405 See @uref{https://github.com/google/kernel-sanitizers} for more details.
17407 @opindex fsanitize=hwaddress
17408 @item -fsanitize=hwaddress
17409 Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
17410 ignore the top byte of a pointer to allow the detection of memory errors with
17411 a low memory overhead.
17412 Memory access instructions are instrumented to detect out-of-bounds and
17413 use-after-free bugs.
17414 The option enables @option{-fsanitize-address-use-after-scope}.
17416 @uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
17417 for more details.  The run-time behavior can be influenced using the
17418 @env{HWASAN_OPTIONS} environment variable.  When set to @code{help=1},
17419 the available options are shown at startup of the instrumented program.
17420 The option cannot be combined with @option{-fsanitize=thread} or
17421 @option{-fsanitize=address}, and is currently only available on AArch64.
17423 @opindex fsanitize=kernel-hwaddress
17424 @item -fsanitize=kernel-hwaddress
17425 Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
17426 Similar to @option{-fsanitize=kernel-address} but using an alternate
17427 instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
17428 instrumentation differences necessary for compiling the Linux kernel.
17429 These differences are to avoid hwasan library initialization calls and to
17430 account for the stack pointer having a different value in its top byte.
17432 @emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
17433 Instrumenting the stack and alloca calls are not on by default but are still
17434 possible by specifying the command-line options
17435 @option{--param hwasan-instrument-stack=1} and
17436 @option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
17437 tag is not implemented for kernel instrumentation.
17439 @opindex fsanitize=pointer-compare
17440 @item -fsanitize=pointer-compare
17441 Instrument comparison operation (<, <=, >, >=) with pointer operands.
17442 The option must be combined with either @option{-fsanitize=kernel-address} or
17443 @option{-fsanitize=address}
17444 The option cannot be combined with @option{-fsanitize=thread}.
17445 Note: By default the check is disabled at run time.  To enable it,
17446 add @code{detect_invalid_pointer_pairs=2} to the environment variable
17447 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
17448 invalid operation only when both pointers are non-null.
17450 @opindex fsanitize=pointer-subtract
17451 @item -fsanitize=pointer-subtract
17452 Instrument subtraction with pointer operands.
17453 The option must be combined with either @option{-fsanitize=kernel-address} or
17454 @option{-fsanitize=address}
17455 The option cannot be combined with @option{-fsanitize=thread}.
17456 Note: By default the check is disabled at run time.  To enable it,
17457 add @code{detect_invalid_pointer_pairs=2} to the environment variable
17458 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
17459 invalid operation only when both pointers are non-null.
17461 @opindex fsanitize=shadow-call-stack
17462 @item -fsanitize=shadow-call-stack
17463 Enable ShadowCallStack, a security enhancement mechanism used to protect
17464 programs against return address overwrites (e.g. stack buffer overflows.)
17465 It works by saving a function's return address to a separately allocated
17466 shadow call stack in the function prologue and restoring the return address
17467 from the shadow call stack in the function epilogue.  Instrumentation only
17468 occurs in functions that need to save the return address to the stack.
17470 Currently it only supports the aarch64 platform.  It is specifically
17471 designed for linux kernels that enable the CONFIG_SHADOW_CALL_STACK option.
17472 For the user space programs, runtime support is not currently provided
17473 in libc and libgcc.  Users who want to use this feature in user space need
17474 to provide their own support for the runtime.  It should be noted that
17475 this may cause the ABI rules to be broken.
17477 On aarch64, the instrumentation makes use of the platform register @code{x18}.
17478 This generally means that any code that may run on the same thread as code
17479 compiled with ShadowCallStack must be compiled with the flag
17480 @option{-ffixed-x18}, otherwise functions compiled without
17481 @option{-ffixed-x18} might clobber @code{x18} and so corrupt the shadow
17482 stack pointer.
17484 Also, because there is no userspace runtime support, code compiled with
17485 ShadowCallStack cannot use exception handling.  Use @option{-fno-exceptions}
17486 to turn off exceptions.
17488 See @uref{https://clang.llvm.org/docs/ShadowCallStack.html} for more
17489 details.
17491 @opindex fsanitize=thread
17492 @item -fsanitize=thread
17493 Enable ThreadSanitizer, a fast data race detector.
17494 Memory access instructions are instrumented to detect
17495 data race bugs.  See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
17496 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
17497 environment variable; see
17498 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
17499 supported options.
17500 The option cannot be combined with @option{-fsanitize=address},
17501 @option{-fsanitize=leak}.
17503 Note that sanitized atomic builtins cannot throw exceptions when
17504 operating on invalid memory addresses with non-call exceptions
17505 (@option{-fnon-call-exceptions}).
17507 @opindex fsanitize=leak
17508 @item -fsanitize=leak
17509 Enable LeakSanitizer, a memory leak detector.
17510 This option only matters for linking of executables.
17511 The executable is linked against a library that overrides @code{malloc}
17512 and other allocator functions.  See
17513 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
17514 details.  The run-time behavior can be influenced using the
17515 @env{LSAN_OPTIONS} environment variable.
17516 The option cannot be combined with @option{-fsanitize=thread}.
17518 @opindex fsanitize=undefined
17519 @item -fsanitize=undefined
17520 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
17521 Various computations are instrumented to detect undefined behavior
17522 at runtime.  See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details.   The run-time behavior can be influenced using the
17523 @env{UBSAN_OPTIONS} environment variable.  Current suboptions are:
17525 @table @gcctabopt
17527 @opindex fsanitize=shift
17528 @item -fsanitize=shift
17529 This option enables checking that the result of a shift operation is
17530 not undefined.  Note that what exactly is considered undefined differs
17531 slightly between C and C++, as well as between ISO C90 and C99, etc.
17532 This option has two suboptions, @option{-fsanitize=shift-base} and
17533 @option{-fsanitize=shift-exponent}.
17535 @opindex fsanitize=shift-exponent
17536 @item -fsanitize=shift-exponent
17537 This option enables checking that the second argument of a shift operation
17538 is not negative and is smaller than the precision of the promoted first
17539 argument.
17541 @opindex fsanitize=shift-base
17542 @item -fsanitize=shift-base
17543 If the second argument of a shift operation is within range, check that the
17544 result of a shift operation is not undefined.  Note that what exactly is
17545 considered undefined differs slightly between C and C++, as well as between
17546 ISO C90 and C99, etc.
17548 @opindex fsanitize=integer-divide-by-zero
17549 @item -fsanitize=integer-divide-by-zero
17550 Detect integer division by zero.
17552 @opindex fsanitize=unreachable
17553 @item -fsanitize=unreachable
17554 With this option, the compiler turns the @code{__builtin_unreachable}
17555 call into a diagnostics message call instead.  When reaching the
17556 @code{__builtin_unreachable} call, the behavior is undefined.
17558 @opindex fsanitize=vla-bound
17559 @item -fsanitize=vla-bound
17560 This option instructs the compiler to check that the size of a variable
17561 length array is positive.
17563 @opindex fsanitize=null
17564 @item -fsanitize=null
17565 This option enables pointer checking.  Particularly, the application
17566 built with this option turned on will issue an error message when it
17567 tries to dereference a NULL pointer, or if a reference (possibly an
17568 rvalue reference) is bound to a NULL pointer, or if a method is invoked
17569 on an object pointed by a NULL pointer.
17571 @opindex fsanitize=return
17572 @item -fsanitize=return
17573 This option enables return statement checking.  Programs
17574 built with this option turned on will issue an error message
17575 when the end of a non-void function is reached without actually
17576 returning a value.  This option works in C++ only.
17578 @opindex fsanitize=signed-integer-overflow
17579 @item -fsanitize=signed-integer-overflow
17580 This option enables signed integer overflow checking.  We check that
17581 the result of @code{+}, @code{*}, and both unary and binary @code{-}
17582 does not overflow in the signed arithmetics.  This also detects
17583 @code{INT_MIN / -1} signed division.  Note, integer promotion
17584 rules must be taken into account.  That is, the following is not an
17585 overflow:
17586 @smallexample
17587 signed char a = SCHAR_MAX;
17588 a++;
17589 @end smallexample
17591 @opindex fsanitize=bounds
17592 @item -fsanitize=bounds
17593 This option enables instrumentation of array bounds.  Various out of bounds
17594 accesses are detected.  Flexible array members, flexible array member-like
17595 arrays, and initializers of variables with static storage are not
17596 instrumented, with the exception of flexible array member-like arrays
17597 for which @code{-fstrict-flex-arrays} or @code{-fstrict-flex-arrays=}
17598 options or @code{strict_flex_array} attributes say they shouldn't be treated
17599 like flexible array member-like arrays.
17601 @opindex fsanitize=bounds-strict
17602 @item -fsanitize=bounds-strict
17603 This option enables strict instrumentation of array bounds.  Most out of bounds
17604 accesses are detected, including flexible array member-like arrays.
17605 Initializers of variables with static storage are not instrumented.
17607 @opindex fsanitize=alignment
17608 @item -fsanitize=alignment
17610 This option enables checking of alignment of pointers when they are
17611 dereferenced, or when a reference is bound to insufficiently aligned target,
17612 or when a method or constructor is invoked on insufficiently aligned object.
17614 @opindex fsanitize=object-size
17615 @item -fsanitize=object-size
17616 This option enables instrumentation of memory references using the
17617 @code{__builtin_dynamic_object_size} function.  Various out of bounds
17618 pointer accesses are detected.
17620 @opindex fsanitize=float-divide-by-zero
17621 @item -fsanitize=float-divide-by-zero
17622 Detect floating-point division by zero.  Unlike other similar options,
17623 @option{-fsanitize=float-divide-by-zero} is not enabled by
17624 @option{-fsanitize=undefined}, since floating-point division by zero can
17625 be a legitimate way of obtaining infinities and NaNs.
17627 @opindex fsanitize=float-cast-overflow
17628 @item -fsanitize=float-cast-overflow
17629 This option enables floating-point type to integer conversion checking.
17630 We check that the result of the conversion does not overflow.
17631 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
17632 not enabled by @option{-fsanitize=undefined}.
17633 This option does not work well with @code{FE_INVALID} exceptions enabled.
17635 @opindex fsanitize=nonnull-attribute
17636 @item -fsanitize=nonnull-attribute
17638 This option enables instrumentation of calls, checking whether null values
17639 are not passed to arguments marked as requiring a non-null value by the
17640 @code{nonnull} function attribute.
17642 @opindex fsanitize=returns-nonnull-attribute
17643 @item -fsanitize=returns-nonnull-attribute
17645 This option enables instrumentation of return statements in functions
17646 marked with @code{returns_nonnull} function attribute, to detect returning
17647 of null values from such functions.
17649 @opindex fsanitize=bool
17650 @item -fsanitize=bool
17652 This option enables instrumentation of loads from bool.  If a value other
17653 than 0/1 is loaded, a run-time error is issued.
17655 @opindex fsanitize=enum
17656 @item -fsanitize=enum
17658 This option enables instrumentation of loads from an enum type.  If
17659 a value outside the range of values for the enum type is loaded,
17660 a run-time error is issued.
17662 @opindex fsanitize=vptr
17663 @item -fsanitize=vptr
17665 This option enables instrumentation of C++ member function calls, member
17666 accesses and some conversions between pointers to base and derived classes,
17667 to verify the referenced object has the correct dynamic type.
17669 @opindex fsanitize=pointer-overflow
17670 @item -fsanitize=pointer-overflow
17672 This option enables instrumentation of pointer arithmetics.  If the pointer
17673 arithmetics overflows, a run-time error is issued.
17675 @opindex fsanitize=builtin
17676 @item -fsanitize=builtin
17678 This option enables instrumentation of arguments to selected builtin
17679 functions.  If an invalid value is passed to such arguments, a run-time
17680 error is issued.  E.g.@ passing 0 as the argument to @code{__builtin_ctz}
17681 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
17682 by this option.
17684 @end table
17686 Note that sanitizers tend to increase the rate of false positive
17687 warnings, most notably those around @option{-Wmaybe-uninitialized}.
17688 We recommend against combining @option{-Werror} and [the use of]
17689 sanitizers.
17691 While @option{-ftrapv} causes traps for signed overflows to be emitted,
17692 @option{-fsanitize=undefined} gives a diagnostic message.
17693 This currently works only for the C family of languages.
17695 @opindex fno-sanitize=all
17696 @item -fno-sanitize=all
17698 This option disables all previously enabled sanitizers.
17699 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
17700 together.
17702 @opindex fasan-shadow-offset
17703 @item -fasan-shadow-offset=@var{number}
17704 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
17705 It is useful for experimenting with different shadow memory layouts in
17706 Kernel AddressSanitizer.
17708 @opindex fsanitize-sections
17709 @item -fsanitize-sections=@var{s1},@var{s2},...
17710 Sanitize global variables in selected user-defined sections.  @var{si} may
17711 contain wildcards.
17713 @opindex fsanitize-recover
17714 @opindex fno-sanitize-recover
17715 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
17716 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
17717 mentioned in comma-separated list of @var{opts}.  Enabling this option
17718 for a sanitizer component causes it to attempt to continue
17719 running the program as if no error happened.  This means multiple
17720 runtime errors can be reported in a single program run, and the exit
17721 code of the program may indicate success even when errors
17722 have been reported.  The @option{-fno-sanitize-recover=} option
17723 can be used to alter
17724 this behavior: only the first detected error is reported
17725 and program then exits with a non-zero exit code.
17727 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
17728 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
17729 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
17730 @option{-fsanitize=bounds-strict},
17731 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
17732 For these sanitizers error recovery is turned on by default,
17733 except @option{-fsanitize=address}, for which this feature is experimental.
17734 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
17735 accepted, the former enables recovery for all sanitizers that support it,
17736 the latter disables recovery for all sanitizers that support it.
17738 Even if a recovery mode is turned on the compiler side, it needs to be also
17739 enabled on the runtime library side, otherwise the failures are still fatal.
17740 The runtime library defaults to @code{halt_on_error=0} for
17741 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
17742 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
17743 setting the @code{halt_on_error} flag in the corresponding environment variable.
17745 Syntax without an explicit @var{opts} parameter is deprecated.  It is
17746 equivalent to specifying an @var{opts} list of:
17748 @smallexample
17749 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
17750 @end smallexample
17752 @opindex fsanitize-address-use-after-scope
17753 @item -fsanitize-address-use-after-scope
17754 Enable sanitization of local variables to detect use-after-scope bugs.
17755 The option sets @option{-fstack-reuse} to @samp{none}.
17757 @opindex fsanitize-trap
17758 @opindex fno-sanitize-trap
17759 @item -fsanitize-trap@r{[}=@var{opts}@r{]}
17760 The @option{-fsanitize-trap=} option instructs the compiler to
17761 report for sanitizers mentioned in comma-separated list of @var{opts}
17762 undefined behavior using @code{__builtin_trap} rather than a @code{libubsan}
17763 library routine.  If this option is enabled for certain sanitizer,
17764 it takes precedence over the @option{-fsanitizer-recover=} for that
17765 sanitizer, @code{__builtin_trap} will be emitted and be fatal regardless
17766 of whether recovery is enabled or disabled using @option{-fsanitize-recover=}.
17768 The advantage of this is that the @code{libubsan} library is not needed
17769 and is not linked in, so this is usable even in freestanding environments.
17771 Currently this feature works with @option{-fsanitize=undefined} (and its suboptions
17772 except for @option{-fsanitize=vptr}), @option{-fsanitize=float-cast-overflow},
17773 @option{-fsanitize=float-divide-by-zero} and
17774 @option{-fsanitize=bounds-strict}.  @code{-fsanitize-trap=all} can be also
17775 specified, which enables it for @code{undefined} suboptions,
17776 @option{-fsanitize=float-cast-overflow},
17777 @option{-fsanitize=float-divide-by-zero} and
17778 @option{-fsanitize=bounds-strict}.
17779 If @code{-fsanitize-trap=undefined} or @code{-fsanitize-trap=all} is used
17780 and @code{-fsanitize=vptr} is enabled on the command line, the
17781 instrumentation is silently ignored as the instrumentation always needs
17782 @code{libubsan} support, @option{-fsanitize-trap=vptr} is not allowed.
17784 @opindex fsanitize-undefined-trap-on-error
17785 @item -fsanitize-undefined-trap-on-error
17786 The @option{-fsanitize-undefined-trap-on-error} option is deprecated
17787 equivalent of @option{-fsanitize-trap=all}.
17789 @opindex fsanitize-coverage=trace-pc
17790 @item -fsanitize-coverage=trace-pc
17791 Enable coverage-guided fuzzing code instrumentation.
17792 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
17794 @opindex fsanitize-coverage=trace-cmp
17795 @item -fsanitize-coverage=trace-cmp
17796 Enable dataflow guided fuzzing code instrumentation.
17797 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
17798 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
17799 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
17800 variable or @code{__sanitizer_cov_trace_const_cmp1},
17801 @code{__sanitizer_cov_trace_const_cmp2},
17802 @code{__sanitizer_cov_trace_const_cmp4} or
17803 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
17804 operand constant, @code{__sanitizer_cov_trace_cmpf} or
17805 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
17806 @code{__sanitizer_cov_trace_switch} for switch statements.
17808 @opindex fcf-protection
17809 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
17810 Enable code instrumentation of control-flow transfers to increase
17811 program security by checking that target addresses of control-flow
17812 transfer instructions (such as indirect function call, function return,
17813 indirect jump) are valid.  This prevents diverting the flow of control
17814 to an unexpected target.  This is intended to protect against such
17815 threats as Return-oriented Programming (ROP), and similarly
17816 call/jmp-oriented programming (COP/JOP).
17818 The value @code{branch} tells the compiler to implement checking of
17819 validity of control-flow transfer at the point of indirect branch
17820 instructions, i.e.@: call/jmp instructions.  The value @code{return}
17821 implements checking of validity at the point of returning from a
17822 function.  The value @code{full} is an alias for specifying both
17823 @code{branch} and @code{return}. The value @code{none} turns off
17824 instrumentation.
17826 To override @option{-fcf-protection}, @option{-fcf-protection=none}
17827 needs to be added and then with @option{-fcf-protection=xxx}.
17829 The value @code{check} is used for the final link with link-time
17830 optimization (LTO).  An error is issued if LTO object files are
17831 compiled with different @option{-fcf-protection} values.  The
17832 value @code{check} is ignored at the compile time.
17834 The macro @code{__CET__} is defined when @option{-fcf-protection} is
17835 used.  The first bit of @code{__CET__} is set to 1 for the value
17836 @code{branch} and the second bit of @code{__CET__} is set to 1 for
17837 the @code{return}.
17839 You can also use the @code{nocf_check} attribute to identify
17840 which functions and calls should be skipped from instrumentation
17841 (@pxref{Function Attributes}).
17843 Currently the x86 GNU/Linux target provides an implementation based
17844 on Intel Control-flow Enforcement Technology (CET) which works for
17845 i686 processor or newer.
17847 @opindex fharden-compares
17848 @item -fharden-compares
17849 For every logical test that survives gimple optimizations and is
17850 @emph{not} the condition in a conditional branch (for example,
17851 conditions tested for conditional moves, or to store in boolean
17852 variables), emit extra code to compute and verify the reversed
17853 condition, and to call @code{__builtin_trap} if the results do not
17854 match.  Use with @samp{-fharden-conditional-branches} to cover all
17855 conditionals.
17857 @opindex fharden-conditional-branches
17858 @item -fharden-conditional-branches
17859 For every non-vectorized conditional branch that survives gimple
17860 optimizations, emit extra code to compute and verify the reversed
17861 condition, and to call @code{__builtin_trap} if the result is
17862 unexpected.  Use with @samp{-fharden-compares} to cover all
17863 conditionals.
17865 @opindex fharden-control-flow-redundancy
17866 @item -fharden-control-flow-redundancy
17867 Emit extra code to set booleans when entering basic blocks, and to
17868 verify and trap, at function exits, when the booleans do not form an
17869 execution path that is compatible with the control flow graph.
17871 Verification takes place before returns, before mandatory tail calls
17872 (see below) and, optionally, before escaping exceptions with
17873 @option{-fhardcfr-check-exceptions}, before returning calls with
17874 @option{-fhardcfr-check-returning-calls}, and before noreturn calls with
17875 @option{-fhardcfr-check-noreturn-calls}).  Tuning options
17876 @option{--param hardcfr-max-blocks} and @option{--param
17877 hardcfr-max-inline-blocks} are available.
17879 Tail call optimization takes place too late to affect control flow
17880 redundancy, but calls annotated as mandatory tail calls by language
17881 front-ends, and any calls marked early enough as potential tail calls
17882 would also have verification issued before the call, but these
17883 possibilities are merely theoretical, as these conditions can only be
17884 met when using custom compiler plugins.
17886 @opindex fhardcfr-skip-leaf
17887 @item -fhardcfr-skip-leaf
17888 Disable @option{-fharden-control-flow-redundancy} in leaf functions.
17890 @opindex fhardcfr-check-exceptions
17891 @opindex fno-hardcfr-check-exceptions
17892 @item -fhardcfr-check-exceptions
17893 When @option{-fharden-control-flow-redundancy} is active, check the
17894 recorded execution path against the control flow graph at exception
17895 escape points, as if the function body was wrapped with a cleanup
17896 handler that performed the check and reraised.  This option is enabled
17897 by default; use @option{-fno-hardcfr-check-exceptions} to disable it.
17899 @opindex fhardcfr-check-returning-calls
17900 @opindex fno-hardcfr-check-returning-calls
17901 @item -fhardcfr-check-returning-calls
17902 When @option{-fharden-control-flow-redundancy} is active, check the
17903 recorded execution path against the control flow graph before any
17904 function call immediately followed by a return of its result, if any, so
17905 as to not prevent tail-call optimization, whether or not it is
17906 ultimately optimized to a tail call.
17908 This option is enabled by default whenever sibling call optimizations
17909 are enabled (see @option{-foptimize-sibling-calls}), but it can be
17910 enabled (or disabled, using its negated form) explicitly, regardless of
17911 the optimizations.
17913 @opindex fhardcfr-check-noreturn-calls
17914 @item -fhardcfr-check-noreturn-calls=@r{[}always@r{|}no-xthrow@r{|}nothrow@r{|}never@r{]}
17915 When @option{-fharden-control-flow-redundancy} is active, check the
17916 recorded execution path against the control flow graph before
17917 @code{noreturn} calls, either all of them (@option{always}), those that
17918 aren't expected to return control to the caller through an exception
17919 (@option{no-xthrow}, the default), those that may not return control to
17920 the caller through an exception either (@option{nothrow}), or none of
17921 them (@option{never}).
17923 Checking before a @code{noreturn} function that may return control to
17924 the caller through an exception may cause checking to be performed more
17925 than once, if the exception is caught in the caller, whether by a
17926 handler or a cleanup.  When @option{-fhardcfr-check-exceptions} is also
17927 enabled, the compiler will avoid associating a @code{noreturn} call with
17928 the implicitly-added cleanup handler, since it would be redundant with
17929 the check performed before the call, but other handlers or cleanups in
17930 the function, if activated, will modify the recorded execution path and
17931 check it again when another checkpoint is hit.  The checkpoint may even
17932 be another @code{noreturn} call, so checking may end up performed
17933 multiple times.
17935 Various optimizers may cause calls to be marked as @code{noreturn}
17936 and/or @code{nothrow}, even in the absence of the corresponding
17937 attributes, which may affect the placement of checks before calls, as
17938 well as the addition of implicit cleanup handlers for them.  This
17939 unpredictability, and the fact that raising and reraising exceptions
17940 frequently amounts to implicitly calling @code{noreturn} functions, have
17941 made @option{no-xthrow} the default setting for this option: it excludes
17942 from the @code{noreturn} treatment only internal functions used to
17943 (re)raise exceptions, that are not affected by these optimizations.
17945 @opindex fhardened
17946 @item -fhardened
17947 Enable a set of flags for C and C++ that improve the security of the
17948 generated code without affecting its ABI.  The precise flags enabled
17949 may change between major releases of GCC, but are currently:
17951 @c Keep this in sync with print_help_hardened!
17952 @gccoptlist{
17953 -D_FORTIFY_SOURCE=3
17954 -D_GLIBCXX_ASSERTIONS
17955 -ftrivial-auto-var-init=zero
17956 -fPIE  -pie  -Wl,-z,relro,-z,now
17957 -fstack-protector-strong
17958 -fstack-clash-protection
17959 -fcf-protection=full @r{(x86 GNU/Linux only)}
17962 The list of options enabled by @option{-fhardened} can be generated using
17963 the @option{--help=hardened} option.
17965 When the system glibc is older than 2.35, @option{-D_FORTIFY_SOURCE=2}
17966 is used instead.
17968 This option is intended to be used in production builds, not merely
17969 in debug builds.
17971 Currently, @option{-fhardened} is only supported on GNU/Linux targets.
17973 @option{-fhardened} only enables a particular option if it wasn't
17974 already specified anywhere on the command line.  For instance,
17975 @option{-fhardened} @option{-fstack-protector} will only enable
17976 @option{-fstack-protector}, but not @option{-fstack-protector-strong}.
17978 @opindex fstack-protector
17979 @item -fstack-protector
17980 Emit extra code to check for buffer overflows, such as stack smashing
17981 attacks.  This is done by adding a guard variable to functions with
17982 vulnerable objects.  This includes functions that call @code{alloca}, and
17983 functions with buffers larger than or equal to 8 bytes.  The guards are
17984 initialized when a function is entered and then checked when the function
17985 exits.  If a guard check fails, an error message is printed and the program
17986 exits.  Only variables that are actually allocated on the stack are
17987 considered, optimized away variables or variables allocated in registers
17988 don't count.
17990 @opindex fstack-protector-all
17991 @item -fstack-protector-all
17992 Like @option{-fstack-protector} except that all functions are protected.
17994 @opindex fstack-protector-strong
17995 @item -fstack-protector-strong
17996 Like @option{-fstack-protector} but includes additional functions to
17997 be protected --- those that have local array definitions, or have
17998 references to local frame addresses.  Only variables that are actually
17999 allocated on the stack are considered, optimized away variables or variables
18000 allocated in registers don't count.
18002 @opindex fstack-protector-explicit
18003 @item -fstack-protector-explicit
18004 Like @option{-fstack-protector} but only protects those functions which
18005 have the @code{stack_protect} attribute.
18007 @opindex fstack-check
18008 @item -fstack-check
18009 Generate code to verify that you do not go beyond the boundary of the
18010 stack.  You should specify this flag if you are running in an
18011 environment with multiple threads, but you only rarely need to specify it in
18012 a single-threaded environment since stack overflow is automatically
18013 detected on nearly all systems if there is only one stack.
18015 Note that this switch does not actually cause checking to be done; the
18016 operating system or the language runtime must do that.  The switch causes
18017 generation of code to ensure that they see the stack being extended.
18019 You can additionally specify a string parameter: @samp{no} means no
18020 checking, @samp{generic} means force the use of old-style checking,
18021 @samp{specific} means use the best checking method and is equivalent
18022 to bare @option{-fstack-check}.
18024 Old-style checking is a generic mechanism that requires no specific
18025 target support in the compiler but comes with the following drawbacks:
18027 @enumerate
18028 @item
18029 Modified allocation strategy for large objects: they are always
18030 allocated dynamically if their size exceeds a fixed threshold.  Note this
18031 may change the semantics of some code.
18033 @item
18034 Fixed limit on the size of the static frame of functions: when it is
18035 topped by a particular function, stack checking is not reliable and
18036 a warning is issued by the compiler.
18038 @item
18039 Inefficiency: because of both the modified allocation strategy and the
18040 generic implementation, code performance is hampered.
18041 @end enumerate
18043 Note that old-style stack checking is also the fallback method for
18044 @samp{specific} if no target support has been added in the compiler.
18046 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
18047 and stack overflows.  @samp{specific} is an excellent choice when compiling
18048 Ada code.  It is not generally sufficient to protect against stack-clash
18049 attacks.  To protect against those you want @samp{-fstack-clash-protection}.
18051 @opindex fstack-clash-protection
18052 @item -fstack-clash-protection
18053 Generate code to prevent stack clash style attacks.  When this option is
18054 enabled, the compiler will only allocate one page of stack space at a time
18055 and each page is accessed immediately after allocation.  Thus, it prevents
18056 allocations from jumping over any stack guard page provided by the
18057 operating system.
18059 Most targets do not fully support stack clash protection.  However, on
18060 those targets @option{-fstack-clash-protection} will protect dynamic stack
18061 allocations.  @option{-fstack-clash-protection} may also provide limited
18062 protection for static stack allocations if the target supports
18063 @option{-fstack-check=specific}.
18065 @opindex fstack-limit-register
18066 @opindex fstack-limit-symbol
18067 @opindex fno-stack-limit
18068 @item -fstack-limit-register=@var{reg}
18069 @itemx -fstack-limit-symbol=@var{sym}
18070 @itemx -fno-stack-limit
18071 Generate code to ensure that the stack does not grow beyond a certain value,
18072 either the value of a register or the address of a symbol.  If a larger
18073 stack is required, a signal is raised at run time.  For most targets,
18074 the signal is raised before the stack overruns the boundary, so
18075 it is possible to catch the signal without taking special precautions.
18077 For instance, if the stack starts at absolute address @samp{0x80000000}
18078 and grows downwards, you can use the flags
18079 @option{-fstack-limit-symbol=__stack_limit} and
18080 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
18081 of 128KB@.  Note that this may only work with the GNU linker.
18083 You can locally override stack limit checking by using the
18084 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
18086 @opindex fsplit-stack
18087 @item -fsplit-stack
18088 Generate code to automatically split the stack before it overflows.
18089 The resulting program has a discontiguous stack which can only
18090 overflow if the program is unable to allocate any more memory.  This
18091 is most useful when running threaded programs, as it is no longer
18092 necessary to calculate a good stack size to use for each thread.  This
18093 is currently only implemented for the x86 targets running
18094 GNU/Linux.
18096 When code compiled with @option{-fsplit-stack} calls code compiled
18097 without @option{-fsplit-stack}, there may not be much stack space
18098 available for the latter code to run.  If compiling all code,
18099 including library code, with @option{-fsplit-stack} is not an option,
18100 then the linker can fix up these calls so that the code compiled
18101 without @option{-fsplit-stack} always has a large stack.  Support for
18102 this is implemented in the gold linker in GNU binutils release 2.21
18103 and later.
18105 @opindex -fstrub=disable
18106 @item -fstrub=disable
18107 Disable stack scrubbing entirely, ignoring any @code{strub} attributes.
18108 See @xref{Common Type Attributes}.
18110 @opindex fstrub=strict
18111 @item -fstrub=strict
18112 Functions default to @code{strub} mode @code{disabled}, and apply
18113 @option{strict}ly the restriction that only functions associated with
18114 @code{strub}-@code{callable} modes (@code{at-calls}, @code{callable} and
18115 @code{always_inline} @code{internal}) are @code{callable} by functions
18116 with @code{strub}-enabled modes (@code{at-calls} and @code{internal}).
18118 @opindex fstrub=relaxed
18119 @item -fstrub=relaxed
18120 Restore the default stack scrub (@code{strub}) setting, namely,
18121 @code{strub} is only enabled as required by @code{strub} attributes
18122 associated with function and data types.  @code{Relaxed} means that
18123 strub contexts are only prevented from calling functions explicitly
18124 associated with @code{strub} mode @code{disabled}.  This option is only
18125 useful to override other @option{-fstrub=*} options that precede it in
18126 the command line.
18128 @opindex fstrub=at-calls
18129 @item -fstrub=at-calls
18130 Enable @code{at-calls} @code{strub} mode where viable.  The primary use
18131 of this option is for testing.  It exercises the @code{strub} machinery
18132 in scenarios strictly local to a translation unit.  This @code{strub}
18133 mode modifies function interfaces, so any function that is visible to
18134 other translation units, or that has its address taken, will @emph{not}
18135 be affected by this option.  Optimization options may also affect
18136 viability.  See the @code{strub} attribute documentation for details on
18137 viability and eligibility requirements.
18139 @opindex fstrub=internal
18140 @item -fstrub=internal
18141 Enable @code{internal} @code{strub} mode where viable.  The primary use
18142 of this option is for testing.  This option is intended to exercise
18143 thoroughly parts of the @code{strub} machinery that implement the less
18144 efficient, but interface-preserving @code{strub} mode.  Functions that
18145 would not be affected by this option are quite uncommon.
18147 @opindex fstrub=all
18148 @item -fstrub=all
18149 Enable some @code{strub} mode where viable.  When both strub modes are
18150 viable, @code{at-calls} is preferred.  @option{-fdump-ipa-strubm} adds
18151 function attributes that tell which mode was selected for each function.
18152 The primary use of this option is for testing, to exercise thoroughly
18153 the @code{strub} machinery.
18155 @opindex fvtable-verify
18156 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
18157 This option is only available when compiling C++ code.
18158 It turns on (or off, if using @option{-fvtable-verify=none}) the security
18159 feature that verifies at run time, for every virtual call, that
18160 the vtable pointer through which the call is made is valid for the type of
18161 the object, and has not been corrupted or overwritten.  If an invalid vtable
18162 pointer is detected at run time, an error is reported and execution of the
18163 program is immediately halted.
18165 This option causes run-time data structures to be built at program startup,
18166 which are used for verifying the vtable pointers.  
18167 The options @samp{std} and @samp{preinit}
18168 control the timing of when these data structures are built.  In both cases the
18169 data structures are built before execution reaches @code{main}.  Using
18170 @option{-fvtable-verify=std} causes the data structures to be built after
18171 shared libraries have been loaded and initialized.
18172 @option{-fvtable-verify=preinit} causes them to be built before shared
18173 libraries have been loaded and initialized.
18175 If this option appears multiple times in the command line with different
18176 values specified, @samp{none} takes highest priority over both @samp{std} and
18177 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
18179 @opindex fvtv-debug
18180 @item -fvtv-debug
18181 When used in conjunction with @option{-fvtable-verify=std} or 
18182 @option{-fvtable-verify=preinit}, causes debug versions of the 
18183 runtime functions for the vtable verification feature to be called.  
18184 This flag also causes the compiler to log information about which 
18185 vtable pointers it finds for each class.
18186 This information is written to a file named @file{vtv_set_ptr_data.log} 
18187 in the directory named by the environment variable @env{VTV_LOGS_DIR} 
18188 if that is defined or the current working directory otherwise.
18190 Note:  This feature @emph{appends} data to the log file. If you want a fresh log
18191 file, be sure to delete any existing one.
18193 @opindex fvtv-counts
18194 @item -fvtv-counts
18195 This is a debugging flag.  When used in conjunction with
18196 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
18197 causes the compiler to keep track of the total number of virtual calls
18198 it encounters and the number of verifications it inserts.  It also
18199 counts the number of calls to certain run-time library functions
18200 that it inserts and logs this information for each compilation unit.
18201 The compiler writes this information to a file named
18202 @file{vtv_count_data.log} in the directory named by the environment
18203 variable @env{VTV_LOGS_DIR} if that is defined or the current working
18204 directory otherwise.  It also counts the size of the vtable pointer sets
18205 for each class, and writes this information to @file{vtv_class_set_sizes.log}
18206 in the same directory.
18208 Note:  This feature @emph{appends} data to the log files.  To get fresh log
18209 files, be sure to delete any existing ones.
18211 @opindex finstrument-functions
18212 @item -finstrument-functions
18213 Generate instrumentation calls for entry and exit to functions.  Just
18214 after function entry and just before function exit, the following
18215 profiling functions are called with the address of the current
18216 function and its call site.  (On some platforms,
18217 @code{__builtin_return_address} does not work beyond the current
18218 function, so the call site information may not be available to the
18219 profiling functions otherwise.)
18221 @smallexample
18222 void __cyg_profile_func_enter (void *this_fn,
18223                                void *call_site);
18224 void __cyg_profile_func_exit  (void *this_fn,
18225                                void *call_site);
18226 @end smallexample
18228 The first argument is the address of the start of the current function,
18229 which may be looked up exactly in the symbol table.
18231 This instrumentation is also done for functions expanded inline in other
18232 functions.  The profiling calls indicate where, conceptually, the
18233 inline function is entered and exited.  This means that addressable
18234 versions of such functions must be available.  If all your uses of a
18235 function are expanded inline, this may mean an additional expansion of
18236 code size.  If you use @code{extern inline} in your C code, an
18237 addressable version of such functions must be provided.  (This is
18238 normally the case anyway, but if you get lucky and the optimizer always
18239 expands the functions inline, you might have gotten away without
18240 providing static copies.)
18242 A function may be given the attribute @code{no_instrument_function}, in
18243 which case this instrumentation is not done.  This can be used, for
18244 example, for the profiling functions listed above, high-priority
18245 interrupt routines, and any functions from which the profiling functions
18246 cannot safely be called (perhaps signal handlers, if the profiling
18247 routines generate output or allocate memory).
18248 @xref{Common Function Attributes}.
18250 @opindex finstrument-functions-once
18251 @item -finstrument-functions-once
18252 This is similar to @option{-finstrument-functions}, but the profiling
18253 functions are called only once per instrumented function, i.e. the first
18254 profiling function is called after the first entry into the instrumented
18255 function and the second profiling function is called before the exit
18256 corresponding to this first entry.
18258 The definition of @code{once} for the purpose of this option is a little
18259 vague because the implementation is not protected against data races.
18260 As a result, the implementation only guarantees that the profiling
18261 functions are called at @emph{least} once per process and at @emph{most}
18262 once per thread, but the calls are always paired, that is to say, if a
18263 thread calls the first function, then it will call the second function,
18264 unless it never reaches the exit of the instrumented function.
18266 @opindex finstrument-functions-exclude-file-list
18267 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
18269 Set the list of functions that are excluded from instrumentation (see
18270 the description of @option{-finstrument-functions}).  If the file that
18271 contains a function definition matches with one of @var{file}, then
18272 that function is not instrumented.  The match is done on substrings:
18273 if the @var{file} parameter is a substring of the file name, it is
18274 considered to be a match.
18276 For example:
18278 @smallexample
18279 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
18280 @end smallexample
18282 @noindent
18283 excludes any inline function defined in files whose pathnames
18284 contain @file{/bits/stl} or @file{include/sys}.
18286 If, for some reason, you want to include letter @samp{,} in one of
18287 @var{sym}, write @samp{\,}. For example,
18288 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
18289 (note the single quote surrounding the option).
18291 @opindex finstrument-functions-exclude-function-list
18292 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
18294 This is similar to @option{-finstrument-functions-exclude-file-list},
18295 but this option sets the list of function names to be excluded from
18296 instrumentation.  The function name to be matched is its user-visible
18297 name, such as @code{vector<int> blah(const vector<int> &)}, not the
18298 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
18299 match is done on substrings: if the @var{sym} parameter is a substring
18300 of the function name, it is considered to be a match.  For C99 and C++
18301 extended identifiers, the function name must be given in UTF-8, not
18302 using universal character names.
18304 @opindex fpatchable-function-entry
18305 @item -fpatchable-function-entry=@var{N}[,@var{M}]
18306 Generate @var{N} NOPs right at the beginning
18307 of each function, with the function entry point before the @var{M}th NOP.
18308 If @var{M} is omitted, it defaults to @code{0} so the
18309 function entry points to the address just at the first NOP.
18310 The NOP instructions reserve extra space which can be used to patch in
18311 any desired instrumentation at run time, provided that the code segment
18312 is writable.  The amount of space is controllable indirectly via
18313 the number of NOPs; the NOP instruction used corresponds to the instruction
18314 emitted by the internal GCC back-end interface @code{gen_nop}.  This behavior
18315 is target-specific and may also depend on the architecture variant and/or
18316 other compilation options.
18318 For run-time identification, the starting addresses of these areas,
18319 which correspond to their respective function entries minus @var{M},
18320 are additionally collected in the @code{__patchable_function_entries}
18321 section of the resulting binary.
18323 Note that the value of @code{__attribute__ ((patchable_function_entry
18324 (N,M)))} takes precedence over command-line option
18325 @option{-fpatchable-function-entry=N,M}.  This can be used to increase
18326 the area size or to remove it completely on a single function.
18327 If @code{N=0}, no pad location is recorded.
18329 The NOP instructions are inserted at---and maybe before, depending on
18330 @var{M}---the function entry address, even before the prologue.  On
18331 PowerPC with the ELFv2 ABI, for a function with dual entry points,
18332 the local entry point is this function entry address.
18334 The maximum value of @var{N} and @var{M} is 65535.  On PowerPC with the
18335 ELFv2 ABI, for a function with dual entry points, the supported values
18336 for @var{M} are 0, 2, 6 and 14.
18337 @end table
18340 @node Preprocessor Options
18341 @section Options Controlling the Preprocessor
18342 @cindex preprocessor options
18343 @cindex options, preprocessor
18345 These options control the C preprocessor, which is run on each C source
18346 file before actual compilation.
18348 If you use the @option{-E} option, nothing is done except preprocessing.
18349 Some of these options make sense only together with @option{-E} because
18350 they cause the preprocessor output to be unsuitable for actual
18351 compilation.
18353 In addition to the options listed here, there are a number of options 
18354 to control search paths for include files documented in 
18355 @ref{Directory Options}.  
18356 Options to control preprocessor diagnostics are listed in 
18357 @ref{Warning Options}.
18359 @table @gcctabopt
18360 @include cppopts.texi
18362 @opindex Wp
18363 @item -Wp,@var{option}
18364 You can use @option{-Wp,@var{option}} to bypass the compiler driver
18365 and pass @var{option} directly through to the preprocessor.  If
18366 @var{option} contains commas, it is split into multiple options at the
18367 commas.  However, many options are modified, translated or interpreted
18368 by the compiler driver before being passed to the preprocessor, and
18369 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
18370 interface is undocumented and subject to change, so whenever possible
18371 you should avoid using @option{-Wp} and let the driver handle the
18372 options instead.
18374 @opindex Xpreprocessor
18375 @item -Xpreprocessor @var{option}
18376 Pass @var{option} as an option to the preprocessor.  You can use this to
18377 supply system-specific preprocessor options that GCC does not 
18378 recognize.
18380 If you want to pass an option that takes an argument, you must use
18381 @option{-Xpreprocessor} twice, once for the option and once for the argument.
18383 @opindex no-integrated-cpp
18384 @item -no-integrated-cpp
18385 Perform preprocessing as a separate pass before compilation.
18386 By default, GCC performs preprocessing as an integrated part of
18387 input tokenization and parsing.
18388 If this option is provided, the appropriate language front end
18389 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
18390 and Objective-C, respectively) is instead invoked twice,
18391 once for preprocessing only and once for actual compilation
18392 of the preprocessed input.
18393 This option may be useful in conjunction with the @option{-B} or
18394 @option{-wrapper} options to specify an alternate preprocessor or
18395 perform additional processing of the program source between
18396 normal preprocessing and compilation.
18398 @opindex flarge-source-files
18399 @item -flarge-source-files
18400 Adjust GCC to expect large source files, at the expense of slower
18401 compilation and higher memory usage.
18403 Specifically, GCC normally tracks both column numbers and line numbers
18404 within source files and it normally prints both of these numbers in
18405 diagnostics.  However, once it has processed a certain number of source
18406 lines, it stops tracking column numbers and only tracks line numbers.
18407 This means that diagnostics for later lines do not include column numbers.
18408 It also means that options like @option{-Wmisleading-indentation} cease to work
18409 at that point, although the compiler prints a note if this happens.
18410 Passing @option{-flarge-source-files} significantly increases the number
18411 of source lines that GCC can process before it stops tracking columns.
18413 @end table
18415 @node Assembler Options
18416 @section Passing Options to the Assembler
18418 @c prevent bad page break with this line
18419 You can pass options to the assembler.
18421 @table @gcctabopt
18422 @opindex Wa
18423 @item -Wa,@var{option}
18424 Pass @var{option} as an option to the assembler.  If @var{option}
18425 contains commas, it is split into multiple options at the commas.
18427 @opindex Xassembler
18428 @item -Xassembler @var{option}
18429 Pass @var{option} as an option to the assembler.  You can use this to
18430 supply system-specific assembler options that GCC does not
18431 recognize.
18433 If you want to pass an option that takes an argument, you must use
18434 @option{-Xassembler} twice, once for the option and once for the argument.
18436 @end table
18438 @node Link Options
18439 @section Options for Linking
18440 @cindex link options
18441 @cindex options, linking
18443 These options come into play when the compiler links object files into
18444 an executable output file.  They are meaningless if the compiler is
18445 not doing a link step.
18447 @table @gcctabopt
18448 @cindex file names
18449 @item @var{object-file-name}
18450 A file name that does not end in a special recognized suffix is
18451 considered to name an object file or library.  (Object files are
18452 distinguished from libraries by the linker according to the file
18453 contents.)  If linking is done, these object files are used as input
18454 to the linker.
18456 @opindex c
18457 @opindex S
18458 @opindex E
18459 @item -c
18460 @itemx -S
18461 @itemx -E
18462 If any of these options is used, then the linker is not run, and
18463 object file names should not be used as arguments.  @xref{Overall
18464 Options}.
18466 @opindex flinker-output
18467 @item -flinker-output=@var{type}
18468 This option controls code generation of the link-time optimizer.  By
18469 default the linker output is automatically determined by the linker
18470 plugin.  For debugging the compiler and if incremental linking with a 
18471 non-LTO object file is desired, it may be useful to control the type
18472 manually.
18474 If @var{type} is @samp{exec}, code generation produces a static
18475 binary. In this case @option{-fpic} and @option{-fpie} are both
18476 disabled.
18478 If @var{type} is @samp{dyn}, code generation produces a shared
18479 library.  In this case @option{-fpic} or @option{-fPIC} is preserved,
18480 but not enabled automatically.  This allows to build shared libraries
18481 without position-independent code on architectures where this is
18482 possible, i.e.@: on x86.
18484 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
18485 executable. This results in similar optimizations as @samp{exec}
18486 except that @option{-fpie} is not disabled if specified at compilation
18487 time.
18489 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
18490 done.  The sections containing intermediate code for link-time optimization are
18491 merged, pre-optimized, and output to the resulting object file. In addition, if
18492 @option{-ffat-lto-objects} is specified, binary code is produced for future
18493 non-LTO linking. The object file produced by incremental linking is smaller
18494 than a static library produced from the same object files.  At link time the
18495 result of incremental linking also loads faster than a static
18496 library assuming that the majority of objects in the library are used.
18498 Finally @samp{nolto-rel} configures the compiler for incremental linking where
18499 code generation is forced, a final binary is produced, and the intermediate
18500 code for later link-time optimization is stripped. When multiple object files
18501 are linked together the resulting code is better optimized than with
18502 link-time optimizations disabled (for example, cross-module inlining 
18503 happens), but most of benefits of whole program optimizations are lost. 
18505 During the incremental link (by @option{-r}) the linker plugin defaults to
18506 @option{rel}. With current interfaces to GNU Binutils it is however not
18507 possible to incrementally link LTO objects and non-LTO objects into a single
18508 mixed object file.  If any of object files in incremental link cannot
18509 be used for link-time optimization, the linker plugin issues a warning and
18510 uses @samp{nolto-rel}. To maintain whole program optimization, it is
18511 recommended to link such objects into static library instead. Alternatively it
18512 is possible to use H.J. Lu's binutils with support for mixed objects.
18514 @opindex fuse-ld=bfd
18515 @item -fuse-ld=bfd
18516 Use the @command{bfd} linker instead of the default linker.
18518 @opindex fuse-ld=gold
18519 @item -fuse-ld=gold
18520 Use the @command{gold} linker instead of the default linker.
18522 @opindex fuse-ld=lld
18523 @item -fuse-ld=lld
18524 Use the LLVM @command{lld} linker instead of the default linker.
18526 @opindex fuse-ld=mold
18527 @item -fuse-ld=mold
18528 Use the Modern Linker (@command{mold}) instead of the default linker.
18530 @cindex Libraries
18531 @opindex l
18532 @item -l@var{library}
18533 @itemx -l @var{library}
18534 Search the library named @var{library} when linking.  (The second
18535 alternative with the library as a separate argument is only for
18536 POSIX compliance and is not recommended.)
18538 The @option{-l} option is passed directly to the linker by GCC.  Refer
18539 to your linker documentation for exact details.  The general
18540 description below applies to the GNU linker.  
18542 The linker searches a standard list of directories for the library.
18543 The directories searched include several standard system directories
18544 plus any that you specify with @option{-L}.
18546 Static libraries are archives of object files, and have file names
18547 like @file{lib@var{library}.a}.  Some targets also support shared
18548 libraries, which typically have names like @file{lib@var{library}.so}.
18549 If both static and shared libraries are found, the linker gives
18550 preference to linking with the shared library unless the
18551 @option{-static} option is used.
18553 It makes a difference where in the command you write this option; the
18554 linker searches and processes libraries and object files in the order they
18555 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
18556 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
18557 to functions in @samp{z}, those functions may not be loaded.
18559 @opindex lobjc
18560 @item -lobjc
18561 You need this special case of the @option{-l} option in order to
18562 link an Objective-C or Objective-C++ program.
18564 @opindex nostartfiles
18565 @item -nostartfiles
18566 Do not use the standard system startup files when linking.
18567 The standard system libraries are used normally, unless @option{-nostdlib},
18568 @option{-nolibc}, or @option{-nodefaultlibs} is used.
18570 @opindex nodefaultlibs
18571 @item -nodefaultlibs
18572 Do not use the standard system libraries when linking.
18573 Only the libraries you specify are passed to the linker, and options
18574 specifying linkage of the system libraries, such as @option{-static-libgcc}
18575 or @option{-shared-libgcc}, are ignored.  
18576 The standard startup files are used normally, unless @option{-nostartfiles}
18577 is used.  
18579 The compiler may generate calls to @code{memcmp},
18580 @code{memset}, @code{memcpy} and @code{memmove}.
18581 These entries are usually resolved by entries in
18582 libc.  These entry points should be supplied through some other
18583 mechanism when this option is specified.
18585 @opindex nolibc
18586 @item -nolibc
18587 Do not use the C library or system libraries tightly coupled with it when
18588 linking.  Still link with the startup files, @file{libgcc} or toolchain
18589 provided language support libraries such as @file{libgnat}, @file{libgfortran}
18590 or @file{libstdc++} unless options preventing their inclusion are used as
18591 well.  This typically removes @option{-lc} from the link command line, as well
18592 as system libraries that normally go with it and become meaningless when
18593 absence of a C library is assumed, for example @option{-lpthread} or
18594 @option{-lm} in some configurations.  This is intended for bare-board
18595 targets when there is indeed no C library available.
18597 @opindex nostdlib
18598 @item -nostdlib
18599 Do not use the standard system startup files or libraries when linking.
18600 No startup files and only the libraries you specify are passed to
18601 the linker, and options specifying linkage of the system libraries, such as
18602 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
18604 The compiler may generate calls to @code{memcmp}, @code{memset},
18605 @code{memcpy} and @code{memmove}.
18606 These entries are usually resolved by entries in
18607 libc.  These entry points should be supplied through some other
18608 mechanism when this option is specified.
18610 @cindex @option{-lgcc}, use with @option{-nostdlib}
18611 @cindex @option{-nostdlib} and unresolved references
18612 @cindex unresolved references and @option{-nostdlib}
18613 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
18614 @cindex @option{-nodefaultlibs} and unresolved references
18615 @cindex unresolved references and @option{-nodefaultlibs}
18616 One of the standard libraries bypassed by @option{-nostdlib} and
18617 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
18618 which GCC uses to overcome shortcomings of particular machines, or special
18619 needs for some languages.
18620 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
18621 Collection (GCC) Internals},
18622 for more discussion of @file{libgcc.a}.)
18623 In most cases, you need @file{libgcc.a} even when you want to avoid
18624 other standard libraries.  In other words, when you specify @option{-nostdlib}
18625 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
18626 This ensures that you have no unresolved references to internal GCC
18627 library subroutines.
18628 (An example of such an internal subroutine is @code{__main}, used to ensure C++
18629 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
18630 GNU Compiler Collection (GCC) Internals}.)
18632 @opindex nostdlib++
18633 @item -nostdlib++
18634 Do not implicitly link with standard C++ libraries.
18636 @opindex e
18637 @opindex entry
18638 @item -e @var{entry}
18639 @itemx --entry=@var{entry}
18641 Specify that the program entry point is @var{entry}.  The argument is
18642 interpreted by the linker; the GNU linker accepts either a symbol name
18643 or an address.
18645 @opindex pie
18646 @item -pie
18647 Produce a dynamically linked position independent executable on targets
18648 that support it.  For predictable results, you must also specify the same
18649 set of options used for compilation (@option{-fpie}, @option{-fPIE},
18650 or model suboptions) when you specify this linker option.
18652 @opindex no-pie
18653 @item -no-pie
18654 Don't produce a dynamically linked position independent executable.
18656 @opindex static-pie
18657 @item -static-pie
18658 Produce a static position independent executable on targets that support
18659 it.  A static position independent executable is similar to a static
18660 executable, but can be loaded at any address without a dynamic linker.
18661 For predictable results, you must also specify the same set of options
18662 used for compilation (@option{-fpie}, @option{-fPIE}, or model
18663 suboptions) when you specify this linker option.
18665 @opindex pthread
18666 @item -pthread
18667 Link with the POSIX threads library.  This option is supported on 
18668 GNU/Linux targets, most other Unix derivatives, and also on 
18669 x86 Cygwin and MinGW targets.  On some targets this option also sets 
18670 flags for the preprocessor, so it should be used consistently for both
18671 compilation and linking.
18673 @opindex r
18674 @item -r
18675 Produce a relocatable object as output.  This is also known as partial
18676 linking.
18678 @opindex rdynamic
18679 @item -rdynamic
18680 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
18681 that support it. This instructs the linker to add all symbols, not
18682 only used ones, to the dynamic symbol table. This option is needed
18683 for some uses of @code{dlopen} or to allow obtaining backtraces
18684 from within a program.
18686 @opindex s
18687 @item -s
18688 Remove all symbol table and relocation information from the executable.
18690 @opindex static
18691 @item -static
18692 On systems that support dynamic linking, this overrides @option{-pie}
18693 and prevents linking with the shared libraries.  On other systems, this
18694 option has no effect.
18696 @opindex shared
18697 @item -shared
18698 Produce a shared object which can then be linked with other objects to
18699 form an executable.  Not all systems support this option.  For predictable
18700 results, you must also specify the same set of options used for compilation
18701 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
18702 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
18703 needs to build supplementary stub code for constructors to work.  On
18704 multi-libbed systems, @samp{gcc -shared} must select the correct support
18705 libraries to link against.  Failing to supply the correct flags may lead
18706 to subtle defects.  Supplying them in cases where they are not necessary
18707 is innocuous.  @option{-shared} suppresses the addition of startup code
18708 to alter the floating-point environment as done with @option{-ffast-math},
18709 @option{-Ofast} or @option{-funsafe-math-optimizations} on some targets.}
18711 @opindex shared-libgcc
18712 @opindex static-libgcc
18713 @item -shared-libgcc
18714 @itemx -static-libgcc
18715 On systems that provide @file{libgcc} as a shared library, these options
18716 force the use of either the shared or static version, respectively.
18717 If no shared version of @file{libgcc} was built when the compiler was
18718 configured, these options have no effect.
18720 There are several situations in which an application should use the
18721 shared @file{libgcc} instead of the static version.  The most common
18722 of these is when the application wishes to throw and catch exceptions
18723 across different shared libraries.  In that case, each of the libraries
18724 as well as the application itself should use the shared @file{libgcc}.
18726 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
18727 whenever you build a shared library or a main executable, because C++
18728 programs typically use exceptions, so this is the right thing to do.
18730 If, instead, you use the GCC driver to create shared libraries, you may
18731 find that they are not always linked with the shared @file{libgcc}.
18732 If GCC finds, at its configuration time, that you have a non-GNU linker
18733 or a GNU linker that does not support option @option{--eh-frame-hdr},
18734 it links the shared version of @file{libgcc} into shared libraries
18735 by default.  Otherwise, it takes advantage of the linker and optimizes
18736 away the linking with the shared version of @file{libgcc}, linking with
18737 the static version of libgcc by default.  This allows exceptions to
18738 propagate through such shared libraries, without incurring relocation
18739 costs at library load time.
18741 However, if a library or main executable is supposed to throw or catch
18742 exceptions, you must link it using the G++ driver, or using the option
18743 @option{-shared-libgcc}, such that it is linked with the shared
18744 @file{libgcc}.
18746 @opindex static-libasan
18747 @item -static-libasan
18748 When the @option{-fsanitize=address} option is used to link a program,
18749 the GCC driver automatically links against @option{libasan}.  If
18750 @file{libasan} is available as a shared library, and the @option{-static}
18751 option is not used, then this links against the shared version of
18752 @file{libasan}.  The @option{-static-libasan} option directs the GCC
18753 driver to link @file{libasan} statically, without necessarily linking
18754 other libraries statically.
18756 @opindex static-libtsan
18757 @item -static-libtsan
18758 When the @option{-fsanitize=thread} option is used to link a program,
18759 the GCC driver automatically links against @option{libtsan}.  If
18760 @file{libtsan} is available as a shared library, and the @option{-static}
18761 option is not used, then this links against the shared version of
18762 @file{libtsan}.  The @option{-static-libtsan} option directs the GCC
18763 driver to link @file{libtsan} statically, without necessarily linking
18764 other libraries statically.
18766 @opindex static-liblsan
18767 @item -static-liblsan
18768 When the @option{-fsanitize=leak} option is used to link a program,
18769 the GCC driver automatically links against @option{liblsan}.  If
18770 @file{liblsan} is available as a shared library, and the @option{-static}
18771 option is not used, then this links against the shared version of
18772 @file{liblsan}.  The @option{-static-liblsan} option directs the GCC
18773 driver to link @file{liblsan} statically, without necessarily linking
18774 other libraries statically.
18776 @opindex static-libubsan
18777 @item -static-libubsan
18778 When the @option{-fsanitize=undefined} option is used to link a program,
18779 the GCC driver automatically links against @option{libubsan}.  If
18780 @file{libubsan} is available as a shared library, and the @option{-static}
18781 option is not used, then this links against the shared version of
18782 @file{libubsan}.  The @option{-static-libubsan} option directs the GCC
18783 driver to link @file{libubsan} statically, without necessarily linking
18784 other libraries statically.
18786 @opindex static-libstdc++
18787 @item -static-libstdc++
18788 When the @command{g++} program is used to link a C++ program, it
18789 normally automatically links against @option{libstdc++}.  If
18790 @file{libstdc++} is available as a shared library, and the
18791 @option{-static} option is not used, then this links against the
18792 shared version of @file{libstdc++}.  That is normally fine.  However, it
18793 is sometimes useful to freeze the version of @file{libstdc++} used by
18794 the program without going all the way to a fully static link.  The
18795 @option{-static-libstdc++} option directs the @command{g++} driver to
18796 link @file{libstdc++} statically, without necessarily linking other
18797 libraries statically.
18799 @opindex symbolic
18800 @item -symbolic
18801 Bind references to global symbols when building a shared object.  Warn
18802 about any unresolved references (unless overridden by the link editor
18803 option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support
18804 this option.
18806 @opindex T
18807 @cindex linker script
18808 @item -T @var{script}
18809 Use @var{script} as the linker script.  This option is supported by most
18810 systems using the GNU linker.  On some targets, such as bare-board
18811 targets without an operating system, the @option{-T} option may be required
18812 when linking to avoid references to undefined symbols.
18814 @opindex Xlinker
18815 @item -Xlinker @var{option}
18816 Pass @var{option} as an option to the linker.  You can use this to
18817 supply system-specific linker options that GCC does not recognize.
18819 If you want to pass an option that takes a separate argument, you must use
18820 @option{-Xlinker} twice, once for the option and once for the argument.
18821 For example, to pass @option{-assert definitions}, you must write
18822 @option{-Xlinker -assert -Xlinker definitions}.  It does not work to write
18823 @option{-Xlinker "-assert definitions"}, because this passes the entire
18824 string as a single argument, which is not what the linker expects.
18826 When using the GNU linker, it is usually more convenient to pass
18827 arguments to linker options using the @option{@var{option}=@var{value}}
18828 syntax than as separate arguments.  For example, you can specify
18829 @option{-Xlinker -Map=output.map} rather than
18830 @option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
18831 this syntax for command-line options.
18833 @opindex Wl
18834 @item -Wl,@var{option}
18835 Pass @var{option} as an option to the linker.  If @var{option} contains
18836 commas, it is split into multiple options at the commas.  You can use this
18837 syntax to pass an argument to the option.
18838 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
18839 linker.  When using the GNU linker, you can also get the same effect with
18840 @option{-Wl,-Map=output.map}.
18842 @opindex u
18843 @item -u @var{symbol}
18844 Pretend the symbol @var{symbol} is undefined, to force linking of
18845 library modules to define it.  You can use @option{-u} multiple times with
18846 different symbols to force loading of additional library modules.
18848 @opindex z
18849 @item -z @var{keyword}
18850 @option{-z} is passed directly on to the linker along with the keyword
18851 @var{keyword}. See the section in the documentation of your linker for
18852 permitted values and their meanings.
18853 @end table
18855 @node Directory Options
18856 @section Options for Directory Search
18857 @cindex directory options
18858 @cindex options, directory search
18859 @cindex search path
18861 These options specify directories to search for header files, for
18862 libraries and for parts of the compiler:
18864 @table @gcctabopt
18865 @include cppdiropts.texi
18867 @opindex iplugindir=
18868 @item -iplugindir=@var{dir}
18869 Set the directory to search for plugins that are passed
18870 by @option{-fplugin=@var{name}} instead of
18871 @option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
18872 to be used by the user, but only passed by the driver.
18874 @opindex L
18875 @item -L@var{dir}
18876 Add directory @var{dir} to the list of directories to be searched
18877 for @option{-l}.
18879 @opindex B
18880 @item -B@var{prefix}
18881 This option specifies where to find the executables, libraries,
18882 include files, and data files of the compiler itself.
18884 The compiler driver program runs one or more of the subprograms
18885 @command{cpp}, @command{cc1}, @command{as} and @command{ld}.  It tries
18886 @var{prefix} as a prefix for each program it tries to run, both with and
18887 without @samp{@var{machine}/@var{version}/} for the corresponding target
18888 machine and compiler version.
18890 For each subprogram to be run, the compiler driver first tries the
18891 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
18892 is not specified, the driver tries two standard prefixes, 
18893 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
18894 those results in a file name that is found, the unmodified program
18895 name is searched for using the directories specified in your
18896 @env{PATH} environment variable.
18898 The compiler checks to see if the path provided by @option{-B}
18899 refers to a directory, and if necessary it adds a directory
18900 separator character at the end of the path.
18902 @option{-B} prefixes that effectively specify directory names also apply
18903 to libraries in the linker, because the compiler translates these
18904 options into @option{-L} options for the linker.  They also apply to
18905 include files in the preprocessor, because the compiler translates these
18906 options into @option{-isystem} options for the preprocessor.  In this case,
18907 the compiler appends @samp{include} to the prefix.
18909 The runtime support file @file{libgcc.a} can also be searched for using
18910 the @option{-B} prefix, if needed.  If it is not found there, the two
18911 standard prefixes above are tried, and that is all.  The file is left
18912 out of the link if it is not found by those means.
18914 Another way to specify a prefix much like the @option{-B} prefix is to use
18915 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
18916 Variables}.
18918 As a special kludge, if the path provided by @option{-B} is
18919 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
18920 9, then it is replaced by @file{[dir/]include}.  This is to help
18921 with boot-strapping the compiler.
18923 @opindex no-canonical-prefixes
18924 @item -no-canonical-prefixes
18925 Do not expand any symbolic links, resolve references to @samp{/../}
18926 or @samp{/./}, or make the path absolute when generating a relative
18927 prefix.
18929 @opindex sysroot
18930 @item --sysroot=@var{dir}
18931 Use @var{dir} as the logical root directory for headers and libraries.
18932 For example, if the compiler normally searches for headers in
18933 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
18934 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
18936 If you use both this option and the @option{-isysroot} option, then
18937 the @option{--sysroot} option applies to libraries, but the
18938 @option{-isysroot} option applies to header files.
18940 The GNU linker (beginning with version 2.16) has the necessary support
18941 for this option.  If your linker does not support this option, the
18942 header file aspect of @option{--sysroot} still works, but the
18943 library aspect does not.
18945 @opindex no-sysroot-suffix
18946 @item --no-sysroot-suffix
18947 For some targets, a suffix is added to the root directory specified
18948 with @option{--sysroot}, depending on the other options used, so that
18949 headers may for example be found in
18950 @file{@var{dir}/@var{suffix}/usr/include} instead of
18951 @file{@var{dir}/usr/include}.  This option disables the addition of
18952 such a suffix.
18954 @end table
18956 @node Code Gen Options
18957 @section Options for Code Generation Conventions
18958 @cindex code generation conventions
18959 @cindex options, code generation
18960 @cindex run-time options
18962 These machine-independent options control the interface conventions
18963 used in code generation.
18965 Most of them have both positive and negative forms; the negative form
18966 of @option{-ffoo} is @option{-fno-foo}.  In the table below, only
18967 one of the forms is listed---the one that is not the default.  You
18968 can figure out the other form by either removing @samp{no-} or adding
18971 @table @gcctabopt
18972 @opindex fstack_reuse
18973 @item -fstack-reuse=@var{reuse-level}
18974 This option controls stack space reuse for user declared local/auto variables
18975 and compiler generated temporaries.  @var{reuse_level} can be @samp{all},
18976 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
18977 local variables and temporaries, @samp{named_vars} enables the reuse only for
18978 user defined local variables with names, and @samp{none} disables stack reuse
18979 completely. The default value is @samp{all}. The option is needed when the
18980 program extends the lifetime of a scoped local variable or a compiler generated
18981 temporary beyond the end point defined by the language.  When a lifetime of
18982 a variable ends, and if the variable lives in memory, the optimizing compiler
18983 has the freedom to reuse its stack space with other temporaries or scoped
18984 local variables whose live range does not overlap with it. Legacy code extending
18985 local lifetime is likely to break with the stack reuse optimization.
18987 For example,
18989 @smallexample
18990    int *p;
18991    @{
18992      int local1;
18994      p = &local1;
18995      local1 = 10;
18996      ....
18997    @}
18998    @{
18999       int local2;
19000       local2 = 20;
19001       ...
19002    @}
19004    if (*p == 10)  // out of scope use of local1
19005      @{
19007      @}
19008 @end smallexample
19010 Another example:
19011 @smallexample
19013    struct A
19014    @{
19015        A(int k) : i(k), j(k) @{ @}
19016        int i;
19017        int j;
19018    @};
19020    A *ap;
19022    void foo(const A& ar)
19023    @{
19024       ap = &ar;
19025    @}
19027    void bar()
19028    @{
19029       foo(A(10)); // temp object's lifetime ends when foo returns
19031       @{
19032         A a(20);
19033         ....
19034       @}
19035       ap->i+= 10;  // ap references out of scope temp whose space
19036                    // is reused with a. What is the value of ap->i?
19037    @}
19039 @end smallexample
19041 The lifetime of a compiler generated temporary is well defined by the C++
19042 standard. When a lifetime of a temporary ends, and if the temporary lives
19043 in memory, the optimizing compiler has the freedom to reuse its stack
19044 space with other temporaries or scoped local variables whose live range
19045 does not overlap with it. However some of the legacy code relies on
19046 the behavior of older compilers in which temporaries' stack space is
19047 not reused, the aggressive stack reuse can lead to runtime errors. This
19048 option is used to control the temporary stack reuse optimization.
19050 @opindex ftrapv
19051 @item -ftrapv
19052 This option generates traps for signed overflow on addition, subtraction,
19053 multiplication operations.
19054 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
19055 @option{-ftrapv} @option{-fwrapv} on the command-line results in
19056 @option{-fwrapv} being effective.  Note that only active options override, so
19057 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
19058 results in @option{-ftrapv} being effective.
19060 @opindex fwrapv
19061 @item -fwrapv
19062 This option instructs the compiler to assume that signed arithmetic
19063 overflow of addition, subtraction and multiplication wraps around
19064 using twos-complement representation.  This flag enables some optimizations
19065 and disables others.
19066 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
19067 @option{-ftrapv} @option{-fwrapv} on the command-line results in
19068 @option{-fwrapv} being effective.  Note that only active options override, so
19069 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
19070 results in @option{-ftrapv} being effective.
19072 @opindex fwrapv-pointer
19073 @item -fwrapv-pointer
19074 This option instructs the compiler to assume that pointer arithmetic
19075 overflow on addition and subtraction wraps around using twos-complement
19076 representation.  This flag disables some optimizations which assume
19077 pointer overflow is invalid.
19079 @opindex fstrict-overflow
19080 @item -fstrict-overflow
19081 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
19082 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
19084 @opindex fexceptions
19085 @item -fexceptions
19086 Enable exception handling.  Generates extra code needed to propagate
19087 exceptions.  For some targets, this implies GCC generates frame
19088 unwind information for all functions, which can produce significant data
19089 size overhead, although it does not affect execution.  If you do not
19090 specify this option, GCC enables it by default for languages like
19091 C++ that normally require exception handling, and disables it for
19092 languages like C that do not normally require it.  However, you may need
19093 to enable this option when compiling C code that needs to interoperate
19094 properly with exception handlers written in C++.  You may also wish to
19095 disable this option if you are compiling older C++ programs that don't
19096 use exception handling.
19098 @opindex fnon-call-exceptions
19099 @item -fnon-call-exceptions
19100 Generate code that allows trapping instructions to throw exceptions.
19101 Note that this requires platform-specific runtime support that does
19102 not exist everywhere.  Moreover, it only allows @emph{trapping}
19103 instructions to throw exceptions, i.e.@: memory references or floating-point
19104 instructions.  It does not allow exceptions to be thrown from
19105 arbitrary signal handlers such as @code{SIGALRM}.  This enables
19106 @option{-fexceptions}.
19108 @opindex fdelete-dead-exceptions
19109 @item -fdelete-dead-exceptions
19110 Consider that instructions that may throw exceptions but don't otherwise
19111 contribute to the execution of the program can be optimized away.
19112 This does not affect calls to functions except those with the
19113 @code{pure} or @code{const} attributes.
19114 This option is enabled by default for the Ada and C++ compilers, as permitted by
19115 the language specifications.
19116 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
19118 @opindex funwind-tables
19119 @item -funwind-tables
19120 Similar to @option{-fexceptions}, except that it just generates any needed
19121 static data, but does not affect the generated code in any other way.
19122 You normally do not need to enable this option; instead, a language processor
19123 that needs this handling enables it on your behalf.
19125 @opindex fasynchronous-unwind-tables
19126 @item -fasynchronous-unwind-tables
19127 Generate unwind table in DWARF format, if supported by target machine.  The
19128 table is exact at each instruction boundary, so it can be used for stack
19129 unwinding from asynchronous events (such as debugger or garbage collector).
19131 @opindex fno-gnu-unique
19132 @opindex fgnu-unique
19133 @item -fno-gnu-unique
19134 On systems with recent GNU assembler and C library, the C++ compiler
19135 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
19136 of template static data members and static local variables in inline
19137 functions are unique even in the presence of @code{RTLD_LOCAL}; this
19138 is necessary to avoid problems with a library used by two different
19139 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
19140 therefore disagreeing with the other one about the binding of the
19141 symbol.  But this causes @code{dlclose} to be ignored for affected
19142 DSOs; if your program relies on reinitialization of a DSO via
19143 @code{dlclose} and @code{dlopen}, you can use
19144 @option{-fno-gnu-unique}.
19146 @opindex fpcc-struct-return
19147 @item -fpcc-struct-return
19148 Return ``short'' @code{struct} and @code{union} values in memory like
19149 longer ones, rather than in registers.  This convention is less
19150 efficient, but it has the advantage of allowing intercallability between
19151 GCC-compiled files and files compiled with other compilers, particularly
19152 the Portable C Compiler (pcc).
19154 The precise convention for returning structures in memory depends
19155 on the target configuration macros.
19157 Short structures and unions are those whose size and alignment match
19158 that of some integer type.
19160 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
19161 switch is not binary compatible with code compiled with the
19162 @option{-freg-struct-return} switch.
19163 Use it to conform to a non-default application binary interface.
19165 @opindex freg-struct-return
19166 @item -freg-struct-return
19167 Return @code{struct} and @code{union} values in registers when possible.
19168 This is more efficient for small structures than
19169 @option{-fpcc-struct-return}.
19171 If you specify neither @option{-fpcc-struct-return} nor
19172 @option{-freg-struct-return}, GCC defaults to whichever convention is
19173 standard for the target.  If there is no standard convention, GCC
19174 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
19175 the principal compiler.  In those cases, we can choose the standard, and
19176 we chose the more efficient register return alternative.
19178 @strong{Warning:} code compiled with the @option{-freg-struct-return}
19179 switch is not binary compatible with code compiled with the
19180 @option{-fpcc-struct-return} switch.
19181 Use it to conform to a non-default application binary interface.
19183 @opindex fshort-enums
19184 @item -fshort-enums
19185 Allocate to an @code{enum} type only as many bytes as it needs for the
19186 declared range of possible values.  Specifically, the @code{enum} type
19187 is equivalent to the smallest integer type that has enough room.
19188 This option has no effect for an enumeration type with a fixed underlying
19189 type.
19191 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
19192 code that is not binary compatible with code generated without that switch.
19193 Use it to conform to a non-default application binary interface.
19195 @opindex fshort-wchar
19196 @item -fshort-wchar
19197 Override the underlying type for @code{wchar_t} to be @code{short
19198 unsigned int} instead of the default for the target.  This option is
19199 useful for building programs to run under WINE@.
19201 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
19202 code that is not binary compatible with code generated without that switch.
19203 Use it to conform to a non-default application binary interface.
19205 @opindex fcommon
19206 @opindex fno-common
19207 @cindex tentative definitions
19208 @item -fcommon
19209 In C code, this option controls the placement of global variables
19210 defined without an initializer, known as @dfn{tentative definitions}
19211 in the C standard.  Tentative definitions are distinct from declarations
19212 of a variable with the @code{extern} keyword, which do not allocate storage.
19214 The default is @option{-fno-common}, which specifies that the compiler places
19215 uninitialized global variables in the BSS section of the object file.
19216 This inhibits the merging of tentative definitions by the linker so you get a
19217 multiple-definition error if the same variable is accidentally defined in more
19218 than one compilation unit.
19220 The @option{-fcommon} places uninitialized global variables in a common block.
19221 This allows the linker to resolve all tentative definitions of the same variable
19222 in different compilation units to the same object, or to a non-tentative
19223 definition.  This behavior is inconsistent with C++, and on many targets implies
19224 a speed and code size penalty on global variable references.  It is mainly
19225 useful to enable legacy code to link without errors.
19227 @opindex fno-ident
19228 @opindex fident
19229 @item -fno-ident
19230 Ignore the @code{#ident} directive.
19232 @opindex finhibit-size-directive
19233 @item -finhibit-size-directive
19234 Don't output a @code{.size} assembler directive, or anything else that
19235 would cause trouble if the function is split in the middle, and the
19236 two halves are placed at locations far apart in memory.  This option is
19237 used when compiling @file{crtstuff.c}; you should not need to use it
19238 for anything else.
19240 @opindex fverbose-asm
19241 @item -fverbose-asm
19242 Put extra commentary information in the generated assembly code to
19243 make it more readable.  This option is generally only of use to those
19244 who actually need to read the generated assembly code (perhaps while
19245 debugging the compiler itself).
19247 @option{-fno-verbose-asm}, the default, causes the
19248 extra information to be omitted and is useful when comparing two assembler
19249 files.
19251 The added comments include:
19253 @itemize @bullet
19255 @item
19256 information on the compiler version and command-line options,
19258 @item
19259 the source code lines associated with the assembly instructions,
19260 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
19262 @item
19263 hints on which high-level expressions correspond to
19264 the various assembly instruction operands.
19266 @end itemize
19268 For example, given this C source file:
19270 @smallexample
19271 int test (int n)
19273   int i;
19274   int total = 0;
19276   for (i = 0; i < n; i++)
19277     total += i * i;
19279   return total;
19281 @end smallexample
19283 compiling to (x86_64) assembly via @option{-S} and emitting the result
19284 direct to stdout via @option{-o} @option{-}
19286 @smallexample
19287 gcc -S test.c -fverbose-asm -Os -o -
19288 @end smallexample
19290 gives output similar to this:
19292 @smallexample
19293         .file   "test.c"
19294 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
19295   [...snip...]
19296 # options passed:
19297   [...snip...]
19299         .text
19300         .globl  test
19301         .type   test, @@function
19302 test:
19303 .LFB0:
19304         .cfi_startproc
19305 # test.c:4:   int total = 0;
19306         xorl    %eax, %eax      # <retval>
19307 # test.c:6:   for (i = 0; i < n; i++)
19308         xorl    %edx, %edx      # i
19309 .L2:
19310 # test.c:6:   for (i = 0; i < n; i++)
19311         cmpl    %edi, %edx      # n, i
19312         jge     .L5     #,
19313 # test.c:7:     total += i * i;
19314         movl    %edx, %ecx      # i, tmp92
19315         imull   %edx, %ecx      # i, tmp92
19316 # test.c:6:   for (i = 0; i < n; i++)
19317         incl    %edx    # i
19318 # test.c:7:     total += i * i;
19319         addl    %ecx, %eax      # tmp92, <retval>
19320         jmp     .L2     #
19321 .L5:
19322 # test.c:10: @}
19323         ret
19324         .cfi_endproc
19325 .LFE0:
19326         .size   test, .-test
19327         .ident  "GCC: (GNU) 7.0.0 20160809 (experimental)"
19328         .section        .note.GNU-stack,"",@@progbits
19329 @end smallexample
19331 The comments are intended for humans rather than machines and hence the
19332 precise format of the comments is subject to change.
19334 @opindex frecord-gcc-switches
19335 @item -frecord-gcc-switches
19336 This switch causes the command line used to invoke the
19337 compiler to be recorded into the object file that is being created.
19338 This switch is only implemented on some targets and the exact format
19339 of the recording is target and binary file format dependent, but it
19340 usually takes the form of a section containing ASCII text.  This
19341 switch is related to the @option{-fverbose-asm} switch, but that
19342 switch only records information in the assembler output file as
19343 comments, so it never reaches the object file.
19344 See also @option{-grecord-gcc-switches} for another
19345 way of storing compiler options into the object file.
19347 @opindex fpic
19348 @cindex global offset table
19349 @cindex PIC
19350 @item -fpic
19351 Generate position-independent code (PIC) suitable for use in a shared
19352 library, if supported for the target machine.  Such code accesses all
19353 constant addresses through a global offset table (GOT)@.  The dynamic
19354 loader resolves the GOT entries when the program starts (the dynamic
19355 loader is not part of GCC; it is part of the operating system).  If
19356 the GOT size for the linked executable exceeds a machine-specific
19357 maximum size, you get an error message from the linker indicating that
19358 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
19359 instead.  (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
19360 on the m68k and RS/6000.  The x86 has no such limit.)
19362 Position-independent code requires special support, and therefore works
19363 only on certain machines.  For the x86, GCC supports PIC for System V
19364 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
19365 position-independent.
19367 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
19368 are defined to 1.
19370 @opindex fPIC
19371 @item -fPIC
19372 If supported for the target machine, emit position-independent code,
19373 suitable for dynamic linking and avoiding any limit on the size of the
19374 global offset table.  This option makes a difference on AArch64, m68k,
19375 PowerPC and SPARC@.
19377 Position-independent code requires special support, and therefore works
19378 only on certain machines.
19380 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
19381 are defined to 2.
19383 @opindex fpie
19384 @opindex fPIE
19385 @item -fpie
19386 @itemx -fPIE
19387 These options are similar to @option{-fpic} and @option{-fPIC}, but the
19388 generated position-independent code can be only linked into executables.
19389 Usually these options are used to compile code that will be linked using
19390 the @option{-pie} GCC option.
19392 @option{-fpie} and @option{-fPIE} both define the macros
19393 @code{__pie__} and @code{__PIE__}.  The macros have the value 1
19394 for @option{-fpie} and 2 for @option{-fPIE}.
19396 @opindex fno-plt
19397 @opindex fplt
19398 @item -fno-plt
19399 Do not use the PLT for external function calls in position-independent code.
19400 Instead, load the callee address at call sites from the GOT and branch to it.
19401 This leads to more efficient code by eliminating PLT stubs and exposing
19402 GOT loads to optimizations.  On architectures such as 32-bit x86 where
19403 PLT stubs expect the GOT pointer in a specific register, this gives more
19404 register allocation freedom to the compiler.
19405 Lazy binding requires use of the PLT; 
19406 with @option{-fno-plt} all external symbols are resolved at load time.
19408 Alternatively, the function attribute @code{noplt} can be used to avoid calls
19409 through the PLT for specific external functions.
19411 In position-dependent code, a few targets also convert calls to
19412 functions that are marked to not use the PLT to use the GOT instead.
19414 @opindex fno-jump-tables
19415 @opindex fjump-tables
19416 @item -fno-jump-tables
19417 Do not use jump tables for switch statements even where it would be
19418 more efficient than other code generation strategies.  This option is
19419 of use in conjunction with @option{-fpic} or @option{-fPIC} for
19420 building code that forms part of a dynamic linker and cannot
19421 reference the address of a jump table.  On some targets, jump tables
19422 do not require a GOT and this option is not needed.
19424 @opindex fno-bit-tests
19425 @opindex fbit-tests
19426 @item -fno-bit-tests
19427 Do not use bit tests for switch statements even where it would be
19428 more efficient than other code generation strategies.
19430 @opindex ffixed
19431 @item -ffixed-@var{reg}
19432 Treat the register named @var{reg} as a fixed register; generated code
19433 should never refer to it (except perhaps as a stack pointer, frame
19434 pointer or in some other fixed role).
19436 @var{reg} must be the name of a register.  The register names accepted
19437 are machine-specific and are defined in the @code{REGISTER_NAMES}
19438 macro in the machine description macro file.
19440 This flag does not have a negative form, because it specifies a
19441 three-way choice.
19443 @opindex fcall-used
19444 @item -fcall-used-@var{reg}
19445 Treat the register named @var{reg} as an allocable register that is
19446 clobbered by function calls.  It may be allocated for temporaries or
19447 variables that do not live across a call.  Functions compiled this way
19448 do not save and restore the register @var{reg}.
19450 It is an error to use this flag with the frame pointer or stack pointer.
19451 Use of this flag for other registers that have fixed pervasive roles in
19452 the machine's execution model produces disastrous results.
19454 This flag does not have a negative form, because it specifies a
19455 three-way choice.
19457 @opindex fcall-saved
19458 @item -fcall-saved-@var{reg}
19459 Treat the register named @var{reg} as an allocable register saved by
19460 functions.  It may be allocated even for temporaries or variables that
19461 live across a call.  Functions compiled this way save and restore
19462 the register @var{reg} if they use it.
19464 It is an error to use this flag with the frame pointer or stack pointer.
19465 Use of this flag for other registers that have fixed pervasive roles in
19466 the machine's execution model produces disastrous results.
19468 A different sort of disaster results from the use of this flag for
19469 a register in which function values may be returned.
19471 This flag does not have a negative form, because it specifies a
19472 three-way choice.
19474 @opindex fpack-struct
19475 @item -fpack-struct[=@var{n}]
19476 Without a value specified, pack all structure members together without
19477 holes.  When a value is specified (which must be a small power of two), pack
19478 structure members according to this value, representing the maximum
19479 alignment (that is, objects with default alignment requirements larger than
19480 this are output potentially unaligned at the next fitting location.
19482 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
19483 code that is not binary compatible with code generated without that switch.
19484 Additionally, it makes the code suboptimal.
19485 Use it to conform to a non-default application binary interface.
19487 @opindex fleading-underscore
19488 @item -fleading-underscore
19489 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
19490 change the way C symbols are represented in the object file.  One use
19491 is to help link with legacy assembly code.
19493 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
19494 generate code that is not binary compatible with code generated without that
19495 switch.  Use it to conform to a non-default application binary interface.
19496 Not all targets provide complete support for this switch.
19498 @opindex ftls-model
19499 @item -ftls-model=@var{model}
19500 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
19501 The @var{model} argument should be one of @samp{global-dynamic},
19502 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
19503 Note that the choice is subject to optimization: the compiler may use
19504 a more efficient model for symbols not visible outside of the translation
19505 unit, or if @option{-fpic} is not given on the command line.
19507 The default without @option{-fpic} is @samp{initial-exec}; with
19508 @option{-fpic} the default is @samp{global-dynamic}.
19510 @opindex ftrampolines
19511 @item -ftrampolines
19512 For targets that normally need trampolines for nested functions, always
19513 generate them instead of using descriptors.  Otherwise, for targets that
19514 do not need them, like for example HP-PA or IA-64, do nothing.
19516 A trampoline is a small piece of code that is created at run time on the
19517 stack when the address of a nested function is taken, and is used to call
19518 the nested function indirectly.  Therefore, it requires the stack to be
19519 made executable in order for the program to work properly.
19521 @option{-fno-trampolines} is enabled by default on a language by language
19522 basis to let the compiler avoid generating them, if it computes that this
19523 is safe, and replace them with descriptors.  Descriptors are made up of data
19524 only, but the generated code must be prepared to deal with them.  As of this
19525 writing, @option{-fno-trampolines} is enabled by default only for Ada.
19527 Moreover, code compiled with @option{-ftrampolines} and code compiled with
19528 @option{-fno-trampolines} are not binary compatible if nested functions are
19529 present.  This option must therefore be used on a program-wide basis and be
19530 manipulated with extreme care.
19532 For languages other than Ada, the @code{-ftrampolines} and
19533 @code{-fno-trampolines} options currently have no effect, and
19534 trampolines are always generated on platforms that need them
19535 for nested functions.
19537 @opindex ftrampoline-impl
19538 @item -ftrampoline-impl=@r{[}stack@r{|}heap@r{]}
19539 By default, trampolines are generated on stack.  However, certain platforms
19540 (such as the Apple M1) do not permit an executable stack.  Compiling with
19541 @option{-ftrampoline-impl=heap} generate calls to
19542 @code{__gcc_nested_func_ptr_created} and
19543 @code{__gcc_nested_func_ptr_deleted} in order to allocate and
19544 deallocate trampoline space on the executable heap.  These functions are
19545 implemented in libgcc, and will only be provided on specific targets:
19546 x86_64 Darwin, x86_64 and aarch64 Linux.  @emph{PLEASE NOTE}: Heap
19547 trampolines are @emph{not} guaranteed to be correctly deallocated if you
19548 @code{setjmp}, instantiate nested functions, and then @code{longjmp} back
19549 to a state prior to having allocated those nested functions.
19551 @opindex fvisibility
19552 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
19553 Set the default ELF image symbol visibility to the specified option---all
19554 symbols are marked with this unless overridden within the code.
19555 Using this feature can very substantially improve linking and
19556 load times of shared object libraries, produce more optimized
19557 code, provide near-perfect API export and prevent symbol clashes.
19558 It is @strong{strongly} recommended that you use this in any shared objects
19559 you distribute.
19561 Despite the nomenclature, @samp{default} always means public; i.e.,
19562 available to be linked against from outside the shared object.
19563 @samp{protected} and @samp{internal} are pretty useless in real-world
19564 usage so the only other commonly used option is @samp{hidden}.
19565 The default if @option{-fvisibility} isn't specified is
19566 @samp{default}, i.e., make every symbol public.
19568 A good explanation of the benefits offered by ensuring ELF
19569 symbols have the correct visibility is given by ``How To Write
19570 Shared Libraries'' by Ulrich Drepper (which can be found at
19571 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
19572 solution made possible by this option to marking things hidden when
19573 the default is public is to make the default hidden and mark things
19574 public.  This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
19575 and @code{__attribute__ ((visibility("default")))} instead of
19576 @code{__declspec(dllexport)} you get almost identical semantics with
19577 identical syntax.  This is a great boon to those working with
19578 cross-platform projects.
19580 For those adding visibility support to existing code, you may find
19581 @code{#pragma GCC visibility} of use.  This works by you enclosing
19582 the declarations you wish to set visibility for with (for example)
19583 @code{#pragma GCC visibility push(hidden)} and
19584 @code{#pragma GCC visibility pop}.
19585 Bear in mind that symbol visibility should be viewed @strong{as
19586 part of the API interface contract} and thus all new code should
19587 always specify visibility when it is not the default; i.e., declarations
19588 only for use within the local DSO should @strong{always} be marked explicitly
19589 as hidden as so to avoid PLT indirection overheads---making this
19590 abundantly clear also aids readability and self-documentation of the code.
19591 Note that due to ISO C++ specification requirements, @code{operator new} and
19592 @code{operator delete} must always be of default visibility.
19594 Be aware that headers from outside your project, in particular system
19595 headers and headers from any other library you use, may not be
19596 expecting to be compiled with visibility other than the default.  You
19597 may need to explicitly say @code{#pragma GCC visibility push(default)}
19598 before including any such headers.
19600 @code{extern} declarations are not affected by @option{-fvisibility}, so
19601 a lot of code can be recompiled with @option{-fvisibility=hidden} with
19602 no modifications.  However, this means that calls to @code{extern}
19603 functions with no explicit visibility use the PLT, so it is more
19604 effective to use @code{__attribute ((visibility))} and/or
19605 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
19606 declarations should be treated as hidden.
19608 Note that @option{-fvisibility} does affect C++ vague linkage
19609 entities. This means that, for instance, an exception class that is
19610 be thrown between DSOs must be explicitly marked with default
19611 visibility so that the @samp{type_info} nodes are unified between
19612 the DSOs.
19614 An overview of these techniques, their benefits and how to use them
19615 is at @uref{https://gcc.gnu.org/@/wiki/@/Visibility}.
19617 @opindex fstrict-volatile-bitfields
19618 @item -fstrict-volatile-bitfields
19619 This option should be used if accesses to volatile bit-fields (or other
19620 structure fields, although the compiler usually honors those types
19621 anyway) should use a single access of the width of the
19622 field's type, aligned to a natural alignment if possible.  For
19623 example, targets with memory-mapped peripheral registers might require
19624 all such accesses to be 16 bits wide; with this flag you can
19625 declare all peripheral bit-fields as @code{unsigned short} (assuming short
19626 is 16 bits on these targets) to force GCC to use 16-bit accesses
19627 instead of, perhaps, a more efficient 32-bit access.
19629 If this option is disabled, the compiler uses the most efficient
19630 instruction.  In the previous example, that might be a 32-bit load
19631 instruction, even though that accesses bytes that do not contain
19632 any portion of the bit-field, or memory-mapped registers unrelated to
19633 the one being updated.
19635 In some cases, such as when the @code{packed} attribute is applied to a 
19636 structure field, it may not be possible to access the field with a single
19637 read or write that is correctly aligned for the target machine.  In this
19638 case GCC falls back to generating multiple accesses rather than code that 
19639 will fault or truncate the result at run time.
19641 Note:  Due to restrictions of the C/C++11 memory model, write accesses are
19642 not allowed to touch non bit-field members.  It is therefore recommended
19643 to define all bits of the field's type as bit-field members.
19645 The default value of this option is determined by the application binary
19646 interface for the target processor.
19648 @opindex fsync-libcalls
19649 @item -fsync-libcalls
19650 This option controls whether any out-of-line instance of the @code{__sync}
19651 family of functions may be used to implement the C++11 @code{__atomic}
19652 family of functions.
19654 The default value of this option is enabled, thus the only useful form
19655 of the option is @option{-fno-sync-libcalls}.  This option is used in
19656 the implementation of the @file{libatomic} runtime library.
19658 @end table
19660 @node Developer Options
19661 @section GCC Developer Options
19662 @cindex developer options
19663 @cindex debugging GCC
19664 @cindex debug dump options
19665 @cindex dump options
19666 @cindex compilation statistics
19668 This section describes command-line options that are primarily of
19669 interest to GCC developers, including options to support compiler
19670 testing and investigation of compiler bugs and compile-time
19671 performance problems.  This includes options that produce debug dumps
19672 at various points in the compilation; that print statistics such as
19673 memory use and execution time; and that print information about GCC's
19674 configuration, such as where it searches for libraries.  You should
19675 rarely need to use any of these options for ordinary compilation and
19676 linking tasks.
19678 Many developer options that cause GCC to dump output to a file take an
19679 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
19680 or @samp{-} to dump to standard output, and @samp{stderr} for standard
19681 error.
19683 If @samp{=@var{filename}} is omitted, a default dump file name is
19684 constructed by concatenating the base dump file name, a pass number,
19685 phase letter, and pass name.  The base dump file name is the name of
19686 output file produced by the compiler if explicitly specified and not
19687 an executable; otherwise it is the source file name.
19688 The pass number is determined by the order passes are registered with
19689 the compiler's pass manager. 
19690 This is generally the same as the order of execution, but passes
19691 registered by plugins, target-specific passes, or passes that are
19692 otherwise registered late are numbered higher than the pass named
19693 @samp{final}, even if they are executed earlier.  The phase letter is
19694 one of @samp{i} (inter-procedural analysis), @samp{l}
19695 (language-specific), @samp{r} (RTL), or @samp{t} (tree). 
19696 The files are created in the directory of the output file. 
19698 @table @gcctabopt
19700 @opindex fcallgraph-info
19701 @item -fcallgraph-info
19702 @itemx -fcallgraph-info=@var{MARKERS}
19703 Makes the compiler output callgraph information for the program, on a
19704 per-object-file basis.  The information is generated in the common VCG
19705 format.  It can be decorated with additional, per-node and/or per-edge
19706 information, if a list of comma-separated markers is additionally
19707 specified.  When the @code{su} marker is specified, the callgraph is
19708 decorated with stack usage information; it is equivalent to
19709 @option{-fstack-usage}.  When the @code{da} marker is specified, the
19710 callgraph is decorated with information about dynamically allocated
19711 objects.
19713 When compiling with @option{-flto}, no callgraph information is output
19714 along with the object file.  At LTO link time, @option{-fcallgraph-info}
19715 may generate multiple callgraph information files next to intermediate
19716 LTO output files.
19718 @opindex d
19719 @opindex fdump-rtl-@var{pass}
19720 @item -d@var{letters}
19721 @itemx -fdump-rtl-@var{pass}
19722 @itemx -fdump-rtl-@var{pass}=@var{filename}
19723 Says to make debugging dumps during compilation at times specified by
19724 @var{letters}.  This is used for debugging the RTL-based passes of the
19725 compiler.
19727 Some @option{-d@var{letters}} switches have different meaning when
19728 @option{-E} is used for preprocessing.  @xref{Preprocessor Options},
19729 for information about preprocessor-specific dump options.
19731 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
19732 @option{-d} option @var{letters}.  Here are the possible
19733 letters for use in @var{pass} and @var{letters}, and their meanings:
19735 @table @gcctabopt
19737 @opindex fdump-rtl-alignments
19738 @item -fdump-rtl-alignments
19739 Dump after branch alignments have been computed.
19741 @opindex fdump-rtl-asmcons
19742 @item -fdump-rtl-asmcons
19743 Dump after fixing rtl statements that have unsatisfied in/out constraints.
19745 @opindex fdump-rtl-auto_inc_dec
19746 @item -fdump-rtl-auto_inc_dec
19747 Dump after auto-inc-dec discovery.  This pass is only run on
19748 architectures that have auto inc or auto dec instructions.
19750 @opindex fdump-rtl-barriers
19751 @item -fdump-rtl-barriers
19752 Dump after cleaning up the barrier instructions.
19754 @opindex fdump-rtl-bbpart
19755 @item -fdump-rtl-bbpart
19756 Dump after partitioning hot and cold basic blocks.
19758 @opindex fdump-rtl-bbro
19759 @item -fdump-rtl-bbro
19760 Dump after block reordering.
19762 @opindex fdump-rtl-btl2
19763 @opindex fdump-rtl-btl2
19764 @item -fdump-rtl-btl1
19765 @itemx -fdump-rtl-btl2
19766 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
19767 after the two branch
19768 target load optimization passes.
19770 @opindex fdump-rtl-bypass
19771 @item -fdump-rtl-bypass
19772 Dump after jump bypassing and control flow optimizations.
19774 @opindex fdump-rtl-combine
19775 @item -fdump-rtl-combine
19776 Dump after the RTL instruction combination pass.
19778 @opindex fdump-rtl-compgotos
19779 @item -fdump-rtl-compgotos
19780 Dump after duplicating the computed gotos.
19782 @opindex fdump-rtl-ce1
19783 @opindex fdump-rtl-ce2
19784 @opindex fdump-rtl-ce3
19785 @item -fdump-rtl-ce1
19786 @itemx -fdump-rtl-ce2
19787 @itemx -fdump-rtl-ce3
19788 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
19789 @option{-fdump-rtl-ce3} enable dumping after the three
19790 if conversion passes.
19792 @opindex fdump-rtl-cprop_hardreg
19793 @item -fdump-rtl-cprop_hardreg
19794 Dump after hard register copy propagation.
19796 @opindex fdump-rtl-csa
19797 @item -fdump-rtl-csa
19798 Dump after combining stack adjustments.
19800 @opindex fdump-rtl-cse1
19801 @opindex fdump-rtl-cse2
19802 @item -fdump-rtl-cse1
19803 @itemx -fdump-rtl-cse2
19804 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
19805 the two common subexpression elimination passes.
19807 @opindex fdump-rtl-dce
19808 @item -fdump-rtl-dce
19809 Dump after the standalone dead code elimination passes.
19811 @opindex fdump-rtl-dbr
19812 @item -fdump-rtl-dbr
19813 Dump after delayed branch scheduling.
19815 @opindex fdump-rtl-dce1
19816 @opindex fdump-rtl-dce2
19817 @item -fdump-rtl-dce1
19818 @itemx -fdump-rtl-dce2
19819 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
19820 the two dead store elimination passes.
19822 @opindex fdump-rtl-eh
19823 @item -fdump-rtl-eh
19824 Dump after finalization of EH handling code.
19826 @opindex fdump-rtl-eh_ranges
19827 @item -fdump-rtl-eh_ranges
19828 Dump after conversion of EH handling range regions.
19830 @opindex fdump-rtl-expand
19831 @item -fdump-rtl-expand
19832 Dump after RTL generation.
19834 @opindex fdump-rtl-fwprop1
19835 @opindex fdump-rtl-fwprop2
19836 @item -fdump-rtl-fwprop1
19837 @itemx -fdump-rtl-fwprop2
19838 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
19839 dumping after the two forward propagation passes.
19841 @opindex fdump-rtl-gcse1
19842 @opindex fdump-rtl-gcse2
19843 @item -fdump-rtl-gcse1
19844 @itemx -fdump-rtl-gcse2
19845 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
19846 after global common subexpression elimination.
19848 @opindex fdump-rtl-init-regs
19849 @item -fdump-rtl-init-regs
19850 Dump after the initialization of the registers.
19852 @opindex fdump-rtl-initvals
19853 @item -fdump-rtl-initvals
19854 Dump after the computation of the initial value sets.
19856 @opindex fdump-rtl-into_cfglayout
19857 @item -fdump-rtl-into_cfglayout
19858 Dump after converting to cfglayout mode.
19860 @opindex fdump-rtl-ira
19861 @item -fdump-rtl-ira
19862 Dump after iterated register allocation.
19864 @opindex fdump-rtl-jump
19865 @item -fdump-rtl-jump
19866 Dump after the second jump optimization.
19868 @opindex fdump-rtl-loop2
19869 @item -fdump-rtl-loop2
19870 @option{-fdump-rtl-loop2} enables dumping after the rtl
19871 loop optimization passes.
19873 @opindex fdump-rtl-mach
19874 @item -fdump-rtl-mach
19875 Dump after performing the machine dependent reorganization pass, if that
19876 pass exists.
19878 @opindex fdump-rtl-mode_sw
19879 @item -fdump-rtl-mode_sw
19880 Dump after removing redundant mode switches.
19882 @opindex fdump-rtl-rnreg
19883 @item -fdump-rtl-rnreg
19884 Dump after register renumbering.
19886 @opindex fdump-rtl-outof_cfglayout
19887 @item -fdump-rtl-outof_cfglayout
19888 Dump after converting from cfglayout mode.
19890 @opindex fdump-rtl-peephole2
19891 @item -fdump-rtl-peephole2
19892 Dump after the peephole pass.
19894 @opindex fdump-rtl-postreload
19895 @item -fdump-rtl-postreload
19896 Dump after post-reload optimizations.
19898 @opindex fdump-rtl-pro_and_epilogue
19899 @item -fdump-rtl-pro_and_epilogue
19900 Dump after generating the function prologues and epilogues.
19902 @opindex fdump-rtl-sched1
19903 @opindex fdump-rtl-sched2
19904 @item -fdump-rtl-sched1
19905 @itemx -fdump-rtl-sched2
19906 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
19907 after the basic block scheduling passes.
19909 @opindex fdump-rtl-ree
19910 @item -fdump-rtl-ree
19911 Dump after sign/zero extension elimination.
19913 @opindex fdump-rtl-seqabstr
19914 @item -fdump-rtl-seqabstr
19915 Dump after common sequence discovery.
19917 @opindex fdump-rtl-shorten
19918 @item -fdump-rtl-shorten
19919 Dump after shortening branches.
19921 @opindex fdump-rtl-sibling
19922 @item -fdump-rtl-sibling
19923 Dump after sibling call optimizations.
19925 @opindex fdump-rtl-split1
19926 @opindex fdump-rtl-split2
19927 @opindex fdump-rtl-split3
19928 @opindex fdump-rtl-split4
19929 @opindex fdump-rtl-split5
19930 @item -fdump-rtl-split1
19931 @itemx -fdump-rtl-split2
19932 @itemx -fdump-rtl-split3
19933 @itemx -fdump-rtl-split4
19934 @itemx -fdump-rtl-split5
19935 These options enable dumping after five rounds of
19936 instruction splitting.
19938 @opindex fdump-rtl-sms
19939 @item -fdump-rtl-sms
19940 Dump after modulo scheduling.  This pass is only run on some
19941 architectures.
19943 @opindex fdump-rtl-stack
19944 @item -fdump-rtl-stack
19945 Dump after conversion from GCC's ``flat register file'' registers to the
19946 x87's stack-like registers.  This pass is only run on x86 variants.
19948 @opindex fdump-rtl-subreg1
19949 @opindex fdump-rtl-subreg2
19950 @item -fdump-rtl-subreg1
19951 @itemx -fdump-rtl-subreg2
19952 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
19953 the two subreg expansion passes.
19955 @opindex fdump-rtl-unshare
19956 @item -fdump-rtl-unshare
19957 Dump after all rtl has been unshared.
19959 @opindex fdump-rtl-vartrack
19960 @item -fdump-rtl-vartrack
19961 Dump after variable tracking.
19963 @opindex fdump-rtl-vregs
19964 @item -fdump-rtl-vregs
19965 Dump after converting virtual registers to hard registers.
19967 @opindex fdump-rtl-web
19968 @item -fdump-rtl-web
19969 Dump after live range splitting.
19971 @opindex fdump-rtl-regclass
19972 @opindex fdump-rtl-subregs_of_mode_init
19973 @opindex fdump-rtl-subregs_of_mode_finish
19974 @opindex fdump-rtl-dfinit
19975 @opindex fdump-rtl-dfinish
19976 @item -fdump-rtl-regclass
19977 @itemx -fdump-rtl-subregs_of_mode_init
19978 @itemx -fdump-rtl-subregs_of_mode_finish
19979 @itemx -fdump-rtl-dfinit
19980 @itemx -fdump-rtl-dfinish
19981 These dumps are defined but always produce empty files.
19983 @opindex da
19984 @opindex fdump-rtl-all
19985 @item -da
19986 @itemx -fdump-rtl-all
19987 Produce all the dumps listed above.
19989 @opindex dA
19990 @item -dA
19991 Annotate the assembler output with miscellaneous debugging information.
19993 @opindex dD
19994 @item -dD
19995 Dump all macro definitions, at the end of preprocessing, in addition to
19996 normal output.
19998 @opindex dH
19999 @item -dH
20000 Produce a core dump whenever an error occurs.
20002 @opindex dp
20003 @item -dp
20004 Annotate the assembler output with a comment indicating which
20005 pattern and alternative is used.  The length and cost of each instruction are
20006 also printed.
20008 @opindex dP
20009 @item -dP
20010 Dump the RTL in the assembler output as a comment before each instruction.
20011 Also turns on @option{-dp} annotation.
20013 @opindex dx
20014 @item -dx
20015 Just generate RTL for a function instead of compiling it.  Usually used
20016 with @option{-fdump-rtl-expand}.
20017 @end table
20019 @opindex fdump-debug
20020 @item -fdump-debug
20021 Dump debugging information generated during the debug
20022 generation phase.
20024 @opindex fdump-earlydebug
20025 @item -fdump-earlydebug
20026 Dump debugging information generated during the early debug
20027 generation phase.
20029 @opindex fdump-noaddr
20030 @item -fdump-noaddr
20031 When doing debugging dumps, suppress address output.  This makes it more
20032 feasible to use diff on debugging dumps for compiler invocations with
20033 different compiler binaries and/or different
20034 text / bss / data / heap / stack / dso start locations.
20036 @opindex freport-bug
20037 @item -freport-bug
20038 Collect and dump debug information into a temporary file if an
20039 internal compiler error (ICE) occurs.
20041 @opindex fdump-unnumbered
20042 @item -fdump-unnumbered
20043 When doing debugging dumps, suppress instruction numbers and address output.
20044 This makes it more feasible to use diff on debugging dumps for compiler
20045 invocations with different options, in particular with and without
20046 @option{-g}.
20048 @opindex fdump-unnumbered-links
20049 @item -fdump-unnumbered-links
20050 When doing debugging dumps (see @option{-d} option above), suppress
20051 instruction numbers for the links to the previous and next instructions
20052 in a sequence.
20054 @opindex fdump-ipa
20055 @item -fdump-ipa-@var{switch}
20056 @itemx -fdump-ipa-@var{switch}-@var{options}
20057 Control the dumping at various stages of inter-procedural analysis
20058 language tree to a file.  The file name is generated by appending a
20059 switch specific suffix to the source file name, and the file is created
20060 in the same directory as the output file.  The following dumps are
20061 possible:
20063 @table @samp
20064 @item all
20065 Enables all inter-procedural analysis dumps.
20067 @item cgraph
20068 Dumps information about call-graph optimization, unused function removal,
20069 and inlining decisions.
20071 @item inline
20072 Dump after function inlining.
20074 @item strubm
20075 Dump after selecting @code{strub} modes, and recording the selections as
20076 function attributes.
20078 @item strub
20079 Dump @code{strub} transformations: interface changes, function wrapping,
20080 and insertion of builtin calls for stack scrubbing and watermarking.
20082 @end table
20084 Additionally, the options @option{-optimized}, @option{-missed},
20085 @option{-note}, and @option{-all} can be provided, with the same meaning
20086 as for @option{-fopt-info}, defaulting to @option{-optimized}.
20088 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
20089 information on callsites that were inlined, along with callsites
20090 that were not inlined.
20092 By default, the dump will contain messages about successful
20093 optimizations (equivalent to @option{-optimized}) together with
20094 low-level details about the analysis.
20096 @opindex fdump-lang
20097 @item -fdump-lang
20098 Dump language-specific information.  The file name is made by appending
20099 @file{.lang} to the source file name.
20101 @opindex fdump-lang-all
20102 @opindex fdump-lang
20103 @item -fdump-lang-all
20104 @itemx -fdump-lang-@var{switch}
20105 @itemx -fdump-lang-@var{switch}-@var{options}
20106 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
20107 Control the dumping of language-specific information.  The @var{options}
20108 and @var{filename} portions behave as described in the
20109 @option{-fdump-tree} option.  The following @var{switch} values are
20110 accepted:
20112 @table @samp
20113 @item all
20115 Enable all language-specific dumps.
20117 @item class
20118 Dump class hierarchy information.  Virtual table information is emitted
20119 unless '@option{slim}' is specified.  This option is applicable to C++ only.
20121 @item module
20122 Dump module information.  Options @option{lineno} (locations),
20123 @option{graph} (reachability), @option{blocks} (clusters),
20124 @option{uid} (serialization), @option{alias} (mergeable),
20125 @option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
20126 (macros) may provide additional information.  This option is
20127 applicable to C++ only.
20129 @item raw
20130 Dump the raw internal tree data.  This option is applicable to C++ only.
20132 @end table
20134 @opindex fdump-passes
20135 @item -fdump-passes
20136 Print on @file{stderr} the list of optimization passes that are turned
20137 on and off by the current command-line options.
20139 @opindex fdump-statistics
20140 @item -fdump-statistics-@var{option}
20141 Enable and control dumping of pass statistics in a separate file.  The
20142 file name is generated by appending a suffix ending in
20143 @samp{.statistics} to the source file name, and the file is created in
20144 the same directory as the output file.  If the @samp{-@var{option}}
20145 form is used, @samp{-stats} causes counters to be summed over the
20146 whole compilation unit while @samp{-details} dumps every event as
20147 the passes generate them.  The default with no option is to sum
20148 counters for each function compiled.
20150 @opindex fdump-tree-all
20151 @opindex fdump-tree
20152 @item -fdump-tree-all
20153 @itemx -fdump-tree-@var{switch}
20154 @itemx -fdump-tree-@var{switch}-@var{options}
20155 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
20156 Control the dumping at various stages of processing the intermediate
20157 language tree to a file.  If the @samp{-@var{options}}
20158 form is used, @var{options} is a list of @samp{-} separated options
20159 which control the details of the dump.  Not all options are applicable
20160 to all dumps; those that are not meaningful are ignored.  The
20161 following options are available
20163 @table @samp
20164 @item address
20165 Print the address of each node.  Usually this is not meaningful as it
20166 changes according to the environment and source file.  Its primary use
20167 is for tying up a dump file with a debug environment.
20168 @item asmname
20169 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
20170 in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
20171 use working backward from mangled names in the assembly file.
20172 @item slim
20173 When dumping front-end intermediate representations, inhibit dumping
20174 of members of a scope or body of a function merely because that scope
20175 has been reached.  Only dump such items when they are directly reachable
20176 by some other path.
20178 When dumping pretty-printed trees, this option inhibits dumping the
20179 bodies of control structures.
20181 When dumping RTL, print the RTL in slim (condensed) form instead of
20182 the default LISP-like representation.
20183 @item raw
20184 Print a raw representation of the tree.  By default, trees are
20185 pretty-printed into a C-like representation.
20186 @item details
20187 Enable more detailed dumps (not honored by every dump option). Also
20188 include information from the optimization passes.
20189 @item stats
20190 Enable dumping various statistics about the pass (not honored by every dump
20191 option).
20192 @item blocks
20193 Enable showing basic block boundaries (disabled in raw dumps).
20194 @item graph
20195 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
20196 dump a representation of the control flow graph suitable for viewing with
20197 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}.  Each function in
20198 the file is pretty-printed as a subgraph, so that GraphViz can render them
20199 all in a single plot.
20201 This option currently only works for RTL dumps, and the RTL is always
20202 dumped in slim form.
20203 @item vops
20204 Enable showing virtual operands for every statement.
20205 @item lineno
20206 Enable showing line numbers for statements.
20207 @item uid
20208 Enable showing the unique ID (@code{DECL_UID}) for each variable.
20209 @item verbose
20210 Enable showing the tree dump for each statement.
20211 @item eh
20212 Enable showing the EH region number holding each statement.
20213 @item scev
20214 Enable showing scalar evolution analysis details.
20215 @item optimized
20216 Enable showing optimization information (only available in certain
20217 passes).
20218 @item missed
20219 Enable showing missed optimization information (only available in certain
20220 passes).
20221 @item note
20222 Enable other detailed optimization information (only available in
20223 certain passes).
20224 @item all
20225 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
20226 and @option{lineno}.
20227 @item optall
20228 Turn on all optimization options, i.e., @option{optimized},
20229 @option{missed}, and @option{note}.
20230 @end table
20232 To determine what tree dumps are available or find the dump for a pass
20233 of interest follow the steps below.
20235 @enumerate
20236 @item
20237 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
20238 look for a code that corresponds to the pass you are interested in.
20239 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
20240 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
20241 The number at the end distinguishes distinct invocations of the same pass.
20242 @item
20243 To enable the creation of the dump file, append the pass code to
20244 the @option{-fdump-} option prefix and invoke GCC with it.  For example,
20245 to enable the dump from the Early Value Range Propagation pass, invoke
20246 GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
20247 specify the name of the dump file.  If you don't specify one, GCC
20248 creates as described below.
20249 @item
20250 Find the pass dump in a file whose name is composed of three components
20251 separated by a period: the name of the source file GCC was invoked to
20252 compile, a numeric suffix indicating the pass number followed by the
20253 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
20254 and finally the pass code.  For example, the Early VRP pass dump might
20255 be in a file named @file{myfile.c.038t.evrp} in the current working
20256 directory.  Note that the numeric codes are not stable and may change
20257 from one version of GCC to another.
20258 @end enumerate
20260 @opindex fopt-info
20261 @item -fopt-info
20262 @itemx -fopt-info-@var{options}
20263 @itemx -fopt-info-@var{options}=@var{filename}
20264 Controls optimization dumps from various optimization passes. If the
20265 @samp{-@var{options}} form is used, @var{options} is a list of
20266 @samp{-} separated option keywords to select the dump details and
20267 optimizations.  
20269 The @var{options} can be divided into three groups:
20270 @enumerate
20271 @item
20272 options describing what kinds of messages should be emitted,
20273 @item
20274 options describing the verbosity of the dump, and
20275 @item
20276 options describing which optimizations should be included.
20277 @end enumerate
20278 The options from each group can be freely mixed as they are
20279 non-overlapping. However, in case of any conflicts,
20280 the later options override the earlier options on the command
20281 line. 
20283 The following options control which kinds of messages should be emitted:
20285 @table @samp
20286 @item optimized
20287 Print information when an optimization is successfully applied. It is
20288 up to a pass to decide which information is relevant. For example, the
20289 vectorizer passes print the source location of loops which are
20290 successfully vectorized.
20291 @item missed
20292 Print information about missed optimizations. Individual passes
20293 control which information to include in the output. 
20294 @item note
20295 Print verbose information about optimizations, such as certain
20296 transformations, more detailed messages about decisions etc.
20297 @item all
20298 Print detailed optimization information. This includes
20299 @samp{optimized}, @samp{missed}, and @samp{note}.
20300 @end table
20302 The following option controls the dump verbosity:
20304 @table @samp
20305 @item internals
20306 By default, only ``high-level'' messages are emitted. This option enables
20307 additional, more detailed, messages, which are likely to only be of interest
20308 to GCC developers.
20309 @end table
20311 One or more of the following option keywords can be used to describe a
20312 group of optimizations:
20314 @table @samp
20315 @item ipa
20316 Enable dumps from all interprocedural optimizations.
20317 @item loop
20318 Enable dumps from all loop optimizations.
20319 @item inline
20320 Enable dumps from all inlining optimizations.
20321 @item omp
20322 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
20323 @item vec
20324 Enable dumps from all vectorization optimizations.
20325 @item optall
20326 Enable dumps from all optimizations. This is a superset of
20327 the optimization groups listed above.
20328 @end table
20330 If @var{options} is
20331 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
20332 about successful optimizations from all the passes, omitting messages
20333 that are treated as ``internals''.
20335 If the @var{filename} is provided, then the dumps from all the
20336 applicable optimizations are concatenated into the @var{filename}.
20337 Otherwise the dump is output onto @file{stderr}. Though multiple
20338 @option{-fopt-info} options are accepted, only one of them can include
20339 a @var{filename}. If other filenames are provided then all but the
20340 first such option are ignored.
20342 Note that the output @var{filename} is overwritten
20343 in case of multiple translation units. If a combined output from
20344 multiple translation units is desired, @file{stderr} should be used
20345 instead.
20347 In the following example, the optimization info is output to
20348 @file{stderr}:
20350 @smallexample
20351 gcc -O3 -fopt-info
20352 @end smallexample
20354 This example:
20355 @smallexample
20356 gcc -O3 -fopt-info-missed=missed.all
20357 @end smallexample
20359 @noindent
20360 outputs missed optimization report from all the passes into
20361 @file{missed.all}, and this one:
20363 @smallexample
20364 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
20365 @end smallexample
20367 @noindent
20368 prints information about missed optimization opportunities from
20369 vectorization passes on @file{stderr}.  
20370 Note that @option{-fopt-info-vec-missed} is equivalent to 
20371 @option{-fopt-info-missed-vec}.  The order of the optimization group
20372 names and message types listed after @option{-fopt-info} does not matter.
20374 As another example,
20375 @smallexample
20376 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
20377 @end smallexample
20379 @noindent
20380 outputs information about missed optimizations as well as
20381 optimized locations from all the inlining passes into
20382 @file{inline.txt}.
20384 Finally, consider:
20386 @smallexample
20387 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
20388 @end smallexample
20390 @noindent
20391 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
20392 in conflict since only one output file is allowed. In this case, only
20393 the first option takes effect and the subsequent options are
20394 ignored. Thus only @file{vec.miss} is produced which contains
20395 dumps from the vectorizer about missed opportunities.
20397 @opindex fsave-optimization-record
20398 @item -fsave-optimization-record
20399 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
20400 were performed, for those optimizations that support @option{-fopt-info}.
20402 This option is experimental and the format of the data within the
20403 compressed JSON file is subject to change.
20405 It is roughly equivalent to a machine-readable version of
20406 @option{-fopt-info-all}, as a collection of messages with source file,
20407 line number and column number, with the following additional data for
20408 each message:
20410 @itemize @bullet
20412 @item
20413 the execution count of the code being optimized, along with metadata about
20414 whether this was from actual profile data, or just an estimate, allowing
20415 consumers to prioritize messages by code hotness,
20417 @item
20418 the function name of the code being optimized, where applicable,
20420 @item
20421 the ``inlining chain'' for the code being optimized, so that when
20422 a function is inlined into several different places (which might
20423 themselves be inlined), the reader can distinguish between the copies,
20425 @item
20426 objects identifying those parts of the message that refer to expressions,
20427 statements or symbol-table nodes, which of these categories they are, and,
20428 when available, their source code location,
20430 @item
20431 the GCC pass that emitted the message, and
20433 @item
20434 the location in GCC's own code from which the message was emitted
20436 @end itemize
20438 Additionally, some messages are logically nested within other
20439 messages, reflecting implementation details of the optimization
20440 passes.
20442 @opindex fsched-verbose
20443 @item -fsched-verbose=@var{n}
20444 On targets that use instruction scheduling, this option controls the
20445 amount of debugging output the scheduler prints to the dump files.
20447 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
20448 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
20449 For @var{n} greater than one, it also output basic block probabilities,
20450 detailed ready list information and unit/insn info.  For @var{n} greater
20451 than two, it includes RTL at abort point, control-flow and regions info.
20452 And for @var{n} over four, @option{-fsched-verbose} also includes
20453 dependence info.
20457 @opindex fdisable-
20458 @opindex fenable-
20459 @item -fenable-@var{kind}-@var{pass}
20460 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
20462 This is a set of options that are used to explicitly disable/enable
20463 optimization passes.  These options are intended for use for debugging GCC.
20464 Compiler users should use regular options for enabling/disabling
20465 passes instead.
20467 @table @gcctabopt
20469 @item -fdisable-ipa-@var{pass}
20470 Disable IPA pass @var{pass}. @var{pass} is the pass name.  If the same pass is
20471 statically invoked in the compiler multiple times, the pass name should be
20472 appended with a sequential number starting from 1.
20474 @item -fdisable-rtl-@var{pass}
20475 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
20476 Disable RTL pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
20477 statically invoked in the compiler multiple times, the pass name should be
20478 appended with a sequential number starting from 1.  @var{range-list} is a 
20479 comma-separated list of function ranges or assembler names.  Each range is a number
20480 pair separated by a colon.  The range is inclusive in both ends.  If the range
20481 is trivial, the number pair can be simplified as a single number.  If the
20482 function's call graph node's @var{uid} falls within one of the specified ranges,
20483 the @var{pass} is disabled for that function.  The @var{uid} is shown in the
20484 function header of a dump file, and the pass names can be dumped by using
20485 option @option{-fdump-passes}.
20487 @item -fdisable-tree-@var{pass}
20488 @itemx -fdisable-tree-@var{pass}=@var{range-list}
20489 Disable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description of
20490 option arguments.
20492 @item -fenable-ipa-@var{pass}
20493 Enable IPA pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
20494 statically invoked in the compiler multiple times, the pass name should be
20495 appended with a sequential number starting from 1.
20497 @item -fenable-rtl-@var{pass}
20498 @itemx -fenable-rtl-@var{pass}=@var{range-list}
20499 Enable RTL pass @var{pass}.  See @option{-fdisable-rtl} for option argument
20500 description and examples.
20502 @item -fenable-tree-@var{pass}
20503 @itemx -fenable-tree-@var{pass}=@var{range-list}
20504 Enable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description
20505 of option arguments.
20507 @end table
20509 Here are some examples showing uses of these options.
20511 @smallexample
20513 # disable ccp1 for all functions
20514    -fdisable-tree-ccp1
20515 # disable complete unroll for function whose cgraph node uid is 1
20516    -fenable-tree-cunroll=1
20517 # disable gcse2 for functions at the following ranges [1,1],
20518 # [300,400], and [400,1000]
20519 # disable gcse2 for functions foo and foo2
20520    -fdisable-rtl-gcse2=foo,foo2
20521 # disable early inlining
20522    -fdisable-tree-einline
20523 # disable ipa inlining
20524    -fdisable-ipa-inline
20525 # enable tree full unroll
20526    -fenable-tree-unroll
20528 @end smallexample
20530 @opindex fchecking
20531 @opindex fno-checking
20532 @item -fchecking
20533 @itemx -fchecking=@var{n}
20534 Enable internal consistency checking.  The default depends on
20535 the compiler configuration.  @option{-fchecking=2} enables further
20536 internal consistency checking that might affect code generation.
20538 @opindex frandom-seed
20539 @item -frandom-seed=@var{string}
20540 This option provides a seed that GCC uses in place of
20541 random numbers in generating certain symbol names
20542 that have to be different in every compiled file.  It is also used to
20543 place unique stamps in coverage data files and the object files that
20544 produce them.  You can use the @option{-frandom-seed} option to produce
20545 reproducibly identical object files.
20547 The @var{string} can either be a number (decimal, octal or hex) or an
20548 arbitrary string (in which case it's converted to a number by
20549 computing CRC32).
20551 The @var{string} should be different for every file you compile.
20553 @opindex save-temps
20554 @item -save-temps
20555 Store the usual ``temporary'' intermediate files permanently; name them
20556 as auxiliary output files, as specified described under
20557 @option{-dumpbase} and @option{-dumpdir}.
20559 When used in combination with the @option{-x} command-line option,
20560 @option{-save-temps} is sensible enough to avoid overwriting an
20561 input source file with the same extension as an intermediate file.
20562 The corresponding intermediate file may be obtained by renaming the
20563 source file before using @option{-save-temps}.
20565 @opindex save-temps=cwd
20566 @item -save-temps=cwd
20567 Equivalent to @option{-save-temps -dumpdir ./}.
20569 @opindex save-temps=obj
20570 @item -save-temps=obj
20571 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
20572 @file{outdir/} is the directory of the output file specified after the
20573 @option{-o} option, including any directory separators.  If the
20574 @option{-o} option is not used, the @option{-save-temps=obj} switch
20575 behaves like @option{-save-temps=cwd}.
20577 @opindex time
20578 @item -time@r{[}=@var{file}@r{]}
20579 Report the CPU time taken by each subprocess in the compilation
20580 sequence.  For C source files, this is the compiler proper and assembler
20581 (plus the linker if linking is done).
20583 Without the specification of an output file, the output looks like this:
20585 @smallexample
20586 # cc1 0.12 0.01
20587 # as 0.00 0.01
20588 @end smallexample
20590 The first number on each line is the ``user time'', that is time spent
20591 executing the program itself.  The second number is ``system time'',
20592 time spent executing operating system routines on behalf of the program.
20593 Both numbers are in seconds.
20595 With the specification of an output file, the output is appended to the
20596 named file, and it looks like this:
20598 @smallexample
20599 0.12 0.01 cc1 @var{options}
20600 0.00 0.01 as @var{options}
20601 @end smallexample
20603 The ``user time'' and the ``system time'' are moved before the program
20604 name, and the options passed to the program are displayed, so that one
20605 can later tell what file was being compiled, and with which options.
20607 @opindex fdump-final-insns
20608 @item -fdump-final-insns@r{[}=@var{file}@r{]}
20609 Dump the final internal representation (RTL) to @var{file}.  If the
20610 optional argument is omitted (or if @var{file} is @code{.}), the name
20611 of the dump file is determined by appending @code{.gkd} to the
20612 dump base name, see @option{-dumpbase}.
20614 @opindex fcompare-debug
20615 @opindex fno-compare-debug
20616 @item -fcompare-debug@r{[}=@var{opts}@r{]}
20617 If no error occurs during compilation, run the compiler a second time,
20618 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
20619 passed to the second compilation.  Dump the final internal
20620 representation in both compilations, and print an error if they differ.
20622 If the equal sign is omitted, the default @option{-gtoggle} is used.
20624 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
20625 and nonzero, implicitly enables @option{-fcompare-debug}.  If
20626 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
20627 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
20628 is used.
20630 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
20631 is equivalent to @option{-fno-compare-debug}, which disables the dumping
20632 of the final representation and the second compilation, preventing even
20633 @env{GCC_COMPARE_DEBUG} from taking effect.
20635 To verify full coverage during @option{-fcompare-debug} testing, set
20636 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
20637 which GCC rejects as an invalid option in any actual compilation
20638 (rather than preprocessing, assembly or linking).  To get just a
20639 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
20640 not overridden} will do.
20642 @opindex fcompare-debug-second
20643 @item -fcompare-debug-second
20644 This option is implicitly passed to the compiler for the second
20645 compilation requested by @option{-fcompare-debug}, along with options to
20646 silence warnings, and omitting other options that would cause the compiler
20647 to produce output to files or to standard output as a side effect.  Dump
20648 files and preserved temporary files are renamed so as to contain the
20649 @code{.gk} additional extension during the second compilation, to avoid
20650 overwriting those generated by the first.
20652 When this option is passed to the compiler driver, it causes the
20653 @emph{first} compilation to be skipped, which makes it useful for little
20654 other than debugging the compiler proper.
20656 @opindex gtoggle
20657 @item -gtoggle
20658 Turn off generation of debug info, if leaving out this option
20659 generates it, or turn it on at level 2 otherwise.  The position of this
20660 argument in the command line does not matter; it takes effect after all
20661 other options are processed, and it does so only once, no matter how
20662 many times it is given.  This is mainly intended to be used with
20663 @option{-fcompare-debug}.
20665 @opindex fvar-tracking-assignments-toggle
20666 @opindex fno-var-tracking-assignments-toggle
20667 @item -fvar-tracking-assignments-toggle
20668 Toggle @option{-fvar-tracking-assignments}, in the same way that
20669 @option{-gtoggle} toggles @option{-g}.
20671 @opindex Q
20672 @item -Q
20673 Makes the compiler print out each function name as it is compiled, and
20674 print some statistics about each pass when it finishes.
20676 @opindex ftime-report
20677 @item -ftime-report
20678 Makes the compiler print some statistics to stderr about the time consumed
20679 by each pass when it finishes.
20681 If SARIF output of diagnostics was requested via
20682 @option{-fdiagnostics-format=sarif-file} or
20683 @option{-fdiagnostics-format=sarif-stderr} then the @option{-ftime-report}
20684 information is instead emitted in JSON form as part of SARIF output.  The
20685 precise format of this JSON data is subject to change, and the values may
20686 not exactly match those emitted to stderr due to being written out at a
20687 slightly different place within the compiler.
20689 @opindex ftime-report-details
20690 @item -ftime-report-details
20691 Record the time consumed by infrastructure parts separately for each pass.
20693 @opindex fira-verbose
20694 @item -fira-verbose=@var{n}
20695 Control the verbosity of the dump file for the integrated register allocator.
20696 The default value is 5.  If the value @var{n} is greater or equal to 10,
20697 the dump output is sent to stderr using the same format as @var{n} minus 10.
20699 @opindex flto-report
20700 @item -flto-report
20701 Prints a report with internal details on the workings of the link-time
20702 optimizer.  The contents of this report vary from version to version.
20703 It is meant to be useful to GCC developers when processing object
20704 files in LTO mode (via @option{-flto}).
20706 Disabled by default.
20708 @opindex flto-report-wpa
20709 @item -flto-report-wpa
20710 Like @option{-flto-report}, but only print for the WPA phase of link-time
20711 optimization.
20713 @opindex fmem-report
20714 @item -fmem-report
20715 Makes the compiler print some statistics about permanent memory
20716 allocation when it finishes.
20718 @opindex fmem-report-wpa
20719 @item -fmem-report-wpa
20720 Makes the compiler print some statistics about permanent memory
20721 allocation for the WPA phase only.
20723 @opindex fpre-ipa-mem-report
20724 @opindex fpost-ipa-mem-report
20725 @item -fpre-ipa-mem-report
20726 @item -fpost-ipa-mem-report
20727 Makes the compiler print some statistics about permanent memory
20728 allocation before or after interprocedural optimization.
20730 @opindex fmultiflags
20731 @item -fmultiflags
20732 This option enables multilib-aware @code{TFLAGS} to be used to build
20733 target libraries with options different from those the compiler is
20734 configured to use by default, through the use of specs (@pxref{Spec
20735 Files}) set up by compiler internals, by the target, or by builders at
20736 configure time.
20738 Like @code{TFLAGS}, this allows the target libraries to be built for
20739 portable baseline environments, while the compiler defaults to more
20740 demanding ones.  That's useful because users can easily override the
20741 defaults the compiler is configured to use to build their own programs,
20742 if the defaults are not ideal for their target environment, whereas
20743 rebuilding the runtime libraries is usually not as easy or desirable.
20745 Unlike @code{TFLAGS}, the use of specs enables different flags to be
20746 selected for different multilibs.  The way to accomplish that is to
20747 build with @samp{make TFLAGS=-fmultiflags}, after configuring
20748 @samp{--with-specs=%@{fmultiflags:...@}}.
20750 This option is discarded by the driver once it's done processing driver
20751 self spec.
20753 It is also useful to check that @code{TFLAGS} are being used to build
20754 all target libraries, by configuring a non-bootstrap compiler
20755 @samp{--with-specs='%@{!fmultiflags:%emissing TFLAGS@}'} and building
20756 the compiler and target libraries.
20758 @opindex fprofile-report
20759 @item -fprofile-report
20760 Makes the compiler print some statistics about consistency of the
20761 (estimated) profile and effect of individual passes.
20763 @opindex fstack-usage
20764 @item -fstack-usage
20765 Makes the compiler output stack usage information for the program, on a
20766 per-function basis.  The filename for the dump is made by appending
20767 @file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
20768 the output file, if explicitly specified and it is not an executable,
20769 otherwise it is the basename of the source file.  An entry is made up
20770 of three fields:
20772 @itemize
20773 @item
20774 The name of the function.
20775 @item
20776 A number of bytes.
20777 @item
20778 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
20779 @end itemize
20781 The qualifier @code{static} means that the function manipulates the stack
20782 statically: a fixed number of bytes are allocated for the frame on function
20783 entry and released on function exit; no stack adjustments are otherwise made
20784 in the function.  The second field is this fixed number of bytes.
20786 The qualifier @code{dynamic} means that the function manipulates the stack
20787 dynamically: in addition to the static allocation described above, stack
20788 adjustments are made in the body of the function, for example to push/pop
20789 arguments around function calls.  If the qualifier @code{bounded} is also
20790 present, the amount of these adjustments is bounded at compile time and
20791 the second field is an upper bound of the total amount of stack used by
20792 the function.  If it is not present, the amount of these adjustments is
20793 not bounded at compile time and the second field only represents the
20794 bounded part.
20796 @opindex fstats
20797 @item -fstats
20798 Emit statistics about front-end processing at the end of the compilation.
20799 This option is supported only by the C++ front end, and
20800 the information is generally only useful to the G++ development team.
20802 @opindex fdbg-cnt-list
20803 @item -fdbg-cnt-list
20804 Print the name and the counter upper bound for all debug counters.
20807 @opindex fdbg-cnt
20808 @item -fdbg-cnt=@var{counter-value-list}
20809 Set the internal debug counter lower and upper bound.  @var{counter-value-list}
20810 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
20811 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
20812 the name of the counter and list of closed intervals.
20813 The @var{lower_bound} is optional and is zero
20814 initialized if not set.
20815 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
20816 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
20817 eleventh invocation.
20818 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
20820 @opindex print-file-name
20821 @item -print-file-name=@var{library}
20822 Print the full absolute name of the library file @var{library} that
20823 would be used when linking---and don't do anything else.  With this
20824 option, GCC does not compile or link anything; it just prints the
20825 file name.
20827 @opindex print-multi-directory
20828 @item -print-multi-directory
20829 Print the directory name corresponding to the multilib selected by any
20830 other switches present in the command line.  This directory is supposed
20831 to exist in @env{GCC_EXEC_PREFIX}.
20833 @opindex print-multi-lib
20834 @item -print-multi-lib
20835 Print the mapping from multilib directory names to compiler switches
20836 that enable them.  The directory name is separated from the switches by
20837 @samp{;}, and each switch starts with an @samp{@@} instead of the
20838 @samp{-}, without spaces between multiple switches.  This is supposed to
20839 ease shell processing.
20841 @opindex print-multi-os-directory
20842 @item -print-multi-os-directory
20843 Print the path to OS libraries for the selected
20844 multilib, relative to some @file{lib} subdirectory.  If OS libraries are
20845 present in the @file{lib} subdirectory and no multilibs are used, this is
20846 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
20847 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
20848 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
20849 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
20851 @opindex print-multiarch
20852 @item -print-multiarch
20853 Print the path to OS libraries for the selected multiarch,
20854 relative to some @file{lib} subdirectory.
20856 @opindex print-prog-name
20857 @item -print-prog-name=@var{program}
20858 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
20860 @opindex print-libgcc-file-name
20861 @item -print-libgcc-file-name
20862 Same as @option{-print-file-name=libgcc.a}.
20864 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
20865 but you do want to link with @file{libgcc.a}.  You can do:
20867 @smallexample
20868 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
20869 @end smallexample
20871 @opindex print-search-dirs
20872 @item -print-search-dirs
20873 Print the name of the configured installation directory and a list of
20874 program and library directories @command{gcc} searches---and don't do anything else.
20876 This is useful when @command{gcc} prints the error message
20877 @samp{installation problem, cannot exec cpp0: No such file or directory}.
20878 To resolve this you either need to put @file{cpp0} and the other compiler
20879 components where @command{gcc} expects to find them, or you can set the environment
20880 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
20881 Don't forget the trailing @samp{/}.
20882 @xref{Environment Variables}.
20884 @opindex print-sysroot
20885 @item -print-sysroot
20886 Print the target sysroot directory that is used during
20887 compilation.  This is the target sysroot specified either at configure
20888 time or using the @option{--sysroot} option, possibly with an extra
20889 suffix that depends on compilation options.  If no target sysroot is
20890 specified, the option prints nothing.
20892 @opindex print-sysroot-headers-suffix
20893 @item -print-sysroot-headers-suffix
20894 Print the suffix added to the target sysroot when searching for
20895 headers, or give an error if the compiler is not configured with such
20896 a suffix---and don't do anything else.
20898 @opindex dumpmachine
20899 @item -dumpmachine
20900 Print the compiler's target machine (for example,
20901 @samp{i686-pc-linux-gnu})---and don't do anything else.
20903 @opindex dumpversion
20904 @item -dumpversion
20905 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
20906 anything else.  This is the compiler version used in filesystem paths and
20907 specs. Depending on how the compiler has been configured it can be just
20908 a single number (major version), two numbers separated by a dot (major and
20909 minor version) or three numbers separated by dots (major, minor and patchlevel
20910 version).
20912 @opindex dumpfullversion
20913 @item -dumpfullversion
20914 Print the full compiler version---and don't do anything else. The output is
20915 always three numbers separated by dots, major, minor and patchlevel version.
20917 @opindex dumpspecs
20918 @item -dumpspecs
20919 Print the compiler's built-in specs---and don't do anything else.  (This
20920 is used when GCC itself is being built.)  @xref{Spec Files}.
20921 @end table
20923 @node Submodel Options
20924 @section Machine-Dependent Options
20925 @cindex submodel options
20926 @cindex specifying hardware config
20927 @cindex hardware models and configurations, specifying
20928 @cindex target-dependent options
20929 @cindex machine-dependent options
20931 Each target machine supported by GCC can have its own options---for
20932 example, to allow you to compile for a particular processor variant or
20933 ABI, or to control optimizations specific to that machine.  By
20934 convention, the names of machine-specific options start with
20935 @samp{-m}.
20937 Some configurations of the compiler also support additional target-specific
20938 options, usually for compatibility with other compilers on the same
20939 platform.
20941 @c This list is ordered alphanumerically by subsection name.
20942 @c It should be the same order and spelling as these options are listed
20943 @c in Machine Dependent Options
20945 @menu
20946 * AArch64 Options::
20947 * Adapteva Epiphany Options::
20948 * AMD GCN Options::
20949 * ARC Options::
20950 * ARM Options::
20951 * AVR Options::
20952 * Blackfin Options::
20953 * C6X Options::
20954 * CRIS Options::
20955 * C-SKY Options::
20956 * Darwin Options::
20957 * DEC Alpha Options::
20958 * eBPF Options::
20959 * FR30 Options::
20960 * FT32 Options::
20961 * FRV Options::
20962 * GNU/Linux Options::
20963 * H8/300 Options::
20964 * HPPA Options::
20965 * IA-64 Options::
20966 * LM32 Options::
20967 * LoongArch Options::
20968 * M32C Options::
20969 * M32R/D Options::
20970 * M680x0 Options::
20971 * MCore Options::
20972 * MicroBlaze Options::
20973 * MIPS Options::
20974 * MMIX Options::
20975 * MN10300 Options::
20976 * Moxie Options::
20977 * MSP430 Options::
20978 * NDS32 Options::
20979 * Nios II Options::
20980 * Nvidia PTX Options::
20981 * OpenRISC Options::
20982 * PDP-11 Options::
20983 * PowerPC Options::
20984 * PRU Options::
20985 * RISC-V Options::
20986 * RL78 Options::
20987 * RS/6000 and PowerPC Options::
20988 * RX Options::
20989 * S/390 and zSeries Options::
20990 * SH Options::
20991 * Solaris 2 Options::
20992 * SPARC Options::
20993 * System V Options::
20994 * V850 Options::
20995 * VAX Options::
20996 * Visium Options::
20997 * VMS Options::
20998 * VxWorks Options::
20999 * x86 Options::
21000 * x86 Windows Options::
21001 * Xstormy16 Options::
21002 * Xtensa Options::
21003 * zSeries Options::
21004 @end menu
21006 @node AArch64 Options
21007 @subsection AArch64 Options
21008 @cindex AArch64 Options
21010 These options are defined for AArch64 implementations:
21012 @table @gcctabopt
21014 @opindex mabi
21015 @item -mabi=@var{name}
21016 Generate code for the specified data model.  Permissible values
21017 are @samp{ilp32} for SysV-like data model where int, long int and pointers
21018 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
21019 but long int and pointers are 64 bits.
21021 The default depends on the specific target configuration.  Note that
21022 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
21023 entire program with the same ABI, and link with a compatible set of libraries.
21025 @opindex mbig-endian
21026 @item -mbig-endian
21027 Generate big-endian code.  This is the default when GCC is configured for an
21028 @samp{aarch64_be-*-*} target.
21030 @opindex mgeneral-regs-only
21031 @item -mgeneral-regs-only
21032 Generate code which uses only the general-purpose registers.  This will prevent
21033 the compiler from using floating-point and Advanced SIMD registers but will not
21034 impose any restrictions on the assembler.
21036 @opindex mlittle-endian
21037 @item -mlittle-endian
21038 Generate little-endian code.  This is the default when GCC is configured for an
21039 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
21041 @opindex mcmodel=tiny
21042 @item -mcmodel=tiny
21043 Generate code for the tiny code model.  The program and its statically defined
21044 symbols must be within 1MB of each other.  Programs can be statically or
21045 dynamically linked.
21047 @opindex mcmodel=small
21048 @item -mcmodel=small
21049 Generate code for the small code model.  The program and its statically defined
21050 symbols must be within 4GB of each other.  Programs can be statically or
21051 dynamically linked.  This is the default code model.
21053 @opindex mcmodel=large
21054 @item -mcmodel=large
21055 Generate code for the large code model.  This makes no assumptions about
21056 addresses and sizes of sections.  Programs can be statically linked only.  The
21057 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
21058 @option{-fpic} and @option{-fPIC}.
21060 @item -mtp=@var{name}
21061 @opindex mtp
21062 Specify the system register to use as a thread pointer.  The valid values
21063 are @samp{tpidr_el0}, @samp{tpidrro_el0}, @samp{tpidr_el1}, @samp{tpidr_el2},
21064 @samp{tpidr_el3}.  For backwards compatibility the aliases @samp{el0},
21065 @samp{el1}, @samp{el2}, @samp{el3} are also accepted.
21066 The default setting is @samp{tpidr_el0}.  It is recommended to compile all
21067 code intended to interoperate with the same value of this option to avoid
21068 accessing a different thread pointer from the wrong exception level.
21070 @opindex mstrict-align
21071 @opindex mno-strict-align
21072 @item -mstrict-align
21073 @itemx -mno-strict-align
21074 Avoid or allow generating memory accesses that may not be aligned on a natural
21075 object boundary as described in the architecture specification.
21077 @opindex momit-leaf-frame-pointer
21078 @opindex mno-omit-leaf-frame-pointer
21079 @item -momit-leaf-frame-pointer
21080 @itemx -mno-omit-leaf-frame-pointer
21081 Omit or keep the frame pointer in leaf functions.  The former behavior is the
21082 default.
21084 @opindex mstack-protector-guard
21085 @opindex mstack-protector-guard-reg
21086 @opindex mstack-protector-guard-offset
21087 @item -mstack-protector-guard=@var{guard}
21088 @itemx -mstack-protector-guard-reg=@var{reg}
21089 @itemx -mstack-protector-guard-offset=@var{offset}
21090 Generate stack protection code using canary at @var{guard}.  Supported
21091 locations are @samp{global} for a global canary or @samp{sysreg} for a
21092 canary in an appropriate system register.
21094 With the latter choice the options
21095 @option{-mstack-protector-guard-reg=@var{reg}} and
21096 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
21097 which system register to use as base register for reading the canary,
21098 and from what offset from that base register. There is no default
21099 register or offset as this is entirely for use within the Linux
21100 kernel.
21102 @opindex mtls-dialect=desc
21103 @item -mtls-dialect=desc
21104 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
21105 of TLS variables.  This is the default.
21107 @opindex mtls-dialect=traditional
21108 @item -mtls-dialect=traditional
21109 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
21110 of TLS variables.
21112 @opindex mtls-size
21113 @item -mtls-size=@var{size}
21114 Specify bit size of immediate TLS offsets.  Valid values are 12, 24, 32, 48.
21115 This option requires binutils 2.26 or newer.
21117 @opindex mfix-cortex-a53-835769
21118 @opindex mno-fix-cortex-a53-835769
21119 @item -mfix-cortex-a53-835769
21120 @itemx -mno-fix-cortex-a53-835769
21121 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
21122 This involves inserting a NOP instruction between memory instructions and
21123 64-bit integer multiply-accumulate instructions.
21125 @opindex mfix-cortex-a53-843419
21126 @opindex mno-fix-cortex-a53-843419
21127 @item -mfix-cortex-a53-843419
21128 @itemx -mno-fix-cortex-a53-843419
21129 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
21130 This erratum workaround is made at link time and this will only pass the
21131 corresponding flag to the linker.
21133 @opindex mlow-precision-recip-sqrt
21134 @opindex mno-low-precision-recip-sqrt
21135 @item -mlow-precision-recip-sqrt
21136 @itemx -mno-low-precision-recip-sqrt
21137 Enable or disable the reciprocal square root approximation.
21138 This option only has an effect if @option{-ffast-math} or
21139 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
21140 precision of reciprocal square root results to about 16 bits for
21141 single precision and to 32 bits for double precision.
21143 @opindex mlow-precision-sqrt
21144 @opindex mno-low-precision-sqrt
21145 @item -mlow-precision-sqrt
21146 @itemx -mno-low-precision-sqrt
21147 Enable or disable the square root approximation.
21148 This option only has an effect if @option{-ffast-math} or
21149 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
21150 precision of square root results to about 16 bits for
21151 single precision and to 32 bits for double precision.
21152 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
21154 @opindex mlow-precision-div
21155 @opindex mno-low-precision-div
21156 @item -mlow-precision-div
21157 @itemx -mno-low-precision-div
21158 Enable or disable the division approximation.
21159 This option only has an effect if @option{-ffast-math} or
21160 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
21161 precision of division results to about 16 bits for
21162 single precision and to 32 bits for double precision.
21164 @item -mtrack-speculation
21165 @itemx -mno-track-speculation
21166 Enable or disable generation of additional code to track speculative
21167 execution through conditional branches.  The tracking state can then
21168 be used by the compiler when expanding calls to
21169 @code{__builtin_speculation_safe_copy} to permit a more efficient code
21170 sequence to be generated.
21172 @item -moutline-atomics
21173 @itemx -mno-outline-atomics
21174 Enable or disable calls to out-of-line helpers to implement atomic operations.
21175 These helpers will, at runtime, determine if the LSE instructions from
21176 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
21177 instructions that are present in the base ARMv8.0 ISA.
21179 This option is only applicable when compiling for the base ARMv8.0
21180 instruction set.  If using a later revision, e.g. @option{-march=armv8.1-a}
21181 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
21182 used directly.  The same applies when using @option{-mcpu=} when the
21183 selected cpu supports the @samp{lse} feature.
21184 This option is on by default.
21186 @opindex march
21187 @item -march=@var{name}
21188 Specify the name of the target architecture and, optionally, one or
21189 more feature modifiers.  This option has the form
21190 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
21192 The table below summarizes the permissible values for @var{arch}
21193 and the features that they enable by default:
21195 @multitable @columnfractions 0.20 0.20 0.60
21196 @headitem @var{arch} value @tab Architecture @tab Includes by default
21197 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
21198 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
21199 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
21200 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
21201 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
21202 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
21203 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
21204 @item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64}
21205 @item @samp{armv8.8-a} @tab Armv8.8-a @tab @samp{armv8.7-a}, @samp{+mops}
21206 @item @samp{armv8.9-a} @tab Armv8.9-a @tab @samp{armv8.8-a}
21207 @item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2}
21208 @item @samp{armv9.1-a} @tab Armv9.1-A @tab @samp{armv9-a}, @samp{+bf16}, @samp{+i8mm}
21209 @item @samp{armv9.2-a} @tab Armv9.2-A @tab @samp{armv9.1-a}, @samp{+ls64}
21210 @item @samp{armv9.3-a} @tab Armv9.3-A @tab @samp{armv9.2-a}, @samp{+mops}
21211 @item @samp{armv9.4-a} @tab Armv9.4-A @tab @samp{armv9.3-a}
21212 @item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
21213 @end multitable
21215 The value @samp{native} is available on native AArch64 GNU/Linux and
21216 causes the compiler to pick the architecture of the host system.  This
21217 option has no effect if the compiler is unable to recognize the
21218 architecture of the host system,
21220 The permissible values for @var{feature} are listed in the sub-section
21221 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
21222 Feature Modifiers}.  Where conflicting feature modifiers are
21223 specified, the right-most feature is used.
21225 GCC uses @var{name} to determine what kind of instructions it can emit
21226 when generating assembly code.  If @option{-march} is specified
21227 without either of @option{-mtune} or @option{-mcpu} also being
21228 specified, the code is tuned to perform well across a range of target
21229 processors implementing the target architecture.
21231 @opindex mtune
21232 @item -mtune=@var{name}
21233 Specify the name of the target processor for which GCC should tune the
21234 performance of the code.  Permissible values for this option are:
21235 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
21236 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
21237 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
21238 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
21239 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
21240 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
21241 @samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
21242 @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{neoverse-v2}, @samp{qdf24xx},
21243 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
21244 @samp{octeontx}, @samp{octeontx81},  @samp{octeontx83},
21245 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
21246 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
21247 @samp{octeontx2f95mm},
21248 @samp{a64fx},
21249 @samp{thunderx}, @samp{thunderxt88},
21250 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
21251 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
21252 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
21253 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
21254 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
21255 @samp{cortex-r82}, @samp{cortex-x1}, @samp{cortex-x1c}, @samp{cortex-x2},
21256 @samp{cortex-x3}, @samp{cortex-x4}, @samp{cortex-a510}, @samp{cortex-a520},
21257 @samp{cortex-a710}, @samp{cortex-a715}, @samp{cortex-a720}, @samp{ampere1},
21258 @samp{ampere1a}, @samp{ampere1b}, @samp{cobalt-100} and @samp{native}.
21260 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
21261 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
21262 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
21263 should tune for a big.LITTLE system.
21265 The value @samp{neoverse-512tvb} specifies that GCC should tune
21266 for Neoverse cores that (a) implement SVE and (b) have a total vector
21267 bandwidth of 512 bits per cycle.  In other words, the option tells GCC to
21268 tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
21269 instructions a cycle and that can execute an equivalent number of SVE
21270 arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
21271 This is more general than tuning for a specific core like Neoverse V1
21272 but is more specific than the default tuning described below.
21274 Additionally on native AArch64 GNU/Linux systems the value
21275 @samp{native} tunes performance to the host system.  This option has no effect
21276 if the compiler is unable to recognize the processor of the host system.
21278 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
21279 are specified, the code is tuned to perform well across a range
21280 of target processors.
21282 This option cannot be suffixed by feature modifiers.
21284 @opindex mcpu
21285 @item -mcpu=@var{name}
21286 Specify the name of the target processor, optionally suffixed by one
21287 or more feature modifiers.  This option has the form
21288 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
21289 the permissible values for @var{cpu} are the same as those available
21290 for @option{-mtune}.  The permissible values for @var{feature} are
21291 documented in the sub-section on
21292 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
21293 Feature Modifiers}.  Where conflicting feature modifiers are
21294 specified, the right-most feature is used.
21296 GCC uses @var{name} to determine what kind of instructions it can emit when
21297 generating assembly code (as if by @option{-march}) and to determine
21298 the target processor for which to tune for performance (as if
21299 by @option{-mtune}).  Where this option is used in conjunction
21300 with @option{-march} or @option{-mtune}, those options take precedence
21301 over the appropriate part of this option.
21303 @option{-mcpu=neoverse-512tvb} is special in that it does not refer
21304 to a specific core, but instead refers to all Neoverse cores that
21305 (a) implement SVE and (b) have a total vector bandwidth of 512 bits
21306 a cycle.  Unless overridden by @option{-march},
21307 @option{-mcpu=neoverse-512tvb} generates code that can run on a
21308 Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
21309 these properties.  Unless overridden by @option{-mtune},
21310 @option{-mcpu=neoverse-512tvb} tunes code in the same way as for
21311 @option{-mtune=neoverse-512tvb}.
21313 @opindex moverride
21314 @item -moverride=@var{string}
21315 Override tuning decisions made by the back-end in response to a
21316 @option{-mtune=} switch.  The syntax, semantics, and accepted values
21317 for @var{string} in this option are not guaranteed to be consistent
21318 across releases.
21320 This option is only intended to be useful when developing GCC.
21322 @opindex mverbose-cost-dump
21323 @item -mverbose-cost-dump
21324 Enable verbose cost model dumping in the debug dump files.  This option is
21325 provided for use in debugging the compiler.
21327 @opindex mpc-relative-literal-loads
21328 @opindex mno-pc-relative-literal-loads
21329 @item -mpc-relative-literal-loads
21330 @itemx -mno-pc-relative-literal-loads
21331 Enable or disable PC-relative literal loads.  With this option literal pools are
21332 accessed using a single instruction and emitted after each function.  This
21333 limits the maximum size of functions to 1MB.  This is enabled by default for
21334 @option{-mcmodel=tiny}.
21336 @opindex msign-return-address
21337 @item -msign-return-address=@var{scope}
21338 Select the function scope on which return address signing will be applied.
21339 Permissible values are @samp{none}, which disables return address signing,
21340 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
21341 functions, and @samp{all}, which enables pointer signing for all functions.  The
21342 default value is @samp{none}. This option has been deprecated by
21343 -mbranch-protection.
21345 @opindex mbranch-protection
21346 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
21347 Select the branch protection features to use.
21348 @samp{none} is the default and turns off all types of branch protection.
21349 @samp{standard} turns on all types of branch protection features.  If a feature
21350 has additional tuning options, then @samp{standard} sets it to its standard
21351 level.
21352 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
21353 level: signing functions that save the return address to memory (non-leaf
21354 functions will practically always do this) using the a-key.  The optional
21355 argument @samp{leaf} can be used to extend the signing to include leaf
21356 functions.  The optional argument @samp{b-key} can be used to sign the functions
21357 with the B-key instead of the A-key.
21358 @samp{bti} turns on branch target identification mechanism.
21360 @opindex mharden-sls
21361 @item -mharden-sls=@var{opts}
21362 Enable compiler hardening against straight line speculation (SLS).
21363 @var{opts} is a comma-separated list of the following options:
21364 @table @samp
21365 @item retbr
21366 @item blr
21367 @end table
21368 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
21369 @samp{-mharden-sls=none} disables all SLS hardening.
21371 @opindex mearly-ra
21372 @item -mearly-ra=@var{scope}
21373 Determine when to enable an early register allocation pass.  This pass runs
21374 before instruction scheduling and tries to find a spill-free allocation of
21375 floating-point and vector code.  It also tries to make use of strided
21376 multi-register instructions, such as SME2's strided LD1 and ST1.
21378 The possible values of @var{scope} are: @var{all}, which runs the pass on
21379 all functions; @var{strided}, which runs the pass on functions that have
21380 access to strided multi-register instructions; and @var{none}, which
21381 disables the pass.
21383 @option{-mearly-ra=all} is the default for @option{-O2} and above, and for
21384 @option{-Os}.  @option{-mearly-ra=none} is the default otherwise.
21386 @opindex mearly-ldp-fusion
21387 @item -mearly-ldp-fusion
21388 Enable the copy of the AArch64 load/store pair fusion pass that runs before
21389 register allocation.  Enabled by default at @samp{-O} and above.
21391 @opindex mlate-ldp-fusion
21392 @item -mlate-ldp-fusion
21393 Enable the copy of the AArch64 load/store pair fusion pass that runs after
21394 register allocation.  Enabled by default at @samp{-O} and above.
21396 @opindex msve-vector-bits
21397 @item -msve-vector-bits=@var{bits}
21398 Specify the number of bits in an SVE vector register.  This option only has
21399 an effect when SVE is enabled.
21401 GCC supports two forms of SVE code generation: ``vector-length
21402 agnostic'' output that works with any size of vector register and
21403 ``vector-length specific'' output that allows GCC to make assumptions
21404 about the vector length when it is useful for optimization reasons.
21405 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
21406 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
21407 Specifying @samp{scalable} selects vector-length agnostic
21408 output.  At present @samp{-msve-vector-bits=128} also generates vector-length
21409 agnostic output for big-endian targets.  All other values generate
21410 vector-length specific code.  The behavior of these values may change
21411 in future releases and no value except @samp{scalable} should be
21412 relied on for producing code that is portable across different
21413 hardware SVE vector lengths.
21415 The default is @samp{-msve-vector-bits=scalable}, which produces
21416 vector-length agnostic code.
21417 @end table
21419 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
21420 @anchor{aarch64-feature-modifiers}
21421 @cindex @option{-march} feature modifiers
21422 @cindex @option{-mcpu} feature modifiers
21423 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
21424 the following and their inverses @option{no@var{feature}}:
21426 @table @samp
21427 @item crc
21428 Enable CRC extension.  This is on by default for
21429 @option{-march=armv8.1-a}.
21430 @item crypto
21431 Enable Crypto extension.  This also enables Advanced SIMD and floating-point
21432 instructions.
21433 @item fp
21434 Enable floating-point instructions.  This is on by default for all possible
21435 values for options @option{-march} and @option{-mcpu}.
21436 @item simd
21437 Enable Advanced SIMD instructions.  This also enables floating-point
21438 instructions.  This is on by default for all possible values for options
21439 @option{-march} and @option{-mcpu}.
21440 @item sve
21441 Enable Scalable Vector Extension instructions.  This also enables Advanced
21442 SIMD and floating-point instructions.
21443 @item lse
21444 Enable Large System Extension instructions.  This is on by default for
21445 @option{-march=armv8.1-a}.
21446 @item rdma
21447 Enable Round Double Multiply Accumulate instructions.  This is on by default
21448 for @option{-march=armv8.1-a}.
21449 @item fp16
21450 Enable FP16 extension.  This also enables floating-point instructions.
21451 @item fp16fml
21452 Enable FP16 fmla extension.  This also enables FP16 extensions and
21453 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.
21455 @item rcpc
21456 Enable the RCpc extension.  This enables the use of the LDAPR instructions for
21457 load-acquire atomic semantics, and passes it on to the assembler, enabling
21458 inline asm statements to use instructions from the RCpc extension.
21459 @item dotprod
21460 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
21461 @item aes
21462 Enable the Armv8-a aes and pmull crypto extension.  This also enables Advanced
21463 SIMD instructions.
21464 @item sha2
21465 Enable the Armv8-a sha2 crypto extension.  This also enables Advanced SIMD instructions.
21466 @item sha3
21467 Enable the sha512 and sha3 crypto extension.  This also enables Advanced SIMD
21468 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
21469 @item sm4
21470 Enable the sm3 and sm4 crypto extension.  This also enables Advanced SIMD instructions.
21471 Use of this option with architectures prior to Armv8.2-A is not supported.
21472 @item profile
21473 Enable the Statistical Profiling extension.  This option is only to enable the
21474 extension at the assembler level and does not affect code generation.
21475 @item rng
21476 Enable the Armv8.5-a Random Number instructions.  This option is only to
21477 enable the extension at the assembler level and does not affect code
21478 generation.
21479 @item memtag
21480 Enable the Armv8.5-a Memory Tagging Extensions.
21481 Use of this option with architectures prior to Armv8.5-A is not supported.
21482 @item sb
21483 Enable the Armv8-a Speculation Barrier instruction.  This option is only to
21484 enable the extension at the assembler level and does not affect code
21485 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
21486 @item ssbs
21487 Enable the Armv8-a Speculative Store Bypass Safe instruction.  This option
21488 is only to enable the extension at the assembler level and does not affect code
21489 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
21490 @item predres
21491 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
21492 This option is only to enable the extension at the assembler level and does
21493 not affect code generation.  This option is enabled by default for
21494 @option{-march=armv8.5-a}.
21495 @item sve2
21496 Enable the Armv8-a Scalable Vector Extension 2.  This also enables SVE
21497 instructions.
21498 @item sve2-bitperm
21499 Enable SVE2 bitperm instructions.  This also enables SVE2 instructions.
21500 @item sve2-sm4
21501 Enable SVE2 sm4 instructions.  This also enables SVE2 instructions.
21502 @item sve2-aes
21503 Enable SVE2 aes instructions.  This also enables SVE2 instructions.
21504 @item sve2-sha3
21505 Enable SVE2 sha3 instructions.  This also enables SVE2 instructions.
21506 @item tme
21507 Enable the Transactional Memory Extension.
21508 @item i8mm
21509 Enable 8-bit Integer Matrix Multiply instructions.  This also enables
21510 Advanced SIMD and floating-point instructions.  This option is enabled by
21511 default for @option{-march=armv8.6-a}.  Use of this option with architectures
21512 prior to Armv8.2-A is not supported.
21513 @item f32mm
21514 Enable 32-bit Floating point Matrix Multiply instructions.  This also enables
21515 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
21516 not supported.
21517 @item f64mm
21518 Enable 64-bit Floating point Matrix Multiply instructions.  This also enables
21519 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
21520 not supported.
21521 @item bf16
21522 Enable brain half-precision floating-point instructions.  This also enables
21523 Advanced SIMD and floating-point instructions.  This option is enabled by
21524 default for @option{-march=armv8.6-a}.  Use of this option with architectures
21525 prior to Armv8.2-A is not supported.
21526 @item ls64
21527 Enable the 64-byte atomic load and store instructions for accelerators.
21528 This option is enabled by default for @option{-march=armv8.7-a}.
21529 @item mops
21530 Enable the instructions to accelerate memory operations like @code{memcpy},
21531 @code{memmove}, @code{memset}.  This option is enabled by default for
21532 @option{-march=armv8.8-a}
21533 @item flagm
21534 Enable the Flag Manipulation instructions Extension.
21535 @item pauth
21536 Enable the Pointer Authentication Extension.
21537 @item cssc
21538 Enable the Common Short Sequence Compression instructions.
21539 @item sme
21540 Enable the Scalable Matrix Extension.
21541 @item sme-i16i64
21542 Enable the FEAT_SME_I16I64 extension to SME.
21543 @item sme-f64f64
21544 Enable the FEAT_SME_F64F64 extension to SME.
21545 +@item sme2
21546 Enable the Scalable Matrix Extension 2.  This also enables SME instructions.
21547 @item d128
21548 Enable support for 128-bit system register read/write instructions.
21549 @item gcs
21550 Enable support for Armv9.4-a Guarded Control Stack extension.
21551 @item the
21552 Enable support for Armv8.9-a/9.4-a translation hardening extension.
21553 @item rcpc3
21554 Enable the RCpc3 (Release Consistency) extension.
21556 @end table
21558 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
21559 which implies @option{fp}.
21560 Conversely, @option{nofp} implies @option{nosimd}, which implies
21561 @option{nocrypto}, @option{noaes} and @option{nosha2}.
21563 @node Adapteva Epiphany Options
21564 @subsection Adapteva Epiphany Options
21566 These @samp{-m} options are defined for Adapteva Epiphany:
21568 @table @gcctabopt
21569 @opindex mhalf-reg-file
21570 @item -mhalf-reg-file
21571 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
21572 That allows code to run on hardware variants that lack these registers.
21574 @opindex mprefer-short-insn-regs
21575 @item -mprefer-short-insn-regs
21576 Preferentially allocate registers that allow short instruction generation.
21577 This can result in increased instruction count, so this may either reduce or
21578 increase overall code size.
21580 @opindex mbranch-cost
21581 @item -mbranch-cost=@var{num}
21582 Set the cost of branches to roughly @var{num} ``simple'' instructions.
21583 This cost is only a heuristic and is not guaranteed to produce
21584 consistent results across releases.
21586 @opindex mcmove
21587 @item -mcmove
21588 Enable the generation of conditional moves.
21590 @opindex mnops
21591 @item -mnops=@var{num}
21592 Emit @var{num} NOPs before every other generated instruction.
21594 @opindex mno-soft-cmpsf
21595 @opindex msoft-cmpsf
21596 @item -mno-soft-cmpsf
21597 For single-precision floating-point comparisons, emit an @code{fsub} instruction
21598 and test the flags.  This is faster than a software comparison, but can
21599 get incorrect results in the presence of NaNs, or when two different small
21600 numbers are compared such that their difference is calculated as zero.
21601 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
21602 software comparisons.
21604 @opindex mstack-offset
21605 @item -mstack-offset=@var{num}
21606 Set the offset between the top of the stack and the stack pointer.
21607 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
21608 can be used by leaf functions without stack allocation.
21609 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
21610 Note also that this option changes the ABI; compiling a program with a
21611 different stack offset than the libraries have been compiled with
21612 generally does not work.
21613 This option can be useful if you want to evaluate if a different stack
21614 offset would give you better code, but to actually use a different stack
21615 offset to build working programs, it is recommended to configure the
21616 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
21618 @opindex mno-round-nearest
21619 @opindex mround-nearest
21620 @item -mno-round-nearest
21621 Make the scheduler assume that the rounding mode has been set to
21622 truncating.  The default is @option{-mround-nearest}.
21624 @opindex mlong-calls
21625 @item -mlong-calls
21626 If not otherwise specified by an attribute, assume all calls might be beyond
21627 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
21628 function address into a register before performing a (otherwise direct) call.
21629 This is the default.
21631 @opindex short-calls
21632 @item -mshort-calls
21633 If not otherwise specified by an attribute, assume all direct calls are
21634 in the range of the @code{b} / @code{bl} instructions, so use these instructions
21635 for direct calls.  The default is @option{-mlong-calls}.
21637 @opindex msmall16
21638 @item -msmall16
21639 Assume addresses can be loaded as 16-bit unsigned values.  This does not
21640 apply to function addresses for which @option{-mlong-calls} semantics
21641 are in effect.
21643 @opindex mfp-mode
21644 @item -mfp-mode=@var{mode}
21645 Set the prevailing mode of the floating-point unit.
21646 This determines the floating-point mode that is provided and expected
21647 at function call and return time.  Making this mode match the mode you
21648 predominantly need at function start can make your programs smaller and
21649 faster by avoiding unnecessary mode switches.
21651 @var{mode} can be set to one the following values:
21653 @table @samp
21654 @item caller
21655 Any mode at function entry is valid, and retained or restored when
21656 the function returns, and when it calls other functions.
21657 This mode is useful for compiling libraries or other compilation units
21658 you might want to incorporate into different programs with different
21659 prevailing FPU modes, and the convenience of being able to use a single
21660 object file outweighs the size and speed overhead for any extra
21661 mode switching that might be needed, compared with what would be needed
21662 with a more specific choice of prevailing FPU mode.
21664 @item truncate
21665 This is the mode used for floating-point calculations with
21666 truncating (i.e.@: round towards zero) rounding mode.  That includes
21667 conversion from floating point to integer.
21669 @item round-nearest
21670 This is the mode used for floating-point calculations with
21671 round-to-nearest-or-even rounding mode.
21673 @item int
21674 This is the mode used to perform integer calculations in the FPU, e.g.@:
21675 integer multiply, or integer multiply-and-accumulate.
21676 @end table
21678 The default is @option{-mfp-mode=caller}
21680 @opindex mno-split-lohi
21681 @opindex msplit-lohi
21682 @opindex mno-postinc
21683 @opindex mpostinc
21684 @opindex mno-postmodify
21685 @opindex mpostmodify
21686 @item -mno-split-lohi
21687 @itemx -mno-postinc
21688 @itemx -mno-postmodify
21689 Code generation tweaks that disable, respectively, splitting of 32-bit
21690 loads, generation of post-increment addresses, and generation of
21691 post-modify addresses.  The defaults are @option{msplit-lohi},
21692 @option{-mpost-inc}, and @option{-mpost-modify}.
21694 @opindex mno-vect-double
21695 @opindex mvect-double
21696 @item -mnovect-double
21697 Change the preferred SIMD mode to SImode.  The default is
21698 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
21700 @opindex max-vect-align
21701 @item -max-vect-align=@var{num}
21702 The maximum alignment for SIMD vector mode types.
21703 @var{num} may be 4 or 8.  The default is 8.
21704 Note that this is an ABI change, even though many library function
21705 interfaces are unaffected if they don't use SIMD vector modes
21706 in places that affect size and/or alignment of relevant types.
21708 @opindex msplit-vecmove-early
21709 @item -msplit-vecmove-early
21710 Split vector moves into single word moves before reload.  In theory this
21711 can give better register allocation, but so far the reverse seems to be
21712 generally the case.
21714 @opindex m1reg-
21715 @item -m1reg-@var{reg}
21716 Specify a register to hold the constant @minus{}1, which makes loading small negative
21717 constants and certain bitmasks faster.
21718 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
21719 which specify use of that register as a fixed register,
21720 and @samp{none}, which means that no register is used for this
21721 purpose.  The default is @option{-m1reg-none}.
21723 @end table
21725 @node AMD GCN Options
21726 @subsection AMD GCN Options
21727 @cindex AMD GCN Options
21729 These options are defined specifically for the AMD GCN port.
21731 @table @gcctabopt
21733 @opindex march
21734 @opindex mtune
21735 @item -march=@var{gpu}
21736 @itemx -mtune=@var{gpu}
21737 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
21740 @table @samp
21741 @item fiji
21742 Compile for GCN3 Fiji devices (gfx803).  Support deprecated; availablility
21743 depends on how GCC has been configured, see @option{--with-arch} and
21744 @option{--with-multilib-list}.
21746 @item gfx900
21747 Compile for GCN5 Vega 10 devices (gfx900).
21749 @item gfx906
21750 Compile for GCN5 Vega 20 devices (gfx906).
21752 @item gfx908
21753 Compile for CDNA1 Instinct MI100 series devices (gfx908).
21755 @item gfx90a
21756 Compile for CDNA2 Instinct MI200 series devices (gfx90a).
21758 @item gfx1030
21759 Compile for RDNA2 gfx1030 devices (GFX10 series).
21761 @item gfx1100
21762 Compile for RDNA3 gfx1100 devices (GFX11 series).
21764 @end table
21766 @opindex msram-ecc
21767 @item -msram-ecc=on
21768 @itemx -msram-ecc=off
21769 @itemx -msram-ecc=any
21770 Compile binaries suitable for devices with the SRAM-ECC feature enabled,
21771 disabled, or either mode.  This feature can be enabled per-process on some
21772 devices.  The compiled code must match the device mode. The default is
21773 @samp{any}, for devices that support it.
21775 @opindex mstack-size
21776 @item -mstack-size=@var{bytes}
21777 Specify how many @var{bytes} of stack space will be requested for each GPU
21778 thread (wave-front).  Beware that there may be many threads and limited memory
21779 available.  The size of the stack allocation may also have an impact on
21780 run-time performance.  The default is 32KB when using OpenACC or OpenMP, and
21781 1MB otherwise.
21783 @opindex mxnack
21784 @item -mxnack=on
21785 @itemx -mxnack=off
21786 @itemx -mxnack=any
21787 Compile binaries suitable for devices with the XNACK feature enabled, disabled,
21788 or either mode.  Some devices always require XNACK and some allow the user to
21789 configure XNACK.  The compiled code must match the device mode.
21790 The default is @samp{-mxnack=any} on devices that support Unified Shared
21791 Memory, and @samp{-mxnack=no} otherwise.
21793 @end table
21795 @node ARC Options
21796 @subsection ARC Options
21797 @cindex ARC options
21799 The following options control the architecture variant for which code
21800 is being compiled:
21802 @c architecture variants
21803 @table @gcctabopt
21805 @opindex mbarrel-shifter
21806 @item -mbarrel-shifter
21807 Generate instructions supported by barrel shifter.  This is the default
21808 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
21810 @opindex mjli-always
21811 @item -mjli-always
21812 Force to call a function using jli_s instruction.  This option is
21813 valid only for ARCv2 architecture.
21815 @opindex mcpu
21816 @item -mcpu=@var{cpu}
21817 Set architecture type, register usage, and instruction scheduling
21818 parameters for @var{cpu}.  There are also shortcut alias options
21819 available for backward compatibility and convenience.  Supported
21820 values for @var{cpu} are
21822 @table @samp
21823 @opindex mA6
21824 @opindex mARC600
21825 @item arc600
21826 Compile for ARC600.  Aliases: @option{-mA6}, @option{-mARC600}.
21828 @opindex mARC601
21829 @item arc601
21830 Compile for ARC601.  Alias: @option{-mARC601}.
21832 @opindex mA7
21833 @opindex mARC700
21834 @item arc700
21835 Compile for ARC700.  Aliases: @option{-mA7}, @option{-mARC700}.
21836 This is the default when configured with @option{--with-cpu=arc700}@.
21838 @item arcem
21839 Compile for ARC EM.
21841 @item archs
21842 Compile for ARC HS.
21844 @item em
21845 Compile for ARC EM CPU with no hardware extensions.
21847 @item em4
21848 Compile for ARC EM4 CPU.
21850 @item em4_dmips
21851 Compile for ARC EM4 DMIPS CPU.
21853 @item em4_fpus
21854 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
21855 extension.
21857 @item em4_fpuda
21858 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
21859 double assist instructions.
21861 @item hs
21862 Compile for ARC HS CPU with no hardware extensions except the atomic
21863 instructions.
21865 @item hs34
21866 Compile for ARC HS34 CPU.
21868 @item hs38
21869 Compile for ARC HS38 CPU.
21871 @item hs38_linux
21872 Compile for ARC HS38 CPU with all hardware extensions on.
21874 @item hs4x
21875 Compile for ARC HS4x CPU.
21877 @item hs4xd
21878 Compile for ARC HS4xD CPU.
21880 @item hs4x_rel31
21881 Compile for ARC HS4x CPU release 3.10a.
21883 @item arc600_norm
21884 Compile for ARC 600 CPU with @code{norm} instructions enabled.
21886 @item arc600_mul32x16
21887 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply 
21888 instructions enabled.
21890 @item arc600_mul64
21891 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family 
21892 instructions enabled.
21894 @item arc601_norm
21895 Compile for ARC 601 CPU with @code{norm} instructions enabled.
21897 @item arc601_mul32x16
21898 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
21899 instructions enabled.
21901 @item arc601_mul64
21902 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
21903 instructions enabled.
21905 @item nps400
21906 Compile for ARC 700 on NPS400 chip.
21908 @item em_mini
21909 Compile for ARC EM minimalist configuration featuring reduced register
21910 set.
21912 @end table
21914 @opindex mdpfp
21915 @opindex mdpfp-compact
21916 @item -mdpfp
21917 @itemx -mdpfp-compact
21918 Generate double-precision FPX instructions, tuned for the compact
21919 implementation.
21921 @opindex mdpfp-fast
21922 @item -mdpfp-fast
21923 Generate double-precision FPX instructions, tuned for the fast
21924 implementation.
21926 @opindex mno-dpfp-lrsr
21927 @item -mno-dpfp-lrsr
21928 Disable @code{lr} and @code{sr} instructions from using FPX extension
21929 aux registers.
21931 @opindex mea
21932 @item -mea
21933 Generate extended arithmetic instructions.  Currently only
21934 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
21935 supported.  Only valid for @option{-mcpu=ARC700}.
21937 @opindex mno-mpy
21938 @opindex mmpy
21939 @item -mno-mpy
21940 Do not generate @code{mpy}-family instructions for ARC700.  This option is
21941 deprecated.
21943 @opindex mmul32x16
21944 @item -mmul32x16
21945 Generate 32x16-bit multiply and multiply-accumulate instructions.
21947 @opindex mmul64
21948 @item -mmul64
21949 Generate @code{mul64} and @code{mulu64} instructions.  
21950 Only valid for @option{-mcpu=ARC600}.
21952 @opindex mnorm
21953 @item -mnorm
21954 Generate @code{norm} instructions.  This is the default if @option{-mcpu=ARC700}
21955 is in effect.
21957 @opindex mspfp
21958 @opindex mspfp-compact
21959 @item -mspfp
21960 @itemx -mspfp-compact
21961 Generate single-precision FPX instructions, tuned for the compact
21962 implementation.
21964 @opindex mspfp-fast
21965 @item -mspfp-fast
21966 Generate single-precision FPX instructions, tuned for the fast
21967 implementation.
21969 @opindex msimd
21970 @item -msimd
21971 Enable generation of ARC SIMD instructions via target-specific
21972 builtins.  Only valid for @option{-mcpu=ARC700}.
21974 @opindex msoft-float
21975 @item -msoft-float
21976 This option ignored; it is provided for compatibility purposes only.
21977 Software floating-point code is emitted by default, and this default
21978 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
21979 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
21980 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
21982 @opindex mswap
21983 @item -mswap
21984 Generate @code{swap} instructions.
21986 @opindex matomic
21987 @item -matomic
21988 This enables use of the locked load/store conditional extension to implement
21989 atomic memory built-in functions.  Not available for ARC 6xx or ARC
21990 EM cores.
21992 @opindex mdiv-rem
21993 @item -mdiv-rem
21994 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
21996 @opindex mcode-density
21997 @item -mcode-density
21998 Enable code density instructions for ARC EM.  
21999 This option is on by default for ARC HS.
22001 @opindex mll64
22002 @item -mll64
22003 Enable double load/store operations for ARC HS cores.
22005 @opindex mtp-regno
22006 @item -mtp-regno=@var{regno}
22007 Specify thread pointer register number.
22009 @opindex mmpy-option
22010 @item -mmpy-option=@var{multo}
22011 Compile ARCv2 code with a multiplier design option.  You can specify 
22012 the option using either a string or numeric value for @var{multo}.  
22013 @samp{wlh1} is the default value.  The recognized values are:
22015 @table @samp
22016 @item 0
22017 @itemx none
22018 No multiplier available.
22020 @item 1
22021 @itemx w
22022 16x16 multiplier, fully pipelined.
22023 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
22025 @item 2
22026 @itemx wlh1
22027 32x32 multiplier, fully
22028 pipelined (1 stage).  The following instructions are additionally
22029 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
22031 @item 3
22032 @itemx wlh2
22033 32x32 multiplier, fully pipelined
22034 (2 stages).  The following instructions are additionally enabled: @code{mpy},
22035 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
22037 @item 4
22038 @itemx wlh3
22039 Two 16x16 multipliers, blocking,
22040 sequential.  The following instructions are additionally enabled: @code{mpy},
22041 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
22043 @item 5
22044 @itemx wlh4
22045 One 16x16 multiplier, blocking,
22046 sequential.  The following instructions are additionally enabled: @code{mpy},
22047 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
22049 @item 6
22050 @itemx wlh5
22051 One 32x4 multiplier, blocking,
22052 sequential.  The following instructions are additionally enabled: @code{mpy},
22053 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
22055 @item 7
22056 @itemx plus_dmpy
22057 ARC HS SIMD support.
22059 @item 8
22060 @itemx plus_macd
22061 ARC HS SIMD support.
22063 @item 9
22064 @itemx plus_qmacw
22065 ARC HS SIMD support.
22067 @end table
22069 This option is only available for ARCv2 cores@.
22071 @opindex mfpu
22072 @item -mfpu=@var{fpu}
22073 Enables support for specific floating-point hardware extensions for ARCv2
22074 cores.  Supported values for @var{fpu} are:
22076 @table @samp
22078 @item fpus
22079 Enables support for single-precision floating-point hardware
22080 extensions@.
22082 @item fpud
22083 Enables support for double-precision floating-point hardware
22084 extensions.  The single-precision floating-point extension is also
22085 enabled.  Not available for ARC EM@.
22087 @item fpuda
22088 Enables support for double-precision floating-point hardware
22089 extensions using double-precision assist instructions.  The single-precision
22090 floating-point extension is also enabled.  This option is
22091 only available for ARC EM@.
22093 @item fpuda_div
22094 Enables support for double-precision floating-point hardware
22095 extensions using double-precision assist instructions.
22096 The single-precision floating-point, square-root, and divide 
22097 extensions are also enabled.  This option is
22098 only available for ARC EM@.
22100 @item fpuda_fma
22101 Enables support for double-precision floating-point hardware
22102 extensions using double-precision assist instructions.
22103 The single-precision floating-point and fused multiply and add 
22104 hardware extensions are also enabled.  This option is
22105 only available for ARC EM@.
22107 @item fpuda_all
22108 Enables support for double-precision floating-point hardware
22109 extensions using double-precision assist instructions.
22110 All single-precision floating-point hardware extensions are also
22111 enabled.  This option is only available for ARC EM@.
22113 @item fpus_div
22114 Enables support for single-precision floating-point, square-root and divide 
22115 hardware extensions@.
22117 @item fpud_div
22118 Enables support for double-precision floating-point, square-root and divide 
22119 hardware extensions.  This option
22120 includes option @samp{fpus_div}. Not available for ARC EM@.
22122 @item fpus_fma
22123 Enables support for single-precision floating-point and 
22124 fused multiply and add hardware extensions@.
22126 @item fpud_fma
22127 Enables support for double-precision floating-point and 
22128 fused multiply and add hardware extensions.  This option
22129 includes option @samp{fpus_fma}.  Not available for ARC EM@.
22131 @item fpus_all
22132 Enables support for all single-precision floating-point hardware
22133 extensions@.
22135 @item fpud_all
22136 Enables support for all single- and double-precision floating-point
22137 hardware extensions.  Not available for ARC EM@.
22139 @end table
22141 @opindex mirq-ctrl-saved
22142 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
22143 Specifies general-purposes registers that the processor automatically
22144 saves/restores on interrupt entry and exit.  @var{register-range} is
22145 specified as two registers separated by a dash.  The register range
22146 always starts with @code{r0}, the upper limit is @code{fp} register.
22147 @var{blink} and @var{lp_count} are optional.  This option is only
22148 valid for ARC EM and ARC HS cores.
22150 @opindex mrgf-banked-regs
22151 @item -mrgf-banked-regs=@var{number}
22152 Specifies the number of registers replicated in second register bank
22153 on entry to fast interrupt.  Fast interrupts are interrupts with the
22154 highest priority level P0.  These interrupts save only PC and STATUS32
22155 registers to avoid memory transactions during interrupt entry and exit
22156 sequences.  Use this option when you are using fast interrupts in an
22157 ARC V2 family processor.  Permitted values are 4, 8, 16, and 32.
22159 @opindex mlpc-width
22160 @item -mlpc-width=@var{width}
22161 Specify the width of the @code{lp_count} register.  Valid values for
22162 @var{width} are 8, 16, 20, 24, 28 and 32 bits.  The default width is
22163 fixed to 32 bits.  If the width is less than 32, the compiler does not
22164 attempt to transform loops in your program to use the zero-delay loop
22165 mechanism unless it is known that the @code{lp_count} register can
22166 hold the required loop-counter value.  Depending on the width
22167 specified, the compiler and run-time library might continue to use the
22168 loop mechanism for various needs.  This option defines macro
22169 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
22171 @opindex mrf16
22172 @item -mrf16
22173 This option instructs the compiler to generate code for a 16-entry
22174 register file.  This option defines the @code{__ARC_RF16__}
22175 preprocessor macro.
22177 @opindex mbranch-index
22178 @item -mbranch-index
22179 Enable use of @code{bi} or @code{bih} instructions to implement jump
22180 tables.
22182 @end table
22184 The following options are passed through to the assembler, and also
22185 define preprocessor macro symbols.
22187 @c Flags used by the assembler, but for which we define preprocessor
22188 @c macro symbols as well.
22189 @table @gcctabopt
22190 @opindex mdsp-packa
22191 @item -mdsp-packa
22192 Passed down to the assembler to enable the DSP Pack A extensions.
22193 Also sets the preprocessor symbol @code{__Xdsp_packa}.  This option is
22194 deprecated.
22196 @opindex mdvbf
22197 @item -mdvbf
22198 Passed down to the assembler to enable the dual Viterbi butterfly
22199 extension.  Also sets the preprocessor symbol @code{__Xdvbf}.  This
22200 option is deprecated.
22202 @c ARC700 4.10 extension instruction
22203 @opindex mlock
22204 @item -mlock
22205 Passed down to the assembler to enable the locked load/store
22206 conditional extension.  Also sets the preprocessor symbol
22207 @code{__Xlock}.
22209 @opindex mmac-d16
22210 @item -mmac-d16
22211 Passed down to the assembler.  Also sets the preprocessor symbol
22212 @code{__Xxmac_d16}.  This option is deprecated.
22214 @opindex mmac-24
22215 @item -mmac-24
22216 Passed down to the assembler.  Also sets the preprocessor symbol
22217 @code{__Xxmac_24}.  This option is deprecated.
22219 @c ARC700 4.10 extension instruction
22220 @opindex mrtsc
22221 @item -mrtsc
22222 Passed down to the assembler to enable the 64-bit time-stamp counter
22223 extension instruction.  Also sets the preprocessor symbol
22224 @code{__Xrtsc}.  This option is deprecated.
22226 @c ARC700 4.10 extension instruction
22227 @opindex mswape
22228 @item -mswape
22229 Passed down to the assembler to enable the swap byte ordering
22230 extension instruction.  Also sets the preprocessor symbol
22231 @code{__Xswape}.
22233 @opindex mtelephony
22234 @item -mtelephony
22235 Passed down to the assembler to enable dual- and single-operand
22236 instructions for telephony.  Also sets the preprocessor symbol
22237 @code{__Xtelephony}.  This option is deprecated.
22239 @opindex mxy
22240 @item -mxy
22241 Passed down to the assembler to enable the XY memory extension.  Also
22242 sets the preprocessor symbol @code{__Xxy}.
22244 @end table
22246 The following options control how the assembly code is annotated:
22248 @c Assembly annotation options
22249 @table @gcctabopt
22250 @opindex misize
22251 @item -misize
22252 Annotate assembler instructions with estimated addresses.
22254 @opindex mannotate-align
22255 @item -mannotate-align
22256 Does nothing.  Preserved for backward compatibility.
22258 @end table
22260 The following options are passed through to the linker:
22262 @c options passed through to the linker
22263 @table @gcctabopt
22264 @opindex marclinux
22265 @item -marclinux
22266 Passed through to the linker, to specify use of the @code{arclinux} emulation.
22267 This option is enabled by default in tool chains built for
22268 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
22269 when profiling is not requested.
22271 @opindex marclinux_prof
22272 @item -marclinux_prof
22273 Passed through to the linker, to specify use of the
22274 @code{arclinux_prof} emulation.  This option is enabled by default in
22275 tool chains built for @w{@code{arc-linux-uclibc}} and
22276 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
22278 @end table
22280 The following options control the semantics of generated code:
22282 @c semantically relevant code generation options
22283 @table @gcctabopt
22284 @opindex mlong-calls
22285 @item -mlong-calls
22286 Generate calls as register indirect calls, thus providing access
22287 to the full 32-bit address range.
22289 @opindex mmedium-calls
22290 @item -mmedium-calls
22291 Don't use less than 25-bit addressing range for calls, which is the
22292 offset available for an unconditional branch-and-link
22293 instruction.  Conditional execution of function calls is suppressed, to
22294 allow use of the 25-bit range, rather than the 21-bit range with
22295 conditional branch-and-link.  This is the default for tool chains built
22296 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
22298 @opindex G
22299 @item -G @var{num}
22300 Put definitions of externally-visible data in a small data section if
22301 that data is no bigger than @var{num} bytes.  The default value of
22302 @var{num} is 4 for any ARC configuration, or 8 when we have double
22303 load/store operations.
22305 @opindex mno-sdata
22306 @opindex msdata
22307 @item -mno-sdata
22308 Do not generate sdata references.  This is the default for tool chains
22309 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
22310 targets.
22312 @opindex mvolatile-cache
22313 @item -mvolatile-cache
22314 Use ordinarily cached memory accesses for volatile references.  This is the
22315 default.
22317 @opindex mno-volatile-cache
22318 @opindex mvolatile-cache
22319 @item -mno-volatile-cache
22320 Enable cache bypass for volatile references.
22322 @end table
22324 The following options fine tune code generation:
22325 @c code generation tuning options
22326 @table @gcctabopt
22327 @opindex malign-call
22328 @item -malign-call
22329 Does nothing.  Preserved for backward compatibility.
22331 @opindex mauto-modify-reg
22332 @item -mauto-modify-reg
22333 Enable the use of pre/post modify with register displacement.
22335 @opindex mbbit-peephole
22336 @item -mbbit-peephole
22337 Does nothing.  Preserved for backward compatibility.
22339 @opindex mno-brcc
22340 @item -mno-brcc
22341 This option disables a target-specific pass in @file{arc_reorg} to
22342 generate compare-and-branch (@code{br@var{cc}}) instructions.  
22343 It has no effect on
22344 generation of these instructions driven by the combiner pass.
22346 @opindex mcase-vector-pcrel
22347 @item -mcase-vector-pcrel
22348 Use PC-relative switch case tables to enable case table shortening.
22349 This is the default for @option{-Os}.
22351 @opindex mcompact-casesi
22352 @item -mcompact-casesi
22353 Enable compact @code{casesi} pattern.  This is the default for @option{-Os},
22354 and only available for ARCv1 cores.  This option is deprecated.
22356 @opindex mno-cond-exec
22357 @item -mno-cond-exec
22358 Disable the ARCompact-specific pass to generate conditional 
22359 execution instructions.
22361 Due to delay slot scheduling and interactions between operand numbers,
22362 literal sizes, instruction lengths, and the support for conditional execution,
22363 the target-independent pass to generate conditional execution is often lacking,
22364 so the ARC port has kept a special pass around that tries to find more
22365 conditional execution generation opportunities after register allocation,
22366 branch shortening, and delay slot scheduling have been done.  This pass
22367 generally, but not always, improves performance and code size, at the cost of
22368 extra compilation time, which is why there is an option to switch it off.
22369 If you have a problem with call instructions exceeding their allowable
22370 offset range because they are conditionalized, you should consider using
22371 @option{-mmedium-calls} instead.
22373 @opindex mearly-cbranchsi
22374 @item -mearly-cbranchsi
22375 Enable pre-reload use of the @code{cbranchsi} pattern.
22377 @opindex mexpand-adddi
22378 @item -mexpand-adddi
22379 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
22380 @code{add.f}, @code{adc} etc.  This option is deprecated.
22382 @opindex mindexed-loads
22383 @item -mindexed-loads
22384 Enable the use of indexed loads.  This can be problematic because some
22385 optimizers then assume that indexed stores exist, which is not
22386 the case.
22388 @opindex mlra
22389 @item -mlra
22390 Enable Local Register Allocation.  This is still experimental for ARC,
22391 so by default the compiler uses standard reload
22392 (i.e.@: @option{-mno-lra}).
22394 @opindex mlra-priority-none
22395 @item -mlra-priority-none
22396 Don't indicate any priority for target registers.
22398 @opindex mlra-priority-compact
22399 @item -mlra-priority-compact
22400 Indicate target register priority for r0..r3 / r12..r15.
22402 @opindex mlra-priority-noncompact
22403 @item -mlra-priority-noncompact
22404 Reduce target register priority for r0..r3 / r12..r15.
22406 @opindex mmillicode
22407 @item -mmillicode
22408 When optimizing for size (using @option{-Os}), prologues and epilogues
22409 that have to save or restore a large number of registers are often
22410 shortened by using call to a special function in libgcc; this is
22411 referred to as a @emph{millicode} call.  As these calls can pose
22412 performance issues, and/or cause linking issues when linking in a
22413 nonstandard way, this option is provided to turn on or off millicode
22414 call generation.
22416 @opindex mcode-density-frame
22417 @item -mcode-density-frame
22418 This option enable the compiler to emit @code{enter} and @code{leave}
22419 instructions.  These instructions are only valid for CPUs with
22420 code-density feature.
22422 @opindex mmixed-code
22423 @item -mmixed-code
22424 Does nothing.  Preserved for backward compatibility.
22426 @opindex mq-class
22427 @item -mq-class
22428 Ths option is deprecated.  Enable @samp{q} instruction alternatives.
22429 This is the default for @option{-Os}.
22431 @opindex mRcq
22432 @item -mRcq
22433 Does nothing.  Preserved for backward compatibility.
22435 @opindex mRcw
22436 @item -mRcw
22437 Does nothing.  Preserved for backward compatibility.
22439 @opindex msize-level
22440 @item -msize-level=@var{level}
22441 Fine-tune size optimization with regards to instruction lengths and alignment.
22442 The recognized values for @var{level} are:
22443 @table @samp
22444 @item 0
22445 No size optimization.  This level is deprecated and treated like @samp{1}.
22447 @item 1
22448 Short instructions are used opportunistically.
22450 @item 2
22451 In addition, alignment of loops and of code after barriers are dropped.
22453 @item 3
22454 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
22456 @end table
22458 This defaults to @samp{3} when @option{-Os} is in effect.  Otherwise,
22459 the behavior when this is not set is equivalent to level @samp{1}.
22461 @opindex mtune
22462 @item -mtune=@var{cpu}
22463 Set instruction scheduling parameters for @var{cpu}, overriding any implied
22464 by @option{-mcpu=}.
22466 Supported values for @var{cpu} are
22468 @table @samp
22469 @item ARC600
22470 Tune for ARC600 CPU.
22472 @item ARC601
22473 Tune for ARC601 CPU.
22475 @item ARC700
22476 Tune for ARC700 CPU with standard multiplier block.
22478 @item ARC700-xmac
22479 Tune for ARC700 CPU with XMAC block.
22481 @item ARC725D
22482 Tune for ARC725D CPU.
22484 @item ARC750D
22485 Tune for ARC750D CPU.
22487 @item core3
22488 Tune for ARCv2 core3 type CPU.  This option enable usage of
22489 @code{dbnz} instruction.
22491 @item release31a
22492 Tune for ARC4x release 3.10a.
22494 @end table
22496 @opindex mmultcost
22497 @item -mmultcost=@var{num}
22498 Cost to assume for a multiply instruction, with @samp{4} being equal to a
22499 normal instruction.
22501 @opindex munalign-prob-threshold
22502 @item -munalign-prob-threshold=@var{probability}
22503 Does nothing.  Preserved for backward compatibility.
22505 @end table
22507 The following options are maintained for backward compatibility, but
22508 are now deprecated and will be removed in a future release:
22510 @c Deprecated options
22511 @table @gcctabopt
22513 @opindex margonaut
22514 @item -margonaut
22515 Obsolete FPX.
22517 @opindex mbig-endian
22518 @opindex EB
22519 @item -mbig-endian
22520 @itemx -EB
22521 Compile code for big-endian targets.  Use of these options is now
22522 deprecated.  Big-endian code is supported by configuring GCC to build
22523 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
22524 for which big endian is the default.
22526 @opindex mlittle-endian
22527 @opindex EL
22528 @item -mlittle-endian
22529 @itemx -EL
22530 Compile code for little-endian targets.  Use of these options is now
22531 deprecated.  Little-endian code is supported by configuring GCC to build 
22532 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
22533 for which little endian is the default.
22535 @opindex mbarrel_shifter
22536 @item -mbarrel_shifter
22537 Replaced by @option{-mbarrel-shifter}.
22539 @opindex mdpfp_compact
22540 @item -mdpfp_compact
22541 Replaced by @option{-mdpfp-compact}.
22543 @opindex mdpfp_fast
22544 @item -mdpfp_fast
22545 Replaced by @option{-mdpfp-fast}.
22547 @opindex mdsp_packa
22548 @item -mdsp_packa
22549 Replaced by @option{-mdsp-packa}.
22551 @opindex mEA
22552 @item -mEA
22553 Replaced by @option{-mea}.
22555 @opindex mmac_24
22556 @item -mmac_24
22557 Replaced by @option{-mmac-24}.
22559 @opindex mmac_d16
22560 @item -mmac_d16
22561 Replaced by @option{-mmac-d16}.
22563 @opindex mspfp_compact
22564 @item -mspfp_compact
22565 Replaced by @option{-mspfp-compact}.
22567 @opindex mspfp_fast
22568 @item -mspfp_fast
22569 Replaced by @option{-mspfp-fast}.
22571 @opindex mtune
22572 @item -mtune=@var{cpu}
22573 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
22574 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
22575 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
22577 @opindex multcost
22578 @item -multcost=@var{num}
22579 Replaced by @option{-mmultcost}.
22581 @end table
22583 @node ARM Options
22584 @subsection ARM Options
22585 @cindex ARM options
22587 These @samp{-m} options are defined for the ARM port:
22589 @table @gcctabopt
22590 @opindex mabi
22591 @item -mabi=@var{name}
22592 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
22593 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
22595 @opindex mapcs-frame
22596 @item -mapcs-frame
22597 Generate a stack frame that is compliant with the ARM Procedure Call
22598 Standard for all functions, even if this is not strictly necessary for
22599 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
22600 with this option causes the stack frames not to be generated for
22601 leaf functions.  The default is @option{-mno-apcs-frame}.
22602 This option is deprecated.
22604 @opindex mapcs
22605 @item -mapcs
22606 This is a synonym for @option{-mapcs-frame} and is deprecated.
22608 @ignore
22609 @c not currently implemented
22610 @opindex mapcs-stack-check
22611 @item -mapcs-stack-check
22612 Generate code to check the amount of stack space available upon entry to
22613 every function (that actually uses some stack space).  If there is
22614 insufficient space available then either the function
22615 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
22616 called, depending upon the amount of stack space required.  The runtime
22617 system is required to provide these functions.  The default is
22618 @option{-mno-apcs-stack-check}, since this produces smaller code.
22620 @c not currently implemented
22621 @opindex mapcs-reentrant
22622 @item -mapcs-reentrant
22623 Generate reentrant, position-independent code.  The default is
22624 @option{-mno-apcs-reentrant}.
22625 @end ignore
22627 @opindex mthumb-interwork
22628 @item -mthumb-interwork
22629 Generate code that supports calling between the ARM and Thumb
22630 instruction sets.  Without this option, on pre-v5 architectures, the
22631 two instruction sets cannot be reliably used inside one program.  The
22632 default is @option{-mno-thumb-interwork}, since slightly larger code
22633 is generated when @option{-mthumb-interwork} is specified.  In AAPCS
22634 configurations this option is meaningless.
22636 @opindex mno-sched-prolog
22637 @opindex msched-prolog
22638 @item -mno-sched-prolog
22639 Prevent the reordering of instructions in the function prologue, or the
22640 merging of those instruction with the instructions in the function's
22641 body.  This means that all functions start with a recognizable set
22642 of instructions (or in fact one of a choice from a small set of
22643 different function prologues), and this information can be used to
22644 locate the start of functions inside an executable piece of code.  The
22645 default is @option{-msched-prolog}.
22647 @opindex mfloat-abi
22648 @item -mfloat-abi=@var{name}
22649 Specifies which floating-point ABI to use.  Permissible values
22650 are: @samp{soft}, @samp{softfp} and @samp{hard}.
22652 Specifying @samp{soft} causes GCC to generate output containing
22653 library calls for floating-point operations.
22654 @samp{softfp} allows the generation of code using hardware floating-point
22655 instructions, but still uses the soft-float calling conventions.
22656 @samp{hard} allows generation of floating-point instructions
22657 and uses FPU-specific calling conventions.
22659 The default depends on the specific target configuration.  Note that
22660 the hard-float and soft-float ABIs are not link-compatible; you must
22661 compile your entire program with the same ABI, and link with a
22662 compatible set of libraries.
22664 @opindex mgeneral-regs-only
22665 @item -mgeneral-regs-only
22666 Generate code which uses only the general-purpose registers.  This will prevent
22667 the compiler from using floating-point and Advanced SIMD registers but will not
22668 impose any restrictions on the assembler.
22670 @opindex mlittle-endian
22671 @item -mlittle-endian
22672 Generate code for a processor running in little-endian mode.  This is
22673 the default for all standard configurations.
22675 @opindex mbig-endian
22676 @item -mbig-endian
22677 Generate code for a processor running in big-endian mode; the default is
22678 to compile code for a little-endian processor.
22680 @opindex mbe8
22681 @item -mbe8
22682 @itemx -mbe32
22683 When linking a big-endian image select between BE8 and BE32 formats.
22684 The option has no effect for little-endian images and is ignored.  The
22685 default is dependent on the selected target architecture.  For ARMv6
22686 and later architectures the default is BE8, for older architectures
22687 the default is BE32.  BE32 format has been deprecated by ARM.
22689 @opindex march
22690 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
22691 This specifies the name of the target ARM architecture.  GCC uses this
22692 name to determine what kind of instructions it can emit when generating
22693 assembly code.  This option can be used in conjunction with or instead
22694 of the @option{-mcpu=} option.
22696 Permissible names are:
22697 @samp{armv4t},
22698 @samp{armv5t}, @samp{armv5te},
22699 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
22700 @samp{armv6z}, @samp{armv6zk},
22701 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve}, 
22702 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
22703 @samp{armv8.4-a},
22704 @samp{armv8.5-a},
22705 @samp{armv8.6-a},
22706 @samp{armv9-a},
22707 @samp{armv7-r},
22708 @samp{armv8-r},
22709 @samp{armv6-m}, @samp{armv6s-m},
22710 @samp{armv7-m}, @samp{armv7e-m},
22711 @samp{armv8-m.base}, @samp{armv8-m.main},
22712 @samp{armv8.1-m.main},
22713 @samp{armv9-a},
22714 @samp{iwmmxt} and @samp{iwmmxt2}.
22716 Additionally, the following architectures, which lack support for the
22717 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
22719 Many of the architectures support extensions.  These can be added by
22720 appending @samp{+@var{extension}} to the architecture name.  Extension
22721 options are processed in order and capabilities accumulate.  An extension
22722 will also enable any necessary base extensions
22723 upon which it depends.  For example, the @samp{+crypto} extension
22724 will always enable the @samp{+simd} extension.  The exception to the
22725 additive construction is for extensions that are prefixed with
22726 @samp{+no@dots{}}: these extensions disable the specified option and
22727 any other extensions that may depend on the presence of that
22728 extension.
22730 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
22731 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
22732 entirely disabled by the @samp{+nofp} option that follows it.
22734 Most extension names are generically named, but have an effect that is
22735 dependent upon the architecture to which it is applied.  For example,
22736 the @samp{+simd} option can be applied to both @samp{armv7-a} and
22737 @samp{armv8-a} architectures, but will enable the original ARMv7-A
22738 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
22739 variant for @samp{armv8-a}.
22741 The table below lists the supported extensions for each architecture.
22742 Architectures not mentioned do not support any extensions.
22744 @table @samp
22745 @item armv5te
22746 @itemx armv6
22747 @itemx armv6j
22748 @itemx armv6k
22749 @itemx armv6kz
22750 @itemx armv6t2
22751 @itemx armv6z
22752 @itemx armv6zk
22753 @table @samp
22754 @item +fp
22755 The VFPv2 floating-point instructions.  The extension @samp{+vfpv2} can be
22756 used as an alias for this extension.
22758 @item +nofp
22759 Disable the floating-point instructions.
22760 @end table
22762 @item armv7
22763 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
22764 @table @samp
22765 @item +fp
22766 The VFPv3 floating-point instructions, with 16 double-precision
22767 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
22768 for this extension.  Note that floating-point is not supported by the
22769 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
22770 ARMv7-R architectures.
22772 @item +nofp
22773 Disable the floating-point instructions.
22774 @end table
22776 @item armv7-a
22777 @table @samp
22778 @item +mp
22779 The multiprocessing extension.
22781 @item +sec
22782 The security extension.
22784 @item +fp
22785 The VFPv3 floating-point instructions, with 16 double-precision
22786 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
22787 for this extension.
22789 @item +simd
22790 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
22791 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
22792 for this extension.
22794 @item +vfpv3
22795 The VFPv3 floating-point instructions, with 32 double-precision
22796 registers.
22798 @item +vfpv3-d16-fp16
22799 The VFPv3 floating-point instructions, with 16 double-precision
22800 registers and the half-precision floating-point conversion operations.
22802 @item +vfpv3-fp16
22803 The VFPv3 floating-point instructions, with 32 double-precision
22804 registers and the half-precision floating-point conversion operations.
22806 @item +vfpv4-d16
22807 The VFPv4 floating-point instructions, with 16 double-precision
22808 registers.
22810 @item +vfpv4
22811 The VFPv4 floating-point instructions, with 32 double-precision
22812 registers.
22814 @item +neon-fp16
22815 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
22816 the half-precision floating-point conversion operations.
22818 @item +neon-vfpv4
22819 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
22821 @item +nosimd
22822 Disable the Advanced SIMD instructions (does not disable floating point).
22824 @item +nofp
22825 Disable the floating-point and Advanced SIMD instructions.
22826 @end table
22828 @item armv7ve
22829 The extended version of the ARMv7-A architecture with support for
22830 virtualization.
22831 @table @samp
22832 @item +fp
22833 The VFPv4 floating-point instructions, with 16 double-precision registers.
22834 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
22836 @item +simd
22837 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.  The
22838 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
22840 @item +vfpv3-d16
22841 The VFPv3 floating-point instructions, with 16 double-precision
22842 registers.
22844 @item +vfpv3
22845 The VFPv3 floating-point instructions, with 32 double-precision
22846 registers.
22848 @item +vfpv3-d16-fp16
22849 The VFPv3 floating-point instructions, with 16 double-precision
22850 registers and the half-precision floating-point conversion operations.
22852 @item +vfpv3-fp16
22853 The VFPv3 floating-point instructions, with 32 double-precision
22854 registers and the half-precision floating-point conversion operations.
22856 @item +vfpv4-d16
22857 The VFPv4 floating-point instructions, with 16 double-precision
22858 registers.
22860 @item +vfpv4
22861 The VFPv4 floating-point instructions, with 32 double-precision
22862 registers.
22864 @item +neon
22865 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
22866 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
22868 @item +neon-fp16
22869 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
22870 the half-precision floating-point conversion operations.
22872 @item +nosimd
22873 Disable the Advanced SIMD instructions (does not disable floating point).
22875 @item +nofp
22876 Disable the floating-point and Advanced SIMD instructions.
22877 @end table
22879 @item armv8-a
22880 @table @samp
22881 @item +crc
22882 The Cyclic Redundancy Check (CRC) instructions.
22883 @item +simd
22884 The ARMv8-A Advanced SIMD and floating-point instructions.
22885 @item +crypto
22886 The cryptographic instructions.
22887 @item +nocrypto
22888 Disable the cryptographic instructions.
22889 @item +nofp
22890 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22891 @item +sb
22892 Speculation Barrier Instruction.
22893 @item +predres
22894 Execution and Data Prediction Restriction Instructions.
22895 @end table
22897 @item armv8.1-a
22898 @table @samp
22899 @item +simd
22900 The ARMv8.1-A Advanced SIMD and floating-point instructions.
22902 @item +crypto
22903 The cryptographic instructions.  This also enables the Advanced SIMD and
22904 floating-point instructions.
22906 @item +nocrypto
22907 Disable the cryptographic instructions.
22909 @item +nofp
22910 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22912 @item +sb
22913 Speculation Barrier Instruction.
22915 @item +predres
22916 Execution and Data Prediction Restriction Instructions.
22917 @end table
22919 @item armv8.2-a
22920 @itemx armv8.3-a
22921 @table @samp
22922 @item +fp16
22923 The half-precision floating-point data processing instructions.
22924 This also enables the Advanced SIMD and floating-point instructions.
22926 @item +fp16fml
22927 The half-precision floating-point fmla extension.  This also enables
22928 the half-precision floating-point extension and Advanced SIMD and
22929 floating-point instructions.
22931 @item +simd
22932 The ARMv8.1-A Advanced SIMD and floating-point instructions.
22934 @item +crypto
22935 The cryptographic instructions.  This also enables the Advanced SIMD and
22936 floating-point instructions.
22938 @item +dotprod
22939 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
22941 @item +nocrypto
22942 Disable the cryptographic extension.
22944 @item +nofp
22945 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22947 @item +sb
22948 Speculation Barrier Instruction.
22950 @item +predres
22951 Execution and Data Prediction Restriction Instructions.
22953 @item +i8mm
22954 8-bit Integer Matrix Multiply instructions.
22955 This also enables Advanced SIMD and floating-point instructions.
22957 @item +bf16
22958 Brain half-precision floating-point instructions.
22959 This also enables Advanced SIMD and floating-point instructions.
22960 @end table
22962 @item armv8.4-a
22963 @table @samp
22964 @item +fp16
22965 The half-precision floating-point data processing instructions.
22966 This also enables the Advanced SIMD and floating-point instructions as well
22967 as the Dot Product extension and the half-precision floating-point fmla
22968 extension.
22970 @item +simd
22971 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22972 Dot Product extension.
22974 @item +crypto
22975 The cryptographic instructions.  This also enables the Advanced SIMD and
22976 floating-point instructions as well as the Dot Product extension.
22978 @item +nocrypto
22979 Disable the cryptographic extension.
22981 @item +nofp
22982 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22984 @item +sb
22985 Speculation Barrier Instruction.
22987 @item +predres
22988 Execution and Data Prediction Restriction Instructions.
22990 @item +i8mm
22991 8-bit Integer Matrix Multiply instructions.
22992 This also enables Advanced SIMD and floating-point instructions.
22994 @item +bf16
22995 Brain half-precision floating-point instructions.
22996 This also enables Advanced SIMD and floating-point instructions.
22997 @end table
22999 @item armv8.5-a
23000 @table @samp
23001 @item +fp16
23002 The half-precision floating-point data processing instructions.
23003 This also enables the Advanced SIMD and floating-point instructions as well
23004 as the Dot Product extension and the half-precision floating-point fmla
23005 extension.
23007 @item +simd
23008 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
23009 Dot Product extension.
23011 @item +crypto
23012 The cryptographic instructions.  This also enables the Advanced SIMD and
23013 floating-point instructions as well as the Dot Product extension.
23015 @item +nocrypto
23016 Disable the cryptographic extension.
23018 @item +nofp
23019 Disable the floating-point, Advanced SIMD and cryptographic instructions.
23021 @item +i8mm
23022 8-bit Integer Matrix Multiply instructions.
23023 This also enables Advanced SIMD and floating-point instructions.
23025 @item +bf16
23026 Brain half-precision floating-point instructions.
23027 This also enables Advanced SIMD and floating-point instructions.
23028 @end table
23030 @item armv8.6-a
23031 @table @samp
23032 @item +fp16
23033 The half-precision floating-point data processing instructions.
23034 This also enables the Advanced SIMD and floating-point instructions as well
23035 as the Dot Product extension and the half-precision floating-point fmla
23036 extension.
23038 @item +simd
23039 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
23040 Dot Product extension.
23042 @item +crypto
23043 The cryptographic instructions.  This also enables the Advanced SIMD and
23044 floating-point instructions as well as the Dot Product extension.
23046 @item +nocrypto
23047 Disable the cryptographic extension.
23049 @item +nofp
23050 Disable the floating-point, Advanced SIMD and cryptographic instructions.
23052 @item +i8mm
23053 8-bit Integer Matrix Multiply instructions.
23054 This also enables Advanced SIMD and floating-point instructions.
23056 @item +bf16
23057 Brain half-precision floating-point instructions.
23058 This also enables Advanced SIMD and floating-point instructions.
23059 @end table
23061 @item armv7-r
23062 @table @samp
23063 @item +fp.sp
23064 The single-precision VFPv3 floating-point instructions.  The extension
23065 @samp{+vfpv3xd} can be used as an alias for this extension.
23067 @item +fp
23068 The VFPv3 floating-point instructions with 16 double-precision registers.
23069 The extension +vfpv3-d16 can be used as an alias for this extension.
23071 @item +vfpv3xd-d16-fp16
23072 The single-precision VFPv3 floating-point instructions with 16 double-precision
23073 registers and the half-precision floating-point conversion operations.
23075 @item +vfpv3-d16-fp16
23076 The VFPv3 floating-point instructions with 16 double-precision
23077 registers and the half-precision floating-point conversion operations.
23079 @item +nofp
23080 Disable the floating-point extension.
23082 @item +idiv
23083 The ARM-state integer division instructions.
23085 @item +noidiv
23086 Disable the ARM-state integer division extension.
23087 @end table
23089 @item armv7e-m
23090 @table @samp
23091 @item +fp
23092 The single-precision VFPv4 floating-point instructions.
23094 @item +fpv5
23095 The single-precision FPv5 floating-point instructions.
23097 @item +fp.dp
23098 The single- and double-precision FPv5 floating-point instructions.
23100 @item +nofp
23101 Disable the floating-point extensions.
23102 @end table
23104 @item  armv8.1-m.main
23105 @table @samp
23107 @item +dsp
23108 The DSP instructions.
23110 @item +mve
23111 The M-Profile Vector Extension (MVE) integer instructions.
23113 @item +mve.fp
23114 The M-Profile Vector Extension (MVE) integer and single precision
23115 floating-point instructions.
23117 @item +fp
23118 The single-precision floating-point instructions.
23120 @item +fp.dp
23121 The single- and double-precision floating-point instructions.
23123 @item +nofp
23124 Disable the floating-point extension.
23126 @item +cdecp0, +cdecp1, ... , +cdecp7
23127 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
23128 to the numbers given in the options in the range 0 to 7.
23130 @item +pacbti
23131 Enable the Pointer Authentication and Branch Target Identification Extension.
23132 @end table
23134 @item  armv8-m.main
23135 @table @samp
23136 @item +dsp
23137 The DSP instructions.
23139 @item +nodsp
23140 Disable the DSP extension.
23142 @item +fp
23143 The single-precision floating-point instructions.
23145 @item +fp.dp
23146 The single- and double-precision floating-point instructions.
23148 @item +nofp
23149 Disable the floating-point extension.
23151 @item +cdecp0, +cdecp1, ... , +cdecp7
23152 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
23153 to the numbers given in the options in the range 0 to 7.
23154 @end table
23156 @item armv8-r
23157 @table @samp
23158 @item +crc
23159 The Cyclic Redundancy Check (CRC) instructions.
23160 @item +fp.sp
23161 The single-precision FPv5 floating-point instructions.
23162 @item +simd
23163 The ARMv8-A Advanced SIMD and floating-point instructions.
23164 @item +crypto
23165 The cryptographic instructions.
23166 @item +nocrypto
23167 Disable the cryptographic instructions.
23168 @item +nofp
23169 Disable the floating-point, Advanced SIMD and cryptographic instructions.
23170 @end table
23172 @end table
23174 @option{-march=native} causes the compiler to auto-detect the architecture
23175 of the build computer.  At present, this feature is only supported on
23176 GNU/Linux, and not all architectures are recognized.  If the auto-detect
23177 is unsuccessful the option has no effect.
23179 @opindex mtune
23180 @item -mtune=@var{name}
23181 This option specifies the name of the target ARM processor for
23182 which GCC should tune the performance of the code.
23183 For some ARM implementations better performance can be obtained by using
23184 this option.
23185 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
23186 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
23187 @samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810},
23188 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
23189 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
23190 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
23191 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
23192 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
23193 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
23194 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
23195 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
23196 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
23197 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
23198 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
23199 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, @samp{cortex-a710},
23200 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
23201 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus},
23202 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
23203 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
23204 @samp{cortex-m35p}, @samp{cortex-m52}, @samp{cortex-m55}, @samp{cortex-m85}, @samp{cortex-x1},
23205 @samp{cortex-x1c}, @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
23206 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
23207 @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
23208 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
23209 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{star-mc1},
23210 @samp{xgene1}.
23212 Additionally, this option can specify that GCC should tune the performance
23213 of the code for a big.LITTLE system.  Permissible names are:
23214 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
23215 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
23216 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
23217 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
23219 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
23220 performance for a blend of processors within architecture @var{arch}.
23221 The aim is to generate code that run well on the current most popular
23222 processors, balancing between optimizations that benefit some CPUs in the
23223 range, and avoiding performance pitfalls of other CPUs.  The effects of
23224 this option may change in future GCC versions as CPU models come and go.
23226 @option{-mtune} permits the same extension options as @option{-mcpu}, but
23227 the extension options do not affect the tuning of the generated code.
23229 @option{-mtune=native} causes the compiler to auto-detect the CPU
23230 of the build computer.  At present, this feature is only supported on
23231 GNU/Linux, and not all architectures are recognized.  If the auto-detect is
23232 unsuccessful the option has no effect.
23234 @opindex mcpu
23235 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
23236 This specifies the name of the target ARM processor.  GCC uses this name
23237 to derive the name of the target ARM architecture (as if specified
23238 by @option{-march}) and the ARM processor type for which to tune for
23239 performance (as if specified by @option{-mtune}).  Where this option
23240 is used in conjunction with @option{-march} or @option{-mtune},
23241 those options take precedence over the appropriate part of this option.
23243 Many of the supported CPUs implement optional architectural
23244 extensions.  Where this is so the architectural extensions are
23245 normally enabled by default.  If implementations that lack the
23246 extension exist, then the extension syntax can be used to disable
23247 those extensions that have been omitted.  For floating-point and
23248 Advanced SIMD (Neon) instructions, the settings of the options
23249 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
23250 floating-point and Advanced SIMD instructions will only be used if
23251 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
23252 @option{-mfpu} other than @samp{auto} will override the available
23253 floating-point and SIMD extension instructions.
23255 For example, @samp{cortex-a9} can be found in three major
23256 configurations: integer only, with just a floating-point unit or with
23257 floating-point and Advanced SIMD.  The default is to enable all the
23258 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
23259 be used to disable just the SIMD or both the SIMD and floating-point
23260 instructions respectively.
23262 Permissible names for this option are the same as those for
23263 @option{-mtune}.
23265 The following extension options are common to the listed CPUs:
23267 @table @samp
23268 @item +nodsp
23269 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p},
23270 @samp{cortex-m52}, @samp{cortex-m55} and @samp{cortex-m85}.
23271 Also disable the M-Profile Vector Extension (MVE) integer and
23272 single precision floating-point instructions on
23273 @samp{cortex-m52}, @samp{cortex-m55} and @samp{cortex-m85}.
23275 @item +nopacbti
23276 Disable the Pointer Authentication and Branch Target Identification Extension
23277 on @samp{cortex-m52} and @samp{cortex-m85}.
23279 @item +nomve
23280 Disable the M-Profile Vector Extension (MVE) integer and single precision
23281 floating-point instructions on @samp{cortex-m52}, @samp{cortex-m55} and @samp{cortex-m85}.
23283 @item +nomve.fp
23284 Disable the M-Profile Vector Extension (MVE) single precision floating-point
23285 instructions on @samp{cortex-m52}, @samp{cortex-m55} and @samp{cortex-m85}.
23287 @item +cdecp0, +cdecp1, ... , +cdecp7
23288 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
23289 to the numbers given in the options in the range 0 to 7 on @samp{cortex-m52} and @samp{cortex-m55}.
23291 @item  +nofp
23292 Disables the floating-point instructions on @samp{arm9e},
23293 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
23294 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
23295 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
23296 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p},
23297 @samp{cortex-m52}, @samp{cortex-m55} and @samp{cortex-m85}.
23298 Disables the floating-point and SIMD instructions on
23299 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
23300 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
23301 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
23302 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
23303 @samp{cortex-a53} and @samp{cortex-a55}.
23305 @item +nofp.dp
23306 Disables the double-precision component of the floating-point instructions
23307 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
23308 @samp{cortex-r52plus} and @samp{cortex-m7}.
23310 @item +nosimd
23311 Disables the SIMD (but not floating-point) instructions on
23312 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
23313 and @samp{cortex-a9}.
23315 @item +crypto
23316 Enables the cryptographic instructions on @samp{cortex-a32},
23317 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
23318 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
23319 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
23320 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
23321 @samp{cortex-a75.cortex-a55}.
23322 @end table
23324 Additionally the @samp{generic-armv7-a} pseudo target defaults to
23325 VFPv3 with 16 double-precision registers.  It supports the following
23326 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
23327 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
23328 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
23329 @samp{neon-fp16}, @samp{neon-vfpv4}.  The meanings are the same as for
23330 the extensions to @option{-march=armv7-a}.
23332 @option{-mcpu=generic-@var{arch}} is also permissible, and is
23333 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
23334 See @option{-mtune} for more information.
23336 @option{-mcpu=native} causes the compiler to auto-detect the CPU
23337 of the build computer.  At present, this feature is only supported on
23338 GNU/Linux, and not all architectures are recognized.  If the auto-detect
23339 is unsuccessful the option has no effect.
23341 @opindex mfpu
23342 @item -mfpu=@var{name}
23343 This specifies what floating-point hardware (or hardware emulation) is
23344 available on the target.  Permissible names are: @samp{auto}, @samp{vfpv2},
23345 @samp{vfpv3},
23346 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
23347 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
23348 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
23349 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
23350 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
23351 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
23352 is an alias for @samp{vfpv2}.
23354 The setting @samp{auto} is the default and is special.  It causes the
23355 compiler to select the floating-point and Advanced SIMD instructions
23356 based on the settings of @option{-mcpu} and @option{-march}.
23358 If the selected floating-point hardware includes the NEON extension
23359 (e.g.@: @option{-mfpu=neon}), note that floating-point
23360 operations are not generated by GCC's auto-vectorization pass unless
23361 @option{-funsafe-math-optimizations} is also specified.  This is
23362 because NEON hardware does not fully implement the IEEE 754 standard for
23363 floating-point arithmetic (in particular denormal values are treated as
23364 zero), so the use of NEON instructions may lead to a loss of precision.
23366 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}).
23368 @opindex mfp16-format
23369 @item -mfp16-format=@var{name}
23370 Specify the format of the @code{__fp16} half-precision floating-point type.
23371 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
23372 the default is @samp{none}, in which case the @code{__fp16} type is not
23373 defined.  @xref{Half-Precision}, for more information.
23375 @opindex mstructure-size-boundary
23376 @item -mstructure-size-boundary=@var{n}
23377 The sizes of all structures and unions are rounded up to a multiple
23378 of the number of bits set by this option.  Permissible values are 8, 32
23379 and 64.  The default value varies for different toolchains.  For the COFF
23380 targeted toolchain the default value is 8.  A value of 64 is only allowed
23381 if the underlying ABI supports it.
23383 Specifying a larger number can produce faster, more efficient code, but
23384 can also increase the size of the program.  Different values are potentially
23385 incompatible.  Code compiled with one value cannot necessarily expect to
23386 work with code or libraries compiled with another value, if they exchange
23387 information using structures or unions.
23389 This option is deprecated.
23391 @opindex mabort-on-noreturn
23392 @item -mabort-on-noreturn
23393 Generate a call to the function @code{abort} at the end of a
23394 @code{noreturn} function.  It is executed if the function tries to
23395 return.
23397 @opindex mlong-calls
23398 @opindex mno-long-calls
23399 @item -mlong-calls
23400 @itemx -mno-long-calls
23401 Tells the compiler to perform function calls by first loading the
23402 address of the function into a register and then performing a subroutine
23403 call on this register.  This switch is needed if the target function
23404 lies outside of the 64-megabyte addressing range of the offset-based
23405 version of subroutine call instruction.
23407 Even if this switch is enabled, not all function calls are turned
23408 into long calls.  The heuristic is that static functions, functions
23409 that have the @code{short_call} attribute, functions that are inside
23410 the scope of a @code{#pragma no_long_calls} directive, and functions whose
23411 definitions have already been compiled within the current compilation
23412 unit are not turned into long calls.  The exceptions to this rule are
23413 that weak function definitions, functions with the @code{long_call}
23414 attribute or the @code{section} attribute, and functions that are within
23415 the scope of a @code{#pragma long_calls} directive are always
23416 turned into long calls.
23418 This feature is not enabled by default.  Specifying
23419 @option{-mno-long-calls} restores the default behavior, as does
23420 placing the function calls within the scope of a @code{#pragma
23421 long_calls_off} directive.  Note these switches have no effect on how
23422 the compiler generates code to handle function calls via function
23423 pointers.
23425 @opindex msingle-pic-base
23426 @item -msingle-pic-base
23427 Treat the register used for PIC addressing as read-only, rather than
23428 loading it in the prologue for each function.  The runtime system is
23429 responsible for initializing this register with an appropriate value
23430 before execution begins.
23432 @opindex mpic-register
23433 @item -mpic-register=@var{reg}
23434 Specify the register to be used for PIC addressing.
23435 For standard PIC base case, the default is any suitable register
23436 determined by compiler.  For single PIC base case, the default is
23437 @samp{R9} if target is EABI based or stack-checking is enabled,
23438 otherwise the default is @samp{R10}.
23440 @opindex mpic-data-is-text-relative
23441 @item -mpic-data-is-text-relative
23442 Assume that the displacement between the text and data segments is fixed
23443 at static link time.  This permits using PC-relative addressing
23444 operations to access data known to be in the data segment.  For
23445 non-VxWorks RTP targets, this option is enabled by default.  When
23446 disabled on such targets, it will enable @option{-msingle-pic-base} by
23447 default.
23449 @opindex mpoke-function-name
23450 @item -mpoke-function-name
23451 Write the name of each function into the text section, directly
23452 preceding the function prologue.  The generated code is similar to this:
23454 @smallexample
23455      t0
23456          .ascii "arm_poke_function_name", 0
23457          .align
23458      t1
23459          .word 0xff000000 + (t1 - t0)
23460      arm_poke_function_name
23461          mov     ip, sp
23462          stmfd   sp!, @{fp, ip, lr, pc@}
23463          sub     fp, ip, #4
23464 @end smallexample
23466 When performing a stack backtrace, code can inspect the value of
23467 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
23468 location @code{pc - 12} and the top 8 bits are set, then we know that
23469 there is a function name embedded immediately preceding this location
23470 and has length @code{((pc[-3]) & 0xff000000)}.
23472 @opindex marm
23473 @opindex mthumb
23474 @item -mthumb
23475 @itemx -marm
23477 Select between generating code that executes in ARM and Thumb
23478 states.  The default for most configurations is to generate code
23479 that executes in ARM state, but the default can be changed by
23480 configuring GCC with the @option{--with-mode=}@var{state}
23481 configure option.
23483 You can also override the ARM and Thumb mode for each function
23484 by using the @code{target("thumb")} and @code{target("arm")} function attributes
23485 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
23487 @opindex mflip-thumb
23488 @item -mflip-thumb 
23489 Switch ARM/Thumb modes on alternating functions.
23490 This option is provided for regression testing of mixed Thumb/ARM code
23491 generation, and is not intended for ordinary use in compiling code.
23493 @opindex mtpcs-frame
23494 @item -mtpcs-frame
23495 Generate a stack frame that is compliant with the Thumb Procedure Call
23496 Standard for all non-leaf functions.  (A leaf function is one that does
23497 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
23499 @opindex mtpcs-leaf-frame
23500 @item -mtpcs-leaf-frame
23501 Generate a stack frame that is compliant with the Thumb Procedure Call
23502 Standard for all leaf functions.  (A leaf function is one that does
23503 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
23505 @opindex mcallee-super-interworking
23506 @item -mcallee-super-interworking
23507 Gives all externally visible functions in the file being compiled an ARM
23508 instruction set header which switches to Thumb mode before executing the
23509 rest of the function.  This allows these functions to be called from
23510 non-interworking code.  This option is not valid in AAPCS configurations
23511 because interworking is enabled by default.
23513 @opindex mcaller-super-interworking
23514 @item -mcaller-super-interworking
23515 Allows calls via function pointers (including virtual functions) to
23516 execute correctly regardless of whether the target code has been
23517 compiled for interworking or not.  There is a small overhead in the cost
23518 of executing a function pointer if this option is enabled.  This option
23519 is not valid in AAPCS configurations because interworking is enabled
23520 by default.
23522 @opindex mtp
23523 @item -mtp=@var{name}
23524 Specify the access model for the thread local storage pointer.  The model
23525 @samp{soft} generates calls to @code{__aeabi_read_tp}.  Other accepted
23526 models are @samp{tpidrurw}, @samp{tpidruro} and @samp{tpidrprw} which fetch
23527 the thread pointer from the corresponding system register directly
23528 (supported from the arm6k architecture and later).  These system registers
23529 are accessed through the CP15 co-processor interface and the argument
23530 @samp{cp15} is also accepted as a convenience alias of @samp{tpidruro}.
23531 The argument @samp{auto} uses the best available method for the selected
23532 processor.  The default setting is @samp{auto}.
23534 @opindex mtls-dialect
23535 @item -mtls-dialect=@var{dialect}
23536 Specify the dialect to use for accessing thread local storage.  Two
23537 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}.  The
23538 @samp{gnu} dialect selects the original GNU scheme for supporting
23539 local and global dynamic TLS models.  The @samp{gnu2} dialect
23540 selects the GNU descriptor scheme, which provides better performance
23541 for shared libraries.  The GNU descriptor scheme is compatible with
23542 the original scheme, but does require new assembler, linker and
23543 library support.  Initial and local exec TLS models are unaffected by
23544 this option and always use the original scheme.
23546 @opindex mword-relocations
23547 @item -mword-relocations
23548 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
23549 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
23550 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
23551 is specified. This option conflicts with @option{-mslow-flash-data}.
23553 @opindex mfix-cortex-m3-ldrd
23554 @item -mfix-cortex-m3-ldrd
23555 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
23556 with overlapping destination and base registers are used.  This option avoids
23557 generating these instructions.  This option is enabled by default when
23558 @option{-mcpu=cortex-m3} is specified.
23560 @item -mfix-cortex-a57-aes-1742098
23561 @itemx -mno-fix-cortex-a57-aes-1742098
23562 @itemx -mfix-cortex-a72-aes-1655431
23563 @itemx -mno-fix-cortex-a72-aes-1655431
23564 Enable (disable) mitigation for an erratum on Cortex-A57 and
23565 Cortex-A72 that affects the AES cryptographic instructions.  This
23566 option is enabled by default when either @option{-mcpu=cortex-a57} or
23567 @option{-mcpu=cortex-a72} is specified.
23569 @opindex munaligned-access
23570 @opindex mno-unaligned-access
23571 @item -munaligned-access
23572 @itemx -mno-unaligned-access
23573 Enables (or disables) reading and writing of 16- and 32- bit values
23574 from addresses that are not 16- or 32- bit aligned.  By default
23575 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
23576 ARMv8-M Baseline architectures, and enabled for all other
23577 architectures.  If unaligned access is not enabled then words in packed
23578 data structures are accessed a byte at a time.
23580 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
23581 generated object file to either true or false, depending upon the
23582 setting of this option.  If unaligned access is enabled then the
23583 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
23584 defined.
23586 @opindex mneon-for-64bits
23587 @item -mneon-for-64bits
23588 This option is deprecated and has no effect.
23590 @opindex mslow-flash-data
23591 @item -mslow-flash-data
23592 Assume loading data from flash is slower than fetching instruction.
23593 Therefore literal load is minimized for better performance.
23594 This option is only supported when compiling for ARMv7 M-profile and
23595 off by default. It conflicts with @option{-mword-relocations}.
23597 @opindex masm-syntax-unified
23598 @item -masm-syntax-unified
23599 Assume inline assembler is using unified asm syntax.  The default is
23600 currently off which implies divided syntax.  This option has no impact
23601 on Thumb2. However, this may change in future releases of GCC.
23602 Divided syntax should be considered deprecated.
23604 @opindex mrestrict-it
23605 @item -mrestrict-it
23606 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
23607 IT blocks can only contain a single 16-bit instruction from a select
23608 set of instructions. This option is on by default for ARMv8-A Thumb mode.
23610 @opindex mprint-tune-info
23611 @item -mprint-tune-info
23612 Print CPU tuning information as comment in assembler file.  This is
23613 an option used only for regression testing of the compiler and not
23614 intended for ordinary use in compiling code.  This option is disabled
23615 by default.
23617 @opindex mverbose-cost-dump
23618 @item -mverbose-cost-dump
23619 Enable verbose cost model dumping in the debug dump files.  This option is
23620 provided for use in debugging the compiler.
23622 @opindex mpure-code
23623 @item -mpure-code
23624 Do not allow constant data to be placed in code sections.
23625 Additionally, when compiling for ELF object format give all text sections the
23626 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}.  This option
23627 is only available when generating non-pic code for M-profile targets.
23629 @opindex mcmse
23630 @item -mcmse
23631 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
23632 Development Tools Engineering Specification", which can be found on
23633 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
23635 @opindex mfix-cmse-cve-2021-35465
23636 @item -mfix-cmse-cve-2021-35465
23637 Mitigate against a potential security issue with the @code{VLLDM} instruction
23638 in some M-profile devices when using CMSE (CVE-2021-365465).  This option is
23639 enabled by default when the option @option{-mcpu=} is used with
23640 @code{cortex-m33}, @code{cortex-m35p}, @code{cortex-m52}, @code{cortex-m55},
23641 @code{cortex-m85} or @code{star-mc1}. The option @option{-mno-fix-cmse-cve-2021-35465}
23642 can be used to disable the mitigation.
23644 @opindex mstack-protector-guard
23645 @opindex mstack-protector-guard-offset
23646 @item -mstack-protector-guard=@var{guard}
23647 @itemx -mstack-protector-guard-offset=@var{offset}
23648 Generate stack protection code using canary at @var{guard}.  Supported
23649 locations are @samp{global} for a global canary or @samp{tls} for a
23650 canary accessible via the TLS register. The option
23651 @option{-mstack-protector-guard-offset=} is for use with
23652 @option{-fstack-protector-guard=tls} and not for use in user-land code.
23654 @opindex mfdpic
23655 @opindex mno-fdpic
23656 @item -mfdpic
23657 @itemx -mno-fdpic
23658 Select the FDPIC ABI, which uses 64-bit function descriptors to
23659 represent pointers to functions.  When the compiler is configured for
23660 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
23661 and implies @option{-fPIE} if none of the PIC/PIE-related options is
23662 provided.  On other targets, it only enables the FDPIC-specific code
23663 generation features, and the user should explicitly provide the
23664 PIC/PIE-related options as needed.
23666 Note that static linking is not supported because it would still
23667 involve the dynamic linker when the program self-relocates.  If such
23668 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
23670 The opposite @option{-mno-fdpic} option is useful (and required) to
23671 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
23672 toolchain as the one used to build the userland programs.
23674 @opindex mbranch-protection
23675 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}][+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]]
23676 Enable branch protection features (armv8.1-m.main only).
23677 @samp{none} generate code without branch protection or return address
23678 signing.
23679 @samp{standard[+@var{leaf}]} generate code with all branch protection
23680 features enabled at their standard level.
23681 @samp{pac-ret[+@var{leaf}]} generate code with return address signing
23682 set to its standard level, which is to sign all functions that save
23683 the return address to memory.
23684 @samp{leaf} When return address signing is enabled, also sign leaf
23685 functions even if they do not write the return address to memory.
23686 +@samp{bti} Add landing-pad instructions at the permitted targets of
23687 indirect branch instructions.
23689 If the @samp{+pacbti} architecture extension is not enabled, then all
23690 branch protection and return address signing operations are
23691 constrained to use only the instructions defined in the
23692 architectural-NOP space. The generated code will remain
23693 backwards-compatible with earlier versions of the architecture, but
23694 the additional security can be enabled at run time on processors that
23695 support the @samp{PACBTI} extension.
23697 Branch target enforcement using BTI can only be enabled at runtime if
23698 all code in the application has been compiled with at least
23699 @samp{-mbranch-protection=bti}.
23701 Any setting other than @samp{none} is supported only on armv8-m.main
23702 or later.
23704 The default is to generate code without branch protection or return
23705 address signing.
23707 @end table
23709 @node AVR Options
23710 @subsection AVR Options
23711 @cindex AVR Options
23713 These options are defined for AVR implementations:
23715 @table @gcctabopt
23716 @opindex mmcu
23717 @item -mmcu=@var{mcu}
23718 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
23720 The default for this option is@tie{}@samp{avr2}.
23722 GCC supports the following AVR devices and ISAs:
23724 @include avr-mmcu.texi
23726 @opindex mabsdata
23727 @item -mabsdata
23729 Assume that all data in static storage can be accessed by LDS / STS
23730 instructions.  This option has only an effect on reduced Tiny devices like
23731 ATtiny40.  See also the @code{absdata}
23732 @ref{AVR Variable Attributes,variable attribute}.
23734 @opindex maccumulate-args
23735 @item -maccumulate-args
23736 Accumulate outgoing function arguments and acquire/release the needed
23737 stack space for outgoing function arguments once in function
23738 prologue/epilogue.  Without this option, outgoing arguments are pushed
23739 before calling a function and popped afterwards.
23741 Popping the arguments after the function call can be expensive on
23742 AVR so that accumulating the stack space might lead to smaller
23743 executables because arguments need not be removed from the
23744 stack after such a function call.
23746 This option can lead to reduced code size for functions that perform
23747 several calls to functions that get their arguments on the stack like
23748 calls to printf-like functions.
23750 @opindex mbranch-cost
23751 @item -mbranch-cost=@var{cost}
23752 Set the branch costs for conditional branch instructions to
23753 @var{cost}.  Reasonable values for @var{cost} are small, non-negative
23754 integers. The default branch cost is 0.
23756 @opindex mcall-prologues
23757 @item -mcall-prologues
23758 Functions prologues/epilogues are expanded as calls to appropriate
23759 subroutines.  Code size is smaller.
23761 @opindex mdouble
23762 @opindex mlong-double
23763 @item -mdouble=@var{bits}
23764 @itemx -mlong-double=@var{bits}
23765 Set the size (in bits) of the @code{double} or @code{long double} type,
23766 respectively.  Possible values for @var{bits} are 32 and 64.
23767 Whether or not a specific value for @var{bits} is allowed depends on
23768 the @code{--with-double=} and @code{--with-long-double=}
23769 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
23770 and the same applies for the default values of the options.
23772 @opindex mgas-isr-prologues
23773 @item -mgas-isr-prologues
23774 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
23775 instruction supported by GNU Binutils.
23776 If this option is on, the feature can still be disabled for individual
23777 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
23778 function attribute.  This feature is activated per default
23779 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
23780 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
23782 @opindex mint8
23783 @item -mint8
23784 Assume @code{int} to be 8-bit integer.  This affects the sizes of all types: a
23785 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
23786 and @code{long long} is 4 bytes.  Please note that this option does not
23787 conform to the C standards, but it results in smaller code
23788 size.
23790 @opindex mmain-is-OS_task
23791 @item -mmain-is-OS_task
23792 Do not save registers in @code{main}.  The effect is the same like
23793 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
23794 to @code{main}. It is activated per default if optimization is on.
23796 @opindex mno-interrupts
23797 @item -mno-interrupts
23798 Generated code is not compatible with hardware interrupts.
23799 Code size is smaller.
23801 @opindex mrelax
23802 @item -mrelax
23803 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
23804 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
23805 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
23806 the assembler's command line and the @option{--relax} option to the
23807 linker's command line.
23809 Jump relaxing is performed by the linker because jump offsets are not
23810 known before code is located. Therefore, the assembler code generated by the
23811 compiler is the same, but the instructions in the executable may
23812 differ from instructions in the assembler code.
23814 Relaxing must be turned on if linker stubs are needed, see the
23815 section on @code{EIND} and linker stubs below.
23817 @opindex mrodata-in-ram
23818 @item -mrodata-in-ram
23819 @itemx -mno-rodata-in-ram
23820 Locate the @code{.rodata} sections for read-only data in RAM resp.@:
23821 in program memory.
23822 For most devices, there is no choice and this option acts rather
23823 like an assertion.
23825 Since v14 and for the AVR64* and AVR128* devices, @code{.rodata}
23826 is located in flash memory per default, provided the required GNU Binutils
23827 support (@w{@uref{https://sourceware.org/PR31124,PR31124}}) is available.
23828 In that case, @option{-mrodata-in-ram} can be used to return to the old
23829 layout with @code{.rodata} in RAM.
23831 @opindex mstrict-X
23832 @item -mstrict-X
23833 Use address register @code{X} in a way proposed by the hardware.  This means
23834 that @code{X} is only used in indirect, post-increment or
23835 pre-decrement addressing.
23837 Without this option, the @code{X} register may be used in the same way
23838 as @code{Y} or @code{Z} which then is emulated by additional
23839 instructions.  
23840 For example, loading a value with @code{X+const} addressing with a
23841 small non-negative @code{const < 64} to a register @var{Rn} is
23842 performed as
23844 @example
23845 adiw r26, const   ; X += const
23846 ld   @var{Rn}, X        ; @var{Rn} = *X
23847 sbiw r26, const   ; X -= const
23848 @end example
23850 @opindex mtiny-stack
23851 @item -mtiny-stack
23852 Only change the lower 8@tie{}bits of the stack pointer.
23854 @opindex mfract-convert-truncate
23855 @item -mfract-convert-truncate
23856 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
23858 @opindex nodevicelib
23859 @item -nodevicelib
23860 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
23862 @opindex nodevicespecs
23863 @item -nodevicespecs
23864 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
23865 command line.  The user takes responsibility for supplying the sub-processes
23866 like compiler proper, assembler and linker with appropriate command line
23867 options.  This means that the user has to supply her private device specs
23868 file by means of @option{-specs=@var{path-to-specs-file}}.  There is no
23869 more need for option @option{-mmcu=@var{mcu}}.
23871 This option can also serve as a replacement for the older way of
23872 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
23873 which contains a folder named @code{device-specs} which contains a specs file named
23874 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
23876 @opindex Waddr-space-convert
23877 @opindex Wno-addr-space-convert
23878 @item -Waddr-space-convert
23879 Warn about conversions between address spaces in the case where the
23880 resulting address space is not contained in the incoming address space.
23882 @opindex Wmisspelled-isr
23883 @opindex Wno-misspelled-isr
23884 @item -Wmisspelled-isr
23885 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
23886 Enabled by default.
23887 @end table
23889 @anchor{eind}
23890 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
23891 @cindex @code{EIND}
23892 Pointers in the implementation are 16@tie{}bits wide.
23893 The address of a function or label is represented as word address so
23894 that indirect jumps and calls can target any code address in the
23895 range of 64@tie{}Ki words.
23897 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
23898 bytes of program memory space, there is a special function register called
23899 @code{EIND} that serves as most significant part of the target address
23900 when @code{EICALL} or @code{EIJMP} instructions are used.
23902 Indirect jumps and calls on these devices are handled as follows by
23903 the compiler and are subject to some limitations:
23905 @itemize @bullet
23907 @item
23908 The compiler never sets @code{EIND}.
23910 @item
23911 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
23912 instructions or might read @code{EIND} directly in order to emulate an
23913 indirect call/jump by means of a @code{RET} instruction.
23915 @item
23916 The compiler assumes that @code{EIND} never changes during the startup
23917 code or during the application. In particular, @code{EIND} is not
23918 saved/restored in function or interrupt service routine
23919 prologue/epilogue.
23921 @item
23922 For indirect calls to functions and computed goto, the linker
23923 generates @emph{stubs}. Stubs are jump pads sometimes also called
23924 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
23925 The stub contains a direct jump to the desired address.
23927 @item
23928 Linker relaxation must be turned on so that the linker generates
23929 the stubs correctly in all situations. See the compiler option
23930 @option{-mrelax} and the linker option @option{--relax}.
23931 There are corner cases where the linker is supposed to generate stubs
23932 but aborts without relaxation and without a helpful error message.
23934 @item
23935 The default linker script is arranged for code with @code{EIND = 0}.
23936 If code is supposed to work for a setup with @code{EIND != 0}, a custom
23937 linker script has to be used in order to place the sections whose
23938 name start with @code{.trampolines} into the segment where @code{EIND}
23939 points to.
23941 @item
23942 The startup code from libgcc never sets @code{EIND}.
23943 Notice that startup code is a blend of code from libgcc and AVR-LibC.
23944 For the impact of AVR-LibC on @code{EIND}, see the
23945 @w{@uref{https://www.nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
23947 @item
23948 It is legitimate for user-specific startup code to set up @code{EIND}
23949 early, for example by means of initialization code located in
23950 section @code{.init3}. Such code runs prior to general startup code
23951 that initializes RAM and calls constructors, but after the bit
23952 of startup code from AVR-LibC that sets @code{EIND} to the segment
23953 where the vector table is located.
23954 @example
23955 #include <avr/io.h>
23957 static void
23958 __attribute__((section(".init3"),naked,used,no_instrument_function))
23959 init3_set_eind (void)
23961   __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
23962                   "out %i0,r24" :: "n" (&EIND) : "r24","memory");
23964 @end example
23966 @noindent
23967 The @code{__trampolines_start} symbol is defined in the linker script.
23969 @item
23970 Stubs are generated automatically by the linker if
23971 the following two conditions are met:
23972 @itemize @minus
23974 @item The address of a label is taken by means of the @code{gs} modifier
23975 (short for @emph{generate stubs}) like so:
23976 @example
23977 LDI r24, lo8(gs(@var{func}))
23978 LDI r25, hi8(gs(@var{func}))
23979 @end example
23980 @item The final location of that label is in a code segment
23981 @emph{outside} the segment where the stubs are located.
23982 @end itemize
23984 @item
23985 The compiler emits such @code{gs} modifiers for code labels in the
23986 following situations:
23987 @itemize @minus
23988 @item Taking address of a function or code label.
23989 @item Computed goto.
23990 @item If prologue-save function is used, see @option{-mcall-prologues}
23991 command-line option.
23992 @item Switch/case dispatch tables. If you do not want such dispatch
23993 tables you can specify the @option{-fno-jump-tables} command-line option.
23994 @item C and C++ constructors/destructors called during startup/shutdown.
23995 @item If the tools hit a @code{gs()} modifier explained above.
23996 @end itemize
23998 @item
23999 Jumping to non-symbolic addresses like so is @emph{not} supported:
24001 @example
24002 int main (void)
24004     /* Call function at word address 0x2 */
24005     return ((int(*)(void)) 0x2)();
24007 @end example
24009 Instead, a stub has to be set up, i.e.@: the function has to be called
24010 through a symbol (@code{func_4} in the example):
24012 @example
24013 int main (void)
24015     extern int func_4 (void);
24017     /* Call function at byte address 0x4 */
24018     return func_4();
24020 @end example
24022 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
24023 Alternatively, @code{func_4} can be defined in the linker script.
24024 @end itemize
24026 @anchor{ramp}
24027 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
24028 @cindex @code{RAMPD}
24029 @cindex @code{RAMPX}
24030 @cindex @code{RAMPY}
24031 @cindex @code{RAMPZ}
24032 Some AVR devices support memories larger than the 64@tie{}KiB range
24033 that can be accessed with 16-bit pointers.  To access memory locations
24034 outside this 64@tie{}KiB range, the content of a @code{RAMP}
24035 register is used as high part of the address:
24036 The @code{X}, @code{Y}, @code{Z} address register is concatenated
24037 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
24038 register, respectively, to get a wide address. Similarly,
24039 @code{RAMPD} is used together with direct addressing.
24041 @itemize
24042 @item
24043 The startup code initializes the @code{RAMP} special function
24044 registers with zero.
24046 @item
24047 If a @ref{AVR Named Address Spaces,named address space} other than
24048 generic or @code{__flash} is used, then @code{RAMPZ} is set
24049 as needed before the operation.
24051 @item
24052 If the device supports RAM larger than 64@tie{}KiB and the compiler
24053 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
24054 is reset to zero after the operation.
24056 @item
24057 If the device comes with a specific @code{RAMP} register, the ISR
24058 prologue/epilogue saves/restores that SFR and initializes it with
24059 zero in case the ISR code might (implicitly) use it.
24061 @item
24062 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
24063 If you use inline assembler to read from locations outside the
24064 16-bit address range and change one of the @code{RAMP} registers,
24065 you must reset it to zero after the access.
24067 @end itemize
24069 @anchor{avr-macros}
24070 @subsubsection AVR Built-in Macros
24072 GCC defines several built-in macros so that the user code can test
24073 for the presence or absence of features.  Almost any of the following
24074 built-in macros are deduced from device capabilities and thus
24075 triggered by the @option{-mmcu=} command-line option.
24077 For even more AVR-specific built-in macros see
24078 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
24080 @table @code
24082 @item __AVR_ARCH__
24083 Build-in macro that resolves to a decimal number that identifies the
24084 architecture and depends on the @option{-mmcu=@var{mcu}} option.
24085 Possible values are:
24087 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
24088 @code{4}, @code{5}, @code{51}, @code{6}
24090 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
24091 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
24093 respectively and
24095 @code{100},
24096 @code{102}, @code{103}, @code{104},
24097 @code{105}, @code{106}, @code{107}
24099 for @var{mcu}=@code{avrtiny},
24100 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
24101 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
24102 If @var{mcu} specifies a device, this built-in macro is set
24103 accordingly. For example, with @option{-mmcu=atmega8} the macro is
24104 defined to @code{4}.
24106 @item __AVR_@var{Device}__
24107 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
24108 the device's name. For example, @option{-mmcu=atmega8} defines the
24109 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
24110 @code{__AVR_ATtiny261A__}, etc.
24112 The built-in macros' names follow
24113 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
24114 the device name as from the AVR user manual. The difference between
24115 @var{Device} in the built-in macro and @var{device} in
24116 @option{-mmcu=@var{device}} is that the latter is always lowercase.
24118 If @var{device} is not a device but only a core architecture like
24119 @samp{avr51}, this macro is not defined.
24121 @item __AVR_DEVICE_NAME__
24122 Setting @option{-mmcu=@var{device}} defines this built-in macro to
24123 the device's name. For example, with @option{-mmcu=atmega8} the macro
24124 is defined to @code{atmega8}.
24126 If @var{device} is not a device but only a core architecture like
24127 @samp{avr51}, this macro is not defined.
24129 @item __AVR_XMEGA__
24130 The device / architecture belongs to the XMEGA family of devices.
24132 @item __AVR_HAVE_ELPM__
24133 The device has the @code{ELPM} instruction.
24135 @item __AVR_HAVE_ELPMX__
24136 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
24137 R@var{n},Z+} instructions.
24139 @item __AVR_HAVE_MOVW__
24140 The device has the @code{MOVW} instruction to perform 16-bit
24141 register-register moves.
24143 @item __AVR_HAVE_LPMX__
24144 The device has the @code{LPM R@var{n},Z} and
24145 @code{LPM R@var{n},Z+} instructions.
24147 @item __AVR_HAVE_MUL__
24148 The device has a hardware multiplier. 
24150 @item __AVR_HAVE_JMP_CALL__
24151 The device has the @code{JMP} and @code{CALL} instructions.
24152 This is the case for devices with more than 8@tie{}KiB of program
24153 memory.
24155 @item __AVR_HAVE_EIJMP_EICALL__
24156 @itemx __AVR_3_BYTE_PC__
24157 The device has the @code{EIJMP} and @code{EICALL} instructions.
24158 This is the case for devices with more than 128@tie{}KiB of program memory.
24159 This also means that the program counter
24160 (PC) is 3@tie{}bytes wide.
24162 @item __AVR_2_BYTE_PC__
24163 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
24164 with up to 128@tie{}KiB of program memory.
24166 @item __AVR_HAVE_8BIT_SP__
24167 @itemx __AVR_HAVE_16BIT_SP__
24168 The stack pointer (SP) register is treated as 8-bit respectively
24169 16-bit register by the compiler.
24170 The definition of these macros is affected by @option{-mtiny-stack}.
24172 @item __AVR_HAVE_SPH__
24173 @itemx __AVR_SP8__
24174 The device has the SPH (high part of stack pointer) special function
24175 register or has an 8-bit stack pointer, respectively.
24176 The definition of these macros is affected by @option{-mmcu=} and
24177 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
24178 by @option{-msp8}.
24180 @item __AVR_HAVE_RAMPD__
24181 @itemx __AVR_HAVE_RAMPX__
24182 @itemx __AVR_HAVE_RAMPY__
24183 @itemx __AVR_HAVE_RAMPZ__
24184 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
24185 @code{RAMPZ} special function register, respectively.
24187 @item __NO_INTERRUPTS__
24188 This macro reflects the @option{-mno-interrupts} command-line option.
24190 @item __AVR_ERRATA_SKIP__
24191 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
24192 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
24193 instructions because of a hardware erratum.  Skip instructions are
24194 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
24195 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
24196 set.
24198 @item __AVR_ISA_RMW__
24199 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
24201 @item __AVR_SFR_OFFSET__=@var{offset}
24202 Instructions that can address I/O special function registers directly
24203 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
24204 address as if addressed by an instruction to access RAM like @code{LD}
24205 or @code{STS}. This offset depends on the device architecture and has
24206 to be subtracted from the RAM address in order to get the
24207 respective I/O@tie{}address.
24209 @item __AVR_SHORT_CALLS__
24210 The @option{-mshort-calls} command line option is set.
24212 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
24213 Some devices support reading from flash memory by means of @code{LD*}
24214 instructions.  The flash memory is seen in the data address space
24215 at an offset of @code{__AVR_PM_BASE_ADDRESS__}.  If this macro
24216 is not defined, this feature is not available.  If defined,
24217 the address space is linear and there is no need to put
24218 @code{.rodata} into RAM.  This is handled by the default linker
24219 description file, and is currently available for
24220 @code{avrtiny} and @code{avrxmega3}.  Even more convenient,
24221 there is no need to use address spaces like @code{__flash} or
24222 features like attribute @code{progmem} and @code{pgm_read_*}.
24224 @item __AVR_HAVE_FLMAP__
24225 This macro is defined provided the following conditions are met:
24226 @itemize @bullet
24227 @item The device has the @code{NVMCTRL_CTRLB.FLMAP} bitfield.
24228 This applies to the AVR64* and AVR128* devices.
24229 @item It's not known at assembler-time which emulation will be used.
24230 @end itemize
24231 This implies the compiler was configured with GNU Binutils that implement
24232 @w{@uref{https://sourceware.org/PR31124,PR31124}}.
24234 @item __AVR_RODATA_IN_RAM__
24235 This macro is undefined when the code is compiled for a core architecture.
24237 When the code is compiled for a device, the macro is defined to@tie{}1
24238 when the @code{.rodata} sections for read-only data is located in RAM;
24239 and defined to@tie{}0, otherwise.
24241 @item __WITH_AVRLIBC__
24242 The compiler is configured to be used together with AVR-Libc.
24243 See the @option{--with-avrlibc} configure option.
24245 @item __HAVE_DOUBLE_MULTILIB__
24246 Defined if @option{-mdouble=} acts as a multilib option.
24248 @item __HAVE_DOUBLE32__
24249 @itemx __HAVE_DOUBLE64__
24250 Defined if the compiler supports 32-bit double resp. 64-bit double.
24251 The actual layout is specified by option @option{-mdouble=}.
24253 @item __DEFAULT_DOUBLE__
24254 The size in bits of @code{double} if @option{-mdouble=} is not set.
24255 To test the layout of @code{double} in a program, use the built-in
24256 macro @code{__SIZEOF_DOUBLE__}.
24258 @item __HAVE_LONG_DOUBLE32__
24259 @itemx __HAVE_LONG_DOUBLE64__
24260 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
24261 @itemx __DEFAULT_LONG_DOUBLE__
24262 Same as above, but for @code{long double} instead of @code{double}.
24264 @item __WITH_DOUBLE_COMPARISON__
24265 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
24266 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
24267 and is defined to @code{2} or @code{3}.
24269 @item __WITH_LIBF7_LIBGCC__
24270 @itemx __WITH_LIBF7_MATH__
24271 @itemx __WITH_LIBF7_MATH_SYMBOLS__
24272 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
24273 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
24275 @end table
24277 @subsubsection AVR Internal Options
24278 The following options are used internally by the compiler and to communicate
24279 between device specs files and the compiler proper. You don't need to set these
24280 options by hand, in particular they are not optimization options.
24281 Using these options in the wrong way may lead to sub-optimal or wrong code.
24282 They are documented for completeness, and in order to get a better
24283 understanding of
24284 @w{@uref{https://gcc.gnu.org/wiki/avr-gcc#spec-files,device specs}}
24285 files.
24287 @table @gcctabopt
24289 @opindex mn-flash
24290 @item -mn-flash=@var{num}
24291 Assume that the flash memory has a size of @var{num} times 64@tie{}KiB.
24292 This determines which @code{__flash@var{N}} address spaces are available.
24294 @opindex mflmap
24295 @item -mflmap
24296 The device has the @code{FLMAP} bit field located in special function
24297 register @code{NVMCTRL_CTRLB}.
24299 @opindex mrmw
24300 @item -mrmw
24301 Assume that the device supports the Read-Modify-Write
24302 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
24304 @opindex mshort-calls
24305 @item -mshort-calls
24307 Assume that @code{RJMP} and @code{RCALL} can target the whole
24308 program memory. This option is used for multilib generation and selection
24309 for the devices from architecture @code{avrxmega3}.
24311 @opindex mskip-bug
24312 @item -mskip-bug
24314 Generate code without skips (@code{CPSE}, @code{SBRS},
24315 @code{SBRC}, @code{SBIS}, @code{SBIC}) over 32-bit instructions.
24317 @opindex msp8
24318 @item -msp8
24319 Treat the stack pointer register as an 8-bit register,
24320 i.e.@: assume the high byte of the stack pointer is zero.
24321 This option is used by the compiler to select and
24322 build multilibs for architectures @code{avr2} and @code{avr25}.
24323 These architectures mix devices with and without @code{SPH}.
24325 @end table
24327 @node Blackfin Options
24328 @subsection Blackfin Options
24329 @cindex Blackfin Options
24331 @table @gcctabopt
24332 @opindex mcpu=
24333 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
24334 Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
24335 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
24336 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
24337 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
24338 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
24339 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
24340 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
24341 @samp{bf561}, @samp{bf592}.
24343 The optional @var{sirevision} specifies the silicon revision of the target
24344 Blackfin processor.  Any workarounds available for the targeted silicon revision
24345 are enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
24346 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
24347 are enabled.  The @code{__SILICON_REVISION__} macro is defined to two
24348 hexadecimal digits representing the major and minor numbers in the silicon
24349 revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
24350 is not defined.  If @var{sirevision} is @samp{any}, the
24351 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
24352 If this optional @var{sirevision} is not used, GCC assumes the latest known
24353 silicon revision of the targeted Blackfin processor.
24355 GCC defines a preprocessor macro for the specified @var{cpu}.
24356 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
24357 provided by libgloss to be linked in if @option{-msim} is not given.
24359 Without this option, @samp{bf532} is used as the processor by default.
24361 Note that support for @samp{bf561} is incomplete.  For @samp{bf561},
24362 only the preprocessor macro is defined.
24364 @opindex msim
24365 @item -msim
24366 Specifies that the program will be run on the simulator.  This causes
24367 the simulator BSP provided by libgloss to be linked in.  This option
24368 has effect only for @samp{bfin-elf} toolchain.
24369 Certain other options, such as @option{-mid-shared-library} and
24370 @option{-mfdpic}, imply @option{-msim}.
24372 @opindex momit-leaf-frame-pointer
24373 @item -momit-leaf-frame-pointer
24374 Don't keep the frame pointer in a register for leaf functions.  This
24375 avoids the instructions to save, set up and restore frame pointers and
24376 makes an extra register available in leaf functions.
24378 @opindex mspecld-anomaly
24379 @item -mspecld-anomaly
24380 When enabled, the compiler ensures that the generated code does not
24381 contain speculative loads after jump instructions. If this option is used,
24382 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
24384 @opindex mno-specld-anomaly
24385 @opindex mspecld-anomaly
24386 @item -mno-specld-anomaly
24387 Don't generate extra code to prevent speculative loads from occurring.
24389 @opindex mcsync-anomaly
24390 @item -mcsync-anomaly
24391 When enabled, the compiler ensures that the generated code does not
24392 contain CSYNC or SSYNC instructions too soon after conditional branches.
24393 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
24395 @opindex mno-csync-anomaly
24396 @opindex mcsync-anomaly
24397 @item -mno-csync-anomaly
24398 Don't generate extra code to prevent CSYNC or SSYNC instructions from
24399 occurring too soon after a conditional branch.
24401 @opindex mlow64k
24402 @item -mlow64k
24403 When enabled, the compiler is free to take advantage of the knowledge that
24404 the entire program fits into the low 64k of memory.
24406 @opindex mno-low64k
24407 @item -mno-low64k
24408 Assume that the program is arbitrarily large.  This is the default.
24410 @opindex mstack-check-l1
24411 @item -mstack-check-l1
24412 Do stack checking using information placed into L1 scratchpad memory by the
24413 uClinux kernel.
24415 @opindex mid-shared-library
24416 @item -mid-shared-library
24417 Generate code that supports shared libraries via the library ID method.
24418 This allows for execute in place and shared libraries in an environment
24419 without virtual memory management.  This option implies @option{-fPIC}.
24420 With a @samp{bfin-elf} target, this option implies @option{-msim}.
24422 @opindex mno-id-shared-library
24423 @opindex mid-shared-library
24424 @item -mno-id-shared-library
24425 Generate code that doesn't assume ID-based shared libraries are being used.
24426 This is the default.
24428 @opindex mleaf-id-shared-library
24429 @item -mleaf-id-shared-library
24430 Generate code that supports shared libraries via the library ID method,
24431 but assumes that this library or executable won't link against any other
24432 ID shared libraries.  That allows the compiler to use faster code for jumps
24433 and calls.
24435 @opindex mno-leaf-id-shared-library
24436 @opindex mleaf-id-shared-library
24437 @item -mno-leaf-id-shared-library
24438 Do not assume that the code being compiled won't link against any ID shared
24439 libraries.  Slower code is generated for jump and call insns.
24441 @opindex mshared-library-id
24442 @item -mshared-library-id=n
24443 Specifies the identification number of the ID-based shared library being
24444 compiled.  Specifying a value of 0 generates more compact code; specifying
24445 other values forces the allocation of that number to the current
24446 library but is no more space- or time-efficient than omitting this option.
24448 @opindex msep-data
24449 @item -msep-data
24450 Generate code that allows the data segment to be located in a different
24451 area of memory from the text segment.  This allows for execute in place in
24452 an environment without virtual memory management by eliminating relocations
24453 against the text section.
24455 @opindex mno-sep-data
24456 @opindex msep-data
24457 @item -mno-sep-data
24458 Generate code that assumes that the data segment follows the text segment.
24459 This is the default.
24461 @opindex mlong-calls
24462 @opindex mno-long-calls
24463 @item -mlong-calls
24464 @itemx -mno-long-calls
24465 Tells the compiler to perform function calls by first loading the
24466 address of the function into a register and then performing a subroutine
24467 call on this register.  This switch is needed if the target function
24468 lies outside of the 24-bit addressing range of the offset-based
24469 version of subroutine call instruction.
24471 This feature is not enabled by default.  Specifying
24472 @option{-mno-long-calls} restores the default behavior.  Note these
24473 switches have no effect on how the compiler generates code to handle
24474 function calls via function pointers.
24476 @opindex mfast-fp
24477 @item -mfast-fp
24478 Link with the fast floating-point library. This library relaxes some of
24479 the IEEE floating-point standard's rules for checking inputs against
24480 Not-a-Number (NAN), in the interest of performance.
24482 @opindex minline-plt
24483 @item -minline-plt
24484 Enable inlining of PLT entries in function calls to functions that are
24485 not known to bind locally.  It has no effect without @option{-mfdpic}.
24487 @opindex mmulticore
24488 @item -mmulticore
24489 Build a standalone application for multicore Blackfin processors. 
24490 This option causes proper start files and link scripts supporting 
24491 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 
24492 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 
24494 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
24495 selects the one-application-per-core programming model.  Without
24496 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
24497 programming model is used. In this model, the main function of Core B
24498 should be named as @code{coreb_main}.
24500 If this option is not used, the single-core application programming
24501 model is used.
24503 @opindex mcorea
24504 @item -mcorea
24505 Build a standalone application for Core A of BF561 when using
24506 the one-application-per-core programming model. Proper start files
24507 and link scripts are used to support Core A, and the macro
24508 @code{__BFIN_COREA} is defined.
24509 This option can only be used in conjunction with @option{-mmulticore}.
24511 @opindex mcoreb
24512 @item -mcoreb
24513 Build a standalone application for Core B of BF561 when using
24514 the one-application-per-core programming model. Proper start files
24515 and link scripts are used to support Core B, and the macro
24516 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
24517 should be used instead of @code{main}. 
24518 This option can only be used in conjunction with @option{-mmulticore}.
24520 @opindex msdram
24521 @item -msdram
24522 Build a standalone application for SDRAM. Proper start files and
24523 link scripts are used to put the application into SDRAM, and the macro
24524 @code{__BFIN_SDRAM} is defined.
24525 The loader should initialize SDRAM before loading the application.
24527 @opindex micplb
24528 @item -micplb
24529 Assume that ICPLBs are enabled at run time.  This has an effect on certain
24530 anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
24531 are enabled; for standalone applications the default is off.
24532 @end table
24534 @node C6X Options
24535 @subsection C6X Options
24536 @cindex C6X Options
24538 @table @gcctabopt
24539 @opindex march
24540 @item -march=@var{name}
24541 This specifies the name of the target architecture.  GCC uses this
24542 name to determine what kind of instructions it can emit when generating
24543 assembly code.  Permissible names are: @samp{c62x},
24544 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
24546 @opindex mbig-endian
24547 @item -mbig-endian
24548 Generate code for a big-endian target.
24550 @opindex mlittle-endian
24551 @item -mlittle-endian
24552 Generate code for a little-endian target.  This is the default.
24554 @opindex msim
24555 @item -msim
24556 Choose startup files and linker script suitable for the simulator.
24558 @opindex msdata=default
24559 @item -msdata=default
24560 Put small global and static data in the @code{.neardata} section,
24561 which is pointed to by register @code{B14}.  Put small uninitialized
24562 global and static data in the @code{.bss} section, which is adjacent
24563 to the @code{.neardata} section.  Put small read-only data into the
24564 @code{.rodata} section.  The corresponding sections used for large
24565 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
24567 @opindex msdata=all
24568 @item -msdata=all
24569 Put all data, not just small objects, into the sections reserved for
24570 small data, and use addressing relative to the @code{B14} register to
24571 access them.
24573 @opindex msdata=none
24574 @item -msdata=none
24575 Make no use of the sections reserved for small data, and use absolute
24576 addresses to access all data.  Put all initialized global and static
24577 data in the @code{.fardata} section, and all uninitialized data in the
24578 @code{.far} section.  Put all constant data into the @code{.const}
24579 section.
24580 @end table
24582 @node CRIS Options
24583 @subsection CRIS Options
24584 @cindex CRIS Options
24586 These options are defined specifically for the CRIS ports.
24588 @table @gcctabopt
24589 @opindex march
24590 @opindex mcpu
24591 @item -march=@var{architecture-type}
24592 @itemx -mcpu=@var{architecture-type}
24593 Generate code for the specified architecture.  The choices for
24594 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
24595 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
24596 Default is @samp{v0}.
24598 @opindex mtune
24599 @item -mtune=@var{architecture-type}
24600 Tune to @var{architecture-type} everything applicable about the generated
24601 code, except for the ABI and the set of available instructions.  The
24602 choices for @var{architecture-type} are the same as for
24603 @option{-march=@var{architecture-type}}.
24605 @opindex mmax-stack-frame
24606 @item -mmax-stack-frame=@var{n}
24607 Warn when the stack frame of a function exceeds @var{n} bytes.
24609 @opindex metrax4
24610 @opindex metrax100
24611 @item -metrax4
24612 @itemx -metrax100
24613 The options @option{-metrax4} and @option{-metrax100} are synonyms for
24614 @option{-march=v3} and @option{-march=v8} respectively.
24616 @opindex mmul-bug-workaround
24617 @opindex mno-mul-bug-workaround
24618 @item -mmul-bug-workaround
24619 @itemx -mno-mul-bug-workaround
24620 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
24621 models where it applies.  This option is disabled by default.
24623 @opindex mpdebug
24624 @item -mpdebug
24625 Enable CRIS-specific verbose debug-related information in the assembly
24626 code.  This option also has the effect of turning off the @samp{#NO_APP}
24627 formatted-code indicator to the assembler at the beginning of the
24628 assembly file.
24630 @opindex mcc-init
24631 @item -mcc-init
24632 Do not use condition-code results from previous instruction; always emit
24633 compare and test instructions before use of condition codes.
24635 @opindex mno-side-effects
24636 @opindex mside-effects
24637 @item -mno-side-effects
24638 Do not emit instructions with side effects in addressing modes other than
24639 post-increment.
24641 @opindex mstack-align
24642 @opindex mno-stack-align
24643 @opindex mdata-align
24644 @opindex mno-data-align
24645 @opindex mconst-align
24646 @opindex mno-const-align
24647 @item -mstack-align
24648 @itemx -mno-stack-align
24649 @itemx -mdata-align
24650 @itemx -mno-data-align
24651 @itemx -mconst-align
24652 @itemx -mno-const-align
24653 These options (@samp{no-} options) arrange (eliminate arrangements) for the
24654 stack frame, individual data and constants to be aligned for the maximum
24655 single data access size for the chosen CPU model.  The default is to
24656 arrange for 32-bit alignment.  ABI details such as structure layout are
24657 not affected by these options.
24659 @opindex m32-bit
24660 @opindex m16-bit
24661 @opindex m8-bit
24662 @item -m32-bit
24663 @itemx -m16-bit
24664 @itemx -m8-bit
24665 Similar to the stack- data- and const-align options above, these options
24666 arrange for stack frame, writable data and constants to all be 32-bit,
24667 16-bit or 8-bit aligned.  The default is 32-bit alignment.
24669 @opindex mno-prologue-epilogue
24670 @opindex mprologue-epilogue
24671 @item -mno-prologue-epilogue
24672 @itemx -mprologue-epilogue
24673 With @option{-mno-prologue-epilogue}, the normal function prologue and
24674 epilogue which set up the stack frame are omitted and no return
24675 instructions or return sequences are generated in the code.  Use this
24676 option only together with visual inspection of the compiled code: no
24677 warnings or errors are generated when call-saved registers must be saved,
24678 or storage for local variables needs to be allocated.
24680 @opindex melf
24681 @item -melf
24682 Legacy no-op option.
24684 @opindex sim
24685 @item -sim
24686 This option arranges
24687 to link with input-output functions from a simulator library.  Code,
24688 initialized data and zero-initialized data are allocated consecutively.
24690 @opindex sim2
24691 @item -sim2
24692 Like @option{-sim}, but pass linker options to locate initialized data at
24693 0x40000000 and zero-initialized data at 0x80000000.
24694 @end table
24696 @node C-SKY Options
24697 @subsection C-SKY Options
24698 @cindex C-SKY Options
24700 GCC supports these options when compiling for C-SKY V2 processors.
24702 @table @gcctabopt
24704 @opindex march=
24705 @item -march=@var{arch}
24706 Specify the C-SKY target architecture.  Valid values for @var{arch} are:
24707 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
24708 The default is @samp{ck810}.
24710 @opindex mcpu=
24711 @item -mcpu=@var{cpu}
24712 Specify the C-SKY target processor.  Valid values for @var{cpu} are:
24713 @samp{ck801}, @samp{ck801t},
24714 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
24715 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
24716 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
24717 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
24718 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
24719 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
24720 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
24721 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
24722 @samp{ck803eftr1}, @samp{ck803efhtr1},
24723 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
24724 @samp{ck803sef}, @samp{ck803seft},
24725 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
24726 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
24727 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
24728 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
24730 @opindex mbig-endian
24731 @opindex EB
24732 @opindex mlittle-endian
24733 @opindex EL
24734 @item -mbig-endian
24735 @itemx -EB
24736 @itemx -mlittle-endian
24737 @itemx -EL
24739 Select big- or little-endian code.  The default is little-endian.
24741 @opindex mfloat-abi
24742 @item -mfloat-abi=@var{name}
24743 Specifies which floating-point ABI to use.  Permissible values
24744 are: @samp{soft}, @samp{softfp} and @samp{hard}.
24746 Specifying @samp{soft} causes GCC to generate output containing
24747 library calls for floating-point operations.
24748 @samp{softfp} allows the generation of code using hardware floating-point
24749 instructions, but still uses the soft-float calling conventions.
24750 @samp{hard} allows generation of floating-point instructions
24751 and uses FPU-specific calling conventions.
24753 The default depends on the specific target configuration.  Note that
24754 the hard-float and soft-float ABIs are not link-compatible; you must
24755 compile your entire program with the same ABI, and link with a
24756 compatible set of libraries.
24758 @opindex mhard-float
24759 @opindex msoft-float
24760 @item -mhard-float
24761 @itemx -msoft-float
24763 Select hardware or software floating-point implementations.
24764 The default is soft float.
24766 @opindex mdouble-float
24767 @item -mdouble-float
24768 @itemx -mno-double-float
24769 When @option{-mhard-float} is in effect, enable generation of
24770 double-precision float instructions.  This is the default except
24771 when compiling for CK803.
24773 @opindex mfdivdu
24774 @item -mfdivdu
24775 @itemx -mno-fdivdu
24776 When @option{-mhard-float} is in effect, enable generation of
24777 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
24778 This is the default except when compiling for CK803.
24780 @opindex mfpu=
24781 @item -mfpu=@var{fpu}
24782 Select the floating-point processor.  This option can only be used with
24783 @option{-mhard-float}.
24784 Values for @var{fpu} are
24785 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
24786 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
24787 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
24789 @opindex melrw
24790 @item -melrw
24791 @itemx -mno-elrw
24792 Enable the extended @code{lrw} instruction.  This option defaults to on
24793 for CK801 and off otherwise.
24795 @opindex mistack
24796 @item -mistack
24797 @itemx -mno-istack
24798 Enable interrupt stack instructions; the default is off.
24800 The @option{-mistack} option is required to handle the
24801 @code{interrupt} and @code{isr} function attributes
24802 (@pxref{C-SKY Function Attributes}).
24804 @opindex mmp
24805 @item -mmp
24806 Enable multiprocessor instructions; the default is off.
24808 @opindex mcp
24809 @item -mcp
24810 Enable coprocessor instructions; the default is off.
24812 @opindex mcache
24813 @item -mcache
24814 Enable coprocessor instructions; the default is off.
24816 @opindex msecurity
24817 @item -msecurity
24818 Enable C-SKY security instructions; the default is off.
24820 @opindex mtrust
24821 @item -mtrust
24822 Enable C-SKY trust instructions; the default is off.
24824 @opindex mdsp
24825 @opindex medsp
24826 @opindex mvdsp
24827 @item -mdsp
24828 @itemx -medsp
24829 @itemx -mvdsp
24830 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
24831 All of these options default to off.
24833 @opindex mdiv
24834 @item -mdiv
24835 @itemx -mno-div
24836 Generate divide instructions.  Default is off.
24838 @opindex msmart
24839 @item -msmart
24840 @itemx -mno-smart
24841 Generate code for Smart Mode, using only registers numbered 0-7 to allow
24842 use of 16-bit instructions.  This option is ignored for CK801 where this
24843 is the required behavior, and it defaults to on for CK802.
24844 For other targets, the default is off.
24846 @opindex mhigh-registers
24847 @item -mhigh-registers
24848 @itemx -mno-high-registers
24849 Generate code using the high registers numbered 16-31.  This option
24850 is not supported on CK801, CK802, or CK803, and is enabled by default
24851 for other processors.
24853 @opindex manchor
24854 @item -manchor
24855 @itemx -mno-anchor
24856 Generate code using global anchor symbol addresses.
24858 @opindex mpushpop
24859 @item -mpushpop
24860 @itemx -mno-pushpop
24861 Generate code using @code{push} and @code{pop} instructions.  This option
24862 defaults to on.
24864 @opindex mmultiple-stld
24865 @item -mmultiple-stld
24866 @itemx -mstm
24867 @itemx -mno-multiple-stld
24868 @itemx -mno-stm
24869 Generate code using @code{stm} and @code{ldm} instructions.  This option
24870 isn't supported on CK801 but is enabled by default on other processors.
24872 @opindex mconstpool
24873 @item -mconstpool
24874 @itemx -mno-constpool
24875 Create constant pools in the compiler instead of deferring it to the
24876 assembler.  This option is the default and required for correct code
24877 generation on CK801 and CK802, and is optional on other processors.
24879 @opindex mstack-size
24880 @item -mstack-size
24881 @item -mno-stack-size
24882 Emit @code{.stack_size} directives for each function in the assembly
24883 output.  This option defaults to off.
24885 @opindex mccrt
24886 @item -mccrt
24887 @itemx -mno-ccrt
24888 Generate code for the C-SKY compiler runtime instead of libgcc.  This
24889 option defaults to off.
24891 @opindex mbranch-cost=
24892 @item -mbranch-cost=@var{n}
24893 Set the branch costs to roughly @code{n} instructions.  The default is 1.
24895 @opindex msched-prolog
24896 @item -msched-prolog
24897 @itemx -mno-sched-prolog
24898 Permit scheduling of function prologue and epilogue sequences.  Using
24899 this option can result in code that is not compliant with the C-SKY V2 ABI
24900 prologue requirements and that cannot be debugged or backtraced.
24901 It is disabled by default.
24903 @opindex msim
24904 @item -msim
24905 Links the library libsemi.a which is in compatible with simulator. Applicable
24906 to ELF compiler only.
24908 @end table
24910 @node Darwin Options
24911 @subsection Darwin Options
24912 @cindex Darwin options
24914 These options are defined for all architectures running the Darwin operating
24915 system.
24917 FSF GCC on Darwin does not create ``fat'' object files; it creates
24918 an object file for the single architecture that GCC was built to
24919 target.  Apple's GCC on Darwin does create ``fat'' files if multiple
24920 @option{-arch} options are used; it does so by running the compiler or
24921 linker multiple times and joining the results together with
24922 @file{lipo}.
24924 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
24925 @samp{i686}) is determined by the flags that specify the ISA
24926 that GCC is targeting, like @option{-mcpu} or @option{-march}.  The
24927 @option{-force_cpusubtype_ALL} option can be used to override this.
24929 The Darwin tools vary in their behavior when presented with an ISA
24930 mismatch.  The assembler, @file{as}, only permits instructions to
24931 be used that are valid for the subtype of the file it is generating,
24932 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
24933 The linker for shared libraries, @file{/usr/bin/libtool}, fails
24934 and prints an error if asked to create a shared library with a less
24935 restrictive subtype than its input files (for instance, trying to put
24936 a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
24937 for executables, @command{ld}, quietly gives the executable the most
24938 restrictive subtype of any of its input files.
24940 @table @gcctabopt
24941 @opindex F
24942 @item -F@var{dir}
24943 Add the framework directory @var{dir} to the head of the list of
24944 directories to be searched for header files.  These directories are
24945 interleaved with those specified by @option{-I} options and are
24946 scanned in a left-to-right order.
24948 A framework directory is a directory with frameworks in it.  A
24949 framework is a directory with a @file{Headers} and/or
24950 @file{PrivateHeaders} directory contained directly in it that ends
24951 in @file{.framework}.  The name of a framework is the name of this
24952 directory excluding the @file{.framework}.  Headers associated with
24953 the framework are found in one of those two directories, with
24954 @file{Headers} being searched first.  A subframework is a framework
24955 directory that is in a framework's @file{Frameworks} directory.
24956 Includes of subframework headers can only appear in a header of a
24957 framework that contains the subframework, or in a sibling subframework
24958 header.  Two subframeworks are siblings if they occur in the same
24959 framework.  A subframework should not have the same name as a
24960 framework; a warning is issued if this is violated.  Currently a
24961 subframework cannot have subframeworks; in the future, the mechanism
24962 may be extended to support this.  The standard frameworks can be found
24963 in @file{/System/Library/Frameworks} and
24964 @file{/Library/Frameworks}.  An example include looks like
24965 @code{#include <Framework/header.h>}, where @file{Framework} denotes
24966 the name of the framework and @file{header.h} is found in the
24967 @file{PrivateHeaders} or @file{Headers} directory.
24969 @opindex iframework
24970 @item -iframework@var{dir}
24971 Like @option{-F} except the directory is a treated as a system
24972 directory.  The main difference between this @option{-iframework} and
24973 @option{-F} is that with @option{-iframework} the compiler does not
24974 warn about constructs contained within header files found via
24975 @var{dir}.  This option is valid only for the C family of languages.
24977 @opindex gused
24978 @item -gused
24979 Emit debugging information for symbols that are used.  For stabs
24980 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
24981 This is by default ON@.
24983 @opindex gfull
24984 @item -gfull
24985 Emit debugging information for all symbols and types.
24987 @opindex fconstant-cfstrings
24988 @item -fconstant-cfstrings
24989 The @option{-fconstant-cfstrings} is an alias for @option{-mconstant-cfstrings}.
24991 @opindex mconstant-cfstrings
24992 @item -mconstant-cfstrings
24993 When the NeXT runtime is being used (the default on these systems), override
24994 any @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"}
24995 literals to be laid out as constant CoreFoundation strings.
24997 @opindex mmacosx-version-min
24998 @item -mmacosx-version-min=@var{version}
24999 The earliest version of MacOS X that this executable will run on is
25000 @var{version}.  Typical values supported for @var{version} include @code{12},
25001 @code{10.12}, and @code{10.5.8}.
25003 If the compiler was built to use the system's headers by default,
25004 then the default for this option is the system version on which the
25005 compiler is running, otherwise the default is to make choices that
25006 are compatible with as many systems and code bases as possible.
25008 @opindex mkernel
25009 @item -mkernel
25010 Enable kernel development mode.  The @option{-mkernel} option sets
25011 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
25012 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
25013 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
25014 applicable.  This mode also sets @option{-mno-altivec},
25015 @option{-msoft-float}, @option{-fno-builtin} and
25016 @option{-mlong-branch} for PowerPC targets.
25018 @opindex mone-byte-bool
25019 @item -mone-byte-bool
25020 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
25021 By default @code{sizeof(bool)} is @code{4} when compiling for
25022 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
25023 option has no effect on x86.
25025 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
25026 to generate code that is not binary compatible with code generated
25027 without that switch.  Using this switch may require recompiling all
25028 other modules in a program, including system libraries.  Use this
25029 switch to conform to a non-default data model.
25031 @opindex mfix-and-continue
25032 @opindex ffix-and-continue
25033 @opindex findirect-data
25034 @item -mfix-and-continue
25035 @itemx -ffix-and-continue
25036 @itemx -findirect-data
25037 Generate code suitable for fast turnaround development, such as to
25038 allow GDB to dynamically load @file{.o} files into already-running
25039 programs.  @option{-findirect-data} and @option{-ffix-and-continue}
25040 are provided for backwards compatibility.
25042 @opindex all_load
25043 @item -all_load
25044 Loads all members of static archive libraries.
25045 See man ld(1) for more information.
25047 @opindex arch_errors_fatal
25048 @item -arch_errors_fatal
25049 Cause the errors having to do with files that have the wrong architecture
25050 to be fatal.
25052 @opindex bind_at_load
25053 @item -bind_at_load
25054 Causes the output file to be marked such that the dynamic linker will
25055 bind all undefined references when the file is loaded or launched.
25057 @opindex bundle
25058 @item -bundle
25059 Produce a Mach-o bundle format file.
25060 See man ld(1) for more information.
25062 @opindex bundle_loader
25063 @item -bundle_loader @var{executable}
25064 This option specifies the @var{executable} that will load the build
25065 output file being linked.  See man ld(1) for more information.
25067 @opindex dynamiclib
25068 @item -dynamiclib
25069 When passed this option, GCC produces a dynamic library instead of
25070 an executable when linking, using the Darwin @file{libtool} command.
25072 @opindex force_cpusubtype_ALL
25073 @item -force_cpusubtype_ALL
25074 This causes GCC's output file to have the @samp{ALL} subtype, instead of
25075 one controlled by the @option{-mcpu} or @option{-march} option.
25077 @opindex nodefaultrpaths
25078 @item -nodefaultrpaths
25079 Do not add default run paths for the compiler library directories to
25080 executables, modules or dynamic libraries. On macOS 10.5 and later,
25081 the embedded runpath is added by default unless the user adds
25082 @option{-nodefaultrpaths} to the link line. Run paths are needed
25083 (and therefore enforced) to build on macOS version 10.11 or later.
25085 @item -allowable_client  @var{client_name}
25086 @itemx -client_name
25087 @itemx -compatibility_version
25088 @itemx -current_version
25089 @itemx -dead_strip
25090 @itemx -dependency-file
25091 @itemx -dylib_file
25092 @itemx -dylinker_install_name
25093 @itemx -dynamic
25094 @itemx -exported_symbols_list
25095 @itemx -filelist
25096 @need 800
25097 @itemx -flat_namespace
25098 @itemx -force_flat_namespace
25099 @itemx -headerpad_max_install_names
25100 @itemx -image_base
25101 @itemx -init
25102 @itemx -install_name
25103 @itemx -keep_private_externs
25104 @itemx -multi_module
25105 @itemx -multiply_defined
25106 @itemx -multiply_defined_unused
25107 @need 800
25108 @itemx -noall_load
25109 @itemx -no_dead_strip_inits_and_terms
25110 @itemx -nofixprebinding
25111 @itemx -nomultidefs
25112 @itemx -noprebind
25113 @itemx -noseglinkedit
25114 @itemx -pagezero_size
25115 @itemx -prebind
25116 @itemx -prebind_all_twolevel_modules
25117 @itemx -private_bundle
25118 @need 800
25119 @itemx -read_only_relocs
25120 @itemx -sectalign
25121 @itemx -sectobjectsymbols
25122 @itemx -whyload
25123 @itemx -seg1addr
25124 @itemx -sectcreate
25125 @itemx -sectobjectsymbols
25126 @itemx -sectorder
25127 @itemx -segaddr
25128 @itemx -segs_read_only_addr
25129 @need 800
25130 @itemx -segs_read_write_addr
25131 @itemx -seg_addr_table
25132 @itemx -seg_addr_table_filename
25133 @itemx -seglinkedit
25134 @itemx -segprot
25135 @itemx -segs_read_only_addr
25136 @itemx -segs_read_write_addr
25137 @itemx -single_module
25138 @itemx -static
25139 @itemx -sub_library
25140 @need 800
25141 @opindex allowable_client
25142 @opindex client_name
25143 @opindex compatibility_version
25144 @opindex current_version
25145 @opindex dead_strip
25146 @opindex dependency-file
25147 @opindex dylib_file
25148 @opindex dylinker_install_name
25149 @opindex dynamic
25150 @opindex exported_symbols_list
25151 @opindex filelist
25152 @opindex flat_namespace
25153 @opindex force_flat_namespace
25154 @opindex headerpad_max_install_names
25155 @opindex image_base
25156 @opindex init
25157 @opindex install_name
25158 @opindex keep_private_externs
25159 @opindex multi_module
25160 @opindex multiply_defined
25161 @opindex multiply_defined_unused
25162 @opindex noall_load
25163 @opindex no_dead_strip_inits_and_terms
25164 @opindex nofixprebinding
25165 @opindex nomultidefs
25166 @opindex noprebind
25167 @opindex noseglinkedit
25168 @opindex pagezero_size
25169 @opindex prebind
25170 @opindex prebind_all_twolevel_modules
25171 @opindex private_bundle
25172 @opindex read_only_relocs
25173 @opindex sectalign
25174 @opindex sectobjectsymbols
25175 @opindex whyload
25176 @opindex seg1addr
25177 @opindex sectcreate
25178 @opindex sectobjectsymbols
25179 @opindex sectorder
25180 @opindex segaddr
25181 @opindex segs_read_only_addr
25182 @opindex segs_read_write_addr
25183 @opindex seg_addr_table
25184 @opindex seg_addr_table_filename
25185 @opindex seglinkedit
25186 @opindex segprot
25187 @opindex segs_read_only_addr
25188 @opindex segs_read_write_addr
25189 @opindex single_module
25190 @opindex static
25191 @opindex sub_library
25192 @opindex sub_umbrella
25193 @opindex twolevel_namespace
25194 @opindex umbrella
25195 @opindex undefined
25196 @opindex unexported_symbols_list
25197 @opindex weak_reference_mismatches
25198 @opindex whatsloaded
25199 @itemx -sub_umbrella
25200 @itemx -twolevel_namespace
25201 @itemx -umbrella
25202 @itemx -undefined
25203 @itemx -unexported_symbols_list
25204 @itemx -weak_reference_mismatches
25205 @itemx -whatsloaded
25206 These options are passed to the Darwin linker.  The Darwin linker man page
25207 describes them in detail.
25208 @end table
25210 @node DEC Alpha Options
25211 @subsection DEC Alpha Options
25213 These @samp{-m} options are defined for the DEC Alpha implementations:
25215 @table @gcctabopt
25216 @opindex mno-soft-float
25217 @opindex msoft-float
25218 @item -mno-soft-float
25219 @itemx -msoft-float
25220 Use (do not use) the hardware floating-point instructions for
25221 floating-point operations.  When @option{-msoft-float} is specified,
25222 functions in @file{libgcc.a} are used to perform floating-point
25223 operations.  Unless they are replaced by routines that emulate the
25224 floating-point operations, or compiled in such a way as to call such
25225 emulations routines, these routines issue floating-point
25226 operations.   If you are compiling for an Alpha without floating-point
25227 operations, you must ensure that the library is built so as not to call
25228 them.
25230 Note that Alpha implementations without floating-point operations are
25231 required to have floating-point registers.
25233 @opindex mfp-reg
25234 @opindex mno-fp-regs
25235 @item -mfp-reg
25236 @itemx -mno-fp-regs
25237 Generate code that uses (does not use) the floating-point register set.
25238 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
25239 register set is not used, floating-point operands are passed in integer
25240 registers as if they were integers and floating-point results are passed
25241 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
25242 so any function with a floating-point argument or return value called by code
25243 compiled with @option{-mno-fp-regs} must also be compiled with that
25244 option.
25246 A typical use of this option is building a kernel that does not use,
25247 and hence need not save and restore, any floating-point registers.
25249 @opindex mieee
25250 @item -mieee
25251 The Alpha architecture implements floating-point hardware optimized for
25252 maximum performance.  It is mostly compliant with the IEEE floating-point
25253 standard.  However, for full compliance, software assistance is
25254 required.  This option generates code fully IEEE-compliant code
25255 @emph{except} that the @var{inexact-flag} is not maintained (see below).
25256 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
25257 defined during compilation.  The resulting code is less efficient but is
25258 able to correctly support denormalized numbers and exceptional IEEE
25259 values such as not-a-number and plus/minus infinity.  Other Alpha
25260 compilers call this option @option{-ieee_with_no_inexact}.
25262 @opindex mieee-with-inexact
25263 @item -mieee-with-inexact
25264 This is like @option{-mieee} except the generated code also maintains
25265 the IEEE @var{inexact-flag}.  Turning on this option causes the
25266 generated code to implement fully-compliant IEEE math.  In addition to
25267 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
25268 macro.  On some Alpha implementations the resulting code may execute
25269 significantly slower than the code generated by default.  Since there is
25270 very little code that depends on the @var{inexact-flag}, you should
25271 normally not specify this option.  Other Alpha compilers call this
25272 option @option{-ieee_with_inexact}.
25274 @opindex mfp-trap-mode
25275 @item -mfp-trap-mode=@var{trap-mode}
25276 This option controls what floating-point related traps are enabled.
25277 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
25278 The trap mode can be set to one of four values:
25280 @table @samp
25281 @item n
25282 This is the default (normal) setting.  The only traps that are enabled
25283 are the ones that cannot be disabled in software (e.g., division by zero
25284 trap).
25286 @item u
25287 In addition to the traps enabled by @samp{n}, underflow traps are enabled
25288 as well.
25290 @item su
25291 Like @samp{u}, but the instructions are marked to be safe for software
25292 completion (see Alpha architecture manual for details).
25294 @item sui
25295 Like @samp{su}, but inexact traps are enabled as well.
25296 @end table
25298 @opindex mfp-rounding-mode
25299 @item -mfp-rounding-mode=@var{rounding-mode}
25300 Selects the IEEE rounding mode.  Other Alpha compilers call this option
25301 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
25304 @table @samp
25305 @item n
25306 Normal IEEE rounding mode.  Floating-point numbers are rounded towards
25307 the nearest machine number or towards the even machine number in case
25308 of a tie.
25310 @item m
25311 Round towards minus infinity.
25313 @item c
25314 Chopped rounding mode.  Floating-point numbers are rounded towards zero.
25316 @item d
25317 Dynamic rounding mode.  A field in the floating-point control register
25318 (@var{fpcr}, see Alpha architecture reference manual) controls the
25319 rounding mode in effect.  The C library initializes this register for
25320 rounding towards plus infinity.  Thus, unless your program modifies the
25321 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
25322 @end table
25324 @opindex mtrap-precision
25325 @item -mtrap-precision=@var{trap-precision}
25326 In the Alpha architecture, floating-point traps are imprecise.  This
25327 means without software assistance it is impossible to recover from a
25328 floating trap and program execution normally needs to be terminated.
25329 GCC can generate code that can assist operating system trap handlers
25330 in determining the exact location that caused a floating-point trap.
25331 Depending on the requirements of an application, different levels of
25332 precisions can be selected:
25334 @table @samp
25335 @item p
25336 Program precision.  This option is the default and means a trap handler
25337 can only identify which program caused a floating-point exception.
25339 @item f
25340 Function precision.  The trap handler can determine the function that
25341 caused a floating-point exception.
25343 @item i
25344 Instruction precision.  The trap handler can determine the exact
25345 instruction that caused a floating-point exception.
25346 @end table
25348 Other Alpha compilers provide the equivalent options called
25349 @option{-scope_safe} and @option{-resumption_safe}.
25351 @opindex mieee-conformant
25352 @item -mieee-conformant
25353 This option marks the generated code as IEEE conformant.  You must not
25354 use this option unless you also specify @option{-mtrap-precision=i} and either
25355 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
25356 is to emit the line @samp{.eflag 48} in the function prologue of the
25357 generated assembly file.
25359 @opindex mbuild-constants
25360 @item -mbuild-constants
25361 Normally GCC examines a 32- or 64-bit integer constant to
25362 see if it can construct it from smaller constants in two or three
25363 instructions.  If it cannot, it outputs the constant as a literal and
25364 generates code to load it from the data segment at run time.
25366 Use this option to require GCC to construct @emph{all} integer constants
25367 using code, even if it takes more instructions (the maximum is six).
25369 You typically use this option to build a shared library dynamic
25370 loader.  Itself a shared library, it must relocate itself in memory
25371 before it can find the variables and constants in its own data segment.
25373 @opindex mbwx
25374 @opindex mno-bwx
25375 @opindex mcix
25376 @opindex mno-cix
25377 @opindex mfix
25378 @opindex mno-fix
25379 @opindex mmax
25380 @opindex mno-max
25381 @item -mbwx
25382 @itemx -mno-bwx
25383 @itemx -mcix
25384 @itemx -mno-cix
25385 @itemx -mfix
25386 @itemx -mno-fix
25387 @itemx -mmax
25388 @itemx -mno-max
25389 Indicate whether GCC should generate code to use the optional BWX,
25390 CIX, FIX and MAX instruction sets.  The default is to use the instruction
25391 sets supported by the CPU type specified via @option{-mcpu=} option or that
25392 of the CPU on which GCC was built if none is specified.
25394 @opindex mfloat-vax
25395 @opindex mfloat-ieee
25396 @item -mfloat-vax
25397 @itemx -mfloat-ieee
25398 Generate code that uses (does not use) VAX F and G floating-point
25399 arithmetic instead of IEEE single and double precision.
25401 @opindex mexplicit-relocs
25402 @opindex mno-explicit-relocs
25403 @item -mexplicit-relocs
25404 @itemx -mno-explicit-relocs
25405 Older Alpha assemblers provided no way to generate symbol relocations
25406 except via assembler macros.  Use of these macros does not allow
25407 optimal instruction scheduling.  GNU binutils as of version 2.12
25408 supports a new syntax that allows the compiler to explicitly mark
25409 which relocations should apply to which instructions.  This option
25410 is mostly useful for debugging, as GCC detects the capabilities of
25411 the assembler when it is built and sets the default accordingly.
25413 @opindex msmall-data
25414 @opindex mlarge-data
25415 @item -msmall-data
25416 @itemx -mlarge-data
25417 When @option{-mexplicit-relocs} is in effect, static data is
25418 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
25419 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
25420 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
25421 16-bit relocations off of the @code{$gp} register.  This limits the
25422 size of the small data area to 64KB, but allows the variables to be
25423 directly accessed via a single instruction.
25425 The default is @option{-mlarge-data}.  With this option the data area
25426 is limited to just below 2GB@.  Programs that require more than 2GB of
25427 data must use @code{malloc} or @code{mmap} to allocate the data in the
25428 heap instead of in the program's data segment.
25430 When generating code for shared libraries, @option{-fpic} implies
25431 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
25433 @opindex msmall-text
25434 @opindex mlarge-text
25435 @item -msmall-text
25436 @itemx -mlarge-text
25437 When @option{-msmall-text} is used, the compiler assumes that the
25438 code of the entire program (or shared library) fits in 4MB, and is
25439 thus reachable with a branch instruction.  When @option{-msmall-data}
25440 is used, the compiler can assume that all local symbols share the
25441 same @code{$gp} value, and thus reduce the number of instructions
25442 required for a function call from 4 to 1.
25444 The default is @option{-mlarge-text}.
25446 @opindex mcpu
25447 @item -mcpu=@var{cpu_type}
25448 Set the instruction set and instruction scheduling parameters for
25449 machine type @var{cpu_type}.  You can specify either the @samp{EV}
25450 style name or the corresponding chip number.  GCC supports scheduling
25451 parameters for the EV4, EV5 and EV6 family of processors and
25452 chooses the default values for the instruction set from the processor
25453 you specify.  If you do not specify a processor type, GCC defaults
25454 to the processor on which the compiler was built.
25456 Supported values for @var{cpu_type} are
25458 @table @samp
25459 @item ev4
25460 @itemx ev45
25461 @itemx 21064
25462 Schedules as an EV4 and has no instruction set extensions.
25464 @item ev5
25465 @itemx 21164
25466 Schedules as an EV5 and has no instruction set extensions.
25468 @item ev56
25469 @itemx 21164a
25470 Schedules as an EV5 and supports the BWX extension.
25472 @item pca56
25473 @itemx 21164pc
25474 @itemx 21164PC
25475 Schedules as an EV5 and supports the BWX and MAX extensions.
25477 @item ev6
25478 @itemx 21264
25479 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
25481 @item ev67
25482 @itemx 21264a
25483 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
25484 @end table
25486 Native toolchains also support the value @samp{native},
25487 which selects the best architecture option for the host processor.
25488 @option{-mcpu=native} has no effect if GCC does not recognize
25489 the processor.
25491 @opindex mtune
25492 @item -mtune=@var{cpu_type}
25493 Set only the instruction scheduling parameters for machine type
25494 @var{cpu_type}.  The instruction set is not changed.
25496 Native toolchains also support the value @samp{native},
25497 which selects the best architecture option for the host processor.
25498 @option{-mtune=native} has no effect if GCC does not recognize
25499 the processor.
25501 @opindex mmemory-latency
25502 @item -mmemory-latency=@var{time}
25503 Sets the latency the scheduler should assume for typical memory
25504 references as seen by the application.  This number is highly
25505 dependent on the memory access patterns used by the application
25506 and the size of the external cache on the machine.
25508 Valid options for @var{time} are
25510 @table @samp
25511 @item @var{number}
25512 A decimal number representing clock cycles.
25514 @item L1
25515 @itemx L2
25516 @itemx L3
25517 @itemx main
25518 The compiler contains estimates of the number of clock cycles for
25519 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
25520 (also called Dcache, Scache, and Bcache), as well as to main memory.
25521 Note that L3 is only valid for EV5.
25523 @end table
25524 @end table
25526 @node eBPF Options
25527 @subsection eBPF Options
25528 @cindex eBPF Options
25530 @table @gcctabopt
25531 @item -mframe-limit=@var{bytes}
25532 This specifies the hard limit for frame sizes, in bytes.  Currently,
25533 the value that can be specified should be less than or equal to
25534 @samp{32767}.  Defaults to whatever limit is imposed by the version of
25535 the Linux kernel targeted.
25537 @opindex mbig-endian
25538 @item -mbig-endian
25539 Generate code for a big-endian target.
25541 @opindex mlittle-endian
25542 @item -mlittle-endian
25543 Generate code for a little-endian target.  This is the default.
25545 @opindex mjmpext
25546 @item -mjmpext
25547 @itemx -mno-jmpext
25548 Enable or disable generation of extra conditional-branch instructions.
25549 Enabled for CPU v2 and above.
25551 @opindex mjmp32
25552 @item -mjmp32
25553 @itemx -mno-jmp32
25554 Enable or disable generation of 32-bit jump instructions.
25555 Enabled for CPU v3 and above.
25557 @opindex malu32
25558 @item -malu32
25559 @itemx -mno-alu32
25560 Enable or disable generation of 32-bit ALU instructions.
25561 Enabled for CPU v3 and above.
25563 @opindex mv3-atomics
25564 @item -mv3-atomics
25565 @itemx -mno-v3-atomics
25566 Enable or disable instructions for general atomic operations introduced
25567 in CPU v3.  Enabled for CPU v3 and above.
25569 @opindex mbswap
25570 @item -mbswap
25571 @itemx -mno-bswap
25572 Enable or disable byte swap instructions.  Enabled for CPU v4 and above.
25574 @opindex msdiv
25575 @item -msdiv
25576 @itemx -mno-sdiv
25577 Enable or disable signed division and modulus instructions.  Enabled for
25578 CPU v4 and above.
25580 @opindex msmov
25581 @item -msmov
25582 @itemx -mno-smov
25583 Enable or disable sign-extending move and memory load instructions.
25584 Enabled for CPU v4 and above.
25586 @opindex mcpu
25587 @item -mcpu=@var{version}
25588 This specifies which version of the eBPF ISA to target. Newer versions
25589 may not be supported by all kernels. The default is @samp{v4}.
25591 Supported values for @var{version} are:
25593 @table @samp
25594 @item v1
25595 The first stable eBPF ISA with no special features or extensions.
25597 @item v2
25598 Supports the jump extensions, as in @option{-mjmpext}.
25600 @item v3
25601 All features of v2, plus:
25602 @itemize @minus
25603 @item 32-bit jump operations, as in @option{-mjmp32}
25604 @item 32-bit ALU operations, as in @option{-malu32}
25605 @item general atomic operations, as in @option{-mv3-atomics}
25606 @end itemize
25608 @item v4
25609 All features of v3, plus:
25610 @itemize @minus
25611 @item Byte swap instructions, as in @option{-mbswap}
25612 @item Signed division and modulus instructions, as in @option{-msdiv}
25613 @item Sign-extending move and memory load instructions, as in @option{-msmov}
25614 @end itemize
25615 @end table
25617 @opindex mco-re
25618 @item -mco-re
25619 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and
25620 is implied by @option{-gbtf}.
25622 @opindex mno-co-re
25623 @item -mno-co-re
25624 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE
25625 support is enabled by default when generating BTF debug information for
25626 the BPF target.
25628 @item -mxbpf
25629 Generate code for an expanded version of BPF, which relaxes some of
25630 the restrictions imposed by the BPF architecture:
25631 @itemize @minus
25632 @item Save and restore callee-saved registers at function entry and
25633 exit, respectively.
25634 @end itemize
25636 @opindex masm=@var{dialect}
25637 @item -masm=@var{dialect}
25638 Outputs assembly instructions using eBPF selected @var{dialect}.  The default
25639 is @samp{normal}.
25641 Supported values for @var{dialect} are:
25643 @table @samp
25644 @item normal
25645 Outputs normal assembly dialect.
25647 @item pseudoc
25648 Outputs pseudo-c assembly dialect.
25650 @end table
25652 @end table
25654 @node FR30 Options
25655 @subsection FR30 Options
25656 @cindex FR30 Options
25658 These options are defined specifically for the FR30 port.
25660 @table @gcctabopt
25662 @opindex msmall-model
25663 @item -msmall-model
25664 Use the small address space model.  This can produce smaller code, but
25665 it does assume that all symbolic values and addresses fit into a
25666 20-bit range.
25668 @opindex mno-lsim
25669 @item -mno-lsim
25670 Assume that runtime support has been provided and so there is no need
25671 to include the simulator library (@file{libsim.a}) on the linker
25672 command line.
25674 @end table
25676 @node FT32 Options
25677 @subsection FT32 Options
25678 @cindex FT32 Options
25680 These options are defined specifically for the FT32 port.
25682 @table @gcctabopt
25684 @opindex msim
25685 @item -msim
25686 Specifies that the program will be run on the simulator.  This causes
25687 an alternate runtime startup and library to be linked.
25688 You must not use this option when generating programs that will run on
25689 real hardware; you must provide your own runtime library for whatever
25690 I/O functions are needed.
25692 @opindex mlra
25693 @item -mlra
25694 Enable Local Register Allocation.  This is still experimental for FT32,
25695 so by default the compiler uses standard reload.
25697 @opindex mnodiv
25698 @item -mnodiv
25699 Do not use div and mod instructions.
25701 @opindex mft32b
25702 @item -mft32b
25703 Enable use of the extended instructions of the FT32B processor.
25705 @opindex mcompress
25706 @item -mcompress
25707 Compress all code using the Ft32B code compression scheme.
25709 @opindex  mnopm
25710 @item -mnopm
25711 Do not generate code that reads program memory.
25713 @end table
25715 @node FRV Options
25716 @subsection FRV Options
25717 @cindex FRV Options
25719 @table @gcctabopt
25720 @opindex mgpr-32
25721 @item -mgpr-32
25723 Only use the first 32 general-purpose registers.
25725 @opindex mgpr-64
25726 @item -mgpr-64
25728 Use all 64 general-purpose registers.
25730 @opindex mfpr-32
25731 @item -mfpr-32
25733 Use only the first 32 floating-point registers.
25735 @opindex mfpr-64
25736 @item -mfpr-64
25738 Use all 64 floating-point registers.
25740 @opindex mhard-float
25741 @item -mhard-float
25743 Use hardware instructions for floating-point operations.
25745 @opindex msoft-float
25746 @item -msoft-float
25748 Use library routines for floating-point operations.
25750 @opindex malloc-cc
25751 @item -malloc-cc
25753 Dynamically allocate condition code registers.
25755 @opindex mfixed-cc
25756 @item -mfixed-cc
25758 Do not try to dynamically allocate condition code registers, only
25759 use @code{icc0} and @code{fcc0}.
25761 @opindex mdword
25762 @item -mdword
25764 Change ABI to use double word insns.
25766 @opindex mno-dword
25767 @opindex mdword
25768 @item -mno-dword
25770 Do not use double word instructions.
25772 @opindex mdouble
25773 @item -mdouble
25775 Use floating-point double instructions.
25777 @opindex mno-double
25778 @item -mno-double
25780 Do not use floating-point double instructions.
25782 @opindex mmedia
25783 @item -mmedia
25785 Use media instructions.
25787 @opindex mno-media
25788 @item -mno-media
25790 Do not use media instructions.
25792 @opindex mmuladd
25793 @item -mmuladd
25795 Use multiply and add/subtract instructions.
25797 @opindex mno-muladd
25798 @item -mno-muladd
25800 Do not use multiply and add/subtract instructions.
25802 @opindex mfdpic
25803 @item -mfdpic
25805 Select the FDPIC ABI, which uses function descriptors to represent
25806 pointers to functions.  Without any PIC/PIE-related options, it
25807 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
25808 assumes GOT entries and small data are within a 12-bit range from the
25809 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
25810 are computed with 32 bits.
25811 With a @samp{bfin-elf} target, this option implies @option{-msim}.
25813 @opindex minline-plt
25814 @item -minline-plt
25816 Enable inlining of PLT entries in function calls to functions that are
25817 not known to bind locally.  It has no effect without @option{-mfdpic}.
25818 It's enabled by default if optimizing for speed and compiling for
25819 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
25820 optimization option such as @option{-O3} or above is present in the
25821 command line.
25823 @opindex mTLS
25824 @item -mTLS
25826 Assume a large TLS segment when generating thread-local code.
25828 @opindex mtls
25829 @item -mtls
25831 Do not assume a large TLS segment when generating thread-local code.
25833 @opindex mgprel-ro
25834 @item -mgprel-ro
25836 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
25837 that is known to be in read-only sections.  It's enabled by default,
25838 except for @option{-fpic} or @option{-fpie}: even though it may help
25839 make the global offset table smaller, it trades 1 instruction for 4.
25840 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
25841 one of which may be shared by multiple symbols, and it avoids the need
25842 for a GOT entry for the referenced symbol, so it's more likely to be a
25843 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
25845 @opindex multilib-library-pic
25846 @item -multilib-library-pic
25848 Link with the (library, not FD) pic libraries.  It's implied by
25849 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
25850 @option{-fpic} without @option{-mfdpic}.  You should never have to use
25851 it explicitly.
25853 @opindex mlinked-fp
25854 @item -mlinked-fp
25856 Follow the EABI requirement of always creating a frame pointer whenever
25857 a stack frame is allocated.  This option is enabled by default and can
25858 be disabled with @option{-mno-linked-fp}.
25860 @opindex mlong-calls
25861 @item -mlong-calls
25863 Use indirect addressing to call functions outside the current
25864 compilation unit.  This allows the functions to be placed anywhere
25865 within the 32-bit address space.
25867 @opindex malign-labels
25868 @item -malign-labels
25870 Try to align labels to an 8-byte boundary by inserting NOPs into the
25871 previous packet.  This option only has an effect when VLIW packing
25872 is enabled.  It doesn't create new packets; it merely adds NOPs to
25873 existing ones.
25875 @opindex mlibrary-pic
25876 @item -mlibrary-pic
25878 Generate position-independent EABI code.
25880 @opindex macc-4
25881 @item -macc-4
25883 Use only the first four media accumulator registers.
25885 @opindex macc-8
25886 @item -macc-8
25888 Use all eight media accumulator registers.
25890 @opindex mpack
25891 @item -mpack
25893 Pack VLIW instructions.
25895 @opindex mno-pack
25896 @item -mno-pack
25898 Do not pack VLIW instructions.
25900 @opindex mno-eflags
25901 @item -mno-eflags
25903 Do not mark ABI switches in e_flags.
25905 @opindex mcond-move
25906 @item -mcond-move
25908 Enable the use of conditional-move instructions (default).
25910 This switch is mainly for debugging the compiler and will likely be removed
25911 in a future version.
25913 @opindex mno-cond-move
25914 @item -mno-cond-move
25916 Disable the use of conditional-move instructions.
25918 This switch is mainly for debugging the compiler and will likely be removed
25919 in a future version.
25921 @opindex mscc
25922 @item -mscc
25924 Enable the use of conditional set instructions (default).
25926 This switch is mainly for debugging the compiler and will likely be removed
25927 in a future version.
25929 @opindex mno-scc
25930 @item -mno-scc
25932 Disable the use of conditional set instructions.
25934 This switch is mainly for debugging the compiler and will likely be removed
25935 in a future version.
25937 @opindex mcond-exec
25938 @item -mcond-exec
25940 Enable the use of conditional execution (default).
25942 This switch is mainly for debugging the compiler and will likely be removed
25943 in a future version.
25945 @opindex mno-cond-exec
25946 @item -mno-cond-exec
25948 Disable the use of conditional execution.
25950 This switch is mainly for debugging the compiler and will likely be removed
25951 in a future version.
25953 @opindex mvliw-branch
25954 @item -mvliw-branch
25956 Run a pass to pack branches into VLIW instructions (default).
25958 This switch is mainly for debugging the compiler and will likely be removed
25959 in a future version.
25961 @opindex mno-vliw-branch
25962 @item -mno-vliw-branch
25964 Do not run a pass to pack branches into VLIW instructions.
25966 This switch is mainly for debugging the compiler and will likely be removed
25967 in a future version.
25969 @opindex mmulti-cond-exec
25970 @item -mmulti-cond-exec
25972 Enable optimization of @code{&&} and @code{||} in conditional execution
25973 (default).
25975 This switch is mainly for debugging the compiler and will likely be removed
25976 in a future version.
25978 @opindex mno-multi-cond-exec
25979 @item -mno-multi-cond-exec
25981 Disable optimization of @code{&&} and @code{||} in conditional execution.
25983 This switch is mainly for debugging the compiler and will likely be removed
25984 in a future version.
25986 @opindex mnested-cond-exec
25987 @item -mnested-cond-exec
25989 Enable nested conditional execution optimizations (default).
25991 This switch is mainly for debugging the compiler and will likely be removed
25992 in a future version.
25994 @opindex mno-nested-cond-exec
25995 @item -mno-nested-cond-exec
25997 Disable nested conditional execution optimizations.
25999 This switch is mainly for debugging the compiler and will likely be removed
26000 in a future version.
26002 @opindex moptimize-membar
26003 @item -moptimize-membar
26005 This switch removes redundant @code{membar} instructions from the
26006 compiler-generated code.  It is enabled by default.
26008 @opindex mno-optimize-membar
26009 @opindex moptimize-membar
26010 @item -mno-optimize-membar
26012 This switch disables the automatic removal of redundant @code{membar}
26013 instructions from the generated code.
26015 @opindex mtomcat-stats
26016 @item -mtomcat-stats
26018 Cause gas to print out tomcat statistics.
26020 @opindex mcpu
26021 @item -mcpu=@var{cpu}
26023 Select the processor type for which to generate code.  Possible values are
26024 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
26025 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
26027 @end table
26029 @node GNU/Linux Options
26030 @subsection GNU/Linux Options
26032 These @samp{-m} options are defined for GNU/Linux targets:
26034 @table @gcctabopt
26035 @opindex mglibc
26036 @item -mglibc
26037 Use the GNU C library.  This is the default except
26038 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
26039 @samp{*-*-linux-*android*} targets.
26041 @opindex muclibc
26042 @item -muclibc
26043 Use uClibc C library.  This is the default on
26044 @samp{*-*-linux-*uclibc*} targets.
26046 @opindex mmusl
26047 @item -mmusl
26048 Use the musl C library.  This is the default on
26049 @samp{*-*-linux-*musl*} targets.
26051 @opindex mbionic
26052 @item -mbionic
26053 Use Bionic C library.  This is the default on
26054 @samp{*-*-linux-*android*} targets.
26056 @opindex mandroid
26057 @item -mandroid
26058 Compile code compatible with Android platform.  This is the default on
26059 @samp{*-*-linux-*android*} targets.
26061 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
26062 @option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
26063 this option makes the GCC driver pass Android-specific options to the linker.
26064 Finally, this option causes the preprocessor macro @code{__ANDROID__}
26065 to be defined.
26067 @opindex tno-android-cc
26068 @item -tno-android-cc
26069 Disable compilation effects of @option{-mandroid}, i.e., do not enable
26070 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
26071 @option{-fno-rtti} by default.
26073 @opindex tno-android-ld
26074 @item -tno-android-ld
26075 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
26076 linking options to the linker.
26078 @end table
26080 @node H8/300 Options
26081 @subsection H8/300 Options
26083 These @samp{-m} options are defined for the H8/300 implementations:
26085 @table @gcctabopt
26086 @opindex mrelax
26087 @item -mrelax
26088 Shorten some address references at link time, when possible; uses the
26089 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
26090 ld, Using ld}, for a fuller description.
26092 @opindex mh
26093 @item -mh
26094 Generate code for the H8/300H@.
26096 @opindex ms
26097 @item -ms
26098 Generate code for the H8S@.
26100 @opindex mn
26101 @item -mn
26102 Generate code for the H8S and H8/300H in the normal mode.  This switch
26103 must be used either with @option{-mh} or @option{-ms}.
26105 @opindex ms2600
26106 @item -ms2600
26107 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
26109 @opindex mexr
26110 @item -mexr
26111 Extended registers are stored on stack before execution of function
26112 with monitor attribute. Default option is @option{-mexr}.
26113 This option is valid only for H8S targets.
26115 @opindex mno-exr
26116 @opindex mexr
26117 @item -mno-exr
26118 Extended registers are not stored on stack before execution of function 
26119 with monitor attribute. Default option is @option{-mno-exr}. 
26120 This option is valid only for H8S targets.
26122 @opindex mint32
26123 @item -mint32
26124 Make @code{int} data 32 bits by default.
26126 @opindex malign-300
26127 @item -malign-300
26128 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
26129 The default for the H8/300H and H8S is to align longs and floats on
26130 4-byte boundaries.
26131 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
26132 This option has no effect on the H8/300.
26133 @end table
26135 @node HPPA Options
26136 @subsection HPPA Options
26137 @cindex HPPA Options
26139 These @samp{-m} options are defined for the HPPA family of computers:
26141 @table @gcctabopt
26142 @opindex march
26143 @item -march=@var{architecture-type}
26144 Generate code for the specified architecture.  The choices for
26145 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
26146 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
26147 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
26148 architecture option for your machine.  Code compiled for lower numbered
26149 architectures runs on higher numbered architectures, but not the
26150 other way around.
26152 @opindex mpa-risc-1-0
26153 @opindex mpa-risc-1-1
26154 @opindex mpa-risc-2-0
26155 @item -mpa-risc-1-0
26156 @itemx -mpa-risc-1-1
26157 @itemx -mpa-risc-2-0
26158 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
26160 @opindex matomic-libcalls
26161 @opindex mno-atomic-libcalls
26162 @item -matomic-libcalls
26163 Generate libcalls for atomic loads and stores when sync libcalls are disabled.
26164 This option is enabled by default.  It only affects the generation of
26165 atomic libcalls by the HPPA backend.
26167 Both the sync and @file{libatomic} libcall implementations use locking.
26168 As a result, processor stores are not atomic with respect to other
26169 atomic operations.  Processor loads up to DImode are atomic with
26170 respect to other atomic operations provided they are implemented as
26171 a single access.
26173 The PA-RISC architecture does not support any atomic operations in
26174 hardware except for the @code{ldcw} instruction.  Thus, all atomic
26175 support is implemented using sync and atomic libcalls.  Sync libcall
26176 support is in @file{libgcc.a}.  Atomic libcall support is in
26177 @file{libatomic}.
26179 This option generates @code{__atomic_exchange} calls for atomic stores.
26180 It also provides special handling for atomic DImode accesses on 32-bit
26181 targets.
26183 @opindex mbig-switch
26184 @item -mbig-switch
26185 Does nothing.  Preserved for backward compatibility.
26187 @opindex mcaller-copies
26188 @item -mcaller-copies
26189 The caller copies function arguments passed by hidden reference.  This
26190 option should be used with care as it is not compatible with the default
26191 32-bit runtime.  However, only aggregates larger than eight bytes are
26192 passed by hidden reference and the option provides better compatibility
26193 with OpenMP.
26195 @opindex mcoherent-ldcw
26196 @item -mcoherent-ldcw
26197 Use ldcw/ldcd coherent cache-control hint.
26199 @opindex mdisable-fpregs
26200 @item -mdisable-fpregs
26201 Disable floating-point registers.  Equivalent to @code{-msoft-float}.
26203 @opindex mdisable-indexing
26204 @item -mdisable-indexing
26205 Prevent the compiler from using indexing address modes.  This avoids some
26206 rather obscure problems when compiling MIG generated code under MACH@.
26208 @opindex mfast-indirect-calls
26209 @item -mfast-indirect-calls
26210 Generate code that assumes calls never cross space boundaries.  This
26211 allows GCC to emit code that performs faster indirect calls.
26213 This option does not work in the presence of shared libraries or nested
26214 functions.
26216 @opindex mfixed-range
26217 @item -mfixed-range=@var{register-range}
26218 Generate code treating the given register range as fixed registers.
26219 A fixed register is one that the register allocator cannot use.  This is
26220 useful when compiling kernel code.  A register range is specified as
26221 two registers separated by a dash.  Multiple register ranges can be
26222 specified separated by a comma.
26224 @opindex mgas
26225 @item -mgas
26226 Enable the use of assembler directives only GAS understands.
26228 @opindex mgnu-ld
26229 @item -mgnu-ld
26230 Use options specific to GNU @command{ld}.
26231 This passes @option{-shared} to @command{ld} when
26232 building a shared library.  It is the default when GCC is configured,
26233 explicitly or implicitly, with the GNU linker.  This option does not
26234 affect which @command{ld} is called; it only changes what parameters
26235 are passed to that @command{ld}.
26236 The @command{ld} that is called is determined by the
26237 @option{--with-ld} configure option, GCC's program search path, and
26238 finally by the user's @env{PATH}.  The linker used by GCC can be printed
26239 using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
26240 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
26242 @opindex mhp-ld
26243 @item -mhp-ld
26244 Use options specific to HP @command{ld}.
26245 This passes @option{-b} to @command{ld} when building
26246 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
26247 links.  It is the default when GCC is configured, explicitly or
26248 implicitly, with the HP linker.  This option does not affect
26249 which @command{ld} is called; it only changes what parameters are passed to that
26250 @command{ld}.
26251 The @command{ld} that is called is determined by the @option{--with-ld}
26252 configure option, GCC's program search path, and finally by the user's
26253 @env{PATH}.  The linker used by GCC can be printed using @samp{which
26254 `gcc -print-prog-name=ld`}.  This option is only available on the 64-bit
26255 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
26257 @opindex mlinker-opt
26258 @item -mlinker-opt
26259 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
26260 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
26261 linkers in which they give bogus error messages when linking some programs.
26263 @opindex mno-long-calls
26264 @opindex mlong-calls
26265 @item -mlong-calls
26266 Generate code that uses long call sequences.  This ensures that a call
26267 is always able to reach linker generated stubs.  The default is to generate
26268 long calls only when the distance from the call site to the beginning
26269 of the function or translation unit, as the case may be, exceeds a
26270 predefined limit set by the branch type being used.  The limits for
26271 normal calls are 7,600,000 and 240,000 bytes, respectively for the
26272 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
26273 240,000 bytes.
26275 Distances are measured from the beginning of functions when using the
26276 @option{-ffunction-sections} option, or when using the @option{-mgas}
26277 and @option{-mno-portable-runtime} options together under HP-UX with
26278 the SOM linker.
26280 It is normally not desirable to use this option as it degrades
26281 performance.  However, it may be useful in large applications,
26282 particularly when partial linking is used to build the application.
26284 The types of long calls used depends on the capabilities of the
26285 assembler and linker, and the type of code being generated.  The
26286 impact on systems that support long absolute calls, and long pic
26287 symbol-difference or pc-relative calls should be relatively small.
26288 However, an indirect call is used on 32-bit ELF systems in pic code
26289 and it is quite long.
26291 @opindex mlong-load-store
26292 @item -mlong-load-store
26293 Generate 3-instruction load and store sequences as sometimes required by
26294 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
26295 the HP compilers.
26297 @opindex mjump-in-delay
26298 @item -mjump-in-delay
26299 This option is ignored and provided for compatibility purposes only.
26301 @opindex mno-space-regs
26302 @opindex mspace-regs
26303 @item -mno-space-regs
26304 Generate code that assumes the target has no space registers.  This allows
26305 GCC to generate faster indirect calls and use unscaled index address modes.
26307 Such code is suitable for level 0 PA systems and kernels.
26309 @opindex mordered
26310 @item -mordered
26311 Assume memory references are ordered and barriers are not needed.
26313 @opindex mportable-runtime
26314 @item -mportable-runtime
26315 Use the portable calling conventions proposed by HP for ELF systems.
26317 @opindex mschedule
26318 @item -mschedule=@var{cpu-type}
26319 Schedule code according to the constraints for the machine type
26320 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
26321 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
26322 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
26323 proper scheduling option for your machine.  The default scheduling is
26324 @samp{8000}.
26326 @opindex msio
26327 @item -msio
26328 Generate the predefine, @code{_SIO}, for server IO@.  The default is
26329 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
26330 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
26331 options are available under HP-UX and HI-UX@.
26333 @opindex msoft-float
26334 @item -msoft-float
26335 Generate output containing library calls for floating point.
26336 @strong{Warning:} the requisite libraries are not available for all HPPA
26337 targets.  Normally the facilities of the machine's usual C compiler are
26338 used, but this cannot be done directly in cross-compilation.  You must make
26339 your own arrangements to provide suitable library functions for
26340 cross-compilation.
26342 @option{-msoft-float} changes the calling convention in the output file;
26343 therefore, it is only useful if you compile @emph{all} of a program with
26344 this option.  In particular, you need to compile @file{libgcc.a}, the
26345 library that comes with GCC, with @option{-msoft-float} in order for
26346 this to work.
26348 @opindex msoft-mult
26349 @item -msoft-mult
26350 Use software integer multiplication.
26352 This disables the use of the @code{xmpyu} instruction.
26354 @opindex march
26355 @item -munix=@var{unix-std}
26356 Generate compiler predefines and select a startfile for the specified
26357 UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
26358 and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
26359 is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
26360 11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
26361 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
26362 and later.
26364 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
26365 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
26366 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
26367 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
26368 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
26369 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
26371 It is @emph{important} to note that this option changes the interfaces
26372 for various library routines.  It also affects the operational behavior
26373 of the C library.  Thus, @emph{extreme} care is needed in using this
26374 option.
26376 Library code that is intended to operate with more than one UNIX
26377 standard must test, set and restore the variable @code{__xpg4_extended_mask}
26378 as appropriate.  Most GNU software doesn't provide this capability.
26380 @opindex nolibdld
26381 @item -nolibdld
26382 Suppress the generation of link options to search libdld.sl when the
26383 @option{-static} option is specified on HP-UX 10 and later.
26385 @opindex static
26386 @item -static
26387 The HP-UX implementation of setlocale in libc has a dependency on
26388 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
26389 when the @option{-static} option is specified, special link options
26390 are needed to resolve this dependency.
26392 On HP-UX 10 and later, the GCC driver adds the necessary options to
26393 link with libdld.sl when the @option{-static} option is specified.
26394 This causes the resulting binary to be dynamic.  On the 64-bit port,
26395 the linkers generate dynamic binaries by default in any case.  The
26396 @option{-nolibdld} option can be used to prevent the GCC driver from
26397 adding these link options.
26399 @opindex threads
26400 @item -threads
26401 Add support for multithreading with the @dfn{dce thread} library
26402 under HP-UX@.  This option sets flags for both the preprocessor and
26403 linker.
26404 @end table
26406 @node IA-64 Options
26407 @subsection IA-64 Options
26408 @cindex IA-64 Options
26410 These are the @samp{-m} options defined for the Intel IA-64 architecture.
26412 @table @gcctabopt
26413 @opindex mbig-endian
26414 @item -mbig-endian
26415 Generate code for a big-endian target.  This is the default for HP-UX@.
26417 @opindex mlittle-endian
26418 @item -mlittle-endian
26419 Generate code for a little-endian target.  This is the default for AIX5
26420 and GNU/Linux.
26422 @opindex mgnu-as
26423 @opindex mno-gnu-as
26424 @item -mgnu-as
26425 @itemx -mno-gnu-as
26426 Generate (or don't) code for the GNU assembler.  This is the default.
26427 @c Also, this is the default if the configure option @option{--with-gnu-as}
26428 @c is used.
26430 @opindex mgnu-ld
26431 @opindex mno-gnu-ld
26432 @item -mgnu-ld
26433 @itemx -mno-gnu-ld
26434 Generate (or don't) code for the GNU linker.  This is the default.
26435 @c Also, this is the default if the configure option @option{--with-gnu-ld}
26436 @c is used.
26438 @opindex mno-pic
26439 @item -mno-pic
26440 Generate code that does not use a global pointer register.  The result
26441 is not position independent code, and violates the IA-64 ABI@.
26443 @opindex mvolatile-asm-stop
26444 @opindex mno-volatile-asm-stop
26445 @item -mvolatile-asm-stop
26446 @itemx -mno-volatile-asm-stop
26447 Generate (or don't) a stop bit immediately before and after volatile asm
26448 statements.
26450 @opindex mregister-names
26451 @opindex mno-register-names
26452 @item -mregister-names
26453 @itemx -mno-register-names
26454 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
26455 the stacked registers.  This may make assembler output more readable.
26457 @opindex mno-sdata
26458 @opindex msdata
26459 @item -mno-sdata
26460 @itemx -msdata
26461 Disable (or enable) optimizations that use the small data section.  This may
26462 be useful for working around optimizer bugs.
26464 @opindex mconstant-gp
26465 @item -mconstant-gp
26466 Generate code that uses a single constant global pointer value.  This is
26467 useful when compiling kernel code.
26469 @opindex mauto-pic
26470 @item -mauto-pic
26471 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
26472 This is useful when compiling firmware code.
26474 @opindex minline-float-divide-min-latency
26475 @item -minline-float-divide-min-latency
26476 Generate code for inline divides of floating-point values
26477 using the minimum latency algorithm.
26479 @opindex minline-float-divide-max-throughput
26480 @item -minline-float-divide-max-throughput
26481 Generate code for inline divides of floating-point values
26482 using the maximum throughput algorithm.
26484 @opindex mno-inline-float-divide
26485 @item -mno-inline-float-divide
26486 Do not generate inline code for divides of floating-point values.
26488 @opindex minline-int-divide-min-latency
26489 @item -minline-int-divide-min-latency
26490 Generate code for inline divides of integer values
26491 using the minimum latency algorithm.
26493 @opindex minline-int-divide-max-throughput
26494 @item -minline-int-divide-max-throughput
26495 Generate code for inline divides of integer values
26496 using the maximum throughput algorithm.
26498 @opindex mno-inline-int-divide
26499 @opindex minline-int-divide
26500 @item -mno-inline-int-divide
26501 Do not generate inline code for divides of integer values.
26503 @opindex minline-sqrt-min-latency
26504 @item -minline-sqrt-min-latency
26505 Generate code for inline square roots
26506 using the minimum latency algorithm.
26508 @opindex minline-sqrt-max-throughput
26509 @item -minline-sqrt-max-throughput
26510 Generate code for inline square roots
26511 using the maximum throughput algorithm.
26513 @opindex mno-inline-sqrt
26514 @item -mno-inline-sqrt
26515 Do not generate inline code for @code{sqrt}.
26517 @opindex mfused-madd
26518 @opindex mno-fused-madd
26519 @item -mfused-madd
26520 @itemx -mno-fused-madd
26521 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
26522 instructions.  The default is to use these instructions.
26524 @opindex mno-dwarf2-asm
26525 @opindex mdwarf2-asm
26526 @item -mno-dwarf2-asm
26527 @itemx -mdwarf2-asm
26528 Don't (or do) generate assembler code for the DWARF line number debugging
26529 info.  This may be useful when not using the GNU assembler.
26531 @opindex mearly-stop-bits
26532 @opindex mno-early-stop-bits
26533 @item -mearly-stop-bits
26534 @itemx -mno-early-stop-bits
26535 Allow stop bits to be placed earlier than immediately preceding the
26536 instruction that triggered the stop bit.  This can improve instruction
26537 scheduling, but does not always do so.
26539 @opindex mfixed-range
26540 @item -mfixed-range=@var{register-range}
26541 Generate code treating the given register range as fixed registers.
26542 A fixed register is one that the register allocator cannot use.  This is
26543 useful when compiling kernel code.  A register range is specified as
26544 two registers separated by a dash.  Multiple register ranges can be
26545 specified separated by a comma.
26547 @opindex mtls-size
26548 @item -mtls-size=@var{tls-size}
26549 Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
26552 @opindex mtune
26553 @item -mtune=@var{cpu-type}
26554 Tune the instruction scheduling for a particular CPU, Valid values are
26555 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
26556 and @samp{mckinley}.
26558 @opindex milp32
26559 @opindex mlp64
26560 @item -milp32
26561 @itemx -mlp64
26562 Generate code for a 32-bit or 64-bit environment.
26563 The 32-bit environment sets int, long and pointer to 32 bits.
26564 The 64-bit environment sets int to 32 bits and long and pointer
26565 to 64 bits.  These are HP-UX specific flags.
26567 @opindex mno-sched-br-data-spec
26568 @opindex msched-br-data-spec
26569 @item -mno-sched-br-data-spec
26570 @itemx -msched-br-data-spec
26571 (Dis/En)able data speculative scheduling before reload.
26572 This results in generation of @code{ld.a} instructions and
26573 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
26574 The default setting is disabled.
26576 @opindex msched-ar-data-spec
26577 @opindex mno-sched-ar-data-spec
26578 @item -msched-ar-data-spec
26579 @itemx -mno-sched-ar-data-spec
26580 (En/Dis)able data speculative scheduling after reload.
26581 This results in generation of @code{ld.a} instructions and
26582 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
26583 The default setting is enabled.
26585 @opindex mno-sched-control-spec
26586 @opindex msched-control-spec
26587 @item -mno-sched-control-spec
26588 @itemx -msched-control-spec
26589 (Dis/En)able control speculative scheduling.  This feature is
26590 available only during region scheduling (i.e.@: before reload).
26591 This results in generation of the @code{ld.s} instructions and
26592 the corresponding check instructions @code{chk.s}.
26593 The default setting is disabled.
26595 @opindex msched-br-in-data-spec
26596 @opindex mno-sched-br-in-data-spec
26597 @item -msched-br-in-data-spec
26598 @itemx -mno-sched-br-in-data-spec
26599 (En/Dis)able speculative scheduling of the instructions that
26600 are dependent on the data speculative loads before reload.
26601 This is effective only with @option{-msched-br-data-spec} enabled.
26602 The default setting is enabled.
26604 @opindex msched-ar-in-data-spec
26605 @opindex mno-sched-ar-in-data-spec
26606 @item -msched-ar-in-data-spec
26607 @itemx -mno-sched-ar-in-data-spec
26608 (En/Dis)able speculative scheduling of the instructions that
26609 are dependent on the data speculative loads after reload.
26610 This is effective only with @option{-msched-ar-data-spec} enabled.
26611 The default setting is enabled.
26613 @opindex msched-in-control-spec
26614 @opindex mno-sched-in-control-spec
26615 @item -msched-in-control-spec
26616 @itemx -mno-sched-in-control-spec
26617 (En/Dis)able speculative scheduling of the instructions that
26618 are dependent on the control speculative loads.
26619 This is effective only with @option{-msched-control-spec} enabled.
26620 The default setting is enabled.
26622 @opindex mno-sched-prefer-non-data-spec-insns
26623 @opindex msched-prefer-non-data-spec-insns
26624 @item -mno-sched-prefer-non-data-spec-insns
26625 @itemx -msched-prefer-non-data-spec-insns
26626 If enabled, data-speculative instructions are chosen for schedule
26627 only if there are no other choices at the moment.  This makes
26628 the use of the data speculation much more conservative.
26629 The default setting is disabled.
26631 @opindex mno-sched-prefer-non-control-spec-insns
26632 @opindex msched-prefer-non-control-spec-insns
26633 @item -mno-sched-prefer-non-control-spec-insns
26634 @itemx -msched-prefer-non-control-spec-insns
26635 If enabled, control-speculative instructions are chosen for schedule
26636 only if there are no other choices at the moment.  This makes
26637 the use of the control speculation much more conservative.
26638 The default setting is disabled.
26640 @opindex mno-sched-count-spec-in-critical-path
26641 @opindex msched-count-spec-in-critical-path
26642 @item -mno-sched-count-spec-in-critical-path
26643 @itemx -msched-count-spec-in-critical-path
26644 If enabled, speculative dependencies are considered during
26645 computation of the instructions priorities.  This makes the use of the
26646 speculation a bit more conservative.
26647 The default setting is disabled.
26649 @opindex msched-spec-ldc
26650 @item -msched-spec-ldc
26651 Use a simple data speculation check.  This option is on by default.
26653 @opindex msched-spec-ldc
26654 @item -msched-control-spec-ldc
26655 Use a simple check for control speculation.  This option is on by default.
26657 @opindex msched-stop-bits-after-every-cycle
26658 @item -msched-stop-bits-after-every-cycle
26659 Place a stop bit after every cycle when scheduling.  This option is on
26660 by default.
26662 @opindex msched-fp-mem-deps-zero-cost
26663 @item -msched-fp-mem-deps-zero-cost
26664 Assume that floating-point stores and loads are not likely to cause a conflict
26665 when placed into the same instruction group.  This option is disabled by
26666 default.
26668 @opindex msel-sched-dont-check-control-spec
26669 @item -msel-sched-dont-check-control-spec
26670 Generate checks for control speculation in selective scheduling.
26671 This flag is disabled by default.
26673 @opindex msched-max-memory-insns
26674 @item -msched-max-memory-insns=@var{max-insns}
26675 Limit on the number of memory insns per instruction group, giving lower
26676 priority to subsequent memory insns attempting to schedule in the same
26677 instruction group. Frequently useful to prevent cache bank conflicts.
26678 The default value is 1.
26680 @opindex msched-max-memory-insns-hard-limit
26681 @item -msched-max-memory-insns-hard-limit
26682 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
26683 disallowing more than that number in an instruction group.
26684 Otherwise, the limit is ``soft'', meaning that non-memory operations
26685 are preferred when the limit is reached, but memory operations may still
26686 be scheduled.
26688 @end table
26690 @node LM32 Options
26691 @subsection LM32 Options
26692 @cindex LM32 options
26694 These @option{-m} options are defined for the LatticeMico32 architecture:
26696 @table @gcctabopt
26697 @opindex mbarrel-shift-enabled
26698 @item -mbarrel-shift-enabled
26699 Enable barrel-shift instructions.
26701 @opindex mdivide-enabled
26702 @item -mdivide-enabled
26703 Enable divide and modulus instructions.
26705 @opindex multiply-enabled
26706 @item -mmultiply-enabled
26707 Enable multiply instructions.
26709 @opindex msign-extend-enabled
26710 @item -msign-extend-enabled
26711 Enable sign extend instructions.
26713 @opindex muser-enabled
26714 @item -muser-enabled
26715 Enable user-defined instructions.
26717 @end table
26719 @node LoongArch Options
26720 @subsection LoongArch Options
26721 @cindex LoongArch Options
26723 These command-line options are defined for LoongArch targets:
26725 @table @gcctabopt
26726 @opindex march
26727 @item -march=@var{cpu-type}
26728 Generate instructions for the machine type @var{cpu-type}.  In contrast to
26729 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
26730 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
26731 to generate code that may not run at all on processors other than the one
26732 indicated.  Specifying @option{-march=@var{cpu-type}} implies
26733 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
26735 The choices for @var{cpu-type} are:
26737 @table @samp
26738 @item native
26739 This selects the CPU to generate code for at compilation time by determining
26740 the processor type of the compiling machine.  Using @option{-march=native}
26741 enables all instruction subsets supported by the local machine (hence
26742 the result might not run on different machines).  Using @option{-mtune=native}
26743 produces code optimized for the local machine under the constraints
26744 of the selected instruction set.
26745 @item loongarch64
26746 A generic CPU with 64-bit extensions.
26747 @item la464
26748 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
26749 @end table
26751 @opindex mtune
26752 @item -mtune=@var{cpu-type}
26753 Optimize the output for the given processor, specified by microarchitecture
26754 name.
26756 @opindex mabi
26757 @item -mabi=@var{base-abi-type}
26758 Generate code for the specified calling convention.
26759 @var{base-abi-type} can be one of:
26760 @table @samp
26761 @item lp64d
26762 Uses 64-bit general purpose registers and 32/64-bit floating-point
26763 registers for parameter passing.  Data model is LP64, where @samp{int}
26764 is 32 bits, while @samp{long int} and pointers are 64 bits.
26765 @item lp64f
26766 Uses 64-bit general purpose registers and 32-bit floating-point
26767 registers for parameter passing.  Data model is LP64, where @samp{int}
26768 is 32 bits, while @samp{long int} and pointers are 64 bits.
26769 @item lp64s
26770 Uses 64-bit general purpose registers and no floating-point
26771 registers for parameter passing.  Data model is LP64, where @samp{int}
26772 is 32 bits, while @samp{long int} and pointers are 64 bits.
26773 @end table
26775 @opindex mfpu
26776 @item -mfpu=@var{fpu-type}
26777 Generate code for the specified FPU type, which can be one of:
26778 @table @samp
26779 @item 64
26780 Allow the use of hardware floating-point instructions for 32-bit
26781 and 64-bit operations.
26782 @item 32
26783 Allow the use of hardware floating-point instructions for 32-bit
26784 operations.
26785 @item none
26786 @item 0
26787 Prevent the use of hardware floating-point instructions.
26788 @end table
26790 @opindex msimd
26791 @item -msimd=@var{simd-type}
26792 Enable generation of LoongArch SIMD instructions for vectorization
26793 and via builtin functions.  The value can be one of:
26794 @table @samp
26795 @item lasx
26796 Enable generating instructions from the 256-bit LoongArch Advanced
26797 SIMD Extension (LASX) and the 128-bit LoongArch SIMD Extension (LSX).
26798 @item lsx
26799 Enable generating instructions from the 128-bit LoongArch SIMD
26800 Extension (LSX).
26801 @item none
26802 No LoongArch SIMD instruction may be generated.
26803 @end table
26805 @opindex msoft-float
26806 @item -msoft-float
26807 Force @option{-mfpu=none} and prevents the use of floating-point
26808 registers for parameter passing.  This option may change the target
26809 ABI.
26811 @opindex msingle-float
26812 @item -msingle-float
26813 Force @option{-mfpu=32} and allow the use of 32-bit floating-point
26814 registers for parameter passing.  This option may change the target
26815 ABI.
26817 @opindex mdouble-float
26818 @item -mdouble-float
26819 Force @option{-mfpu=64} and allow the use of 32/64-bit floating-point
26820 registers for parameter passing.  This option may change the target
26821 ABI.
26823 @opindex ml[a]sx
26824 @item -mlasx
26825 @itemx -mno-lasx
26826 @item -mlsx
26827 @itemx -mno-lsx
26828 Incrementally adjust the scope of the SIMD extensions (none / LSX / LASX)
26829 that can be used by the compiler for code generation.  Enabling LASX with
26830 @option{mlasx} automatically enables LSX, and diabling LSX with @option{mno-lsx}
26831 automatically disables LASX.  These driver-only options act upon the final
26832 @option{msimd} configuration state and make incremental chagnes in the order
26833 they appear on the GCC driver's command line, deriving the final / canonicalized
26834 @option{msimd} option that is passed to the compiler proper.
26836 @opindex mbranch-cost
26837 @item -mbranch-cost=@var{n}
26838 Set the cost of branches to roughly @var{n} instructions.
26840 @opindex mcheck-zero-division
26841 @item -mcheck-zero-division
26842 @itemx -mno-check-zero-divison
26843 Trap (do not trap) on integer division by zero.  The default is
26844 @option{-mcheck-zero-division} for @option{-O0} or @option{-Og}, and
26845 @option{-mno-check-zero-division} for other optimization levels.
26847 @opindex mcond-move-int
26848 @item -mcond-move-int
26849 @itemx -mno-cond-move-int
26850 Conditional moves for integral data in general-purpose registers
26851 are enabled (disabled).  The default is @option{-mcond-move-int}.
26853 @opindex mcond-move-float
26854 @item -mcond-move-float
26855 @itemx -mno-cond-move-float
26856 Conditional moves for floating-point registers are enabled (disabled).
26857 The default is @option{-mcond-move-float}.
26859 @opindex mmemcpy
26860 @item -mmemcpy
26861 @itemx -mno-memcpy
26862 Force (do not force) the use of @code{memcpy} for non-trivial block moves.
26863 The default is @option{-mno-memcpy}, which allows GCC to inline most
26864 constant-sized copies.  Setting optimization level to @option{-Os} also
26865 forces the use of @code{memcpy}, but @option{-mno-memcpy} may override this
26866 behavior if explicitly specified, regardless of the order these options on
26867 the command line.
26869 @opindex mstrict-align
26870 @item -mstrict-align
26871 @itemx -mno-strict-align
26872 Avoid or allow generating memory accesses that may not be aligned on a natural
26873 object boundary as described in the architecture specification. The default is
26874 @option{-mno-strict-align}.
26876 @opindex msmall-data-limit
26877 @item -msmall-data-limit=@var{number}
26878 Put global and static data smaller than @var{number} bytes into a special
26879 section (on some targets).  The default value is 0.
26881 @opindex mmax-inline-memcpy-size
26882 @item -mmax-inline-memcpy-size=@var{n}
26883 Inline all block moves (such as calls to @code{memcpy} or structure copies)
26884 less than or equal to @var{n} bytes.  The default value of @var{n} is 1024.
26886 @item -mcmodel=@var{code-model}
26887 Set the code model to one of:
26888 @table @samp
26889 @item tiny-static (Not implemented yet)
26890 @item tiny (Not implemented yet)
26892 @item normal
26893 The text segment must be within 128MB addressing space.  The data segment must
26894 be within 2GB addressing space.
26896 @item medium
26897 The text segment and data segment must be within 2GB addressing space.
26899 @item large (Not implemented yet)
26901 @item extreme
26902 This mode does not limit the size of the code segment and data segment.
26903 The @option{-mcmodel=extreme} option is incompatible with @option{-fplt}
26904 and/or @option{-mexplicit-relocs=none}.
26905 @end table
26906 The default code model is @code{normal}.
26908 @item -mexplicit-relocs=@var{style}
26909 Set when to use assembler relocation operators when dealing with symbolic
26910 addresses.  The alternative is to use assembler macros instead, which may
26911 limit instruction scheduling but allow linker relaxation.
26912 with @option{-mexplicit-relocs=none} the assembler macros are always used,
26913 with @option{-mexplicit-relocs=always} the assembler relocation operators
26914 are always used, with @option{-mexplicit-relocs=auto} the compiler will
26915 use the relocation operators where the linker relaxation is impossible to
26916 improve the code quality, and macros elsewhere.  The default
26917 value for the option is determined with the assembler capability detected
26918 during GCC build-time and the setting of @option{-mrelax}:
26919 @option{-mexplicit-relocs=none} if the assembler does not support
26920 relocation operators at all,
26921 @option{-mexplicit-relocs=always} if the assembler supports relocation
26922 operators but @option{-mrelax} is not enabled,
26923 @option{-mexplicit-relocs=auto} if the assembler supports relocation
26924 operators and @option{-mrelax} is enabled.
26926 @opindex mexplicit-relocs
26927 @item -mexplicit-relocs
26928 An alias of @option{-mexplicit-relocs=always} for backward compatibility.
26930 @opindex mno-explicit-relocs
26931 @item -mno-explicit-relocs
26932 An alias of @option{-mexplicit-relocs=none} for backward compatibility.
26934 @opindex mdirect-extern-access
26935 @item -mdirect-extern-access
26936 @itemx -mno-direct-extern-access
26937 Do not use or use GOT to access external symbols.  The default is
26938 @option{-mno-direct-extern-access}: GOT is used for external symbols with
26939 default visibility, but not used for other external symbols.
26941 With @option{-mdirect-extern-access}, GOT is not used and all external
26942 symbols are PC-relatively addressed.  It is @strong{only} suitable for
26943 environments where no dynamic link is performed, like firmwares, OS
26944 kernels, executables linked with @option{-static} or @option{-static-pie}.
26945 @option{-mdirect-extern-access} is not compatible with @option{-fPIC} or
26946 @option{-fpic}.
26948 @item -mrelax
26949 @itemx -mno-relax
26950 Take (do not take) advantage of linker relaxations.  If
26951 @option{-mpass-mrelax-to-as} is enabled, this option is also passed to
26952 the assembler.  The default is determined during GCC build-time by
26953 detecting corresponding assembler support:
26954 @option{-mrelax} if the assembler supports both the @option{-mrelax}
26955 option and the conditional branch relaxation (it's required or the
26956 @code{.align} directives and conditional branch instructions in the
26957 assembly code outputted by GCC may be rejected by the assembler because
26958 of a relocation overflow), @option{-mno-relax} otherwise.
26960 @item -mpass-mrelax-to-as
26961 @itemx -mno-pass-mrelax-to-as
26962 Pass (do not pass) the @option{-mrelax} or @option{-mno-relax} option
26963 to the assembler.  The default is determined during GCC build-time by
26964 detecting corresponding assembler support:
26965 @option{-mpass-mrelax-to-as} if the assembler supports the
26966 @option{-mrelax} option, @option{-mno-pass-mrelax-to-as} otherwise.
26967 This option is mostly useful for debugging, or interoperation with
26968 assemblers different from the build-time one.
26970 @opindex mrecip
26971 @item -mrecip
26972 This option enables use of the reciprocal estimate and reciprocal square
26973 root estimate instructions with additional Newton-Raphson steps to increase
26974 precision instead of doing a divide or square root and divide for
26975 floating-point arguments.
26976 These instructions are generated only when @option{-funsafe-math-optimizations}
26977 is enabled together with @option{-ffinite-math-only} and
26978 @option{-fno-trapping-math}.
26979 This option is off by default. Before you can use this option, you must sure the
26980 target CPU supports frecipe and frsqrte instructions.
26981 Note that while the throughput of the sequence is higher than the throughput of
26982 the non-reciprocal instruction, the precision of the sequence can be decreased
26983 by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
26985 @opindex mrecip=opt
26986 @item -mrecip=@var{opt}
26987 This option controls which reciprocal estimate instructions
26988 may be used.  @var{opt} is a comma-separated list of options, which may
26989 be preceded by a @samp{!} to invert the option:
26991 @table @samp
26992 @item all
26993 Enable all estimate instructions.
26995 @item default
26996 Enable the default instructions, equivalent to @option{-mrecip}.
26998 @item none
26999 Disable all estimate instructions, equivalent to @option{-mno-recip}.
27001 @item div
27002 Enable the approximation for scalar division.
27004 @item vec-div
27005 Enable the approximation for vectorized division.
27007 @item sqrt
27008 Enable the approximation for scalar square root.
27010 @item vec-sqrt
27011 Enable the approximation for vectorized square root.
27013 @item rsqrt
27014 Enable the approximation for scalar reciprocal square root.
27016 @item vec-rsqrt
27017 Enable the approximation for vectorized reciprocal square root.
27018 @end table
27020 So, for example, @option{-mrecip=all,!sqrt} enables
27021 all of the reciprocal approximations, except for scalar square root.
27023 @item loongarch-vect-unroll-limit
27024 The vectorizer will use available tuning information to determine whether it
27025 would be beneficial to unroll the main vectorized loop and by how much.  This
27026 parameter set's the upper bound of how much the vectorizer will unroll the main
27027 loop.  The default value is six.
27029 @end table
27032 @node M32C Options
27033 @subsection M32C Options
27034 @cindex M32C options
27036 @table @gcctabopt
27037 @opindex mcpu=
27038 @item -mcpu=@var{name}
27039 Select the CPU for which code is generated.  @var{name} may be one of
27040 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
27041 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
27042 the M32C/80 series.
27044 @opindex msim
27045 @item -msim
27046 Specifies that the program will be run on the simulator.  This causes
27047 an alternate runtime library to be linked in which supports, for
27048 example, file I/O@.  You must not use this option when generating
27049 programs that will run on real hardware; you must provide your own
27050 runtime library for whatever I/O functions are needed.
27052 @opindex memregs=
27053 @item -memregs=@var{number}
27054 Specifies the number of memory-based pseudo-registers GCC uses
27055 during code generation.  These pseudo-registers are used like real
27056 registers, so there is a tradeoff between GCC's ability to fit the
27057 code into available registers, and the performance penalty of using
27058 memory instead of registers.  Note that all modules in a program must
27059 be compiled with the same value for this option.  Because of that, you
27060 must not use this option with GCC's default runtime libraries.
27062 @end table
27064 @node M32R/D Options
27065 @subsection M32R/D Options
27066 @cindex M32R/D options
27068 These @option{-m} options are defined for Renesas M32R/D architectures:
27070 @table @gcctabopt
27071 @opindex m32r2
27072 @item -m32r2
27073 Generate code for the M32R/2@.
27075 @opindex m32rx
27076 @item -m32rx
27077 Generate code for the M32R/X@.
27079 @opindex m32r
27080 @item -m32r
27081 Generate code for the M32R@.  This is the default.
27083 @opindex mmodel=small
27084 @item -mmodel=small
27085 Assume all objects live in the lower 16MB of memory (so that their addresses
27086 can be loaded with the @code{ld24} instruction), and assume all subroutines
27087 are reachable with the @code{bl} instruction.
27088 This is the default.
27090 The addressability of a particular object can be set with the
27091 @code{model} attribute.
27093 @opindex mmodel=medium
27094 @item -mmodel=medium
27095 Assume objects may be anywhere in the 32-bit address space (the compiler
27096 generates @code{seth/add3} instructions to load their addresses), and
27097 assume all subroutines are reachable with the @code{bl} instruction.
27099 @opindex mmodel=large
27100 @item -mmodel=large
27101 Assume objects may be anywhere in the 32-bit address space (the compiler
27102 generates @code{seth/add3} instructions to load their addresses), and
27103 assume subroutines may not be reachable with the @code{bl} instruction
27104 (the compiler generates the much slower @code{seth/add3/jl}
27105 instruction sequence).
27107 @opindex msdata=none
27108 @item -msdata=none
27109 Disable use of the small data area.  Variables are put into
27110 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
27111 @code{section} attribute has been specified).
27112 This is the default.
27114 The small data area consists of sections @code{.sdata} and @code{.sbss}.
27115 Objects may be explicitly put in the small data area with the
27116 @code{section} attribute using one of these sections.
27118 @opindex msdata=sdata
27119 @item -msdata=sdata
27120 Put small global and static data in the small data area, but do not
27121 generate special code to reference them.
27123 @opindex msdata=use
27124 @item -msdata=use
27125 Put small global and static data in the small data area, and generate
27126 special instructions to reference them.
27128 @opindex G
27129 @cindex smaller data references
27130 @item -G @var{num}
27131 Put global and static objects less than or equal to @var{num} bytes
27132 into the small data or BSS sections instead of the normal data or BSS
27133 sections.  The default value of @var{num} is 8.
27134 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
27135 for this option to have any effect.
27137 All modules should be compiled with the same @option{-G @var{num}} value.
27138 Compiling with different values of @var{num} may or may not work; if it
27139 doesn't the linker gives an error message---incorrect code is not
27140 generated.
27142 @opindex mdebug
27143 @item -mdebug
27144 Makes the M32R-specific code in the compiler display some statistics
27145 that might help in debugging programs.
27147 @opindex malign-loops
27148 @item -malign-loops
27149 Align all loops to a 32-byte boundary.
27151 @opindex mno-align-loops
27152 @item -mno-align-loops
27153 Do not enforce a 32-byte alignment for loops.  This is the default.
27155 @opindex missue-rate=@var{number}
27156 @item -missue-rate=@var{number}
27157 Issue @var{number} instructions per cycle.  @var{number} can only be 1
27158 or 2.
27160 @opindex mbranch-cost=@var{number}
27161 @item -mbranch-cost=@var{number}
27162 @var{number} can only be 1 or 2.  If it is 1 then branches are
27163 preferred over conditional code, if it is 2, then the opposite applies.
27165 @opindex mflush-trap=@var{number}
27166 @item -mflush-trap=@var{number}
27167 Specifies the trap number to use to flush the cache.  The default is
27168 12.  Valid numbers are between 0 and 15 inclusive.
27170 @opindex mno-flush-trap
27171 @item -mno-flush-trap
27172 Specifies that the cache cannot be flushed by using a trap.
27174 @opindex mflush-func=@var{name}
27175 @item -mflush-func=@var{name}
27176 Specifies the name of the operating system function to call to flush
27177 the cache.  The default is @samp{_flush_cache}, but a function call
27178 is only used if a trap is not available.
27180 @opindex mno-flush-func
27181 @item -mno-flush-func
27182 Indicates that there is no OS function for flushing the cache.
27184 @end table
27186 @node M680x0 Options
27187 @subsection M680x0 Options
27188 @cindex M680x0 options
27190 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
27191 The default settings depend on which architecture was selected when
27192 the compiler was configured; the defaults for the most common choices
27193 are given below.
27195 @table @gcctabopt
27196 @opindex march
27197 @item -march=@var{arch}
27198 Generate code for a specific M680x0 or ColdFire instruction set
27199 architecture.  Permissible values of @var{arch} for M680x0
27200 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
27201 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
27202 architectures are selected according to Freescale's ISA classification
27203 and the permissible values are: @samp{isaa}, @samp{isaaplus},
27204 @samp{isab} and @samp{isac}.
27206 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
27207 code for a ColdFire target.  The @var{arch} in this macro is one of the
27208 @option{-march} arguments given above.
27210 When used together, @option{-march} and @option{-mtune} select code
27211 that runs on a family of similar processors but that is optimized
27212 for a particular microarchitecture.
27214 @opindex mcpu
27215 @item -mcpu=@var{cpu}
27216 Generate code for a specific M680x0 or ColdFire processor.
27217 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
27218 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
27219 and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
27220 below, which also classifies the CPUs into families:
27222 @multitable @columnfractions 0.20 0.80
27223 @headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments}
27224 @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}
27225 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
27226 @item @samp{5206e} @tab @samp{5206e}
27227 @item @samp{5208} @tab @samp{5207} @samp{5208}
27228 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
27229 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
27230 @item @samp{5216} @tab @samp{5214} @samp{5216}
27231 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
27232 @item @samp{5225} @tab @samp{5224} @samp{5225}
27233 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
27234 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
27235 @item @samp{5249} @tab @samp{5249}
27236 @item @samp{5250} @tab @samp{5250}
27237 @item @samp{5271} @tab @samp{5270} @samp{5271}
27238 @item @samp{5272} @tab @samp{5272}
27239 @item @samp{5275} @tab @samp{5274} @samp{5275}
27240 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
27241 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
27242 @item @samp{5307} @tab @samp{5307}
27243 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
27244 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
27245 @item @samp{5407} @tab @samp{5407}
27246 @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}
27247 @end multitable
27249 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
27250 @var{arch} is compatible with @var{cpu}.  Other combinations of
27251 @option{-mcpu} and @option{-march} are rejected.
27253 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
27254 @var{cpu} is selected.  It also defines @code{__mcf_family_@var{family}},
27255 where the value of @var{family} is given by the table above.
27257 @opindex mtune
27258 @item -mtune=@var{tune}
27259 Tune the code for a particular microarchitecture within the
27260 constraints set by @option{-march} and @option{-mcpu}.
27261 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
27262 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
27263 and @samp{cpu32}.  The ColdFire microarchitectures
27264 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
27266 You can also use @option{-mtune=68020-40} for code that needs
27267 to run relatively well on 68020, 68030 and 68040 targets.
27268 @option{-mtune=68020-60} is similar but includes 68060 targets
27269 as well.  These two options select the same tuning decisions as
27270 @option{-m68020-40} and @option{-m68020-60} respectively.
27272 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
27273 when tuning for 680x0 architecture @var{arch}.  It also defines
27274 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
27275 option is used.  If GCC is tuning for a range of architectures,
27276 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
27277 it defines the macros for every architecture in the range.
27279 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
27280 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
27281 of the arguments given above.
27283 @opindex m68000
27284 @opindex mc68000
27285 @item -m68000
27286 @itemx -mc68000
27287 Generate output for a 68000.  This is the default
27288 when the compiler is configured for 68000-based systems.
27289 It is equivalent to @option{-march=68000}.
27291 Use this option for microcontrollers with a 68000 or EC000 core,
27292 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
27294 @opindex m68010
27295 @item -m68010
27296 Generate output for a 68010.  This is the default
27297 when the compiler is configured for 68010-based systems.
27298 It is equivalent to @option{-march=68010}.
27300 @opindex m68020
27301 @opindex mc68020
27302 @item -m68020
27303 @itemx -mc68020
27304 Generate output for a 68020.  This is the default
27305 when the compiler is configured for 68020-based systems.
27306 It is equivalent to @option{-march=68020}.
27308 @opindex m68030
27309 @item -m68030
27310 Generate output for a 68030.  This is the default when the compiler is
27311 configured for 68030-based systems.  It is equivalent to
27312 @option{-march=68030}.
27314 @opindex m68040
27315 @item -m68040
27316 Generate output for a 68040.  This is the default when the compiler is
27317 configured for 68040-based systems.  It is equivalent to
27318 @option{-march=68040}.
27320 This option inhibits the use of 68881/68882 instructions that have to be
27321 emulated by software on the 68040.  Use this option if your 68040 does not
27322 have code to emulate those instructions.
27324 @opindex m68060
27325 @item -m68060
27326 Generate output for a 68060.  This is the default when the compiler is
27327 configured for 68060-based systems.  It is equivalent to
27328 @option{-march=68060}.
27330 This option inhibits the use of 68020 and 68881/68882 instructions that
27331 have to be emulated by software on the 68060.  Use this option if your 68060
27332 does not have code to emulate those instructions.
27334 @opindex mcpu32
27335 @item -mcpu32
27336 Generate output for a CPU32.  This is the default
27337 when the compiler is configured for CPU32-based systems.
27338 It is equivalent to @option{-march=cpu32}.
27340 Use this option for microcontrollers with a
27341 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
27342 68336, 68340, 68341, 68349 and 68360.
27344 @opindex m5200
27345 @item -m5200
27346 Generate output for a 520X ColdFire CPU@.  This is the default
27347 when the compiler is configured for 520X-based systems.
27348 It is equivalent to @option{-mcpu=5206}, and is now deprecated
27349 in favor of that option.
27351 Use this option for microcontroller with a 5200 core, including
27352 the MCF5202, MCF5203, MCF5204 and MCF5206.
27354 @opindex m5206e
27355 @item -m5206e
27356 Generate output for a 5206e ColdFire CPU@.  The option is now
27357 deprecated in favor of the equivalent @option{-mcpu=5206e}.
27359 @opindex m528x
27360 @item -m528x
27361 Generate output for a member of the ColdFire 528X family.
27362 The option is now deprecated in favor of the equivalent
27363 @option{-mcpu=528x}.
27365 @opindex m5307
27366 @item -m5307
27367 Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
27368 in favor of the equivalent @option{-mcpu=5307}.
27370 @opindex m5407
27371 @item -m5407
27372 Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
27373 in favor of the equivalent @option{-mcpu=5407}.
27375 @opindex mcfv4e
27376 @item -mcfv4e
27377 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
27378 This includes use of hardware floating-point instructions.
27379 The option is equivalent to @option{-mcpu=547x}, and is now
27380 deprecated in favor of that option.
27382 @opindex m68020-40
27383 @item -m68020-40
27384 Generate output for a 68040, without using any of the new instructions.
27385 This results in code that can run relatively efficiently on either a
27386 68020/68881 or a 68030 or a 68040.  The generated code does use the
27387 68881 instructions that are emulated on the 68040.
27389 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
27391 @opindex m68020-60
27392 @item -m68020-60
27393 Generate output for a 68060, without using any of the new instructions.
27394 This results in code that can run relatively efficiently on either a
27395 68020/68881 or a 68030 or a 68040.  The generated code does use the
27396 68881 instructions that are emulated on the 68060.
27398 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
27400 @opindex mhard-float
27401 @opindex m68881
27402 @item -mhard-float
27403 @itemx -m68881
27404 Generate floating-point instructions.  This is the default for 68020
27405 and above, and for ColdFire devices that have an FPU@.  It defines the
27406 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
27407 on ColdFire targets.
27409 @opindex msoft-float
27410 @item -msoft-float
27411 Do not generate floating-point instructions; use library calls instead.
27412 This is the default for 68000, 68010, and 68832 targets.  It is also
27413 the default for ColdFire devices that have no FPU.
27415 @opindex mdiv
27416 @opindex mno-div
27417 @item -mdiv
27418 @itemx -mno-div
27419 Generate (do not generate) ColdFire hardware divide and remainder
27420 instructions.  If @option{-march} is used without @option{-mcpu},
27421 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
27422 architectures.  Otherwise, the default is taken from the target CPU
27423 (either the default CPU, or the one specified by @option{-mcpu}).  For
27424 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
27425 @option{-mcpu=5206e}.
27427 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
27429 @opindex mshort
27430 @item -mshort
27431 Consider type @code{int} to be 16 bits wide, like @code{short int}.
27432 Additionally, parameters passed on the stack are also aligned to a
27433 16-bit boundary even on targets whose API mandates promotion to 32-bit.
27435 @opindex mno-short
27436 @item -mno-short
27437 Do not consider type @code{int} to be 16 bits wide.  This is the default.
27439 @opindex mnobitfield
27440 @opindex mno-bitfield
27441 @item -mnobitfield
27442 @itemx -mno-bitfield
27443 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
27444 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
27446 @opindex mbitfield
27447 @item -mbitfield
27448 Do use the bit-field instructions.  The @option{-m68020} option implies
27449 @option{-mbitfield}.  This is the default if you use a configuration
27450 designed for a 68020.
27452 @opindex mrtd
27453 @item -mrtd
27454 Use a different function-calling convention, in which functions
27455 that take a fixed number of arguments return with the @code{rtd}
27456 instruction, which pops their arguments while returning.  This
27457 saves one instruction in the caller since there is no need to pop
27458 the arguments there.
27460 This calling convention is incompatible with the one normally
27461 used on Unix, so you cannot use it if you need to call libraries
27462 compiled with the Unix compiler.
27464 Also, you must provide function prototypes for all functions that
27465 take variable numbers of arguments (including @code{printf});
27466 otherwise incorrect code is generated for calls to those
27467 functions.
27469 In addition, seriously incorrect code results if you call a
27470 function with too many arguments.  (Normally, extra arguments are
27471 harmlessly ignored.)
27473 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
27474 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
27476 The default is @option{-mno-rtd}.
27478 @opindex malign-int
27479 @opindex mno-align-int
27480 @item -malign-int
27481 @itemx -mno-align-int
27482 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
27483 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
27484 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
27485 Aligning variables on 32-bit boundaries produces code that runs somewhat
27486 faster on processors with 32-bit busses at the expense of more memory.
27488 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
27489 aligns structures containing the above types differently than
27490 most published application binary interface specifications for the m68k.
27492 @opindex mpcrel
27493 Use the pc-relative addressing mode of the 68000 directly, instead of
27494 using a global offset table.  At present, this option implies @option{-fpic},
27495 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
27496 not presently supported with @option{-mpcrel}, though this could be supported for
27497 68020 and higher processors.
27499 @opindex mno-strict-align
27500 @opindex mstrict-align
27501 @item -mno-strict-align
27502 @itemx -mstrict-align
27503 Do not (do) assume that unaligned memory references are handled by
27504 the system.
27506 @item -msep-data
27507 Generate code that allows the data segment to be located in a different
27508 area of memory from the text segment.  This allows for execute-in-place in
27509 an environment without virtual memory management.  This option implies
27510 @option{-fPIC}.
27512 @item -mno-sep-data
27513 Generate code that assumes that the data segment follows the text segment.
27514 This is the default.
27516 @item -mid-shared-library
27517 Generate code that supports shared libraries via the library ID method.
27518 This allows for execute-in-place and shared libraries in an environment
27519 without virtual memory management.  This option implies @option{-fPIC}.
27521 @item -mno-id-shared-library
27522 Generate code that doesn't assume ID-based shared libraries are being used.
27523 This is the default.
27525 @item -mshared-library-id=n
27526 Specifies the identification number of the ID-based shared library being
27527 compiled.  Specifying a value of 0 generates more compact code; specifying
27528 other values forces the allocation of that number to the current
27529 library, but is no more space- or time-efficient than omitting this option.
27531 @opindex mxgot
27532 @opindex mno-xgot
27533 @item -mxgot
27534 @itemx -mno-xgot
27535 When generating position-independent code for ColdFire, generate code
27536 that works if the GOT has more than 8192 entries.  This code is
27537 larger and slower than code generated without this option.  On M680x0
27538 processors, this option is not needed; @option{-fPIC} suffices.
27540 GCC normally uses a single instruction to load values from the GOT@.
27541 While this is relatively efficient, it only works if the GOT
27542 is smaller than about 64k.  Anything larger causes the linker
27543 to report an error such as:
27545 @cindex relocation truncated to fit (ColdFire)
27546 @smallexample
27547 relocation truncated to fit: R_68K_GOT16O foobar
27548 @end smallexample
27550 If this happens, you should recompile your code with @option{-mxgot}.
27551 It should then work with very large GOTs.  However, code generated with
27552 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
27553 the value of a global symbol.
27555 Note that some linkers, including newer versions of the GNU linker,
27556 can create multiple GOTs and sort GOT entries.  If you have such a linker,
27557 you should only need to use @option{-mxgot} when compiling a single
27558 object file that accesses more than 8192 GOT entries.  Very few do.
27560 These options have no effect unless GCC is generating
27561 position-independent code.
27563 @opindex mlong-jump-table-offsets
27564 @item -mlong-jump-table-offsets
27565 Use 32-bit offsets in @code{switch} tables.  The default is to use
27566 16-bit offsets.
27568 @end table
27570 @node MCore Options
27571 @subsection MCore Options
27572 @cindex MCore options
27574 These are the @samp{-m} options defined for the Motorola M*Core
27575 processors.
27577 @table @gcctabopt
27579 @opindex mhardlit
27580 @opindex mno-hardlit
27581 @item -mhardlit
27582 @itemx -mno-hardlit
27583 Inline constants into the code stream if it can be done in two
27584 instructions or less.
27586 @opindex mdiv
27587 @opindex mno-div
27588 @item -mdiv
27589 @itemx -mno-div
27590 Use the divide instruction.  (Enabled by default).
27592 @opindex mrelax-immediate
27593 @opindex mno-relax-immediate
27594 @item -mrelax-immediate
27595 @itemx -mno-relax-immediate
27596 Allow arbitrary-sized immediates in bit operations.
27598 @opindex mwide-bitfields
27599 @opindex mno-wide-bitfields
27600 @item -mwide-bitfields
27601 @itemx -mno-wide-bitfields
27602 Always treat bit-fields as @code{int}-sized.
27604 @opindex m4byte-functions
27605 @opindex mno-4byte-functions
27606 @item -m4byte-functions
27607 @itemx -mno-4byte-functions
27608 Force all functions to be aligned to a 4-byte boundary.
27610 @opindex mcallgraph-data
27611 @opindex mno-callgraph-data
27612 @item -mcallgraph-data
27613 @itemx -mno-callgraph-data
27614 Emit callgraph information.
27616 @opindex mslow-bytes
27617 @opindex mno-slow-bytes
27618 @item -mslow-bytes
27619 @itemx -mno-slow-bytes
27620 Prefer word access when reading byte quantities.
27622 @opindex mlittle-endian
27623 @opindex mbig-endian
27624 @item -mlittle-endian
27625 @itemx -mbig-endian
27626 Generate code for a little-endian target.
27628 @opindex m210
27629 @opindex m340
27630 @item -m210
27631 @itemx -m340
27632 Generate code for the 210 processor.
27634 @opindex mno-lsim
27635 @item -mno-lsim
27636 Assume that runtime support has been provided and so omit the
27637 simulator library (@file{libsim.a)} from the linker command line.
27639 @opindex mstack-increment
27640 @item -mstack-increment=@var{size}
27641 Set the maximum amount for a single stack increment operation.  Large
27642 values can increase the speed of programs that contain functions
27643 that need a large amount of stack space, but they can also trigger a
27644 segmentation fault if the stack is extended too much.  The default
27645 value is 0x1000.
27647 @end table
27649 @node MicroBlaze Options
27650 @subsection MicroBlaze Options
27651 @cindex MicroBlaze Options
27653 @table @gcctabopt
27655 @opindex msoft-float
27656 @item -msoft-float
27657 Use software emulation for floating point (default).
27659 @opindex mhard-float
27660 @item -mhard-float
27661 Use hardware floating-point instructions.
27663 @opindex mmemcpy
27664 @item -mmemcpy
27665 Do not optimize block moves, use @code{memcpy}.
27667 @opindex mno-clearbss
27668 @item -mno-clearbss
27669 This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
27671 @opindex mcpu=
27672 @item -mcpu=@var{cpu-type}
27673 Use features of, and schedule code for, the given CPU.
27674 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
27675 where @var{X} is a major version, @var{YY} is the minor version, and
27676 @var{Z} is compatibility code.  Example values are @samp{v3.00.a},
27677 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
27679 @opindex mxl-soft-mul
27680 @item -mxl-soft-mul
27681 Use software multiply emulation (default).
27683 @opindex mxl-soft-div
27684 @item -mxl-soft-div
27685 Use software emulation for divides (default).
27687 @opindex mxl-barrel-shift
27688 @item -mxl-barrel-shift
27689 Use the hardware barrel shifter.
27691 @opindex mxl-pattern-compare
27692 @item -mxl-pattern-compare
27693 Use pattern compare instructions.
27695 @opindex msmall-divides
27696 @item -msmall-divides
27697 Use table lookup optimization for small signed integer divisions.
27699 @opindex mxl-stack-check
27700 @item -mxl-stack-check
27701 This option is deprecated.  Use @option{-fstack-check} instead.
27703 @opindex mxl-gp-opt
27704 @item -mxl-gp-opt
27705 Use GP-relative @code{.sdata}/@code{.sbss} sections.
27707 @opindex mxl-multiply-high
27708 @item -mxl-multiply-high
27709 Use multiply high instructions for high part of 32x32 multiply.
27711 @opindex mxl-float-convert
27712 @item -mxl-float-convert
27713 Use hardware floating-point conversion instructions.
27715 @opindex mxl-float-sqrt
27716 @item -mxl-float-sqrt
27717 Use hardware floating-point square root instruction.
27719 @opindex mbig-endian
27720 @item -mbig-endian
27721 Generate code for a big-endian target.
27723 @opindex mlittle-endian
27724 @item -mlittle-endian
27725 Generate code for a little-endian target.
27727 @opindex mxl-reorder
27728 @item -mxl-reorder
27729 Use reorder instructions (swap and byte reversed load/store).
27731 @item -mxl-mode-@var{app-model}
27732 Select application model @var{app-model}.  Valid models are
27733 @table @samp
27734 @item executable
27735 normal executable (default), uses startup code @file{crt0.o}.
27737 @item xmdstub
27738 for use with Xilinx Microprocessor Debugger (XMD) based
27739 software intrusive debug agent called xmdstub. This uses startup file
27740 @file{crt1.o} and sets the start address of the program to 0x800.
27742 @item bootstrap
27743 for applications that are loaded using a bootloader.
27744 This model uses startup file @file{crt2.o} which does not contain a processor
27745 reset vector handler. This is suitable for transferring control on a
27746 processor reset to the bootloader rather than the application.
27748 @item novectors
27749 for applications that do not require any of the
27750 MicroBlaze vectors. This option may be useful for applications running
27751 within a monitoring application. This model uses @file{crt3.o} as a startup file.
27752 @end table
27754 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
27755 @option{-mxl-mode-@var{app-model}}.
27757 @opindex mpic-data-is-text-relative
27758 @item -mpic-data-is-text-relative
27759 Assume that the displacement between the text and data segments is fixed
27760 at static link time.  This allows data to be referenced by offset from start of
27761 text address instead of GOT since PC-relative addressing is not supported.
27763 @end table
27765 @node MIPS Options
27766 @subsection MIPS Options
27767 @cindex MIPS options
27769 @table @gcctabopt
27771 @opindex EB
27772 @item -EB
27773 Generate big-endian code.
27775 @opindex EL
27776 @item -EL
27777 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
27778 configurations.
27780 @opindex march
27781 @item -march=@var{arch}
27782 Generate code that runs on @var{arch}, which can be the name of a
27783 generic MIPS ISA, or the name of a particular processor.
27784 The ISA names are:
27785 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
27786 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
27787 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
27788 @samp{mips64r5} and @samp{mips64r6}.
27789 The processor names are:
27790 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
27791 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
27792 @samp{5kc}, @samp{5kf},
27793 @samp{20kc},
27794 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
27795 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
27796 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
27797 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
27798 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
27799 @samp{i6400}, @samp{i6500},
27800 @samp{interaptiv},
27801 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
27802 @samp{gs464e}, @samp{gs264e},
27803 @samp{m4k},
27804 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
27805 @samp{m5100}, @samp{m5101},
27806 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
27807 @samp{orion},
27808 @samp{p5600}, @samp{p6600},
27809 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
27810 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
27811 @samp{r6000}, @samp{r8000},
27812 @samp{rm7000}, @samp{rm9000},
27813 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
27814 @samp{sb1},
27815 @samp{sr71000},
27816 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
27817 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
27818 @samp{xlr} and @samp{xlp}.
27819 The special value @samp{from-abi} selects the
27820 most compatible architecture for the selected ABI (that is,
27821 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
27823 The native Linux/GNU toolchain also supports the value @samp{native},
27824 which selects the best architecture option for the host processor.
27825 @option{-march=native} has no effect if GCC does not recognize
27826 the processor.
27828 In processor names, a final @samp{000} can be abbreviated as @samp{k}
27829 (for example, @option{-march=r2k}).  Prefixes are optional, and
27830 @samp{vr} may be written @samp{r}.
27832 Names of the form @samp{@var{n}f2_1} refer to processors with
27833 FPUs clocked at half the rate of the core, names of the form
27834 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
27835 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
27836 processors with FPUs clocked a ratio of 3:2 with respect to the core.
27837 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
27838 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
27839 accepted as synonyms for @samp{@var{n}f1_1}.
27841 GCC defines two macros based on the value of this option.  The first
27842 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
27843 a string.  The second has the form @code{_MIPS_ARCH_@var{foo}},
27844 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
27845 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
27846 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
27848 Note that the @code{_MIPS_ARCH} macro uses the processor names given
27849 above.  In other words, it has the full prefix and does not
27850 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
27851 the macro names the resolved architecture (either @code{"mips1"} or
27852 @code{"mips3"}).  It names the default architecture when no
27853 @option{-march} option is given.
27855 @opindex mtune
27856 @item -mtune=@var{arch}
27857 Optimize for @var{arch}.  Among other things, this option controls
27858 the way instructions are scheduled, and the perceived cost of arithmetic
27859 operations.  The list of @var{arch} values is the same as for
27860 @option{-march}.
27862 When this option is not used, GCC optimizes for the processor
27863 specified by @option{-march}.  By using @option{-march} and
27864 @option{-mtune} together, it is possible to generate code that
27865 runs on a family of processors, but optimize the code for one
27866 particular member of that family.
27868 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
27869 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
27870 @option{-march} ones described above.
27872 @opindex mips1
27873 @item -mips1
27874 Equivalent to @option{-march=mips1}.
27876 @opindex mips2
27877 @item -mips2
27878 Equivalent to @option{-march=mips2}.
27880 @opindex mips3
27881 @item -mips3
27882 Equivalent to @option{-march=mips3}.
27884 @opindex mips4
27885 @item -mips4
27886 Equivalent to @option{-march=mips4}.
27888 @opindex mips32
27889 @item -mips32
27890 Equivalent to @option{-march=mips32}.
27892 @opindex mips32r3
27893 @item -mips32r3
27894 Equivalent to @option{-march=mips32r3}.
27896 @opindex mips32r5
27897 @item -mips32r5
27898 Equivalent to @option{-march=mips32r5}.
27900 @opindex mips32r6
27901 @item -mips32r6
27902 Equivalent to @option{-march=mips32r6}.
27904 @opindex mips64
27905 @item -mips64
27906 Equivalent to @option{-march=mips64}.
27908 @opindex mips64r2
27909 @item -mips64r2
27910 Equivalent to @option{-march=mips64r2}.
27912 @opindex mips64r3
27913 @item -mips64r3
27914 Equivalent to @option{-march=mips64r3}.
27916 @opindex mips64r5
27917 @item -mips64r5
27918 Equivalent to @option{-march=mips64r5}.
27920 @opindex mips64r6
27921 @item -mips64r6
27922 Equivalent to @option{-march=mips64r6}.
27924 @opindex mips16
27925 @opindex mno-mips16
27926 @item -mips16
27927 @itemx -mno-mips16
27928 Generate (do not generate) MIPS16 code.  If GCC is targeting a
27929 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
27931 MIPS16 code generation can also be controlled on a per-function basis
27932 by means of @code{mips16} and @code{nomips16} attributes.
27933 @xref{Function Attributes}, for more information.
27935 @opindex mmips16e2
27936 @opindex mno-mips16e2
27937 @item -mmips16e2
27938 @itemx -mno-mips16e2
27939 Use (do not use) the MIPS16e2 ASE.  This option modifies the behavior
27940 of the @option{-mips16} option such that it targets the MIPS16e2 ASE@.
27942 @opindex mflip-mips16
27943 @item -mflip-mips16
27944 Generate MIPS16 code on alternating functions.  This option is provided
27945 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
27946 not intended for ordinary use in compiling user code.
27948 @opindex minterlink-compressed
27949 @opindex mno-interlink-compressed
27950 @item -minterlink-compressed
27951 @itemx -mno-interlink-compressed
27952 Require (do not require) that code using the standard (uncompressed) MIPS ISA
27953 be link-compatible with MIPS16 and microMIPS code, and vice versa.
27955 For example, code using the standard ISA encoding cannot jump directly
27956 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
27957 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
27958 knows that the target of the jump is not compressed.
27960 @opindex minterlink-mips16
27961 @opindex mno-interlink-mips16
27962 @item -minterlink-mips16
27963 @itemx -mno-interlink-mips16
27964 Aliases of @option{-minterlink-compressed} and
27965 @option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
27966 and are retained for backwards compatibility.
27968 @opindex mabi=32
27969 @opindex mabi=o64
27970 @opindex mabi=n32
27971 @opindex mabi=64
27972 @opindex mabi=eabi
27973 @item -mabi=32
27974 @itemx -mabi=o64
27975 @itemx -mabi=n32
27976 @itemx -mabi=64
27977 @itemx -mabi=eabi
27978 Generate code for the given ABI@.
27980 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
27981 generates 64-bit code when you select a 64-bit architecture, but you
27982 can use @option{-mgp32} to get 32-bit code instead.
27984 For information about the O64 ABI, see
27985 @uref{https://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
27987 GCC supports a variant of the o32 ABI in which floating-point registers
27988 are 64 rather than 32 bits wide.  You can select this combination with
27989 @option{-mabi=32} @option{-mfp64}.  This ABI relies on the @code{mthc1}
27990 and @code{mfhc1} instructions and is therefore only supported for
27991 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
27993 The register assignments for arguments and return values remain the
27994 same, but each scalar value is passed in a single 64-bit register
27995 rather than a pair of 32-bit registers.  For example, scalar
27996 floating-point values are returned in @samp{$f0} only, not a
27997 @samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
27998 remains the same in that the even-numbered double-precision registers
27999 are saved.
28001 Two additional variants of the o32 ABI are supported to enable
28002 a transition from 32-bit to 64-bit registers.  These are FPXX
28003 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
28004 The FPXX extension mandates that all code must execute correctly
28005 when run using 32-bit or 64-bit registers.  The code can be interlinked
28006 with either FP32 or FP64, but not both.
28007 The FP64A extension is similar to the FP64 extension but forbids the
28008 use of odd-numbered single-precision registers.  This can be used
28009 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
28010 processors and allows both FP32 and FP64A code to interlink and
28011 run in the same process without changing FPU modes.
28013 @opindex mabicalls
28014 @opindex mno-abicalls
28015 @item -mabicalls
28016 @itemx -mno-abicalls
28017 Generate (do not generate) code that is suitable for SVR4-style
28018 dynamic objects.  @option{-mabicalls} is the default for SVR4-based
28019 systems.
28021 @item -mshared
28022 @itemx -mno-shared
28023 Generate (do not generate) code that is fully position-independent,
28024 and that can therefore be linked into shared libraries.  This option
28025 only affects @option{-mabicalls}.
28027 All @option{-mabicalls} code has traditionally been position-independent,
28028 regardless of options like @option{-fPIC} and @option{-fpic}.  However,
28029 as an extension, the GNU toolchain allows executables to use absolute
28030 accesses for locally-binding symbols.  It can also use shorter GP
28031 initialization sequences and generate direct calls to locally-defined
28032 functions.  This mode is selected by @option{-mno-shared}.
28034 @option{-mno-shared} depends on binutils 2.16 or higher and generates
28035 objects that can only be linked by the GNU linker.  However, the option
28036 does not affect the ABI of the final executable; it only affects the ABI
28037 of relocatable objects.  Using @option{-mno-shared} generally makes
28038 executables both smaller and quicker.
28040 @option{-mshared} is the default.
28042 @opindex mplt
28043 @opindex mno-plt
28044 @item -mplt
28045 @itemx -mno-plt
28046 Assume (do not assume) that the static and dynamic linkers
28047 support PLTs and copy relocations.  This option only affects
28048 @option{-mno-shared -mabicalls}.  For the n64 ABI, this option
28049 has no effect without @option{-msym32}.
28051 You can make @option{-mplt} the default by configuring
28052 GCC with @option{--with-mips-plt}.  The default is
28053 @option{-mno-plt} otherwise.
28055 @opindex mxgot
28056 @opindex mno-xgot
28057 @item -mxgot
28058 @itemx -mno-xgot
28059 Lift (do not lift) the usual restrictions on the size of the global
28060 offset table.
28062 GCC normally uses a single instruction to load values from the GOT@.
28063 While this is relatively efficient, it only works if the GOT
28064 is smaller than about 64k.  Anything larger causes the linker
28065 to report an error such as:
28067 @cindex relocation truncated to fit (MIPS)
28068 @smallexample
28069 relocation truncated to fit: R_MIPS_GOT16 foobar
28070 @end smallexample
28072 If this happens, you should recompile your code with @option{-mxgot}.
28073 This works with very large GOTs, although the code is also
28074 less efficient, since it takes three instructions to fetch the
28075 value of a global symbol.
28077 Note that some linkers can create multiple GOTs.  If you have such a
28078 linker, you should only need to use @option{-mxgot} when a single object
28079 file accesses more than 64k's worth of GOT entries.  Very few do.
28081 These options have no effect unless GCC is generating position
28082 independent code.
28084 @opindex mgp32
28085 @item -mgp32
28086 Assume that general-purpose registers are 32 bits wide.
28088 @opindex mgp64
28089 @item -mgp64
28090 Assume that general-purpose registers are 64 bits wide.
28092 @opindex mfp32
28093 @item -mfp32
28094 Assume that floating-point registers are 32 bits wide.
28096 @opindex mfp64
28097 @item -mfp64
28098 Assume that floating-point registers are 64 bits wide.
28100 @opindex mfpxx
28101 @item -mfpxx
28102 Do not assume the width of floating-point registers.
28104 @opindex mhard-float
28105 @item -mhard-float
28106 Use floating-point coprocessor instructions.
28108 @opindex msoft-float
28109 @item -msoft-float
28110 Do not use floating-point coprocessor instructions.  Implement
28111 floating-point calculations using library calls instead.
28113 @opindex mno-float
28114 @item -mno-float
28115 Equivalent to @option{-msoft-float}, but additionally asserts that the
28116 program being compiled does not perform any floating-point operations.
28117 This option is presently supported only by some bare-metal MIPS
28118 configurations, where it may select a special set of libraries
28119 that lack all floating-point support (including, for example, the
28120 floating-point @code{printf} formats).  
28121 If code compiled with @option{-mno-float} accidentally contains
28122 floating-point operations, it is likely to suffer a link-time
28123 or run-time failure.
28125 @opindex msingle-float
28126 @item -msingle-float
28127 Assume that the floating-point coprocessor only supports single-precision
28128 operations.
28130 @opindex mdouble-float
28131 @item -mdouble-float
28132 Assume that the floating-point coprocessor supports double-precision
28133 operations.  This is the default.
28135 @opindex modd-spreg
28136 @opindex mno-odd-spreg
28137 @item -modd-spreg
28138 @itemx -mno-odd-spreg
28139 Enable the use of odd-numbered single-precision floating-point registers
28140 for the o32 ABI.  This is the default for processors that are known to
28141 support these registers.  When using the o32 FPXX ABI, @option{-mno-odd-spreg}
28142 is set by default.
28144 @opindex mabs=2008
28145 @opindex mabs=legacy
28146 @item -mabs=2008
28147 @itemx -mabs=legacy
28148 These options control the treatment of the special not-a-number (NaN)
28149 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
28150 @code{neg.@i{fmt}} machine instructions.
28152 By default or when @option{-mabs=legacy} is used the legacy
28153 treatment is selected.  In this case these instructions are considered
28154 arithmetic and avoided where correct operation is required and the
28155 input operand might be a NaN.  A longer sequence of instructions that
28156 manipulate the sign bit of floating-point datum manually is used
28157 instead unless the @option{-ffinite-math-only} option has also been
28158 specified.
28160 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment.  In
28161 this case these instructions are considered non-arithmetic and therefore
28162 operating correctly in all cases, including in particular where the
28163 input operand is a NaN.  These instructions are therefore always used
28164 for the respective operations.
28166 @opindex mnan=2008
28167 @opindex mnan=legacy
28168 @item -mnan=2008
28169 @itemx -mnan=legacy
28170 These options control the encoding of the special not-a-number (NaN)
28171 IEEE 754 floating-point data.
28173 The @option{-mnan=legacy} option selects the legacy encoding.  In this
28174 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
28175 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
28176 by the first bit of their trailing significand field being 1.
28178 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding.  In
28179 this case qNaNs are denoted by the first bit of their trailing
28180 significand field being 1, whereas sNaNs are denoted by the first bit of
28181 their trailing significand field being 0.
28183 The default is @option{-mnan=legacy} unless GCC has been configured with
28184 @option{--with-nan=2008}.
28186 @opindex mllsc
28187 @opindex mno-llsc
28188 @item -mllsc
28189 @itemx -mno-llsc
28190 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
28191 implement atomic memory built-in functions.  When neither option is
28192 specified, GCC uses the instructions if the target architecture
28193 supports them.
28195 @option{-mllsc} is useful if the runtime environment can emulate the
28196 instructions and @option{-mno-llsc} can be useful when compiling for
28197 nonstandard ISAs.  You can make either option the default by
28198 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
28199 respectively.  @option{--with-llsc} is the default for some
28200 configurations; see the installation documentation for details.
28202 @opindex mdsp
28203 @opindex mno-dsp
28204 @item -mdsp
28205 @itemx -mno-dsp
28206 Use (do not use) revision 1 of the MIPS DSP ASE@.
28207 @xref{MIPS DSP Built-in Functions}.  This option defines the
28208 preprocessor macro @code{__mips_dsp}.  It also defines
28209 @code{__mips_dsp_rev} to 1.
28211 @opindex mdspr2
28212 @opindex mno-dspr2
28213 @item -mdspr2
28214 @itemx -mno-dspr2
28215 Use (do not use) revision 2 of the MIPS DSP ASE@.
28216 @xref{MIPS DSP Built-in Functions}.  This option defines the
28217 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
28218 It also defines @code{__mips_dsp_rev} to 2.
28220 @opindex msmartmips
28221 @opindex mno-smartmips
28222 @item -msmartmips
28223 @itemx -mno-smartmips
28224 Use (do not use) the MIPS SmartMIPS ASE.
28226 @opindex mpaired-single
28227 @opindex mno-paired-single
28228 @item -mpaired-single
28229 @itemx -mno-paired-single
28230 Use (do not use) paired-single floating-point instructions.
28231 @xref{MIPS Paired-Single Support}.  This option requires
28232 hardware floating-point support to be enabled.
28234 @opindex mdmx
28235 @opindex mno-mdmx
28236 @item -mdmx
28237 @itemx -mno-mdmx
28238 Use (do not use) MIPS Digital Media Extension instructions.
28239 This option can only be used when generating 64-bit code and requires
28240 hardware floating-point support to be enabled.
28242 @opindex mips3d
28243 @opindex mno-mips3d
28244 @item -mips3d
28245 @itemx -mno-mips3d
28246 Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
28247 The option @option{-mips3d} implies @option{-mpaired-single}.
28249 @opindex mmicromips
28250 @opindex mno-mmicromips
28251 @item -mmicromips
28252 @itemx -mno-micromips
28253 Generate (do not generate) microMIPS code.
28255 MicroMIPS code generation can also be controlled on a per-function basis
28256 by means of @code{micromips} and @code{nomicromips} attributes.
28257 @xref{Function Attributes}, for more information.
28259 @opindex mmt
28260 @opindex mno-mt
28261 @item -mmt
28262 @itemx -mno-mt
28263 Use (do not use) MT Multithreading instructions.
28265 @opindex mmcu
28266 @opindex mno-mcu
28267 @item -mmcu
28268 @itemx -mno-mcu
28269 Use (do not use) the MIPS MCU ASE instructions.
28271 @opindex meva
28272 @opindex mno-eva
28273 @item -meva
28274 @itemx -mno-eva
28275 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
28277 @opindex mvirt
28278 @opindex mno-virt
28279 @item -mvirt
28280 @itemx -mno-virt
28281 Use (do not use) the MIPS Virtualization (VZ) instructions.
28283 @opindex mxpa
28284 @opindex mno-xpa
28285 @item -mxpa
28286 @itemx -mno-xpa
28287 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
28289 @opindex mcrc
28290 @opindex mno-crc
28291 @item -mcrc
28292 @itemx -mno-crc
28293 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
28295 @opindex mginv
28296 @opindex mno-ginv
28297 @item -mginv
28298 @itemx -mno-ginv
28299 Use (do not use) the MIPS Global INValidate (GINV) instructions.
28301 @opindex mloongson-mmi
28302 @opindex mno-loongson-mmi
28303 @item -mloongson-mmi
28304 @itemx -mno-loongson-mmi
28305 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
28307 @opindex mloongson-ext
28308 @opindex mno-loongson-ext
28309 @item -mloongson-ext
28310 @itemx -mno-loongson-ext
28311 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
28313 @opindex mloongson-ext2
28314 @opindex mno-loongson-ext2
28315 @item -mloongson-ext2
28316 @itemx -mno-loongson-ext2
28317 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
28319 @opindex mlong64
28320 @item -mlong64
28321 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
28322 an explanation of the default and the way that the pointer size is
28323 determined.
28325 @opindex mlong32
28326 @item -mlong32
28327 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
28329 The default size of @code{int}s, @code{long}s and pointers depends on
28330 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
28331 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
28332 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
28333 or the same size as integer registers, whichever is smaller.
28335 @opindex msym32
28336 @opindex mno-sym32
28337 @item -msym32
28338 @itemx -mno-sym32
28339 Assume (do not assume) that all symbols have 32-bit values, regardless
28340 of the selected ABI@.  This option is useful in combination with
28341 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
28342 to generate shorter and faster references to symbolic addresses.
28344 @opindex G
28345 @item -G @var{num}
28346 Put definitions of externally-visible data in a small data section
28347 if that data is no bigger than @var{num} bytes.  GCC can then generate
28348 more efficient accesses to the data; see @option{-mgpopt} for details.
28350 The default @option{-G} option depends on the configuration.
28352 @opindex mlocal-sdata
28353 @opindex mno-local-sdata
28354 @item -mlocal-sdata
28355 @itemx -mno-local-sdata
28356 Extend (do not extend) the @option{-G} behavior to local data too,
28357 such as to static variables in C@.  @option{-mlocal-sdata} is the
28358 default for all configurations.
28360 If the linker complains that an application is using too much small data,
28361 you might want to try rebuilding the less performance-critical parts with
28362 @option{-mno-local-sdata}.  You might also want to build large
28363 libraries with @option{-mno-local-sdata}, so that the libraries leave
28364 more room for the main program.
28366 @opindex mextern-sdata
28367 @opindex mno-extern-sdata
28368 @item -mextern-sdata
28369 @itemx -mno-extern-sdata
28370 Assume (do not assume) that externally-defined data is in
28371 a small data section if the size of that data is within the @option{-G} limit.
28372 @option{-mextern-sdata} is the default for all configurations.
28374 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
28375 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
28376 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
28377 is placed in a small data section.  If @var{Var} is defined by another
28378 module, you must either compile that module with a high-enough
28379 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
28380 definition.  If @var{Var} is common, you must link the application
28381 with a high-enough @option{-G} setting.
28383 The easiest way of satisfying these restrictions is to compile
28384 and link every module with the same @option{-G} option.  However,
28385 you may wish to build a library that supports several different
28386 small data limits.  You can do this by compiling the library with
28387 the highest supported @option{-G} setting and additionally using
28388 @option{-mno-extern-sdata} to stop the library from making assumptions
28389 about externally-defined data.
28391 @opindex mgpopt
28392 @opindex mno-gpopt
28393 @item -mgpopt
28394 @itemx -mno-gpopt
28395 Use (do not use) GP-relative accesses for symbols that are known to be
28396 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
28397 @option{-mextern-sdata}.  @option{-mgpopt} is the default for all
28398 configurations.
28400 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
28401 might not hold the value of @code{_gp}.  For example, if the code is
28402 part of a library that might be used in a boot monitor, programs that
28403 call boot monitor routines pass an unknown value in @code{$gp}.
28404 (In such situations, the boot monitor itself is usually compiled
28405 with @option{-G0}.)
28407 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
28408 @option{-mno-extern-sdata}.
28410 @opindex membedded-data
28411 @opindex mno-embedded-data
28412 @item -membedded-data
28413 @itemx -mno-embedded-data
28414 Allocate variables to the read-only data section first if possible, then
28415 next in the small data section if possible, otherwise in data.  This gives
28416 slightly slower code than the default, but reduces the amount of RAM required
28417 when executing, and thus may be preferred for some embedded systems.
28419 @opindex muninit-const-in-rodata
28420 @opindex mno-uninit-const-in-rodata
28421 @item -muninit-const-in-rodata
28422 @itemx -mno-uninit-const-in-rodata
28423 Put uninitialized @code{const} variables in the read-only data section.
28424 This option is only meaningful in conjunction with @option{-membedded-data}.
28426 @opindex mcode-readable
28427 @item -mcode-readable=@var{setting}
28428 Specify whether GCC may generate code that reads from executable sections.
28429 There are three possible settings:
28431 @table @gcctabopt
28432 @item -mcode-readable=yes
28433 Instructions may freely access executable sections.  This is the
28434 default setting.
28436 @item -mcode-readable=pcrel
28437 MIPS16 PC-relative load instructions can access executable sections,
28438 but other instructions must not do so.  This option is useful on 4KSc
28439 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
28440 It is also useful on processors that can be configured to have a dual
28441 instruction/data SRAM interface and that, like the M4K, automatically
28442 redirect PC-relative loads to the instruction RAM.
28444 @item -mcode-readable=no
28445 Instructions must not access executable sections.  This option can be
28446 useful on targets that are configured to have a dual instruction/data
28447 SRAM interface but that (unlike the M4K) do not automatically redirect
28448 PC-relative loads to the instruction RAM.
28449 @end table
28451 @opindex msplit-addresses
28452 @opindex mno-split-addresses
28453 @item -msplit-addresses
28454 @itemx -mno-split-addresses
28455 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
28456 relocation operators.  This option has been superseded by
28457 @option{-mexplicit-relocs} but is retained for backwards compatibility.
28459 @opindex mexplicit-relocs=none
28460 @opindex mexplicit-relocs=base
28461 @opindex mexplicit-relocs=pcrel
28462 @item -mexplicit-relocs=none
28463 @itemx -mexplicit-relocs=base
28464 @itemx -mexplicit-relocs=pcrel
28465 @itemx -mexplicit-relocs
28466 @itemx -mno-explicit-relocs
28467 These options control whether explicit relocs (such as %gp_rel) are used.
28468 The default value depends on the version of GAS when GCC itself was built.
28470 The @code{base} explicit-relocs support introdunced into GAS in 2001.
28471 The @code{pcrel} explicit-relocs support introdunced into GAS in 2014,
28472 which supports @code{%pcrel_hi} and @code{%pcrel_lo}.
28474 @opindex mcheck-zero-division
28475 @opindex mno-check-zero-division
28476 @item -mcheck-zero-division
28477 @itemx -mno-check-zero-division
28478 Trap (do not trap) on integer division by zero.
28480 The default is @option{-mcheck-zero-division}.
28482 @opindex mdivide-traps
28483 @opindex mdivide-breaks
28484 @item -mdivide-traps
28485 @itemx -mdivide-breaks
28486 MIPS systems check for division by zero by generating either a
28487 conditional trap or a break instruction.  Using traps results in
28488 smaller code, but is only supported on MIPS II and later.  Also, some
28489 versions of the Linux kernel have a bug that prevents trap from
28490 generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
28491 allow conditional traps on architectures that support them and
28492 @option{-mdivide-breaks} to force the use of breaks.
28494 The default is usually @option{-mdivide-traps}, but this can be
28495 overridden at configure time using @option{--with-divide=breaks}.
28496 Divide-by-zero checks can be completely disabled using
28497 @option{-mno-check-zero-division}.
28499 @opindex mload-store-pairs
28500 @opindex mno-load-store-pairs
28501 @item -mload-store-pairs
28502 @itemx -mno-load-store-pairs
28503 Enable (disable) an optimization that pairs consecutive load or store
28504 instructions to enable load/store bonding.  This option is enabled by
28505 default but only takes effect when the selected architecture is known
28506 to support bonding.
28508 @opindex munaligned-access
28509 @opindex mno-unaligned-access
28510 @item -munaligned-access
28511 @itemx -mno-unaligned-access
28512 Enable (disable) direct unaligned access for MIPS Release 6.
28513 MIPSr6 requires load/store unaligned-access support,
28514 by hardware or trap&emulate.
28515 So @option{-mno-unaligned-access} may be needed by kernel.
28517 @opindex mmemcpy
28518 @opindex mno-memcpy
28519 @item -mmemcpy
28520 @itemx -mno-memcpy
28521 Force (do not force) the use of @code{memcpy} for non-trivial block
28522 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
28523 most constant-sized copies.
28525 @opindex mlong-calls
28526 @opindex mno-long-calls
28527 @item -mlong-calls
28528 @itemx -mno-long-calls
28529 Disable (do not disable) use of the @code{jal} instruction.  Calling
28530 functions using @code{jal} is more efficient but requires the caller
28531 and callee to be in the same 256 megabyte segment.
28533 This option has no effect on abicalls code.  The default is
28534 @option{-mno-long-calls}.
28536 @opindex mmad
28537 @opindex mno-mad
28538 @item -mmad
28539 @itemx -mno-mad
28540 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
28541 instructions, as provided by the R4650 ISA@.
28543 @opindex mimadd
28544 @opindex mno-imadd
28545 @item -mimadd
28546 @itemx -mno-imadd
28547 Enable (disable) use of the @code{madd} and @code{msub} integer
28548 instructions.  The default is @option{-mimadd} on architectures
28549 that support @code{madd} and @code{msub} except for the 74k 
28550 architecture where it was found to generate slower code.
28552 @opindex mfused-madd
28553 @opindex mno-fused-madd
28554 @item -mfused-madd
28555 @itemx -mno-fused-madd
28556 Enable (disable) use of the floating-point multiply-accumulate
28557 instructions, when they are available.  The default is
28558 @option{-mfused-madd}.
28560 On the R8000 CPU when multiply-accumulate instructions are used,
28561 the intermediate product is calculated to infinite precision
28562 and is not subject to the FCSR Flush to Zero bit.  This may be
28563 undesirable in some circumstances.  On other processors the result
28564 is numerically identical to the equivalent computation using
28565 separate multiply, add, subtract and negate instructions.
28567 @opindex nocpp
28568 @item -nocpp
28569 Tell the MIPS assembler to not run its preprocessor over user
28570 assembler files (with a @samp{.s} suffix) when assembling them.
28572 @opindex mfix-24k
28573 @opindex mno-fix-24k
28574 @item -mfix-24k
28575 @itemx -mno-fix-24k
28576 Work around the 24K E48 (lost data on stores during refill) errata.
28577 The workarounds are implemented by the assembler rather than by GCC@.
28579 @opindex mfix-r4000
28580 @opindex mno-fix-r4000
28581 @item -mfix-r4000
28582 @itemx -mno-fix-r4000
28583 Work around certain R4000 CPU errata:
28584 @itemize @minus
28585 @item
28586 A double-word or a variable shift may give an incorrect result if executed
28587 immediately after starting an integer division.
28588 @item
28589 A double-word or a variable shift may give an incorrect result if executed
28590 while an integer multiplication is in progress.
28591 @item
28592 An integer division may give an incorrect result if started in a delay slot
28593 of a taken branch or a jump.
28594 @end itemize
28596 @opindex mfix-r4400
28597 @opindex mno-fix-r4400
28598 @item -mfix-r4400
28599 @itemx -mno-fix-r4400
28600 Work around certain R4400 CPU errata:
28601 @itemize @minus
28602 @item
28603 A double-word or a variable shift may give an incorrect result if executed
28604 immediately after starting an integer division.
28605 @end itemize
28607 @opindex mfix-r10000
28608 @opindex mno-fix-r10000
28609 @item -mfix-r10000
28610 @itemx -mno-fix-r10000
28611 Work around certain R10000 errata:
28612 @itemize @minus
28613 @item
28614 @code{ll}/@code{sc} sequences may not behave atomically on revisions
28615 prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
28616 @end itemize
28618 This option can only be used if the target architecture supports
28619 branch-likely instructions.  @option{-mfix-r10000} is the default when
28620 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
28621 otherwise.
28623 @opindex mfix-r5900
28624 @item -mfix-r5900
28625 @itemx -mno-fix-r5900
28626 Do not attempt to schedule the preceding instruction into the delay slot
28627 of a branch instruction placed at the end of a short loop of six
28628 instructions or fewer and always schedule a @code{nop} instruction there
28629 instead.  The short loop bug under certain conditions causes loops to
28630 execute only once or twice, due to a hardware bug in the R5900 chip.  The
28631 workaround is implemented by the assembler rather than by GCC@.
28633 @opindex mfix-rm7000
28634 @item -mfix-rm7000
28635 @itemx -mno-fix-rm7000
28636 Work around the RM7000 @code{dmult}/@code{dmultu} errata.  The
28637 workarounds are implemented by the assembler rather than by GCC@.
28639 @opindex mfix-vr4120
28640 @item -mfix-vr4120
28641 @itemx -mno-fix-vr4120
28642 Work around certain VR4120 errata:
28643 @itemize @minus
28644 @item
28645 @code{dmultu} does not always produce the correct result.
28646 @item
28647 @code{div} and @code{ddiv} do not always produce the correct result if one
28648 of the operands is negative.
28649 @end itemize
28650 The workarounds for the division errata rely on special functions in
28651 @file{libgcc.a}.  At present, these functions are only provided by
28652 the @code{mips64vr*-elf} configurations.
28654 Other VR4120 errata require a NOP to be inserted between certain pairs of
28655 instructions.  These errata are handled by the assembler, not by GCC itself.
28657 @opindex mfix-vr4130
28658 @item -mfix-vr4130
28659 Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
28660 workarounds are implemented by the assembler rather than by GCC,
28661 although GCC avoids using @code{mflo} and @code{mfhi} if the
28662 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
28663 instructions are available instead.
28665 @opindex mfix-sb1
28666 @item -mfix-sb1
28667 @itemx -mno-fix-sb1
28668 Work around certain SB-1 CPU core errata.
28669 (This flag currently works around the SB-1 revision 2
28670 ``F1'' and ``F2'' floating-point errata.)
28672 @opindex mr10k-cache-barrier
28673 @item -mr10k-cache-barrier=@var{setting}
28674 Specify whether GCC should insert cache barriers to avoid the
28675 side effects of speculation on R10K processors.
28677 In common with many processors, the R10K tries to predict the outcome
28678 of a conditional branch and speculatively executes instructions from
28679 the ``taken'' branch.  It later aborts these instructions if the
28680 predicted outcome is wrong.  However, on the R10K, even aborted
28681 instructions can have side effects.
28683 This problem only affects kernel stores and, depending on the system,
28684 kernel loads.  As an example, a speculatively-executed store may load
28685 the target memory into cache and mark the cache line as dirty, even if
28686 the store itself is later aborted.  If a DMA operation writes to the
28687 same area of memory before the ``dirty'' line is flushed, the cached
28688 data overwrites the DMA-ed data.  See the R10K processor manual
28689 for a full description, including other potential problems.
28691 One workaround is to insert cache barrier instructions before every memory
28692 access that might be speculatively executed and that might have side
28693 effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
28694 controls GCC's implementation of this workaround.  It assumes that
28695 aborted accesses to any byte in the following regions does not have
28696 side effects:
28698 @enumerate
28699 @item
28700 the memory occupied by the current function's stack frame;
28702 @item
28703 the memory occupied by an incoming stack argument;
28705 @item
28706 the memory occupied by an object with a link-time-constant address.
28707 @end enumerate
28709 It is the kernel's responsibility to ensure that speculative
28710 accesses to these regions are indeed safe.
28712 If the input program contains a function declaration such as:
28714 @smallexample
28715 void foo (void);
28716 @end smallexample
28718 then the implementation of @code{foo} must allow @code{j foo} and
28719 @code{jal foo} to be executed speculatively.  GCC honors this
28720 restriction for functions it compiles itself.  It expects non-GCC
28721 functions (such as hand-written assembly code) to do the same.
28723 The option has three forms:
28725 @table @gcctabopt
28726 @item -mr10k-cache-barrier=load-store
28727 Insert a cache barrier before a load or store that might be
28728 speculatively executed and that might have side effects even
28729 if aborted.
28731 @item -mr10k-cache-barrier=store
28732 Insert a cache barrier before a store that might be speculatively
28733 executed and that might have side effects even if aborted.
28735 @item -mr10k-cache-barrier=none
28736 Disable the insertion of cache barriers.  This is the default setting.
28737 @end table
28739 @opindex mflush-func
28740 @item -mflush-func=@var{func}
28741 @itemx -mno-flush-func
28742 Specifies the function to call to flush the I and D caches, or to not
28743 call any such function.  If called, the function must take the same
28744 arguments as the common @code{_flush_func}, that is, the address of the
28745 memory range for which the cache is being flushed, the size of the
28746 memory range, and the number 3 (to flush both caches).  The default
28747 depends on the target GCC was configured for, but commonly is either
28748 @code{_flush_func} or @code{__cpu_flush}.
28750 @opindex mbranch-cost
28751 @item mbranch-cost=@var{num}
28752 Set the cost of branches to roughly @var{num} ``simple'' instructions.
28753 This cost is only a heuristic and is not guaranteed to produce
28754 consistent results across releases.  A zero cost redundantly selects
28755 the default, which is based on the @option{-mtune} setting.
28757 @opindex mbranch-likely
28758 @opindex mno-branch-likely
28759 @item -mbranch-likely
28760 @itemx -mno-branch-likely
28761 Enable or disable use of Branch Likely instructions, regardless of the
28762 default for the selected architecture.  By default, Branch Likely
28763 instructions may be generated if they are supported by the selected
28764 architecture.  An exception is for the MIPS32 and MIPS64 architectures
28765 and processors that implement those architectures; for those, Branch
28766 Likely instructions are not be generated by default because the MIPS32
28767 and MIPS64 architectures specifically deprecate their use.
28769 @opindex mcompact-branches=never
28770 @opindex mcompact-branches=optimal
28771 @opindex mcompact-branches=always
28772 @item -mcompact-branches=never
28773 @itemx -mcompact-branches=optimal
28774 @itemx -mcompact-branches=always
28775 These options control which form of branches will be generated.  The
28776 default is @option{-mcompact-branches=optimal}.
28778 The @option{-mcompact-branches=never} option ensures that compact branch
28779 instructions will never be generated.
28781 The @option{-mcompact-branches=always} option ensures that a compact
28782 branch instruction will be generated if available for MIPS Release 6 onwards.
28783 If a compact branch instruction is not available (or pre-R6),
28784 a delay slot form of the branch will be used instead.
28786 If it is used for MIPS16/microMIPS targets, it will be just ignored now.
28787 The behaviour for MIPS16/microMIPS may change in future,
28788 since they do have some compact branch instructions.
28790 The @option{-mcompact-branches=optimal} option will cause a delay slot
28791 branch to be used if one is available in the current ISA and the delay
28792 slot is successfully filled.  If the delay slot is not filled, a compact
28793 branch will be chosen if one is available.
28795 @opindex mfp-exceptions
28796 @item -mfp-exceptions
28797 @itemx -mno-fp-exceptions
28798 Specifies whether FP exceptions are enabled.  This affects how
28799 FP instructions are scheduled for some processors.
28800 The default is that FP exceptions are
28801 enabled.
28803 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
28804 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
28805 FP pipe.
28807 @opindex mvr4130-align
28808 @item -mvr4130-align
28809 @itemx -mno-vr4130-align
28810 The VR4130 pipeline is two-way superscalar, but can only issue two
28811 instructions together if the first one is 8-byte aligned.  When this
28812 option is enabled, GCC aligns pairs of instructions that it
28813 thinks should execute in parallel.
28815 This option only has an effect when optimizing for the VR4130.
28816 It normally makes code faster, but at the expense of making it bigger.
28817 It is enabled by default at optimization level @option{-O3}.
28819 @opindex msynci
28820 @item -msynci
28821 @itemx -mno-synci
28822 Enable (disable) generation of @code{synci} instructions on
28823 architectures that support it.  The @code{synci} instructions (if
28824 enabled) are generated when @code{__builtin___clear_cache} is
28825 compiled.
28827 This option defaults to @option{-mno-synci}, but the default can be
28828 overridden by configuring GCC with @option{--with-synci}.
28830 When compiling code for single processor systems, it is generally safe
28831 to use @code{synci}.  However, on many multi-core (SMP) systems, it
28832 does not invalidate the instruction caches on all cores and may lead
28833 to undefined behavior.
28835 @opindex mrelax-pic-calls
28836 @item -mrelax-pic-calls
28837 @itemx -mno-relax-pic-calls
28838 Try to turn PIC calls that are normally dispatched via register
28839 @code{$25} into direct calls.  This is only possible if the linker can
28840 resolve the destination at link time and if the destination is within
28841 range for a direct call.
28843 @option{-mrelax-pic-calls} is the default if GCC was configured to use
28844 an assembler and a linker that support the @code{.reloc} assembly
28845 directive and @option{-mexplicit-relocs} is in effect.  With
28846 @option{-mno-explicit-relocs}, this optimization can be performed by the
28847 assembler and the linker alone without help from the compiler.
28849 @opindex mmcount-ra-address
28850 @opindex mno-mcount-ra-address
28851 @item -mmcount-ra-address
28852 @itemx -mno-mcount-ra-address
28853 Emit (do not emit) code that allows @code{_mcount} to modify the
28854 calling function's return address.  When enabled, this option extends
28855 the usual @code{_mcount} interface with a new @var{ra-address}
28856 parameter, which has type @code{intptr_t *} and is passed in register
28857 @code{$12}.  @code{_mcount} can then modify the return address by
28858 doing both of the following:
28859 @itemize
28860 @item
28861 Returning the new address in register @code{$31}.
28862 @item
28863 Storing the new address in @code{*@var{ra-address}},
28864 if @var{ra-address} is nonnull.
28865 @end itemize
28867 The default is @option{-mno-mcount-ra-address}.
28869 @opindex mframe-header-opt
28870 @item -mframe-header-opt
28871 @itemx -mno-frame-header-opt
28872 Enable (disable) frame header optimization in the o32 ABI.  When using the
28873 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
28874 function to write out register arguments.  When enabled, this optimization
28875 will suppress the allocation of the frame header if it can be determined that
28876 it is unused.
28878 This optimization is off by default at all optimization levels.
28880 @opindex mlxc1-sxc1
28881 @item -mlxc1-sxc1
28882 @itemx -mno-lxc1-sxc1
28883 When applicable, enable (disable) the generation of @code{lwxc1},
28884 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions.  Enabled by default.
28886 @opindex mmadd4
28887 @item -mmadd4
28888 @itemx -mno-madd4
28889 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
28890 @code{madd.d} and related instructions.  Enabled by default.
28892 @end table
28894 @node MMIX Options
28895 @subsection MMIX Options
28896 @cindex MMIX Options
28898 These options are defined for the MMIX:
28900 @table @gcctabopt
28901 @opindex mlibfuncs
28902 @opindex mno-libfuncs
28903 @item -mlibfuncs
28904 @itemx -mno-libfuncs
28905 Specify that intrinsic library functions are being compiled, passing all
28906 values in registers, no matter the size.
28908 @opindex mepsilon
28909 @opindex mno-epsilon
28910 @item -mepsilon
28911 @itemx -mno-epsilon
28912 Generate floating-point comparison instructions that compare with respect
28913 to the @code{rE} epsilon register.
28915 @opindex mabi=mmixware
28916 @opindex mabi=gnu
28917 @item -mabi=mmixware
28918 @itemx -mabi=gnu
28919 Generate code that passes function parameters and return values that (in
28920 the called function) are seen as registers @code{$0} and up, as opposed to
28921 the GNU ABI which uses global registers @code{$231} and up.
28923 @opindex mzero-extend
28924 @opindex mno-zero-extend
28925 @item -mzero-extend
28926 @itemx -mno-zero-extend
28927 When reading data from memory in sizes shorter than 64 bits, use (do not
28928 use) zero-extending load instructions by default, rather than
28929 sign-extending ones.
28931 @opindex mknuthdiv
28932 @opindex mno-knuthdiv
28933 @item -mknuthdiv
28934 @itemx -mno-knuthdiv
28935 Make the result of a division yielding a remainder have the same sign as
28936 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
28937 remainder follows the sign of the dividend.  Both methods are
28938 arithmetically valid, the latter being almost exclusively used.
28940 @opindex mtoplevel-symbols
28941 @opindex mno-toplevel-symbols
28942 @item -mtoplevel-symbols
28943 @itemx -mno-toplevel-symbols
28944 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
28945 code can be used with the @code{PREFIX} assembly directive.
28947 @opindex melf
28948 @item -melf
28949 Generate an executable in the ELF format, rather than the default
28950 @samp{mmo} format used by the @command{mmix} simulator.
28952 @opindex mbranch-predict
28953 @opindex mno-branch-predict
28954 @item -mbranch-predict
28955 @itemx -mno-branch-predict
28956 Use (do not use) the probable-branch instructions, when static branch
28957 prediction indicates a probable branch.
28959 @opindex mbase-addresses
28960 @opindex mno-base-addresses
28961 @item -mbase-addresses
28962 @itemx -mno-base-addresses
28963 Generate (do not generate) code that uses @emph{base addresses}.  Using a
28964 base address automatically generates a request (handled by the assembler
28965 and the linker) for a constant to be set up in a global register.  The
28966 register is used for one or more base address requests within the range 0
28967 to 255 from the value held in the register.  The generally leads to short
28968 and fast code, but the number of different data items that can be
28969 addressed is limited.  This means that a program that uses lots of static
28970 data may require @option{-mno-base-addresses}.
28972 @opindex msingle-exit
28973 @opindex mno-single-exit
28974 @item -msingle-exit
28975 @itemx -mno-single-exit
28976 Force (do not force) generated code to have a single exit point in each
28977 function.
28978 @end table
28980 @node MN10300 Options
28981 @subsection MN10300 Options
28982 @cindex MN10300 options
28984 These @option{-m} options are defined for Matsushita MN10300 architectures:
28986 @table @gcctabopt
28987 @opindex mmult-bug
28988 @item -mmult-bug
28989 Generate code to avoid bugs in the multiply instructions for the MN10300
28990 processors.  This is the default.
28992 @opindex mno-mult-bug
28993 @item -mno-mult-bug
28994 Do not generate code to avoid bugs in the multiply instructions for the
28995 MN10300 processors.
28997 @opindex mam33
28998 @item -mam33
28999 Generate code using features specific to the AM33 processor.
29001 @opindex mno-am33
29002 @item -mno-am33
29003 Do not generate code using features specific to the AM33 processor.  This
29004 is the default.
29006 @opindex mam33-2
29007 @item -mam33-2
29008 Generate code using features specific to the AM33/2.0 processor.
29010 @opindex mam34
29011 @item -mam34
29012 Generate code using features specific to the AM34 processor.
29014 @opindex mtune
29015 @item -mtune=@var{cpu-type}
29016 Use the timing characteristics of the indicated CPU type when
29017 scheduling instructions.  This does not change the targeted processor
29018 type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
29019 @samp{am33-2} or @samp{am34}.
29021 @opindex mreturn-pointer-on-d0
29022 @item -mreturn-pointer-on-d0
29023 When generating a function that returns a pointer, return the pointer
29024 in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
29025 only in @code{a0}, and attempts to call such functions without a prototype
29026 result in errors.  Note that this option is on by default; use
29027 @option{-mno-return-pointer-on-d0} to disable it.
29029 @opindex mno-crt0
29030 @item -mno-crt0
29031 Do not link in the C run-time initialization object file.
29033 @opindex mrelax
29034 @item -mrelax
29035 Indicate to the linker that it should perform a relaxation optimization pass
29036 to shorten branches, calls and absolute memory addresses.  This option only
29037 has an effect when used on the command line for the final link step.
29039 This option makes symbolic debugging impossible.
29041 @opindex mliw
29042 @item -mliw
29043 Allow the compiler to generate @emph{Long Instruction Word}
29044 instructions if the target is the @samp{AM33} or later.  This is the
29045 default.  This option defines the preprocessor macro @code{__LIW__}.
29047 @opindex mno-liw
29048 @item -mno-liw
29049 Do not allow the compiler to generate @emph{Long Instruction Word}
29050 instructions.  This option defines the preprocessor macro
29051 @code{__NO_LIW__}.
29053 @opindex msetlb
29054 @item -msetlb
29055 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
29056 instructions if the target is the @samp{AM33} or later.  This is the
29057 default.  This option defines the preprocessor macro @code{__SETLB__}.
29059 @opindex mno-setlb
29060 @item -mno-setlb
29061 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
29062 instructions.  This option defines the preprocessor macro
29063 @code{__NO_SETLB__}.
29065 @end table
29067 @node Moxie Options
29068 @subsection Moxie Options
29069 @cindex Moxie Options
29071 @table @gcctabopt
29073 @opindex meb
29074 @item -meb
29075 Generate big-endian code.  This is the default for @samp{moxie-*-*}
29076 configurations.
29078 @opindex mel
29079 @item -mel
29080 Generate little-endian code.
29082 @opindex mmul.x
29083 @item -mmul.x
29084 Generate mul.x and umul.x instructions.  This is the default for
29085 @samp{moxiebox-*-*} configurations.
29087 @opindex mno-crt0
29088 @item -mno-crt0
29089 Do not link in the C run-time initialization object file.
29091 @end table
29093 @node MSP430 Options
29094 @subsection MSP430 Options
29095 @cindex MSP430 Options
29097 These options are defined for the MSP430:
29099 @table @gcctabopt
29101 @opindex masm-hex
29102 @item -masm-hex
29103 Force assembly output to always use hex constants.  Normally such
29104 constants are signed decimals, but this option is available for
29105 testsuite and/or aesthetic purposes.
29107 @opindex mmcu=
29108 @item -mmcu=
29109 Select the MCU to target.  This is used to create a C preprocessor
29110 symbol based upon the MCU name, converted to upper case and pre- and
29111 post-fixed with @samp{__}.  This in turn is used by the
29112 @file{msp430.h} header file to select an MCU-specific supplementary
29113 header file.
29115 The option also sets the ISA to use.  If the MCU name is one that is
29116 known to only support the 430 ISA then that is selected, otherwise the
29117 430X ISA is selected.  A generic MCU name of @samp{msp430} can also be
29118 used to select the 430 ISA.  Similarly the generic @samp{msp430x} MCU
29119 name selects the 430X ISA.
29121 In addition an MCU-specific linker script is added to the linker
29122 command line.  The script's name is the name of the MCU with
29123 @file{.ld} appended.  Thus specifying @option{-mmcu=xxx} on the @command{gcc}
29124 command line defines the C preprocessor symbol @code{__XXX__} and
29125 cause the linker to search for a script called @file{xxx.ld}.
29127 The ISA and hardware multiply supported for the different MCUs is hard-coded
29128 into GCC.  However, an external @samp{devices.csv} file can be used to
29129 extend device support beyond those that have been hard-coded.
29131 GCC searches for the @samp{devices.csv} file using the following methods in the
29132 given precedence order, where the first method takes precendence over the
29133 second which takes precedence over the third.
29135 @table @asis
29136 @item Include path specified with @code{-I} and @code{-L}
29137 @samp{devices.csv} will be searched for in each of the directories specified by
29138 include paths and linker library search paths.
29139 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
29140 Define the value of the global environment variable
29141 @samp{MSP430_GCC_INCLUDE_DIR}
29142 to the full path to the directory containing devices.csv, and GCC will search
29143 this directory for devices.csv.  If devices.csv is found, this directory will
29144 also be registered as an include path, and linker library path.  Header files
29145 and linker scripts in this directory can therefore be used without manually
29146 specifying @code{-I} and @code{-L} on the command line.
29147 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
29148 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
29149 toolchain root directory.  This directory does not exist in a default
29150 installation, but if the user has created it and copied @samp{devices.csv}
29151 there, then the MCU data will be read.  As above, this directory will
29152 also be registered as an include path, and linker library path.
29154 @end table
29155 If none of the above search methods find @samp{devices.csv}, then the
29156 hard-coded MCU data is used.
29159 @opindex mwarn-mcu
29160 @opindex mno-warn-mcu
29161 @item -mwarn-mcu
29162 @itemx -mno-warn-mcu
29163 This option enables or disables warnings about conflicts between the
29164 MCU name specified by the @option{-mmcu} option and the ISA set by the
29165 @option{-mcpu} option and/or the hardware multiply support set by the
29166 @option{-mhwmult} option.  It also toggles warnings about unrecognized
29167 MCU names.  This option is on by default.
29169 @opindex mcpu=
29170 @item -mcpu=
29171 Specifies the ISA to use.  Accepted values are @samp{msp430},
29172 @samp{msp430x} and @samp{msp430xv2}.  This option is deprecated.  The
29173 @option{-mmcu=} option should be used to select the ISA.
29175 @opindex msim
29176 @item -msim
29177 Link to the simulator runtime libraries and linker script.  Overrides
29178 any scripts that would be selected by the @option{-mmcu=} option.
29180 @opindex mlarge
29181 @item -mlarge
29182 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
29184 @opindex msmall
29185 @item -msmall
29186 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
29188 @opindex mrelax
29189 @item -mrelax
29190 This option is passed to the assembler and linker, and allows the
29191 linker to perform certain optimizations that cannot be done until
29192 the final link.
29194 @opindex mhwmult=
29195 @item mhwmult=
29196 Describes the type of hardware multiply supported by the target.
29197 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
29198 for the original 16-bit-only multiply supported by early MCUs.
29199 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
29200 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
29201 A value of @samp{auto} can also be given.  This tells GCC to deduce
29202 the hardware multiply support based upon the MCU name provided by the
29203 @option{-mmcu} option.  If no @option{-mmcu} option is specified or if
29204 the MCU name is not recognized then no hardware multiply support is
29205 assumed.  @code{auto} is the default setting.
29207 Hardware multiplies are normally performed by calling a library
29208 routine.  This saves space in the generated code.  When compiling at
29209 @option{-O3} or higher however the hardware multiplier is invoked
29210 inline.  This makes for bigger, but faster code.
29212 The hardware multiply routines disable interrupts whilst running and
29213 restore the previous interrupt state when they finish.  This makes
29214 them safe to use inside interrupt handlers as well as in normal code.
29216 @opindex minrt
29217 @item -minrt
29218 Enable the use of a minimum runtime environment - no static
29219 initializers or constructors.  This is intended for memory-constrained
29220 devices.  The compiler includes special symbols in some objects
29221 that tell the linker and runtime which code fragments are required.
29223 @opindex mtiny-printf
29224 @item -mtiny-printf
29225 Enable reduced code size @code{printf} and @code{puts} library functions.
29226 The @samp{tiny} implementations of these functions are not reentrant, so
29227 must be used with caution in multi-threaded applications.
29229 Support for streams has been removed and the string to be printed will
29230 always be sent to stdout via the @code{write} syscall.  The string is not
29231 buffered before it is sent to write.
29233 This option requires Newlib Nano IO, so GCC must be configured with
29234 @samp{--enable-newlib-nano-formatted-io}.
29236 @opindex mmax-inline-shift=
29237 @item -mmax-inline-shift=
29238 This option takes an integer between 0 and 64 inclusive, and sets
29239 the maximum number of inline shift instructions which should be emitted to
29240 perform a shift operation by a constant amount.  When this value needs to be
29241 exceeded, an mspabi helper function is used instead.  The default value is 4.
29243 This only affects cases where a shift by multiple positions cannot be
29244 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
29246 Shifts of a 32-bit value are at least twice as costly, so the value passed for
29247 this option is divided by 2 and the resulting value used instead.
29249 @opindex mcode-region
29250 @opindex mdata-region
29251 @item -mcode-region=
29252 @itemx -mdata-region=
29253 These options tell the compiler where to place functions and data that
29254 do not have one of the @code{lower}, @code{upper}, @code{either} or
29255 @code{section} attributes.  Possible values are @code{lower},
29256 @code{upper}, @code{either} or @code{any}.  The first three behave
29257 like the corresponding attribute.  The fourth possible value -
29258 @code{any} - is the default.  It leaves placement entirely up to the
29259 linker script and how it assigns the standard sections
29260 (@code{.text}, @code{.data}, etc) to the memory regions.
29262 @opindex msilicon-errata
29263 @item -msilicon-errata=
29264 This option passes on a request to assembler to enable the fixes for
29265 the named silicon errata.
29267 @opindex msilicon-errata-warn
29268 @item -msilicon-errata-warn=
29269 This option passes on a request to the assembler to enable warning
29270 messages when a silicon errata might need to be applied.
29272 @opindex mwarn-devices-csv
29273 @opindex mno-warn-devices-csv
29274 @item -mwarn-devices-csv
29275 @itemx -mno-warn-devices-csv
29276 Warn if @samp{devices.csv} is not found or there are problem parsing it
29277 (default: on).
29279 @end table
29281 @node NDS32 Options
29282 @subsection NDS32 Options
29283 @cindex NDS32 Options
29285 These options are defined for NDS32 implementations:
29287 @table @gcctabopt
29289 @opindex mbig-endian
29290 @item -mbig-endian
29291 Generate code in big-endian mode.
29293 @opindex mlittle-endian
29294 @item -mlittle-endian
29295 Generate code in little-endian mode.
29297 @opindex mreduced-regs
29298 @item -mreduced-regs
29299 Use reduced-set registers for register allocation.
29301 @opindex mfull-regs
29302 @item -mfull-regs
29303 Use full-set registers for register allocation.
29305 @opindex mcmov
29306 @item -mcmov
29307 Generate conditional move instructions.
29309 @opindex mno-cmov
29310 @item -mno-cmov
29311 Do not generate conditional move instructions.
29313 @opindex mext-perf
29314 @item -mext-perf
29315 Generate performance extension instructions.
29317 @opindex mno-ext-perf
29318 @item -mno-ext-perf
29319 Do not generate performance extension instructions.
29321 @opindex mext-perf2
29322 @item -mext-perf2
29323 Generate performance extension 2 instructions.
29325 @opindex mno-ext-perf2
29326 @item -mno-ext-perf2
29327 Do not generate performance extension 2 instructions.
29329 @opindex mext-string
29330 @item -mext-string
29331 Generate string extension instructions.
29333 @opindex mno-ext-string
29334 @item -mno-ext-string
29335 Do not generate string extension instructions.
29337 @opindex mv3push
29338 @item -mv3push
29339 Generate v3 push25/pop25 instructions.
29341 @opindex mno-v3push
29342 @item -mno-v3push
29343 Do not generate v3 push25/pop25 instructions.
29345 @opindex m16-bit
29346 @item -m16-bit
29347 Generate 16-bit instructions.
29349 @opindex mno-16-bit
29350 @item -mno-16-bit
29351 Do not generate 16-bit instructions.
29353 @opindex misr-vector-size
29354 @item -misr-vector-size=@var{num}
29355 Specify the size of each interrupt vector, which must be 4 or 16.
29357 @opindex mcache-block-size
29358 @item -mcache-block-size=@var{num}
29359 Specify the size of each cache block,
29360 which must be a power of 2 between 4 and 512.
29362 @opindex march
29363 @item -march=@var{arch}
29364 Specify the name of the target architecture.
29366 @opindex mcmodel
29367 @item -mcmodel=@var{code-model}
29368 Set the code model to one of
29369 @table @asis
29370 @item @samp{small}
29371 All the data and read-only data segments must be within 512KB addressing space.
29372 The text segment must be within 16MB addressing space.
29373 @item @samp{medium}
29374 The data segment must be within 512KB while the read-only data segment can be
29375 within 4GB addressing space.  The text segment should be still within 16MB
29376 addressing space.
29377 @item @samp{large}
29378 All the text and data segments can be within 4GB addressing space.
29379 @end table
29381 @opindex mctor-dtor
29382 @item -mctor-dtor
29383 Enable constructor/destructor feature.
29385 @opindex mrelax
29386 @item -mrelax
29387 Guide linker to relax instructions.
29389 @end table
29391 @node Nios II Options
29392 @subsection Nios II Options
29393 @cindex Nios II options
29394 @cindex Altera Nios II options
29396 These are the options defined for the Altera Nios II processor.
29398 @table @gcctabopt
29400 @opindex G
29401 @cindex smaller data references
29402 @item -G @var{num}
29403 Put global and static objects less than or equal to @var{num} bytes
29404 into the small data or BSS sections instead of the normal data or BSS
29405 sections.  The default value of @var{num} is 8.
29407 @opindex mgpopt
29408 @opindex mno-gpopt
29409 @item -mgpopt=@var{option}
29410 @itemx -mgpopt
29411 @itemx -mno-gpopt
29412 Generate (do not generate) GP-relative accesses.  The following 
29413 @var{option} names are recognized:
29415 @table @samp
29417 @item none
29418 Do not generate GP-relative accesses.
29420 @item local
29421 Generate GP-relative accesses for small data objects that are not 
29422 external, weak, or uninitialized common symbols.  
29423 Also use GP-relative addressing for objects that
29424 have been explicitly placed in a small data section via a @code{section}
29425 attribute.
29427 @item global
29428 As for @samp{local}, but also generate GP-relative accesses for
29429 small data objects that are external, weak, or common.  If you use this option,
29430 you must ensure that all parts of your program (including libraries) are
29431 compiled with the same @option{-G} setting.
29433 @item data
29434 Generate GP-relative accesses for all data objects in the program.  If you
29435 use this option, the entire data and BSS segments
29436 of your program must fit in 64K of memory and you must use an appropriate
29437 linker script to allocate them within the addressable range of the
29438 global pointer.
29440 @item all
29441 Generate GP-relative addresses for function pointers as well as data
29442 pointers.  If you use this option, the entire text, data, and BSS segments
29443 of your program must fit in 64K of memory and you must use an appropriate
29444 linker script to allocate them within the addressable range of the
29445 global pointer.
29447 @end table
29449 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
29450 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
29452 The default is @option{-mgpopt} except when @option{-fpic} or
29453 @option{-fPIC} is specified to generate position-independent code.
29454 Note that the Nios II ABI does not permit GP-relative accesses from
29455 shared libraries.
29457 You may need to specify @option{-mno-gpopt} explicitly when building
29458 programs that include large amounts of small data, including large
29459 GOT data sections.  In this case, the 16-bit offset for GP-relative
29460 addressing may not be large enough to allow access to the entire 
29461 small data section.
29463 @opindex mgprel-sec
29464 @item -mgprel-sec=@var{regexp}
29465 This option specifies additional section names that can be accessed via
29466 GP-relative addressing.  It is most useful in conjunction with 
29467 @code{section} attributes on variable declarations 
29468 (@pxref{Common Variable Attributes}) and a custom linker script.  
29469 The @var{regexp} is a POSIX Extended Regular Expression.
29471 This option does not affect the behavior of the @option{-G} option, and 
29472 the specified sections are in addition to the standard @code{.sdata}
29473 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
29475 @opindex mr0rel-sec
29476 @item -mr0rel-sec=@var{regexp}
29477 This option specifies names of sections that can be accessed via a 
29478 16-bit offset from @code{r0}; that is, in the low 32K or high 32K 
29479 of the 32-bit address space.  It is most useful in conjunction with 
29480 @code{section} attributes on variable declarations 
29481 (@pxref{Common Variable Attributes}) and a custom linker script.  
29482 The @var{regexp} is a POSIX Extended Regular Expression.
29484 In contrast to the use of GP-relative addressing for small data, 
29485 zero-based addressing is never generated by default and there are no 
29486 conventional section names used in standard linker scripts for sections
29487 in the low or high areas of memory.
29489 @opindex mel
29490 @opindex meb
29491 @item -mel
29492 @itemx -meb
29493 Generate little-endian (default) or big-endian (experimental) code,
29494 respectively.
29496 @opindex march
29497 @item -march=@var{arch}
29498 This specifies the name of the target Nios II architecture.  GCC uses this
29499 name to determine what kind of instructions it can emit when generating
29500 assembly code.  Permissible names are: @samp{r1}, @samp{r2}.
29502 The preprocessor macro @code{__nios2_arch__} is available to programs,
29503 with value 1 or 2, indicating the targeted ISA level.
29505 @opindex mno-bypass-cache
29506 @opindex mbypass-cache
29507 @item -mbypass-cache
29508 @itemx -mno-bypass-cache
29509 Force all load and store instructions to always bypass cache by 
29510 using I/O variants of the instructions. The default is not to
29511 bypass the cache.
29513 @opindex mcache-volatile 
29514 @opindex mno-cache-volatile
29515 @item -mno-cache-volatile 
29516 @itemx -mcache-volatile       
29517 Volatile memory access bypass the cache using the I/O variants of 
29518 the load and store instructions. The default is not to bypass the cache.
29520 @opindex mno-fast-sw-div
29521 @opindex mfast-sw-div
29522 @item -mno-fast-sw-div
29523 @itemx -mfast-sw-div
29524 Do not use table-based fast divide for small numbers. The default 
29525 is to use the fast divide at @option{-O3} and above.
29527 @opindex mno-hw-mul
29528 @opindex mhw-mul
29529 @opindex mno-hw-mulx
29530 @opindex mhw-mulx
29531 @opindex mno-hw-div
29532 @opindex mhw-div
29533 @item -mno-hw-mul
29534 @itemx -mhw-mul
29535 @itemx -mno-hw-mulx
29536 @itemx -mhw-mulx
29537 @itemx -mno-hw-div
29538 @itemx -mhw-div
29539 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 
29540 instructions by the compiler. The default is to emit @code{mul}
29541 and not emit @code{div} and @code{mulx}.
29543 @item -mbmx
29544 @itemx -mno-bmx
29545 @itemx -mcdx
29546 @itemx -mno-cdx
29547 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
29548 CDX (code density) instructions.  Enabling these instructions also
29549 requires @option{-march=r2}.  Since these instructions are optional
29550 extensions to the R2 architecture, the default is not to emit them.
29552 @opindex mcustom-@var{insn}
29553 @opindex mno-custom-@var{insn}
29554 @item -mcustom-@var{insn}=@var{N}
29555 @itemx -mno-custom-@var{insn}
29556 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
29557 custom instruction with encoding @var{N} when generating code that uses 
29558 @var{insn}.  For example, @option{-mcustom-fadds=253} generates custom
29559 instruction 253 for single-precision floating-point add operations instead
29560 of the default behavior of using a library call.
29562 The following values of @var{insn} are supported.  Except as otherwise
29563 noted, floating-point operations are expected to be implemented with
29564 normal IEEE 754 semantics and correspond directly to the C operators or the
29565 equivalent GCC built-in functions (@pxref{Other Builtins}).
29567 Single-precision floating point:
29568 @table @asis
29570 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
29571 Binary arithmetic operations.
29573 @item @samp{fnegs}
29574 Unary negation.
29576 @item @samp{fabss}
29577 Unary absolute value.
29579 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
29580 Comparison operations.
29582 @item @samp{fmins}, @samp{fmaxs}
29583 Floating-point minimum and maximum.  These instructions are only
29584 generated if @option{-ffinite-math-only} is specified.
29586 @item @samp{fsqrts}
29587 Unary square root operation.
29589 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
29590 Floating-point trigonometric and exponential functions.  These instructions
29591 are only generated if @option{-funsafe-math-optimizations} is also specified.
29593 @end table
29595 Double-precision floating point:
29596 @table @asis
29598 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
29599 Binary arithmetic operations.
29601 @item @samp{fnegd}
29602 Unary negation.
29604 @item @samp{fabsd}
29605 Unary absolute value.
29607 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
29608 Comparison operations.
29610 @item @samp{fmind}, @samp{fmaxd}
29611 Double-precision minimum and maximum.  These instructions are only
29612 generated if @option{-ffinite-math-only} is specified.
29614 @item @samp{fsqrtd}
29615 Unary square root operation.
29617 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
29618 Double-precision trigonometric and exponential functions.  These instructions
29619 are only generated if @option{-funsafe-math-optimizations} is also specified.
29621 @end table
29623 Conversions:
29624 @table @asis
29625 @item @samp{fextsd}
29626 Conversion from single precision to double precision.
29628 @item @samp{ftruncds}
29629 Conversion from double precision to single precision.
29631 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
29632 Conversion from floating point to signed or unsigned integer types, with
29633 truncation towards zero.
29635 @item @samp{round}
29636 Conversion from single-precision floating point to signed integer,
29637 rounding to the nearest integer and ties away from zero.
29638 This corresponds to the @code{__builtin_lroundf} function when
29639 @option{-fno-math-errno} is used.
29641 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
29642 Conversion from signed or unsigned integer types to floating-point types.
29644 @end table
29646 In addition, all of the following transfer instructions for internal
29647 registers X and Y must be provided to use any of the double-precision
29648 floating-point instructions.  Custom instructions taking two
29649 double-precision source operands expect the first operand in the
29650 64-bit register X.  The other operand (or only operand of a unary
29651 operation) is given to the custom arithmetic instruction with the
29652 least significant half in source register @var{src1} and the most
29653 significant half in @var{src2}.  A custom instruction that returns a
29654 double-precision result returns the most significant 32 bits in the
29655 destination register and the other half in 32-bit register Y.  
29656 GCC automatically generates the necessary code sequences to write
29657 register X and/or read register Y when double-precision floating-point
29658 instructions are used.
29660 @table @asis
29662 @item @samp{fwrx}
29663 Write @var{src1} into the least significant half of X and @var{src2} into
29664 the most significant half of X.
29666 @item @samp{fwry}
29667 Write @var{src1} into Y.
29669 @item @samp{frdxhi}, @samp{frdxlo}
29670 Read the most or least (respectively) significant half of X and store it in
29671 @var{dest}.
29673 @item @samp{frdy}
29674 Read the value of Y and store it into @var{dest}.
29675 @end table
29677 Note that you can gain more local control over generation of Nios II custom
29678 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
29679 and @code{target("no-custom-@var{insn}")} function attributes
29680 (@pxref{Function Attributes})
29681 or pragmas (@pxref{Function Specific Option Pragmas}).
29683 @opindex mcustom-fpu-cfg
29684 @item -mcustom-fpu-cfg=@var{name}
29686 This option enables a predefined, named set of custom instruction encodings
29687 (see @option{-mcustom-@var{insn}} above).  
29688 Currently, the following sets are defined:
29690 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
29691 @gccoptlist{-mcustom-fmuls=252
29692 -mcustom-fadds=253
29693 -mcustom-fsubs=254
29694 -fsingle-precision-constant}
29696 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
29697 @gccoptlist{-mcustom-fmuls=252
29698 -mcustom-fadds=253
29699 -mcustom-fsubs=254
29700 -mcustom-fdivs=255
29701 -fsingle-precision-constant}
29703 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
29704 @gccoptlist{-mcustom-floatus=243
29705 -mcustom-fixsi=244
29706 -mcustom-floatis=245
29707 -mcustom-fcmpgts=246
29708 -mcustom-fcmples=249
29709 -mcustom-fcmpeqs=250
29710 -mcustom-fcmpnes=251
29711 -mcustom-fmuls=252
29712 -mcustom-fadds=253
29713 -mcustom-fsubs=254
29714 -mcustom-fdivs=255
29715 -fsingle-precision-constant}
29717 @option{-mcustom-fpu-cfg=fph2} is equivalent to:
29718 @gccoptlist{-mcustom-fabss=224
29719 -mcustom-fnegs=225
29720 -mcustom-fcmpnes=226
29721 -mcustom-fcmpeqs=227
29722 -mcustom-fcmpges=228
29723 -mcustom-fcmpgts=229
29724 -mcustom-fcmples=230
29725 -mcustom-fcmplts=231
29726 -mcustom-fmaxs=232
29727 -mcustom-fmins=233
29728 -mcustom-round=248
29729 -mcustom-fixsi=249
29730 -mcustom-floatis=250
29731 -mcustom-fsqrts=251
29732 -mcustom-fmuls=252
29733 -mcustom-fadds=253
29734 -mcustom-fsubs=254
29735 -mcustom-fdivs=255}
29737 Custom instruction assignments given by individual
29738 @option{-mcustom-@var{insn}=} options override those given by
29739 @option{-mcustom-fpu-cfg=}, regardless of the
29740 order of the options on the command line.
29742 Note that you can gain more local control over selection of a FPU
29743 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
29744 function attribute (@pxref{Function Attributes})
29745 or pragma (@pxref{Function Specific Option Pragmas}).
29747 The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
29748 Hardware 2 Component}.  Please note that the custom instructions enabled by
29749 @option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
29750 if @option{-ffinite-math-only} is specified.  The custom instruction enabled by
29751 @option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
29752 specified.  In contrast to the other configurations,
29753 @option{-fsingle-precision-constant} is not set.
29755 @end table
29757 These additional @samp{-m} options are available for the Altera Nios II
29758 ELF (bare-metal) target:
29760 @table @gcctabopt
29762 @opindex mhal
29763 @item -mhal
29764 Link with HAL BSP.  This suppresses linking with the GCC-provided C runtime
29765 startup and termination code, and is typically used in conjunction with
29766 @option{-msys-crt0=} to specify the location of the alternate startup code
29767 provided by the HAL BSP.
29769 @opindex msmallc
29770 @item -msmallc
29771 Link with a limited version of the C library, @option{-lsmallc}, rather than
29772 Newlib.
29774 @opindex msys-crt0
29775 @item -msys-crt0=@var{startfile}
29776 @var{startfile} is the file name of the startfile (crt0) to use 
29777 when linking.  This option is only useful in conjunction with @option{-mhal}.
29779 @opindex msys-lib
29780 @item -msys-lib=@var{systemlib}
29781 @var{systemlib} is the library name of the library that provides
29782 low-level system calls required by the C library,
29783 e.g.@: @code{read} and @code{write}.
29784 This option is typically used to link with a library provided by a HAL BSP.
29786 @end table
29788 @node Nvidia PTX Options
29789 @subsection Nvidia PTX Options
29790 @cindex Nvidia PTX options
29791 @cindex nvptx options
29793 These options are defined for Nvidia PTX:
29795 @table @gcctabopt
29797 @opindex m64
29798 @item -m64
29799 Ignored, but preserved for backward compatibility.  Only 64-bit ABI is
29800 supported.
29802 @opindex march
29803 @item -march=@var{architecture-string}
29804 Generate code for the specified PTX ISA target architecture
29805 (e.g.@: @samp{sm_35}).  Valid architecture strings are @samp{sm_30},
29806 @samp{sm_35}, @samp{sm_53}, @samp{sm_70}, @samp{sm_75} and
29807 @samp{sm_80}.
29808 The default depends on how the compiler has been configured, see
29809 @option{--with-arch}.
29811 This option sets the value of the preprocessor macro
29812 @code{__PTX_SM__}; for instance, for @samp{sm_35}, it has the value
29813 @samp{350}.
29815 @opindex misa
29816 @item -misa=@var{architecture-string}
29817 Alias of @option{-march=}.
29819 @opindex march
29820 @item -march-map=@var{architecture-string}
29821 Select the closest available @option{-march=} value that is not more
29822 capable.  For instance, for @option{-march-map=sm_50} select
29823 @option{-march=sm_35}, and for @option{-march-map=sm_53} select
29824 @option{-march=sm_53}.
29826 @opindex mptx
29827 @item -mptx=@var{version-string}
29828 Generate code for the specified PTX ISA version (e.g.@: @samp{7.0}).
29829 Valid version strings include @samp{3.1}, @samp{6.0}, @samp{6.3}, and
29830 @samp{7.0}.  The default PTX ISA version is 6.0, unless a higher
29831 version is required for specified PTX ISA target architecture via
29832 option @option{-march=}.
29834 This option sets the values of the preprocessor macros
29835 @code{__PTX_ISA_VERSION_MAJOR__} and @code{__PTX_ISA_VERSION_MINOR__};
29836 for instance, for @samp{3.1} the macros have the values @samp{3} and
29837 @samp{1}, respectively.
29839 @opindex mmainkernel
29840 @item -mmainkernel
29841 Link in code for a __main kernel.  This is for stand-alone instead of
29842 offloading execution.
29844 @opindex moptimize
29845 @item -moptimize
29846 Apply partitioned execution optimizations.  This is the default when any
29847 level of optimization is selected.
29849 @opindex msoft-stack
29850 @item -msoft-stack
29851 Generate code that does not use @code{.local} memory
29852 directly for stack storage. Instead, a per-warp stack pointer is
29853 maintained explicitly. This enables variable-length stack allocation (with
29854 variable-length arrays or @code{alloca}), and when global memory is used for
29855 underlying storage, makes it possible to access automatic variables from other
29856 threads, or with atomic instructions. This code generation variant is used
29857 for OpenMP offloading, but the option is exposed on its own for the purpose
29858 of testing the compiler; to generate code suitable for linking into programs
29859 using OpenMP offloading, use option @option{-mgomp}.
29861 @opindex muniform-simt
29862 @item -muniform-simt
29863 Switch to code generation variant that allows to execute all threads in each
29864 warp, while maintaining memory state and side effects as if only one thread
29865 in each warp was active outside of OpenMP SIMD regions.  All atomic operations
29866 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
29867 current lane index equals the master lane index), and the register being
29868 assigned is copied via a shuffle instruction from the master lane.  Outside of
29869 SIMD regions lane 0 is the master; inside, each thread sees itself as the
29870 master.  Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
29871 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
29872 regions).  Each thread can bitwise-and the bitmask at position @code{tid.y}
29873 with current lane index to compute the master lane index.
29875 @opindex mgomp
29876 @item -mgomp
29877 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
29878 @option{-muniform-simt} options, and selects corresponding multilib variant.
29880 @end table
29882 @node OpenRISC Options
29883 @subsection OpenRISC Options
29884 @cindex OpenRISC Options
29886 These options are defined for OpenRISC:
29888 @table @gcctabopt
29890 @opindex mboard
29891 @item -mboard=@var{name}
29892 Configure a board specific runtime.  This will be passed to the linker for
29893 newlib board library linking.  The default is @code{or1ksim}.
29895 @opindex mnewlib
29896 @item -mnewlib
29897 This option is ignored; it is for compatibility purposes only.  This used to
29898 select linker and preprocessor options for use with newlib.
29900 @opindex msoft-div
29901 @opindex mhard-div
29902 @item -msoft-div
29903 @itemx -mhard-div
29904 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
29905 This default is hardware divide.
29907 @opindex msoft-mul
29908 @opindex mhard-mul
29909 @item -msoft-mul
29910 @itemx -mhard-mul
29911 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
29912 This default is hardware multiply.
29914 @opindex msoft-float
29915 @opindex mhard-float
29916 @item -msoft-float
29917 @itemx -mhard-float
29918 Select software or hardware for floating point operations.
29919 The default is software.
29921 @opindex mdouble-float
29922 @item -mdouble-float
29923 When @option{-mhard-float} is selected, enables generation of double-precision
29924 floating point instructions.  By default functions from @file{libgcc} are used
29925 to perform double-precision floating point operations.
29927 @opindex munordered-float
29928 @item -munordered-float
29929 When @option{-mhard-float} is selected, enables generation of unordered
29930 floating point compare and set flag (@code{lf.sfun*}) instructions.  By default
29931 functions from @file{libgcc} are used to perform unordered floating point
29932 compare and set flag operations.
29934 @opindex mcmov
29935 @item -mcmov
29936 Enable generation of conditional move (@code{l.cmov}) instructions.  By
29937 default the equivalent will be generated using set and branch.
29939 @opindex mror
29940 @item -mror
29941 Enable generation of rotate right (@code{l.ror}) instructions.  By default
29942 functions from @file{libgcc} are used to perform rotate right operations.
29944 @opindex mrori
29945 @item -mrori
29946 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
29947 By default functions from @file{libgcc} are used to perform rotate right with
29948 immediate operations.
29950 @opindex msext
29951 @item -msext
29952 Enable generation of sign extension (@code{l.ext*}) instructions.  By default
29953 memory loads are used to perform sign extension.
29955 @opindex msfimm
29956 @item -msfimm
29957 Enable generation of compare and set flag with immediate (@code{l.sf*i})
29958 instructions.  By default extra instructions will be generated to store the
29959 immediate to a register first.
29961 @opindex mshftimm
29962 @item -mshftimm
29963 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
29964 @code{l.slli}) instructions.  By default extra instructions will be generated
29965 to store the immediate to a register first.
29967 @opindex mcmodel=small
29968 @item -mcmodel=small
29969 Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
29970 the default model.
29972 @opindex mcmodel=large
29973 @item -mcmodel=large
29974 Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
29977 @end table
29979 @node PDP-11 Options
29980 @subsection PDP-11 Options
29981 @cindex PDP-11 Options
29983 These options are defined for the PDP-11:
29985 @table @gcctabopt
29986 @opindex mfpu
29987 @item -mfpu
29988 Use hardware FPP floating point.  This is the default.  (FIS floating
29989 point on the PDP-11/40 is not supported.)  Implies -m45.
29991 @opindex msoft-float
29992 @item -msoft-float
29993 Do not use hardware floating point.
29995 @opindex mac0
29996 @item -mac0
29997 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
29999 @opindex mno-ac0
30000 @item -mno-ac0
30001 Return floating-point results in memory.  This is the default.
30003 @opindex m40
30004 @item -m40
30005 Generate code for a PDP-11/40.  Implies -msoft-float -mno-split.
30007 @opindex m45
30008 @item -m45
30009 Generate code for a PDP-11/45.  This is the default.
30011 @opindex m10
30012 @item -m10
30013 Generate code for a PDP-11/10.  Implies -msoft-float -mno-split.
30015 @opindex mint16
30016 @opindex mno-int32
30017 @item -mint16
30018 @itemx -mno-int32
30019 Use 16-bit @code{int}.  This is the default.
30021 @opindex mint32
30022 @opindex mno-int16
30023 @item -mint32
30024 @itemx -mno-int16
30025 Use 32-bit @code{int}.
30027 @opindex msplit
30028 @item -msplit
30029 Target has split instruction and data space.  Implies -m45.
30031 @opindex munix-asm
30032 @item -munix-asm
30033 Use Unix assembler syntax.
30035 @opindex mdec-asm
30036 @item -mdec-asm
30037 Use DEC assembler syntax.
30039 @opindex mgnu-asm
30040 @item -mgnu-asm
30041 Use GNU assembler syntax.  This is the default.
30043 @opindex mlra
30044 @item -mlra
30045 Use the new LRA register allocator.  By default, the old ``reload''
30046 allocator is used.
30047 @end table
30049 @node PowerPC Options
30050 @subsection PowerPC Options
30051 @cindex PowerPC options
30053 These are listed under @xref{RS/6000 and PowerPC Options}.
30055 @node PRU Options
30056 @subsection PRU Options
30057 @cindex PRU Options
30059 These command-line options are defined for PRU target:
30061 @table @gcctabopt
30062 @opindex minrt
30063 @item -minrt
30064 Link with a minimum runtime environment, with no support for static
30065 initializers and constructors.  Using this option can significantly reduce
30066 the size of the final ELF binary.  Beware that the compiler could still
30067 generate code with static initializers and constructors.  It is up to the
30068 programmer to ensure that the source program will not use those features.
30070 @opindex mmcu
30071 @item -mmcu=@var{mcu}
30072 Specify the PRU MCU variant to use.  Check Newlib for the exact list of
30073 supported MCUs.
30075 @opindex mno-relax
30076 @item -mno-relax
30077 Make GCC pass the @option{--no-relax} command-line option to the linker
30078 instead of the @option{--relax} option.
30080 @opindex mloop
30081 @item -mloop
30082 Allow (or do not allow) GCC to use the LOOP instruction.
30084 @opindex mabi
30085 @item -mabi=@var{variant}
30086 Specify the ABI variant to output code for.  @option{-mabi=ti} selects the
30087 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
30088 more naturally with certain GCC assumptions.  These are the differences:
30090 @table @samp
30091 @item Function Pointer Size
30092 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
30093 supports only 32-bit data and code pointers.
30095 @item Optional Return Value Pointer
30096 Function return values larger than 64 bits are passed by using a hidden
30097 pointer as the first argument of the function.  TI ABI, though, mandates that
30098 the pointer can be NULL in case the caller is not using the returned value.
30099 GNU always passes and expects a valid return value pointer.
30101 @end table
30103 The current @option{-mabi=ti} implementation simply raises a compile error
30104 when any of the above code constructs is detected.  As a consequence
30105 the standard C library cannot be built and it is omitted when linking with
30106 @option{-mabi=ti}.
30108 Relaxation is a GNU feature and for safety reasons is disabled when using
30109 @option{-mabi=ti}.  The TI toolchain does not emit relocations for QBBx
30110 instructions, so the GNU linker cannot adjust them when shortening adjacent
30111 LDI32 pseudo instructions.
30113 @end table
30115 @node RISC-V Options
30116 @subsection RISC-V Options
30117 @cindex RISC-V Options
30119 These command-line options are defined for RISC-V targets:
30121 @table @gcctabopt
30122 @opindex mbranch-cost
30123 @item -mbranch-cost=@var{n}
30124 Set the cost of branches to roughly @var{n} instructions.
30126 @opindex plt
30127 @item -mplt
30128 @itemx -mno-plt
30129 When generating PIC code, do or don't allow the use of PLTs. Ignored for
30130 non-PIC.  The default is @option{-mplt}.
30132 @opindex mabi
30133 @item -mabi=@var{ABI-string}
30134 Specify integer and floating-point calling convention.  @var{ABI-string}
30135 contains two parts: the size of integer types and the registers used for
30136 floating-point types.  For example @samp{-march=rv64ifd -mabi=lp64d} means that
30137 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
30138 32-bit), and that floating-point values up to 64 bits wide are passed in F
30139 registers.  Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
30140 allows the compiler to generate code that uses the F and D extensions but only
30141 allows floating-point values up to 32 bits long to be passed in registers; or
30142 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
30143 passed in registers.
30145 The default for this argument is system dependent, users who want a specific
30146 calling convention should specify one explicitly.  The valid calling
30147 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
30148 @samp{lp64f}, and @samp{lp64d}.  Some calling conventions are impossible to
30149 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
30150 invalid because the ABI requires 64-bit values be passed in F registers, but F
30151 registers are only 32 bits wide.  There are also the @samp{ilp32e} ABI that can
30152 only be used with the @samp{rv32e} architecture and the @samp{lp64e} ABI that
30153 can only be used with the @samp{rv64e}.  Those ABIs are not well specified at
30154 present, and are subject to change.
30156 @opindex mfdiv
30157 @item -mfdiv
30158 @itemx -mno-fdiv
30159 Do or don't use hardware floating-point divide and square root instructions.
30160 This requires the F or D extensions for floating-point registers.  The default
30161 is to use them if the specified architecture has these instructions.
30163 @opindex mdiv
30164 @item -mdiv
30165 @itemx -mno-div
30166 Do or don't use hardware instructions for integer division.  This requires the
30167 M extension.  The default is to use them if the specified architecture has
30168 these instructions.
30170 @opindex misa-spec
30171 @item -misa-spec=@var{ISA-spec-string}
30172 Specify the version of the RISC-V Unprivileged (formerly User-Level)
30173 ISA specification to produce code conforming to.  The possibilities
30174 for @var{ISA-spec-string} are:
30175 @table @code
30176 @item 2.2
30177 Produce code conforming to version 2.2.
30178 @item 20190608
30179 Produce code conforming to version 20190608.
30180 @item 20191213
30181 Produce code conforming to version 20191213.
30182 @end table
30183 The default is @option{-misa-spec=20191213} unless GCC has been configured
30184 with @option{--with-isa-spec=} specifying a different default version.
30186 @opindex march
30187 @item -march=@var{ISA-string}
30188 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}).  ISA strings must be
30189 lower-case.  Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
30190 @samp{rv32imaf}.
30192 The syntax of the ISA string is defined as follows:
30194 @table @code
30195 @item The string must start with @samp{rv32} or @samp{rv64}, followed by
30196 @samp{i}, @samp{e}, or @samp{g}, referred to as the base ISA.
30197 @item The subsequent part of the string is a list of extension names. Extension
30198 names can be categorized as multi-letter (e.g.@: @samp{zba}) and single-letter
30199 (e.g.@: @samp{v}). Single-letter extensions can appear consecutively,
30200 but multi-letter extensions must be separated by underscores.
30201 @item An underscore can appear anywhere after the base ISA. It has no specific
30202 effect but is used to improve readability and can act as a separator.
30203 @item Extension names may include an optional version number, following the
30204 syntax @samp{<major>p<minor>} or @samp{<major>}, (e.g.@: @samp{m2p1} or
30205 @samp{m2}).
30206 @end table
30208 Supported extension are listed below:
30209 @multitable @columnfractions .10 .10 .80
30210 @headitem Extension Name @tab Supported Version @tab Description
30211 @item i
30212 @tab 2.0, 2.1
30213 @tab Base integer extension.
30215 @item e
30216 @tab 2.0
30217 @tab Reduced base integer extension.
30219 @item g
30220 @tab -
30221 @tab General-purpose computing base extension, @samp{g} will expand to
30222 @samp{i}, @samp{m}, @samp{a}, @samp{f}, @samp{d}, @samp{zicsr} and
30223 @samp{zifencei}.
30225 @item m
30226 @tab 2.0
30227 @tab Integer multiplication and division extension.
30229 @item a
30230 @tab 2.0, 2.1
30231 @tab Atomic extension.
30233 @item f
30234 @tab 2.0, 2.2
30235 @tab Single-precision floating-point extension.
30237 @item d
30238 @tab 2.0, 2.2
30239 @tab Double-precision floating-point extension.
30241 @item c
30242 @tab 2.0
30243 @tab Compressed extension.
30245 @item h
30246 @tab 1.0
30247 @tab Hypervisor extension.
30249 @item v
30250 @tab 1.0
30251 @tab Vector extension.
30253 @item zicsr
30254 @tab 2.0
30255 @tab Control and status register access extension.
30257 @item zifencei
30258 @tab 2.0
30259 @tab Instruction-fetch fence extension.
30261 @item zicond
30262 @tab 1.0
30263 @tab Integer conditional operations extension.
30265 @item za64rs
30266 @tab 1.0
30267 @tab Reservation set size of 64 bytes.
30269 @item za128rs
30270 @tab 1.0
30271 @tab Reservation set size of 128 bytes.
30273 @item zawrs
30274 @tab 1.0
30275 @tab Wait-on-reservation-set extension.
30277 @item zba
30278 @tab 1.0
30279 @tab Address calculation extension.
30281 @item zbb
30282 @tab 1.0
30283 @tab Basic bit manipulation extension.
30285 @item zbc
30286 @tab 1.0
30287 @tab Carry-less multiplication extension.
30289 @item zbs
30290 @tab 1.0
30291 @tab Single-bit operation extension.
30293 @item zfinx
30294 @tab 1.0
30295 @tab Single-precision floating-point in integer registers extension.
30297 @item zdinx
30298 @tab 1.0
30299 @tab Double-precision floating-point in integer registers extension.
30301 @item zhinx
30302 @tab 1.0
30303 @tab Half-precision floating-point in integer registers extension.
30305 @item zhinxmin
30306 @tab 1.0
30307 @tab Minimal half-precision floating-point in integer registers extension.
30309 @item zbkb
30310 @tab 1.0
30311 @tab Cryptography bit-manipulation extension.
30313 @item zbkc
30314 @tab 1.0
30315 @tab Cryptography carry-less multiply extension.
30317 @item zbkx
30318 @tab 1.0
30319 @tab Cryptography crossbar permutation extension.
30321 @item zkne
30322 @tab 1.0
30323 @tab AES Encryption extension.
30325 @item zknd
30326 @tab 1.0
30327 @tab AES Decryption extension.
30329 @item zknh
30330 @tab 1.0
30331 @tab Hash function extension.
30333 @item zkr
30334 @tab 1.0
30335 @tab Entropy source extension.
30337 @item zksed
30338 @tab 1.0
30339 @tab SM4 block cipher extension.
30341 @item zksh
30342 @tab 1.0
30343 @tab SM3 hash function extension.
30345 @item zkt
30346 @tab 1.0
30347 @tab Data independent execution latency extension.
30349 @item zk
30350 @tab 1.0
30351 @tab Standard scalar cryptography extension.
30353 @item zkn
30354 @tab 1.0
30355 @tab NIST algorithm suite extension.
30357 @item zks
30358 @tab 1.0
30359 @tab ShangMi algorithm suite extension.
30361 @item zihintntl
30362 @tab 1.0
30363 @tab Non-temporal locality hints extension.
30365 @item zihintpause
30366 @tab 1.0
30367 @tab Pause hint extension.
30369 @item zicboz
30370 @tab 1.0
30371 @tab Cache-block zero extension.
30373 @item zicbom
30374 @tab 1.0
30375 @tab Cache-block management extension.
30377 @item zicbop
30378 @tab 1.0
30379 @tab Cache-block prefetch extension.
30381 @item zic64b
30382 @tab 1.0
30383 @tab Cache block size isf 64 bytes.
30385 @item ziccamoa
30386 @tab 1.0
30387 @tab Main memory supports all atomics in A.
30389 @item ziccif
30390 @tab 1.0
30391 @tab Main memory supports instruction fetch with atomicity requirement.
30393 @item zicclsm
30394 @tab 1.0
30395 @tab Main memory supports misaligned loads/stores.
30397 @item ziccrse
30398 @tab 1.0
30399 @tab Main memory supports forward progress on LR/SC sequences.
30401 @item zicntr
30402 @tab 2.0
30403 @tab Standard extension for base counters and timers.
30405 @item zihpm
30406 @tab 2.0
30407 @tab Standard extension for hardware performance counters.
30409 @item ztso
30410 @tab 1.0
30411 @tab Total store ordering extension.
30413 @item zve32x
30414 @tab 1.0
30415 @tab Vector extensions for embedded processors.
30417 @item zve32f
30418 @tab 1.0
30419 @tab Vector extensions for embedded processors.
30421 @item zve64x
30422 @tab 1.0
30423 @tab Vector extensions for embedded processors.
30425 @item zve64f
30426 @tab 1.0
30427 @tab Vector extensions for embedded processors.
30429 @item zve64d
30430 @tab 1.0
30431 @tab Vector extensions for embedded processors.
30433 @item zvl32b
30434 @tab 1.0
30435 @tab Minimum vector length standard extensions
30437 @item zvl64b
30438 @tab 1.0
30439 @tab Minimum vector length standard extensions
30441 @item zvl128b
30442 @tab 1.0
30443 @tab Minimum vector length standard extensions
30445 @item zvl256b
30446 @tab 1.0
30447 @tab Minimum vector length standard extensions
30449 @item zvl512b
30450 @tab 1.0
30451 @tab Minimum vector length standard extensions
30453 @item zvl1024b
30454 @tab 1.0
30455 @tab Minimum vector length standard extensions
30457 @item zvl2048b
30458 @tab 1.0
30459 @tab Minimum vector length standard extensions
30461 @item zvl4096b
30462 @tab 1.0
30463 @tab Minimum vector length standard extensions
30465 @item zvbb
30466 @tab 1.0
30467 @tab Vector basic bit-manipulation extension.
30469 @item zvbc
30470 @tab 1.0
30471 @tab Vector carryless multiplication extension.
30473 @item zvkb
30474 @tab 1.0
30475 @tab Vector cryptography bit-manipulation extension.
30477 @item zvkg
30478 @tab 1.0
30479 @tab Vector GCM/GMAC extension.
30481 @item zvkned
30482 @tab 1.0
30483 @tab Vector AES block cipher extension.
30485 @item zvknha
30486 @tab 1.0
30487 @tab Vector SHA-2 secure hash extension.
30489 @item zvknhb
30490 @tab 1.0
30491 @tab Vector SHA-2 secure hash extension.
30493 @item zvksed
30494 @tab 1.0
30495 @tab Vector SM4 Block Cipher extension.
30497 @item zvksh
30498 @tab 1.0
30499 @tab Vector SM3 Secure Hash extension.
30501 @item zvkn
30502 @tab 1.0
30503 @tab Vector NIST Algorithm Suite extension, @samp{zvkn} will expand to
30504 @samp{zvkned}, @samp{zvknhb}, @samp{zvkb} and @samp{zvkt}.
30506 @item zvknc
30507 @tab 1.0
30508 @tab Vector NIST Algorithm Suite with carryless multiply extension, @samp{zvknc}
30509 will expand to @samp{zvkn} and @samp{zvbc}.
30511 @item zvkng
30512 @tab 1.0
30513 @tab Vector NIST Algorithm Suite with GCM extension, @samp{zvkng} will expand
30514 to @samp{zvkn} and @samp{zvkg}.
30516 @item zvks
30517 @tab 1.0
30518 @tab Vector ShangMi algorithm suite extension, @samp{zvks} will expand
30519 to @samp{zvksed}, @samp{zvksh}, @samp{zvkb} and @samp{zvkt}.
30521 @item zvksc
30522 @tab 1.0
30523 @tab Vector ShangMi algorithm suite with carryless multiplication extension,
30524 @samp{zvksc} will expand to @samp{zvks} and @samp{zvbc}.
30526 @item zvksg
30527 @tab 1.0
30528 @tab Vector ShangMi algorithm suite with GCM extension, @samp{zvksg} will expand
30529 to @samp{zvks} and @samp{zvkg}.
30531 @item zvkt
30532 @tab 1.0
30533 @tab Vector data independent execution latency extension.
30535 @item zfh
30536 @tab 1.0
30537 @tab Half-precision floating-point extension.
30539 @item zfhmin
30540 @tab 1.0
30541 @tab Minimal half-precision floating-point extension.
30543 @item zvfh
30544 @tab 1.0
30545 @tab Vector half-precision floating-point extension.
30547 @item zvfhmin
30548 @tab 1.0
30549 @tab Vector minimal half-precision floating-point extension.
30551 @item zvfbfmin
30552 @tab 1.0
30553 @tab Vector BF16 converts extension.
30555 @item zfa
30556 @tab 1.0
30557 @tab Additional floating-point extension.
30559 @item zmmul
30560 @tab 1.0
30561 @tab Integer multiplication extension.
30563 @item zca
30564 @tab 1.0
30565 @tab Integer compressed instruction extension.
30567 @item zcf
30568 @tab 1.0
30569 @tab Compressed single-precision floating point loads and stores extension.
30571 @item zcd
30572 @tab 1.0
30573 @tab Compressed double-precision floating point loads and stores extension.
30575 @item zcb
30576 @tab 1.0
30577 @tab Simple compressed instruction extension.
30579 @item zce
30580 @tab 1.0
30581 @tab Compressed instruction extensions for embedded processors.
30583 @item zcmp
30584 @tab 1.0
30585 @tab Compressed push pop extension.
30587 @item zcmt
30588 @tab 1.0
30589 @tab Table jump instruction extension.
30591 @item smaia
30592 @tab 1.0
30593 @tab Advanced interrupt architecture extension.
30595 @item smepmp
30596 @tab 1.0
30597 @tab PMP Enhancements for memory access and execution prevention on Machine mode.
30599 @item smstateen
30600 @tab 1.0
30601 @tab State enable extension.
30603 @item ssaia
30604 @tab 1.0
30605 @tab Advanced interrupt architecture extension for supervisor-mode.
30607 @item sscofpmf
30608 @tab 1.0
30609 @tab Count overflow & filtering extension.
30611 @item ssstateen
30612 @tab 1.0
30613 @tab State-enable extension for supervisor-mode.
30615 @item sstc
30616 @tab 1.0
30617 @tab Supervisor-mode timer interrupts extension.
30619 @item svinval
30620 @tab 1.0
30621 @tab Fine-grained address-translation cache invalidation extension.
30623 @item svnapot
30624 @tab 1.0
30625 @tab NAPOT translation contiguity extension.
30627 @item svpbmt
30628 @tab 1.0
30629 @tab Page-based memory types extension.
30631 @item xcvmac
30632 @tab 1.0
30633 @tab Core-V multiply-accumulate extension.
30635 @item xcvalu
30636 @tab 1.0
30637 @tab Core-V miscellaneous ALU extension.
30639 @item xcvelw
30640 @tab 1.0
30641 @tab Core-V event load word extension.
30643 @item xtheadba
30644 @tab 1.0
30645 @tab T-head address calculation extension.
30647 @item xtheadbb
30648 @tab 1.0
30649 @tab T-head basic bit-manipulation extension.
30651 @item xtheadbs
30652 @tab 1.0
30653 @tab T-head single-bit instructions extension.
30655 @item xtheadcmo
30656 @tab 1.0
30657 @tab T-head cache management operations extension.
30659 @item xtheadcondmov
30660 @tab 1.0
30661 @tab T-head conditional move extension.
30663 @item xtheadfmemidx
30664 @tab 1.0
30665 @tab T-head indexed memory operations for floating-point registers extension.
30667 @item xtheadfmv
30668 @tab 1.0
30669 @tab T-head double floating-point high-bit data transmission extension.
30671 @item xtheadint
30672 @tab 1.0
30673 @tab T-head acceleration interruption extension.
30675 @item xtheadmac
30676 @tab 1.0
30677 @tab T-head multiply-accumulate extension.
30679 @item xtheadmemidx
30680 @tab 1.0
30681 @tab T-head indexed memory operation extension.
30683 @item xtheadmempair
30684 @tab 1.0
30685 @tab T-head two-GPR memory operation extension.
30687 @item xtheadsync
30688 @tab 1.0
30689 @tab T-head multi-core synchronization extension.
30691 @item xventanacondops
30692 @tab 1.0
30693 @tab Ventana integer conditional operations extension.
30695 @end multitable
30697 When @option{-march=} is not specified, use the setting from @option{-mcpu}.
30699 If both @option{-march} and @option{-mcpu=} are not specified, the default for
30700 this argument is system dependent, users who want a specific architecture
30701 extensions should specify one explicitly.
30703 @opindex mcpu
30704 @item -mcpu=@var{processor-string}
30705 Use architecture of and optimize the output for the given processor, specified
30706 by particular CPU name.
30707 Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
30708 @samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
30709 @samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
30710 @samp{sifive-u54}, @samp{sifive-u74}, @samp{sifive-x280}, @samp{sifive-xp450},
30711 @samp{sifive-x670}.
30713 @opindex mtune
30714 @item -mtune=@var{processor-string}
30715 Optimize the output for the given processor, specified by microarchitecture or
30716 particular CPU name.  Permissible values for this option are: @samp{rocket},
30717 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
30718 @samp{thead-c906}, @samp{size}, @samp{sifive-p400-series},
30719 @samp{sifive-p600-series}, and all valid options for @option{-mcpu=}.
30721 When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
30722 the default is @samp{rocket} if both are not specified.
30724 The @samp{size} choice is not intended for use by end-users.  This is used
30725 when @option{-Os} is specified.  It overrides the instruction cost info
30726 provided by @option{-mtune=}, but does not override the pipeline info.  This
30727 helps reduce code size while still giving good performance.
30729 @opindex mpreferred-stack-boundary
30730 @item -mpreferred-stack-boundary=@var{num}
30731 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
30732 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
30733 the default is 4 (16 bytes or 128-bits).
30735 @strong{Warning:} If you use this switch, then you must build all modules with
30736 the same value, including any libraries.  This includes the system libraries
30737 and startup modules.
30739 @opindex msmall-data-limit
30740 @item -msmall-data-limit=@var{n}
30741 Put global and static data smaller than @var{n} bytes into a special section
30742 (on some targets).
30744 @opindex msave-restore
30745 @item -msave-restore
30746 @itemx -mno-save-restore
30747 Do or don't use smaller but slower prologue and epilogue code that uses
30748 library function calls.  The default is to use fast inline prologues and
30749 epilogues.
30751 @opindex mmovcc
30752 @item -mmovcc
30753 @itemx -mno-movcc
30754 Do or don't produce branchless conditional-move code sequences even with
30755 targets that do not have specific instructions for conditional operations.
30756 If enabled, sequences of ALU operations are produced using base integer
30757 ISA instructions where profitable.
30759 @opindex minline-atomics
30760 @item -minline-atomics
30761 @itemx -mno-inline-atomics
30762 Do or don't use smaller but slower subword atomic emulation code that uses
30763 libatomic function calls.  The default is to use fast inline subword atomics
30764 that do not require libatomic.
30766 @opindex minline-strlen
30767 @item -minline-strlen
30768 @itemx -mno-inline-strlen
30769 Do or do not attempt to inline strlen calls if possible.
30770 Inlining will only be done if the string is properly aligned
30771 and instructions for accelerated processing are available.
30772 The default is to not inline strlen calls.
30774 @opindex minline-strcmp
30775 @item -minline-strcmp
30776 @itemx -mno-inline-strcmp
30777 Do or do not attempt to inline strcmp calls if possible.
30778 Inlining will only be done if the strings are properly aligned
30779 and instructions for accelerated processing are available.
30780 The default is to not inline strcmp calls.
30782 The @option{--param riscv-strcmp-inline-limit=@var{n}} parameter controls
30783 the maximum number of bytes compared by the inlined code.
30784 The default value is 64.
30786 @opindex minline-strncmp
30787 @item -minline-strncmp
30788 @itemx -mno-inline-strncmp
30789 Do or do not attempt to inline strncmp calls if possible.
30790 Inlining will only be done if the strings are properly aligned
30791 and instructions for accelerated processing are available.
30792 The default is to not inline strncmp calls.
30794 The @option{--param riscv-strcmp-inline-limit=@var{n}} parameter controls
30795 the maximum number of bytes compared by the inlined code.
30796 The default value is 64.
30798 @opindex mshorten-memrefs
30799 @item -mshorten-memrefs
30800 @itemx -mno-shorten-memrefs
30801 Do or do not attempt to make more use of compressed load/store instructions by
30802 replacing a load/store of 'base register + large offset' with a new load/store
30803 of 'new base + small offset'.  If the new base gets stored in a compressed
30804 register, then the new load/store can be compressed.  Currently targets 32-bit
30805 integer load/stores only.
30807 @opindex mstrict-align
30808 @item -mstrict-align
30809 @itemx -mno-strict-align
30810 Do not or do generate unaligned memory accesses.  The default is set depending
30811 on whether the processor we are optimizing for supports fast unaligned access
30812 or not.
30814 @opindex mcmodel=medlow
30815 @item -mcmodel=medlow
30816 Generate code for the medium-low code model. The program and its statically
30817 defined symbols must lie within a single 2 GiB address range and must lie
30818 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
30819 statically or dynamically linked. This is the default code model.
30821 @opindex mcmodel=medany
30822 @item -mcmodel=medany
30823 Generate code for the medium-any code model. The program and its statically
30824 defined symbols must be within any single 2 GiB address range. Programs can be
30825 statically or dynamically linked.
30827 The code generated by the medium-any code model is position-independent, but is
30828 not guaranteed to function correctly when linked into position-independent
30829 executables or libraries.
30831 @item -mexplicit-relocs
30832 @itemx -mno-exlicit-relocs
30833 Use or do not use assembler relocation operators when dealing with symbolic
30834 addresses.  The alternative is to use assembler macros instead, which may
30835 limit optimization.
30837 @opindex mrelax
30838 @item -mrelax
30839 @itemx -mno-relax
30840 Take advantage of linker relaxations to reduce the number of instructions
30841 required to materialize symbol addresses. The default is to take advantage of
30842 linker relaxations.
30844 @opindex mriscv-attribute
30845 @item -mriscv-attribute
30846 @itemx -mno-riscv-attribute
30847 Emit (do not emit) RISC-V attribute to record extra information into ELF
30848 objects.  This feature requires at least binutils 2.32.
30850 @opindex mcsr-check
30851 @item -mcsr-check
30852 @itemx -mno-csr-check
30853 Enables or disables the CSR checking.
30855 @opindex malign-data
30856 @item -malign-data=@var{type}
30857 Control how GCC aligns variables and constants of array, structure, or union
30858 types.  Supported values for @var{type} are @samp{xlen} which uses x register
30859 width as the alignment value, and @samp{natural} which uses natural alignment.
30860 @samp{xlen} is the default.
30862 @opindex mbig-endian
30863 @item -mbig-endian
30864 Generate big-endian code.  This is the default when GCC is configured for a
30865 @samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
30867 @opindex mlittle-endian
30868 @item -mlittle-endian
30869 Generate little-endian code.  This is the default when GCC is configured for a
30870 @samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
30871 @samp{riscv32be-*-*} target.
30873 @opindex mstack-protector-guard
30874 @opindex mstack-protector-guard-reg
30875 @opindex mstack-protector-guard-offset
30876 @item -mstack-protector-guard=@var{guard}
30877 @itemx -mstack-protector-guard-reg=@var{reg}
30878 @itemx -mstack-protector-guard-offset=@var{offset}
30879 Generate stack protection code using canary at @var{guard}.  Supported
30880 locations are @samp{global} for a global canary or @samp{tls} for per-thread
30881 canary in the TLS block.
30883 With the latter choice the options
30884 @option{-mstack-protector-guard-reg=@var{reg}} and
30885 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
30886 which register to use as base register for reading the canary,
30887 and from what offset from that base register. There is no default
30888 register or offset as this is entirely for use within the Linux
30889 kernel.
30890 @end table
30892 @node RL78 Options
30893 @subsection RL78 Options
30894 @cindex RL78 Options
30896 @table @gcctabopt
30898 @opindex msim
30899 @item -msim
30900 Links in additional target libraries to support operation within a
30901 simulator.
30903 @opindex mmul
30904 @item -mmul=none
30905 @itemx -mmul=g10
30906 @itemx -mmul=g13
30907 @itemx -mmul=g14
30908 @itemx -mmul=rl78
30909 Specifies the type of hardware multiplication and division support to
30910 be used.  The simplest is @code{none}, which uses software for both
30911 multiplication and division.  This is the default.  The @code{g13}
30912 value is for the hardware multiply/divide peripheral found on the
30913 RL78/G13 (S2 core) targets.  The @code{g14} value selects the use of
30914 the multiplication and division instructions supported by the RL78/G14
30915 (S3 core) parts.  The value @code{rl78} is an alias for @code{g14} and
30916 the value @code{mg10} is an alias for @code{none}.
30918 In addition a C preprocessor macro is defined, based upon the setting
30919 of this option.  Possible values are: @code{__RL78_MUL_NONE__},
30920 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
30922 @opindex mcpu
30923 @item -mcpu=g10
30924 @itemx -mcpu=g13
30925 @itemx -mcpu=g14
30926 @itemx -mcpu=rl78
30927 Specifies the RL78 core to target.  The default is the G14 core, also
30928 known as an S3 core or just RL78.  The G13 or S2 core does not have
30929 multiply or divide instructions, instead it uses a hardware peripheral
30930 for these operations.  The G10 or S1 core does not have register
30931 banks, so it uses a different calling convention.
30933 If this option is set it also selects the type of hardware multiply
30934 support to use, unless this is overridden by an explicit
30935 @option{-mmul=none} option on the command line.  Thus specifying
30936 @option{-mcpu=g13} enables the use of the G13 hardware multiply
30937 peripheral and specifying @option{-mcpu=g10} disables the use of
30938 hardware multiplications altogether.
30940 Note, although the RL78/G14 core is the default target, specifying
30941 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
30942 change the behavior of the toolchain since it also enables G14
30943 hardware multiply support.  If these options are not specified on the
30944 command line then software multiplication routines will be used even
30945 though the code targets the RL78 core.  This is for backwards
30946 compatibility with older toolchains which did not have hardware
30947 multiply and divide support.
30949 In addition a C preprocessor macro is defined, based upon the setting
30950 of this option.  Possible values are: @code{__RL78_G10__},
30951 @code{__RL78_G13__} or @code{__RL78_G14__}.
30953 @opindex mg10
30954 @opindex mg13
30955 @opindex mg14
30956 @opindex mrl78
30957 @item -mg10
30958 @itemx -mg13
30959 @itemx -mg14
30960 @itemx -mrl78
30961 These are aliases for the corresponding @option{-mcpu=} option.  They
30962 are provided for backwards compatibility.
30964 @opindex mallregs
30965 @item -mallregs
30966 Allow the compiler to use all of the available registers.  By default
30967 registers @code{r24..r31} are reserved for use in interrupt handlers.
30968 With this option enabled these registers can be used in ordinary
30969 functions as well.
30971 @opindex m64bit-doubles
30972 @opindex m32bit-doubles
30973 @item -m64bit-doubles
30974 @itemx -m32bit-doubles
30975 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
30976 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
30977 @option{-m32bit-doubles}.
30979 @opindex msave-mduc-in-interrupts
30980 @opindex mno-save-mduc-in-interrupts
30981 @item -msave-mduc-in-interrupts
30982 @itemx -mno-save-mduc-in-interrupts
30983 Specifies that interrupt handler functions should preserve the
30984 MDUC registers.  This is only necessary if normal code might use
30985 the MDUC registers, for example because it performs multiplication
30986 and division operations.  The default is to ignore the MDUC registers
30987 as this makes the interrupt handlers faster.  The target option -mg13
30988 needs to be passed for this to work as this feature is only available
30989 on the G13 target (S2 core).  The MDUC registers will only be saved
30990 if the interrupt handler performs a multiplication or division
30991 operation or it calls another function.
30993 @end table
30995 @node RS/6000 and PowerPC Options
30996 @subsection IBM RS/6000 and PowerPC Options
30997 @cindex RS/6000 and PowerPC Options
30998 @cindex IBM RS/6000 and PowerPC Options
31000 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
31001 @table @gcctabopt
31002 @item -mpowerpc-gpopt
31003 @itemx -mno-powerpc-gpopt
31004 @itemx -mpowerpc-gfxopt
31005 @itemx -mno-powerpc-gfxopt
31006 @need 800
31007 @itemx -mpowerpc64
31008 @itemx -mno-powerpc64
31009 @itemx -mmfcrf
31010 @itemx -mno-mfcrf
31011 @itemx -mpopcntb
31012 @itemx -mno-popcntb
31013 @itemx -mpopcntd
31014 @itemx -mno-popcntd
31015 @itemx -mfprnd
31016 @itemx -mno-fprnd
31017 @need 800
31018 @opindex mpowerpc-gpopt
31019 @opindex mno-powerpc-gpopt
31020 @opindex mpowerpc-gfxopt
31021 @opindex mno-powerpc-gfxopt
31022 @opindex mpowerpc64
31023 @opindex mno-powerpc64
31024 @opindex mmfcrf
31025 @opindex mno-mfcrf
31026 @opindex mpopcntb
31027 @opindex mno-popcntb
31028 @opindex mpopcntd
31029 @opindex mno-popcntd
31030 @opindex mfprnd
31031 @opindex mno-fprnd
31032 @opindex mcmpb
31033 @opindex mno-cmpb
31034 @opindex mhard-dfp
31035 @opindex mno-hard-dfp
31036 @itemx -mcmpb
31037 @itemx -mno-cmpb
31038 @itemx -mhard-dfp
31039 @itemx -mno-hard-dfp
31040 You use these options to specify which instructions are available on the
31041 processor you are using.  The default value of these options is
31042 determined when configuring GCC@.  Specifying the
31043 @option{-mcpu=@var{cpu_type}} overrides the specification of these
31044 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
31045 rather than the options listed above.
31047 Specifying @option{-mpowerpc-gpopt} allows
31048 GCC to use the optional PowerPC architecture instructions in the
31049 General Purpose group, including floating-point square root.  Specifying
31050 @option{-mpowerpc-gfxopt} allows GCC to
31051 use the optional PowerPC architecture instructions in the Graphics
31052 group, including floating-point select.
31054 The @option{-mmfcrf} option allows GCC to generate the move from
31055 condition register field instruction implemented on the POWER4
31056 processor and other processors that support the PowerPC V2.01
31057 architecture.
31058 The @option{-mpopcntb} option allows GCC to generate the popcount and
31059 double-precision FP reciprocal estimate instruction implemented on the
31060 POWER5 processor and other processors that support the PowerPC V2.02
31061 architecture.
31062 The @option{-mpopcntd} option allows GCC to generate the popcount
31063 instruction implemented on the POWER7 processor and other processors
31064 that support the PowerPC V2.06 architecture.
31065 The @option{-mfprnd} option allows GCC to generate the FP round to
31066 integer instructions implemented on the POWER5+ processor and other
31067 processors that support the PowerPC V2.03 architecture.
31068 The @option{-mcmpb} option allows GCC to generate the compare bytes
31069 instruction implemented on the POWER6 processor and other processors
31070 that support the PowerPC V2.05 architecture.
31071 The @option{-mhard-dfp} option allows GCC to generate the decimal
31072 floating-point instructions implemented on some POWER processors.
31074 The @option{-mpowerpc64} option allows GCC to generate the additional
31075 64-bit instructions that are found in the full PowerPC64 architecture
31076 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
31077 @option{-mno-powerpc64}.
31079 @opindex mcpu
31080 @item -mcpu=@var{cpu_type}
31081 Set architecture type, register usage, and
31082 instruction scheduling parameters for machine type @var{cpu_type}.
31083 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
31084 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
31085 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
31086 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
31087 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
31088 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
31089 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
31090 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
31091 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
31092 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
31093 @samp{power9}, @samp{power10}, @samp{powerpc}, @samp{powerpc64},
31094 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
31096 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
31097 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
31098 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
31099 architecture machine types, with an appropriate, generic processor
31100 model assumed for scheduling purposes.
31102 Specifying @samp{native} as cpu type detects and selects the
31103 architecture option that corresponds to the host processor of the
31104 system performing the compilation.
31105 @option{-mcpu=native} has no effect if GCC does not recognize the
31106 processor.
31108 The other options specify a specific processor.  Code generated under
31109 those options runs best on that processor, and may not run at all on
31110 others.
31112 The @option{-mcpu} options automatically enable or disable the
31113 following options:
31115 @gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple
31116 -mpopcntb  -mpopcntd  -mpowerpc64
31117 -mpowerpc-gpopt  -mpowerpc-gfxopt
31118 -mmulhw  -mdlmzb  -mmfpgpr  -mvsx
31119 -mcrypto  -mhtm  -mpower8-fusion  -mpower8-vector
31120 -mquad-memory  -mquad-memory-atomic  -mfloat128
31121 -mfloat128-hardware -mprefixed -mpcrel -mmma
31122 -mrop-protect}
31124 The particular options set for any particular CPU varies between
31125 compiler versions, depending on what setting seems to produce optimal
31126 code for that CPU; it doesn't necessarily reflect the actual hardware's
31127 capabilities.  If you wish to set an individual option to a particular
31128 value, you may specify it after the @option{-mcpu} option, like
31129 @option{-mcpu=970 -mno-altivec}.
31131 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
31132 not enabled or disabled by the @option{-mcpu} option at present because
31133 AIX does not have full support for these options.  You may still
31134 enable or disable them individually if you're sure it'll work in your
31135 environment.
31137 @opindex mtune
31138 @item -mtune=@var{cpu_type}
31139 Set the instruction scheduling parameters for machine type
31140 @var{cpu_type}, but do not set the architecture type or register usage,
31141 as @option{-mcpu=@var{cpu_type}} does.  The same
31142 values for @var{cpu_type} are used for @option{-mtune} as for
31143 @option{-mcpu}.  If both are specified, the code generated uses the
31144 architecture and registers set by @option{-mcpu}, but the
31145 scheduling parameters set by @option{-mtune}.
31147 @opindex mcmodel=small
31148 @item -mcmodel=small
31149 Generate PowerPC64 code for the small model: The TOC is limited to
31150 64k.
31152 @opindex mcmodel=medium
31153 @item -mcmodel=medium
31154 Generate PowerPC64 code for the medium model: The TOC and other static
31155 data may be up to a total of 4G in size.  This is the default for 64-bit
31156 Linux.
31158 @opindex mcmodel=large
31159 @item -mcmodel=large
31160 Generate PowerPC64 code for the large model: The TOC may be up to 4G
31161 in size.  Other data and code is only limited by the 64-bit address
31162 space.
31164 @opindex maltivec
31165 @opindex mno-altivec
31166 @item -maltivec
31167 @itemx -mno-altivec
31168 Generate code that uses (does not use) AltiVec instructions, and also
31169 enable the use of built-in functions that allow more direct access to
31170 the AltiVec instruction set.  You may also need to set
31171 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
31172 enhancements.
31174 When @option{-maltivec} is used, the element order for AltiVec intrinsics
31175 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 
31176 match array element order corresponding to the endianness of the
31177 target.  That is, element zero identifies the leftmost element in a
31178 vector register when targeting a big-endian platform, and identifies
31179 the rightmost element in a vector register when targeting a
31180 little-endian platform.
31182 @opindex mvrsave
31183 @opindex mno-vrsave
31184 @item -mvrsave
31185 @itemx -mno-vrsave
31186 Generate VRSAVE instructions when generating AltiVec code.
31188 @opindex msecure-plt
31189 @item -msecure-plt
31190 Generate code that allows @command{ld} and @command{ld.so}
31191 to build executables and shared
31192 libraries with non-executable @code{.plt} and @code{.got} sections.
31193 This is a PowerPC
31194 32-bit SYSV ABI option.
31196 @opindex mbss-plt
31197 @item -mbss-plt
31198 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
31199 fills in, and
31200 requires @code{.plt} and @code{.got}
31201 sections that are both writable and executable.
31202 This is a PowerPC 32-bit SYSV ABI option.
31204 @opindex misel
31205 @opindex mno-isel
31206 @item -misel
31207 @itemx -mno-isel
31208 This switch enables or disables the generation of ISEL instructions.
31210 @opindex mvsx
31211 @opindex mno-vsx
31212 @item -mvsx
31213 @itemx -mno-vsx
31214 Generate code that uses (does not use) vector/scalar (VSX)
31215 instructions, and also enable the use of built-in functions that allow
31216 more direct access to the VSX instruction set.
31218 @opindex mcrypto
31219 @opindex mno-crypto
31220 @item -mcrypto
31221 @itemx -mno-crypto
31222 Enable the use (disable) of the built-in functions that allow direct
31223 access to the cryptographic instructions that were added in version
31224 2.07 of the PowerPC ISA.
31226 @opindex mhtm
31227 @opindex mno-htm
31228 @item -mhtm
31229 @itemx -mno-htm
31230 Enable (disable) the use of the built-in functions that allow direct
31231 access to the Hardware Transactional Memory (HTM) instructions that
31232 were added in version 2.07 of the PowerPC ISA.
31234 @opindex mpower8-fusion
31235 @opindex mno-power8-fusion
31236 @item -mpower8-fusion
31237 @itemx -mno-power8-fusion
31238 Generate code that keeps (does not keeps) some integer operations
31239 adjacent so that the instructions can be fused together on power8 and
31240 later processors.
31242 @opindex mpower8-vector
31243 @opindex mno-power8-vector
31244 @item -mpower8-vector
31245 @itemx -mno-power8-vector
31246 Generate code that uses (does not use) the vector and scalar
31247 instructions that were added in version 2.07 of the PowerPC ISA.  Also
31248 enable the use of built-in functions that allow more direct access to
31249 the vector instructions.
31251 @opindex mquad-memory
31252 @opindex mno-quad-memory
31253 @item -mquad-memory
31254 @itemx -mno-quad-memory
31255 Generate code that uses (does not use) the non-atomic quad word memory
31256 instructions.  The @option{-mquad-memory} option requires use of
31257 64-bit mode.
31259 @opindex mquad-memory-atomic
31260 @opindex mno-quad-memory-atomic
31261 @item -mquad-memory-atomic
31262 @itemx -mno-quad-memory-atomic
31263 Generate code that uses (does not use) the atomic quad word memory
31264 instructions.  The @option{-mquad-memory-atomic} option requires use of
31265 64-bit mode.
31267 @opindex mfloat128
31268 @opindex mno-float128
31269 @item -mfloat128
31270 @itemx -mno-float128
31271 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
31272 and use either software emulation for IEEE 128-bit floating point or
31273 hardware instructions.
31275 The VSX instruction set (@option{-mvsx}) must be enabled to use the IEEE
31276 128-bit floating point support.  The IEEE 128-bit floating point is only
31277 supported on Linux.
31279 The default for @option{-mfloat128} is enabled on PowerPC Linux
31280 systems using the VSX instruction set, and disabled on other systems.
31282 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
31283 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
31284 point support will also enable the generation of ISA 3.0 IEEE 128-bit
31285 floating point instructions.  Otherwise, if you do not specify to
31286 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
31287 system, IEEE 128-bit floating point will be done with software
31288 emulation.
31290 @opindex mfloat128-hardware
31291 @opindex mno-float128-hardware
31292 @item -mfloat128-hardware
31293 @itemx -mno-float128-hardware
31294 Enable/disable using ISA 3.0 hardware instructions to support the
31295 @var{__float128} data type.
31297 The default for @option{-mfloat128-hardware} is enabled on PowerPC
31298 Linux systems using the ISA 3.0 instruction set, and disabled on other
31299 systems.
31301 @opindex m32
31302 @opindex m64
31303 @item -m32
31304 @itemx -m64
31305 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
31306 targets (including GNU/Linux).  The 32-bit environment sets int, long
31307 and pointer to 32 bits and generates code that runs on any PowerPC
31308 variant.  The 64-bit environment sets int to 32 bits and long and
31309 pointer to 64 bits, and generates code for PowerPC64, as for
31310 @option{-mpowerpc64}.
31312 @opindex mfull-toc
31313 @opindex mno-fp-in-toc
31314 @opindex mno-sum-in-toc
31315 @opindex mminimal-toc
31316 @item -mfull-toc
31317 @itemx -mno-fp-in-toc
31318 @itemx -mno-sum-in-toc
31319 @itemx -mminimal-toc
31320 Modify generation of the TOC (Table Of Contents), which is created for
31321 every executable file.  The @option{-mfull-toc} option is selected by
31322 default.  In that case, GCC allocates at least one TOC entry for
31323 each unique non-automatic variable reference in your program.  GCC
31324 also places floating-point constants in the TOC@.  However, only
31325 16,384 entries are available in the TOC@.
31327 If you receive a linker error message that saying you have overflowed
31328 the available TOC space, you can reduce the amount of TOC space used
31329 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
31330 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
31331 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
31332 generate code to calculate the sum of an address and a constant at
31333 run time instead of putting that sum into the TOC@.  You may specify one
31334 or both of these options.  Each causes GCC to produce very slightly
31335 slower and larger code at the expense of conserving TOC space.
31337 If you still run out of space in the TOC even when you specify both of
31338 these options, specify @option{-mminimal-toc} instead.  This option causes
31339 GCC to make only one TOC entry for every file.  When you specify this
31340 option, GCC produces code that is slower and larger but which
31341 uses extremely little TOC space.  You may wish to use this option
31342 only on files that contain less frequently-executed code.
31344 @opindex maix64
31345 @opindex maix32
31346 @item -maix64
31347 @itemx -maix32
31348 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
31349 @code{long} type, and the infrastructure needed to support them.
31350 Specifying @option{-maix64} implies @option{-mpowerpc64},
31351 while @option{-maix32} disables the 64-bit ABI and
31352 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
31354 @opindex mxl-compat
31355 @opindex mno-xl-compat
31356 @item -mxl-compat
31357 @itemx -mno-xl-compat
31358 Produce code that conforms more closely to IBM XL compiler semantics
31359 when using AIX-compatible ABI@.  Pass floating-point arguments to
31360 prototyped functions beyond the register save area (RSA) on the stack
31361 in addition to argument FPRs.  Do not assume that most significant
31362 double in 128-bit long double value is properly rounded when comparing
31363 values and converting to double.  Use XL symbol names for long double
31364 support routines.
31366 The AIX calling convention was extended but not initially documented to
31367 handle an obscure K&R C case of calling a function that takes the
31368 address of its arguments with fewer arguments than declared.  IBM XL
31369 compilers access floating-point arguments that do not fit in the
31370 RSA from the stack when a subroutine is compiled without
31371 optimization.  Because always storing floating-point arguments on the
31372 stack is inefficient and rarely needed, this option is not enabled by
31373 default and only is necessary when calling subroutines compiled by IBM
31374 XL compilers without optimization.
31376 @opindex mpe
31377 @item -mpe
31378 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
31379 application written to use message passing with special startup code to
31380 enable the application to run.  The system must have PE installed in the
31381 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
31382 must be overridden with the @option{-specs=} option to specify the
31383 appropriate directory location.  The Parallel Environment does not
31384 support threads, so the @option{-mpe} option and the @option{-pthread}
31385 option are incompatible.
31387 @opindex malign-natural
31388 @opindex malign-power
31389 @item -malign-natural
31390 @itemx -malign-power
31391 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
31392 @option{-malign-natural} overrides the ABI-defined alignment of larger
31393 types, such as floating-point doubles, on their natural size-based boundary.
31394 The option @option{-malign-power} instructs GCC to follow the ABI-specified
31395 alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
31397 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
31398 is not supported.
31400 @opindex msoft-float
31401 @opindex mhard-float
31402 @item -msoft-float
31403 @itemx -mhard-float
31404 Generate code that does not use (uses) the floating-point register set.
31405 Software floating-point emulation is provided if you use the
31406 @option{-msoft-float} option, and pass the option to GCC when linking.
31408 @opindex mmultiple
31409 @opindex mno-multiple
31410 @item -mmultiple
31411 @itemx -mno-multiple
31412 Generate code that uses (does not use) the load multiple word
31413 instructions and the store multiple word instructions.  These
31414 instructions are generated by default on POWER systems, and not
31415 generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
31416 PowerPC systems, since those instructions do not work when the
31417 processor is in little-endian mode.  The exceptions are PPC740 and
31418 PPC750 which permit these instructions in little-endian mode.
31420 @opindex mupdate
31421 @opindex mno-update
31422 @item -mupdate
31423 @itemx -mno-update
31424 Generate code that uses (does not use) the load or store instructions
31425 that update the base register to the address of the calculated memory
31426 location.  These instructions are generated by default.  If you use
31427 @option{-mno-update}, there is a small window between the time that the
31428 stack pointer is updated and the address of the previous frame is
31429 stored, which means code that walks the stack frame across interrupts or
31430 signals may get corrupted data.
31432 @opindex mavoid-indexed-addresses
31433 @opindex mno-avoid-indexed-addresses
31434 @item -mavoid-indexed-addresses
31435 @itemx -mno-avoid-indexed-addresses
31436 Generate code that tries to avoid (not avoid) the use of indexed load
31437 or store instructions. These instructions can incur a performance
31438 penalty on Power6 processors in certain situations, such as when
31439 stepping through large arrays that cross a 16M boundary.  This option
31440 is enabled by default when targeting Power6 and disabled otherwise.
31442 @opindex mfused-madd
31443 @opindex mno-fused-madd
31444 @item -mfused-madd
31445 @itemx -mno-fused-madd
31446 Generate code that uses (does not use) the floating-point multiply and
31447 accumulate instructions.  These instructions are generated by default
31448 if hardware floating point is used.  The machine-dependent
31449 @option{-mfused-madd} option is now mapped to the machine-independent
31450 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
31451 mapped to @option{-ffp-contract=off}.
31453 @opindex mmulhw
31454 @opindex mno-mulhw
31455 @item -mmulhw
31456 @itemx -mno-mulhw
31457 Generate code that uses (does not use) the half-word multiply and
31458 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
31459 These instructions are generated by default when targeting those
31460 processors.
31462 @opindex mdlmzb
31463 @opindex mno-dlmzb
31464 @item -mdlmzb
31465 @itemx -mno-dlmzb
31466 Generate code that uses (does not use) the string-search @samp{dlmzb}
31467 instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
31468 generated by default when targeting those processors.
31470 @opindex mno-bit-align
31471 @opindex mbit-align
31472 @item -mno-bit-align
31473 @itemx -mbit-align
31474 On System V.4 and embedded PowerPC systems do not (do) force structures
31475 and unions that contain bit-fields to be aligned to the base type of the
31476 bit-field.
31478 For example, by default a structure containing nothing but 8
31479 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
31480 boundary and has a size of 4 bytes.  By using @option{-mno-bit-align},
31481 the structure is aligned to a 1-byte boundary and is 1 byte in
31482 size.
31484 @opindex mno-strict-align
31485 @opindex mstrict-align
31486 @item -mno-strict-align
31487 @itemx -mstrict-align
31488 On System V.4 and embedded PowerPC systems do not (do) assume that
31489 unaligned memory references are handled by the system.
31491 @opindex mrelocatable
31492 @opindex mno-relocatable
31493 @item -mrelocatable
31494 @itemx -mno-relocatable
31495 Generate code that allows (does not allow) a static executable to be
31496 relocated to a different address at run time.  A simple embedded
31497 PowerPC system loader should relocate the entire contents of
31498 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
31499 a table of 32-bit addresses generated by this option.  For this to
31500 work, all objects linked together must be compiled with
31501 @option{-mrelocatable} or @option{-mrelocatable-lib}.
31502 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
31504 @opindex mrelocatable-lib
31505 @opindex mno-relocatable-lib
31506 @item -mrelocatable-lib
31507 @itemx -mno-relocatable-lib
31508 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
31509 @code{.fixup} section to allow static executables to be relocated at
31510 run time, but @option{-mrelocatable-lib} does not use the smaller stack
31511 alignment of @option{-mrelocatable}.  Objects compiled with
31512 @option{-mrelocatable-lib} may be linked with objects compiled with
31513 any combination of the @option{-mrelocatable} options.
31515 @opindex mno-toc
31516 @opindex mtoc
31517 @item -mno-toc
31518 @itemx -mtoc
31519 On System V.4 and embedded PowerPC systems do not (do) assume that
31520 register 2 contains a pointer to a global area pointing to the addresses
31521 used in the program.
31523 @opindex mlittle
31524 @opindex mlittle-endian
31525 @item -mlittle
31526 @itemx -mlittle-endian
31527 On System V.4 and embedded PowerPC systems compile code for the
31528 processor in little-endian mode.  The @option{-mlittle-endian} option is
31529 the same as @option{-mlittle}.
31531 @opindex mbig
31532 @opindex mbig-endian
31533 @item -mbig
31534 @itemx -mbig-endian
31535 On System V.4 and embedded PowerPC systems compile code for the
31536 processor in big-endian mode.  The @option{-mbig-endian} option is
31537 the same as @option{-mbig}.
31539 @opindex mdynamic-no-pic
31540 @item -mdynamic-no-pic
31541 On Darwin / macOS systems, compile code so that it is not
31542 relocatable, but that its external references are relocatable.  The
31543 resulting code is suitable for applications, but not shared
31544 libraries.
31546 @opindex msingle-pic-base
31547 @item -msingle-pic-base
31548 Treat the register used for PIC addressing as read-only, rather than
31549 loading it in the prologue for each function.  The runtime system is
31550 responsible for initializing this register with an appropriate value
31551 before execution begins.
31553 @opindex mprioritize-restricted-insns
31554 @item -mprioritize-restricted-insns=@var{priority}
31555 This option controls the priority that is assigned to
31556 dispatch-slot restricted instructions during the second scheduling
31557 pass.  The argument @var{priority} takes the value @samp{0}, @samp{1},
31558 or @samp{2} to assign no, highest, or second-highest (respectively) 
31559 priority to dispatch-slot restricted
31560 instructions.
31562 @opindex msched-costly-dep
31563 @item -msched-costly-dep=@var{dependence_type}
31564 This option controls which dependences are considered costly
31565 by the target during instruction scheduling.  The argument
31566 @var{dependence_type} takes one of the following values:
31568 @table @asis
31569 @item @samp{no}
31570 No dependence is costly.
31572 @item @samp{all}
31573 All dependences are costly.
31575 @item @samp{true_store_to_load}
31576 A true dependence from store to load is costly.
31578 @item @samp{store_to_load}
31579 Any dependence from store to load is costly.
31581 @item @var{number}
31582 Any dependence for which the latency is greater than or equal to 
31583 @var{number} is costly.
31584 @end table
31586 @opindex minsert-sched-nops
31587 @item -minsert-sched-nops=@var{scheme}
31588 This option controls which NOP insertion scheme is used during
31589 the second scheduling pass.  The argument @var{scheme} takes one of the
31590 following values:
31592 @table @asis
31593 @item @samp{no}
31594 Don't insert NOPs.
31596 @item @samp{pad}
31597 Pad with NOPs any dispatch group that has vacant issue slots,
31598 according to the scheduler's grouping.
31600 @item @samp{regroup_exact}
31601 Insert NOPs to force costly dependent insns into
31602 separate groups.  Insert exactly as many NOPs as needed to force an insn
31603 to a new group, according to the estimated processor grouping.
31605 @item @var{number}
31606 Insert NOPs to force costly dependent insns into
31607 separate groups.  Insert @var{number} NOPs to force an insn to a new group.
31608 @end table
31610 @opindex mcall-sysv
31611 @item -mcall-sysv
31612 On System V.4 and embedded PowerPC systems compile code using calling
31613 conventions that adhere to the March 1995 draft of the System V
31614 Application Binary Interface, PowerPC processor supplement.  This is the
31615 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
31617 @opindex mcall-sysv-eabi
31618 @opindex mcall-eabi
31619 @item -mcall-sysv-eabi
31620 @itemx -mcall-eabi
31621 Specify both @option{-mcall-sysv} and @option{-meabi} options.
31623 @opindex mcall-sysv-noeabi
31624 @item -mcall-sysv-noeabi
31625 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
31627 @opindex mcall-aixdesc
31628 @item -mcall-aixdesc
31629 On System V.4 and embedded PowerPC systems compile code for the AIX
31630 operating system.
31632 @opindex mcall-linux
31633 @item -mcall-linux
31634 On System V.4 and embedded PowerPC systems compile code for the
31635 Linux-based GNU system.
31637 @opindex mcall-freebsd
31638 @item -mcall-freebsd
31639 On System V.4 and embedded PowerPC systems compile code for the
31640 FreeBSD operating system.
31642 @opindex mcall-netbsd
31643 @item -mcall-netbsd
31644 On System V.4 and embedded PowerPC systems compile code for the
31645 NetBSD operating system.
31647 @opindex mcall-openbsd
31648 @item -mcall-openbsd
31649 On System V.4 and embedded PowerPC systems compile code for the
31650 OpenBSD operating system.
31652 @opindex mtraceback
31653 @item -mtraceback=@var{traceback_type}
31654 Select the type of traceback table. Valid values for @var{traceback_type}
31655 are @samp{full}, @samp{part}, and @samp{no}.
31657 @opindex maix-struct-return
31658 @item -maix-struct-return
31659 Return all structures in memory (as specified by the AIX ABI)@.
31661 @opindex msvr4-struct-return
31662 @item -msvr4-struct-return
31663 Return structures smaller than 8 bytes in registers (as specified by the
31664 SVR4 ABI)@.
31666 @opindex mabi
31667 @item -mabi=@var{abi-type}
31668 Extend the current ABI with a particular extension, or remove such extension.
31669 Valid values are: @samp{altivec}, @samp{no-altivec},
31670 @samp{ibmlongdouble}, @samp{ieeelongdouble},
31671 @samp{elfv1}, @samp{elfv2},
31672 and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
31674 @opindex mabi=ibmlongdouble
31675 @item -mabi=ibmlongdouble
31676 Change the current ABI to use IBM extended-precision long double.
31677 This is not likely to work if your system defaults to using IEEE
31678 extended-precision long double.  If you change the long double type
31679 from IEEE extended-precision, the compiler will issue a warning unless
31680 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
31681 to be enabled.
31683 @opindex mabi=ieeelongdouble
31684 @item -mabi=ieeelongdouble
31685 Change the current ABI to use IEEE extended-precision long double.
31686 This is not likely to work if your system defaults to using IBM
31687 extended-precision long double.  If you change the long double type
31688 from IBM extended-precision, the compiler will issue a warning unless
31689 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
31690 to be enabled.
31692 @opindex mabi=elfv1
31693 @item -mabi=elfv1
31694 Change the current ABI to use the ELFv1 ABI.
31695 This is the default ABI for big-endian PowerPC 64-bit Linux.
31696 Overriding the default ABI requires special system support and is
31697 likely to fail in spectacular ways.
31699 @opindex mabi=elfv2
31700 @item -mabi=elfv2
31701 Change the current ABI to use the ELFv2 ABI.
31702 This is the default ABI for little-endian PowerPC 64-bit Linux.
31703 Overriding the default ABI requires special system support and is
31704 likely to fail in spectacular ways.
31706 @opindex mgnu-attribute
31707 @opindex mno-gnu-attribute
31708 @item -mgnu-attribute
31709 @itemx -mno-gnu-attribute
31710 Emit .gnu_attribute assembly directives to set tag/value pairs in a
31711 .gnu.attributes section that specify ABI variations in function
31712 parameters or return values.
31714 @opindex mprototype
31715 @opindex mno-prototype
31716 @item -mprototype
31717 @itemx -mno-prototype
31718 On System V.4 and embedded PowerPC systems assume that all calls to
31719 variable argument functions are properly prototyped.  Otherwise, the
31720 compiler must insert an instruction before every non-prototyped call to
31721 set or clear bit 6 of the condition code register (@code{CR}) to
31722 indicate whether floating-point values are passed in the floating-point
31723 registers in case the function takes variable arguments.  With
31724 @option{-mprototype}, only calls to prototyped variable argument functions
31725 set or clear the bit.
31727 @opindex msim
31728 @item -msim
31729 On embedded PowerPC systems, assume that the startup module is called
31730 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
31731 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
31732 configurations.
31734 @opindex mmvme
31735 @item -mmvme
31736 On embedded PowerPC systems, assume that the startup module is called
31737 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
31738 @file{libc.a}.
31740 @opindex mads
31741 @item -mads
31742 On embedded PowerPC systems, assume that the startup module is called
31743 @file{crt0.o} and the standard C libraries are @file{libads.a} and
31744 @file{libc.a}.
31746 @opindex myellowknife
31747 @item -myellowknife
31748 On embedded PowerPC systems, assume that the startup module is called
31749 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
31750 @file{libc.a}.
31752 @opindex mvxworks
31753 @item -mvxworks
31754 On System V.4 and embedded PowerPC systems, specify that you are
31755 compiling for a VxWorks system.
31757 @opindex memb
31758 @item -memb
31759 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
31760 header to indicate that @samp{eabi} extended relocations are used.
31762 @opindex meabi
31763 @opindex mno-eabi
31764 @item -meabi
31765 @itemx -mno-eabi
31766 On System V.4 and embedded PowerPC systems do (do not) adhere to the
31767 Embedded Applications Binary Interface (EABI), which is a set of
31768 modifications to the System V.4 specifications.  Selecting @option{-meabi}
31769 means that the stack is aligned to an 8-byte boundary, a function
31770 @code{__eabi} is called from @code{main} to set up the EABI
31771 environment, and the @option{-msdata} option can use both @code{r2} and
31772 @code{r13} to point to two separate small data areas.  Selecting
31773 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
31774 no EABI initialization function is called from @code{main}, and the
31775 @option{-msdata} option only uses @code{r13} to point to a single
31776 small data area.  The @option{-meabi} option is on by default if you
31777 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
31779 @opindex msdata=eabi
31780 @item -msdata=eabi
31781 On System V.4 and embedded PowerPC systems, put small initialized
31782 @code{const} global and static data in the @code{.sdata2} section, which
31783 is pointed to by register @code{r2}.  Put small initialized
31784 non-@code{const} global and static data in the @code{.sdata} section,
31785 which is pointed to by register @code{r13}.  Put small uninitialized
31786 global and static data in the @code{.sbss} section, which is adjacent to
31787 the @code{.sdata} section.  The @option{-msdata=eabi} option is
31788 incompatible with the @option{-mrelocatable} option.  The
31789 @option{-msdata=eabi} option also sets the @option{-memb} option.
31791 @opindex msdata=sysv
31792 @item -msdata=sysv
31793 On System V.4 and embedded PowerPC systems, put small global and static
31794 data in the @code{.sdata} section, which is pointed to by register
31795 @code{r13}.  Put small uninitialized global and static data in the
31796 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
31797 The @option{-msdata=sysv} option is incompatible with the
31798 @option{-mrelocatable} option.
31800 @opindex msdata=default
31801 @opindex msdata
31802 @item -msdata=default
31803 @itemx -msdata
31804 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
31805 compile code the same as @option{-msdata=eabi}, otherwise compile code the
31806 same as @option{-msdata=sysv}.
31808 @opindex msdata=data
31809 @item -msdata=data
31810 On System V.4 and embedded PowerPC systems, put small global
31811 data in the @code{.sdata} section.  Put small uninitialized global
31812 data in the @code{.sbss} section.  Do not use register @code{r13}
31813 to address small data however.  This is the default behavior unless
31814 other @option{-msdata} options are used.
31816 @opindex msdata=none
31817 @opindex mno-sdata
31818 @item -msdata=none
31819 @itemx -mno-sdata
31820 On embedded PowerPC systems, put all initialized global and static data
31821 in the @code{.data} section, and all uninitialized data in the
31822 @code{.bss} section.
31824 @opindex mreadonly-in-sdata
31825 @opindex mno-readonly-in-sdata
31826 @item -mreadonly-in-sdata
31827 Put read-only objects in the @code{.sdata} section as well.  This is the
31828 default.
31830 @opindex mblock-move-inline-limit
31831 @item -mblock-move-inline-limit=@var{num}
31832 Inline all block moves (such as calls to @code{memcpy} or structure
31833 copies) less than or equal to @var{num} bytes.  The minimum value for
31834 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
31835 targets.  The default value is target-specific.
31837 @opindex mblock-compare-inline-limit
31838 @item -mblock-compare-inline-limit=@var{num}
31839 Generate non-looping inline code for all block compares (such as calls
31840 to @code{memcmp} or structure compares) less than or equal to @var{num}
31841 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
31842 block compare is disabled. The default value is target-specific.
31844 @opindex mblock-compare-inline-loop-limit
31845 @item -mblock-compare-inline-loop-limit=@var{num}
31846 Generate an inline expansion using loop code for all block compares that
31847 are less than or equal to @var{num} bytes, but greater than the limit
31848 for non-loop inline block compare expansion. If the block length is not
31849 constant, at most @var{num} bytes will be compared before @code{memcmp}
31850 is called to compare the remainder of the block. The default value is
31851 target-specific.
31853 @opindex mstring-compare-inline-limit
31854 @item -mstring-compare-inline-limit=@var{num}
31855 Compare at most @var{num} string bytes with inline code.
31856 If the difference or end of string is not found at the
31857 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
31858 take care of the rest of the comparison. The default is 64 bytes.
31860 @opindex G
31861 @cindex smaller data references (PowerPC)
31862 @cindex .sdata/.sdata2 references (PowerPC)
31863 @item -G @var{num}
31864 On embedded PowerPC systems, put global and static items less than or
31865 equal to @var{num} bytes into the small data or BSS sections instead of
31866 the normal data or BSS section.  By default, @var{num} is 8.  The
31867 @option{-G @var{num}} switch is also passed to the linker.
31868 All modules should be compiled with the same @option{-G @var{num}} value.
31870 @opindex mregnames
31871 @opindex mno-regnames
31872 @item -mregnames
31873 @itemx -mno-regnames
31874 On System V.4 and embedded PowerPC systems do (do not) emit register
31875 names in the assembly language output using symbolic forms.
31877 @opindex mlongcall
31878 @opindex mno-longcall
31879 @item -mlongcall
31880 @itemx -mno-longcall
31881 By default assume that all calls are far away so that a longer and more
31882 expensive calling sequence is required.  This is required for calls
31883 farther than 32 megabytes (33,554,432 bytes) from the current location.
31884 A short call is generated if the compiler knows
31885 the call cannot be that far away.  This setting can be overridden by
31886 the @code{shortcall} function attribute, or by @code{#pragma
31887 longcall(0)}.
31889 Some linkers are capable of detecting out-of-range calls and generating
31890 glue code on the fly.  On these systems, long calls are unnecessary and
31891 generate slower code.  As of this writing, the AIX linker can do this,
31892 as can the GNU linker for PowerPC/64.  It is planned to add this feature
31893 to the GNU linker for 32-bit PowerPC systems as well.
31895 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
31896 GCC can generate long calls using an inline PLT call sequence (see
31897 @option{-mpltseq}).  PowerPC with @option{-mbss-plt} and PowerPC64
31898 ELFv1 (big-endian) do not support inline PLT calls.
31900 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
31901 callee, L42}, plus a @dfn{branch island} (glue code).  The two target
31902 addresses represent the callee and the branch island.  The
31903 Darwin/PPC linker prefers the first address and generates a @code{bl
31904 callee} if the PPC @code{bl} instruction reaches the callee directly;
31905 otherwise, the linker generates @code{bl L42} to call the branch
31906 island.  The branch island is appended to the body of the
31907 calling function; it computes the full 32-bit address of the callee
31908 and jumps to it.
31910 On Mach-O (Darwin) systems, this option directs the compiler emit to
31911 the glue for every direct call, and the Darwin linker decides whether
31912 to use or discard it.
31914 In the future, GCC may ignore all longcall specifications
31915 when the linker is known to generate glue.
31917 @opindex mpltseq
31918 @opindex mno-pltseq
31919 @item -mpltseq
31920 @itemx -mno-pltseq
31921 Implement (do not implement) -fno-plt and long calls using an inline
31922 PLT call sequence that supports lazy linking and long calls to
31923 functions in dlopen'd shared libraries.  Inline PLT calls are only
31924 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
31925 linkers, and are enabled by default if the support is detected when
31926 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
31927 configured with @option{--enable-secureplt}.  @option{-mpltseq} code
31928 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
31929 linked together.
31931 @opindex mtls-markers
31932 @opindex mno-tls-markers
31933 @item -mtls-markers
31934 @itemx -mno-tls-markers
31935 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
31936 specifying the function argument.  The relocation allows the linker to
31937 reliably associate function call with argument setup instructions for
31938 TLS optimization, which in turn allows GCC to better schedule the
31939 sequence.
31941 @opindex mrecip
31942 @item -mrecip
31943 @itemx -mno-recip
31944 This option enables use of the reciprocal estimate and
31945 reciprocal square root estimate instructions with additional
31946 Newton-Raphson steps to increase precision instead of doing a divide or
31947 square root and divide for floating-point arguments.  You should use
31948 the @option{-ffast-math} option when using @option{-mrecip} (or at
31949 least @option{-funsafe-math-optimizations},
31950 @option{-ffinite-math-only}, @option{-freciprocal-math} and
31951 @option{-fno-trapping-math}).  Note that while the throughput of the
31952 sequence is generally higher than the throughput of the non-reciprocal
31953 instruction, the precision of the sequence can be decreased by up to 2
31954 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
31955 roots.
31957 @opindex mrecip=opt
31958 @item -mrecip=@var{opt}
31959 This option controls which reciprocal estimate instructions
31960 may be used.  @var{opt} is a comma-separated list of options, which may
31961 be preceded by a @code{!} to invert the option:
31963 @table @samp
31965 @item all
31966 Enable all estimate instructions.
31968 @item default 
31969 Enable the default instructions, equivalent to @option{-mrecip}.
31971 @item none 
31972 Disable all estimate instructions, equivalent to @option{-mno-recip}.
31974 @item div 
31975 Enable the reciprocal approximation instructions for both 
31976 single and double precision.
31978 @item divf 
31979 Enable the single-precision reciprocal approximation instructions.
31981 @item divd 
31982 Enable the double-precision reciprocal approximation instructions.
31984 @item rsqrt 
31985 Enable the reciprocal square root approximation instructions for both
31986 single and double precision.
31988 @item rsqrtf 
31989 Enable the single-precision reciprocal square root approximation instructions.
31991 @item rsqrtd 
31992 Enable the double-precision reciprocal square root approximation instructions.
31994 @end table
31996 So, for example, @option{-mrecip=all,!rsqrtd} enables
31997 all of the reciprocal estimate instructions, except for the
31998 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
31999 which handle the double-precision reciprocal square root calculations.
32001 @opindex mrecip-precision
32002 @item -mrecip-precision
32003 @itemx -mno-recip-precision
32004 Assume (do not assume) that the reciprocal estimate instructions
32005 provide higher-precision estimates than is mandated by the PowerPC
32006 ABI.  Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
32007 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
32008 The double-precision square root estimate instructions are not generated by
32009 default on low-precision machines, since they do not provide an
32010 estimate that converges after three steps.
32012 @opindex mveclibabi
32013 @item -mveclibabi=@var{type}
32014 Specifies the ABI type to use for vectorizing intrinsics using an
32015 external library.  The only type supported at present is @samp{mass},
32016 which specifies to use IBM's Mathematical Acceleration Subsystem
32017 (MASS) libraries for vectorizing intrinsics using external libraries.
32018 GCC currently emits calls to @code{acosd2}, @code{acosf4},
32019 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
32020 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
32021 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
32022 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
32023 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
32024 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
32025 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
32026 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
32027 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
32028 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
32029 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
32030 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
32031 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
32032 for power7.  Both @option{-ftree-vectorize} and
32033 @option{-funsafe-math-optimizations} must also be enabled.  The MASS
32034 libraries must be specified at link time.
32036 @opindex mfriz
32037 @item -mfriz
32038 @itemx -mno-friz
32039 Generate (do not generate) the @code{friz} instruction when the
32040 @option{-funsafe-math-optimizations} option is used to optimize
32041 rounding of floating-point values to 64-bit integer and back to floating
32042 point.  The @code{friz} instruction does not return the same value if
32043 the floating-point number is too large to fit in an integer.
32045 @opindex mpointers-to-nested-functions
32046 @item -mpointers-to-nested-functions
32047 @itemx -mno-pointers-to-nested-functions
32048 Generate (do not generate) code to load up the static chain register
32049 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
32050 systems where a function pointer points to a 3-word descriptor giving
32051 the function address, TOC value to be loaded in register @code{r2}, and
32052 static chain value to be loaded in register @code{r11}.  The
32053 @option{-mpointers-to-nested-functions} is on by default.  You cannot
32054 call through pointers to nested functions or pointers
32055 to functions compiled in other languages that use the static chain if
32056 you use @option{-mno-pointers-to-nested-functions}.
32058 @opindex msave-toc-indirect
32059 @item -msave-toc-indirect
32060 @itemx -mno-save-toc-indirect
32061 Generate (do not generate) code to save the TOC value in the reserved
32062 stack location in the function prologue if the function calls through
32063 a pointer on AIX and 64-bit Linux systems.  If the TOC value is not
32064 saved in the prologue, it is saved just before the call through the
32065 pointer.  The @option{-mno-save-toc-indirect} option is the default.
32067 @opindex mcompat-align-parm
32068 @item -mcompat-align-parm
32069 @itemx -mno-compat-align-parm
32070 Generate (do not generate) code to pass structure parameters with a
32071 maximum alignment of 64 bits, for compatibility with older versions
32072 of GCC.
32074 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
32075 structure parameter on a 128-bit boundary when that structure contained
32076 a member requiring 128-bit alignment.  This is corrected in more
32077 recent versions of GCC.  This option may be used to generate code
32078 that is compatible with functions compiled with older versions of
32079 GCC.
32081 The @option{-mno-compat-align-parm} option is the default.
32083 @opindex mstack-protector-guard
32084 @opindex mstack-protector-guard-reg
32085 @opindex mstack-protector-guard-offset
32086 @opindex mstack-protector-guard-symbol
32087 @item -mstack-protector-guard=@var{guard}
32088 @itemx -mstack-protector-guard-reg=@var{reg}
32089 @itemx -mstack-protector-guard-offset=@var{offset}
32090 @itemx -mstack-protector-guard-symbol=@var{symbol}
32091 Generate stack protection code using canary at @var{guard}.  Supported
32092 locations are @samp{global} for global canary or @samp{tls} for per-thread
32093 canary in the TLS block (the default with GNU libc version 2.4 or later).
32095 With the latter choice the options
32096 @option{-mstack-protector-guard-reg=@var{reg}} and
32097 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
32098 which register to use as base register for reading the canary, and from what
32099 offset from that base register. The default for those is as specified in the
32100 relevant ABI.  @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
32101 the offset with a symbol reference to a canary in the TLS block.
32103 @opindex mpcrel
32104 @opindex mno-pcrel
32105 @item -mpcrel
32106 @itemx -mno-pcrel
32107 Generate (do not generate) pc-relative addressing.  The @option{-mpcrel}
32108 option requires that the medium code model (@option{-mcmodel=medium})
32109 and prefixed addressing (@option{-mprefixed}) options are enabled.
32111 @opindex mprefixed
32112 @opindex mno-prefixed
32113 @item -mprefixed
32114 @itemx -mno-prefixed
32115 Generate (do not generate) addressing modes using prefixed load and
32116 store instructions.  The @option{-mprefixed} option requires that
32117 the option @option{-mcpu=power10} (or later) is enabled.
32119 @opindex mmma
32120 @opindex mno-mma
32121 @item -mmma
32122 @itemx -mno-mma
32123 Generate (do not generate) the MMA instructions.  The @option{-mma}
32124 option requires that the option @option{-mcpu=power10} (or later)
32125 is enabled.
32127 @opindex mrop-protect
32128 @opindex mno-rop-protect
32129 @item -mrop-protect
32130 @itemx -mno-rop-protect
32131 Generate (do not generate) ROP protection instructions when the target
32132 processor supports them.  Currently this option disables the shrink-wrap
32133 optimization (@option{-fshrink-wrap}).
32135 @opindex mprivileged
32136 @opindex mno-privileged
32137 @item -mprivileged
32138 @itemx -mno-privileged
32139 Generate (do not generate) code that will run in privileged state.
32141 @opindex block-ops-unaligned-vsx
32142 @opindex no-block-ops-unaligned-vsx
32143 @item -mblock-ops-unaligned-vsx
32144 @itemx -mno-block-ops-unaligned-vsx
32145 Generate (do not generate) unaligned vsx loads and stores for
32146 inline expansion of @code{memcpy} and @code{memmove}.
32148 @item --param rs6000-vect-unroll-limit=
32149 The vectorizer will check with target information to determine whether it
32150 would be beneficial to unroll the main vectorized loop and by how much.  This
32151 parameter sets the upper bound of how much the vectorizer will unroll the main
32152 loop.  The default value is four.
32154 @end table
32156 @node RX Options
32157 @subsection RX Options
32158 @cindex RX Options
32160 These command-line options are defined for RX targets:
32162 @table @gcctabopt
32163 @opindex m64bit-doubles
32164 @opindex m32bit-doubles
32165 @item -m64bit-doubles
32166 @itemx -m32bit-doubles
32167 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
32168 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
32169 @option{-m32bit-doubles}.  @emph{Note} RX floating-point hardware only
32170 works on 32-bit values, which is why the default is
32171 @option{-m32bit-doubles}.
32173 @opindex fpu
32174 @opindex nofpu
32175 @item -fpu
32176 @itemx -nofpu
32177 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
32178 floating-point hardware.  The default is enabled for the RX600
32179 series and disabled for the RX200 series.
32181 Floating-point instructions are only generated for 32-bit floating-point 
32182 values, however, so the FPU hardware is not used for doubles if the
32183 @option{-m64bit-doubles} option is used.
32185 @emph{Note} If the @option{-fpu} option is enabled then
32186 @option{-funsafe-math-optimizations} is also enabled automatically.
32187 This is because the RX FPU instructions are themselves unsafe.
32189 @opindex mcpu
32190 @item -mcpu=@var{name}
32191 Selects the type of RX CPU to be targeted.  Currently three types are
32192 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
32193 the specific @samp{RX610} CPU.  The default is @samp{RX600}.
32195 The only difference between @samp{RX600} and @samp{RX610} is that the
32196 @samp{RX610} does not support the @code{MVTIPL} instruction.
32198 The @samp{RX200} series does not have a hardware floating-point unit
32199 and so @option{-nofpu} is enabled by default when this type is
32200 selected.
32202 @opindex mbig-endian-data
32203 @opindex mlittle-endian-data
32204 @item -mbig-endian-data
32205 @itemx -mlittle-endian-data
32206 Store data (but not code) in the big-endian format.  The default is
32207 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
32208 format.
32210 @opindex msmall-data-limit
32211 @item -msmall-data-limit=@var{N}
32212 Specifies the maximum size in bytes of global and static variables
32213 which can be placed into the small data area.  Using the small data
32214 area can lead to smaller and faster code, but the size of area is
32215 limited and it is up to the programmer to ensure that the area does
32216 not overflow.  Also when the small data area is used one of the RX's
32217 registers (usually @code{r13}) is reserved for use pointing to this
32218 area, so it is no longer available for use by the compiler.  This
32219 could result in slower and/or larger code if variables are pushed onto
32220 the stack instead of being held in this register.
32222 Note, common variables (variables that have not been initialized) and
32223 constants are not placed into the small data area as they are assigned
32224 to other sections in the output executable.
32226 The default value is zero, which disables this feature.  Note, this
32227 feature is not enabled by default with higher optimization levels
32228 (@option{-O2} etc) because of the potentially detrimental effects of
32229 reserving a register.  It is up to the programmer to experiment and
32230 discover whether this feature is of benefit to their program.  See the
32231 description of the @option{-mpid} option for a description of how the
32232 actual register to hold the small data area pointer is chosen.
32234 @opindex msim
32235 @opindex mno-sim
32236 @item -msim
32237 @itemx -mno-sim
32238 Use the simulator runtime.  The default is to use the libgloss
32239 board-specific runtime.
32241 @opindex mas100-syntax
32242 @opindex mno-as100-syntax
32243 @item -mas100-syntax
32244 @itemx -mno-as100-syntax
32245 When generating assembler output use a syntax that is compatible with
32246 Renesas's AS100 assembler.  This syntax can also be handled by the GAS
32247 assembler, but it has some restrictions so it is not generated by default.
32249 @opindex mmax-constant-size
32250 @item -mmax-constant-size=@var{N}
32251 Specifies the maximum size, in bytes, of a constant that can be used as
32252 an operand in a RX instruction.  Although the RX instruction set does
32253 allow constants of up to 4 bytes in length to be used in instructions,
32254 a longer value equates to a longer instruction.  Thus in some
32255 circumstances it can be beneficial to restrict the size of constants
32256 that are used in instructions.  Constants that are too big are instead
32257 placed into a constant pool and referenced via register indirection.
32259 The value @var{N} can be between 0 and 4.  A value of 0 (the default)
32260 or 4 means that constants of any size are allowed.
32262 @opindex mrelax
32263 @item -mrelax
32264 Enable linker relaxation.  Linker relaxation is a process whereby the
32265 linker attempts to reduce the size of a program by finding shorter
32266 versions of various instructions.  Disabled by default.
32268 @opindex mint-register
32269 @item -mint-register=@var{N}
32270 Specify the number of registers to reserve for fast interrupt handler
32271 functions.  The value @var{N} can be between 0 and 4.  A value of 1
32272 means that register @code{r13} is reserved for the exclusive use
32273 of fast interrupt handlers.  A value of 2 reserves @code{r13} and
32274 @code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
32275 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
32276 A value of 0, the default, does not reserve any registers.
32278 @opindex msave-acc-in-interrupts
32279 @item -msave-acc-in-interrupts
32280 Specifies that interrupt handler functions should preserve the
32281 accumulator register.  This is only necessary if normal code might use
32282 the accumulator register, for example because it performs 64-bit
32283 multiplications.  The default is to ignore the accumulator as this
32284 makes the interrupt handlers faster.
32286 @opindex mpid
32287 @opindex mno-pid
32288 @item -mpid
32289 @itemx -mno-pid
32290 Enables the generation of position independent data.  When enabled any
32291 access to constant data is done via an offset from a base address
32292 held in a register.  This allows the location of constant data to be
32293 determined at run time without requiring the executable to be
32294 relocated, which is a benefit to embedded applications with tight
32295 memory constraints.  Data that can be modified is not affected by this
32296 option.
32298 Note, using this feature reserves a register, usually @code{r13}, for
32299 the constant data base address.  This can result in slower and/or
32300 larger code, especially in complicated functions.
32302 The actual register chosen to hold the constant data base address
32303 depends upon whether the @option{-msmall-data-limit} and/or the
32304 @option{-mint-register} command-line options are enabled.  Starting
32305 with register @code{r13} and proceeding downwards, registers are
32306 allocated first to satisfy the requirements of @option{-mint-register},
32307 then @option{-mpid} and finally @option{-msmall-data-limit}.  Thus it
32308 is possible for the small data area register to be @code{r8} if both
32309 @option{-mint-register=4} and @option{-mpid} are specified on the
32310 command line.
32312 By default this feature is not enabled.  The default can be restored
32313 via the @option{-mno-pid} command-line option.
32315 @opindex mno-warn-multiple-fast-interrupts
32316 @opindex mwarn-multiple-fast-interrupts
32317 @item -mno-warn-multiple-fast-interrupts
32318 @itemx -mwarn-multiple-fast-interrupts
32319 Prevents GCC from issuing a warning message if it finds more than one
32320 fast interrupt handler when it is compiling a file.  The default is to
32321 issue a warning for each extra fast interrupt handler found, as the RX
32322 only supports one such interrupt.
32324 @opindex mallow-string-insns
32325 @opindex mno-allow-string-insns
32326 @item -mallow-string-insns
32327 @itemx -mno-allow-string-insns
32328 Enables or disables the use of the string manipulation instructions
32329 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
32330 @code{SWHILE} and also the @code{RMPA} instruction.  These
32331 instructions may prefetch data, which is not safe to do if accessing
32332 an I/O register.  (See section 12.2.7 of the RX62N Group User's Manual
32333 for more information).
32335 The default is to allow these instructions, but it is not possible for
32336 GCC to reliably detect all circumstances where a string instruction
32337 might be used to access an I/O register, so their use cannot be
32338 disabled automatically.  Instead it is reliant upon the programmer to
32339 use the @option{-mno-allow-string-insns} option if their program
32340 accesses I/O space.
32342 When the instructions are enabled GCC defines the C preprocessor
32343 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
32344 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
32346 @opindex mjsr
32347 @opindex mno-jsr
32348 @item -mjsr
32349 @itemx -mno-jsr
32350 Use only (or not only) @code{JSR} instructions to access functions.
32351 This option can be used when code size exceeds the range of @code{BSR}
32352 instructions.  Note that @option{-mno-jsr} does not mean to not use
32353 @code{JSR} but instead means that any type of branch may be used.
32354 @end table
32356 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
32357 has special significance to the RX port when used with the
32358 @code{interrupt} function attribute.  This attribute indicates a
32359 function intended to process fast interrupts.  GCC ensures
32360 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
32361 and/or @code{r13} and only provided that the normal use of the
32362 corresponding registers have been restricted via the
32363 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
32364 options.
32366 @node S/390 and zSeries Options
32367 @subsection S/390 and zSeries Options
32368 @cindex S/390 and zSeries Options
32370 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
32372 @table @gcctabopt
32373 @opindex mhard-float
32374 @opindex msoft-float
32375 @item -mhard-float
32376 @itemx -msoft-float
32377 Use (do not use) the hardware floating-point instructions and registers
32378 for floating-point operations.  When @option{-msoft-float} is specified,
32379 functions in @file{libgcc.a} are used to perform floating-point
32380 operations.  When @option{-mhard-float} is specified, the compiler
32381 generates IEEE floating-point instructions.  This is the default.
32383 @opindex mhard-dfp
32384 @opindex mno-hard-dfp
32385 @item -mhard-dfp
32386 @itemx -mno-hard-dfp
32387 Use (do not use) the hardware decimal-floating-point instructions for
32388 decimal-floating-point operations.  When @option{-mno-hard-dfp} is
32389 specified, functions in @file{libgcc.a} are used to perform
32390 decimal-floating-point operations.  When @option{-mhard-dfp} is
32391 specified, the compiler generates decimal-floating-point hardware
32392 instructions.  This is the default for @option{-march=z9-ec} or higher.
32394 @opindex mlong-double-64
32395 @opindex mlong-double-128
32396 @item -mlong-double-64
32397 @itemx -mlong-double-128
32398 These switches control the size of @code{long double} type. A size
32399 of 64 bits makes the @code{long double} type equivalent to the @code{double}
32400 type. This is the default.
32402 @opindex mbackchain
32403 @opindex mno-backchain
32404 @item -mbackchain
32405 @itemx -mno-backchain
32406 Store (do not store) the address of the caller's frame as backchain pointer
32407 into the callee's stack frame.
32408 A backchain may be needed to allow debugging using tools that do not understand
32409 DWARF call frame information.
32410 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
32411 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
32412 the backchain is placed into the topmost word of the 96/160 byte register
32413 save area.
32415 In general, code compiled with @option{-mbackchain} is call-compatible with
32416 code compiled with @option{-mno-backchain}; however, use of the backchain
32417 for debugging purposes usually requires that the whole binary is built with
32418 @option{-mbackchain}.  Note that the combination of @option{-mbackchain},
32419 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
32420 to build a linux kernel use @option{-msoft-float}.
32422 The default is to not maintain the backchain.
32424 @opindex mpacked-stack
32425 @opindex mno-packed-stack
32426 @item -mpacked-stack
32427 @itemx -mno-packed-stack
32428 Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
32429 specified, the compiler uses the all fields of the 96/160 byte register save
32430 area only for their default purpose; unused fields still take up stack space.
32431 When @option{-mpacked-stack} is specified, register save slots are densely
32432 packed at the top of the register save area; unused space is reused for other
32433 purposes, allowing for more efficient use of the available stack space.
32434 However, when @option{-mbackchain} is also in effect, the topmost word of
32435 the save area is always used to store the backchain, and the return address
32436 register is always saved two words below the backchain.
32438 As long as the stack frame backchain is not used, code generated with
32439 @option{-mpacked-stack} is call-compatible with code generated with
32440 @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
32441 S/390 or zSeries generated code that uses the stack frame backchain at run
32442 time, not just for debugging purposes.  Such code is not call-compatible
32443 with code compiled with @option{-mpacked-stack}.  Also, note that the
32444 combination of @option{-mbackchain},
32445 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
32446 to build a linux kernel use @option{-msoft-float}.
32448 The default is to not use the packed stack layout.
32450 @opindex msmall-exec
32451 @opindex mno-small-exec
32452 @item -msmall-exec
32453 @itemx -mno-small-exec
32454 Generate (or do not generate) code using the @code{bras} instruction
32455 to do subroutine calls.
32456 This only works reliably if the total executable size does not
32457 exceed 64k.  The default is to use the @code{basr} instruction instead,
32458 which does not have this limitation.
32460 @opindex m64
32461 @opindex m31
32462 @item -m64
32463 @itemx -m31
32464 When @option{-m31} is specified, generate code compliant to the
32465 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
32466 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
32467 particular to generate 64-bit instructions.  For the @samp{s390}
32468 targets, the default is @option{-m31}, while the @samp{s390x}
32469 targets default to @option{-m64}.
32471 @opindex mzarch
32472 @opindex mesa
32473 @item -mzarch
32474 @itemx -mesa
32475 When @option{-mzarch} is specified, generate code using the
32476 instructions available on z/Architecture.
32477 When @option{-mesa} is specified, generate code using the
32478 instructions available on ESA/390.  Note that @option{-mesa} is
32479 not possible with @option{-m64}.
32480 When generating code compliant to the GNU/Linux for S/390 ABI,
32481 the default is @option{-mesa}.  When generating code compliant
32482 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
32484 @opindex mhtm
32485 @opindex mno-htm
32486 @item -mhtm
32487 @itemx -mno-htm
32488 The @option{-mhtm} option enables a set of builtins making use of
32489 instructions available with the transactional execution facility
32490 introduced with the IBM zEnterprise EC12 machine generation
32491 @ref{S/390 System z Built-in Functions}.
32492 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
32494 @opindex mvx
32495 @opindex mno-vx
32496 @item -mvx
32497 @itemx -mno-vx
32498 When @option{-mvx} is specified, generate code using the instructions
32499 available with the vector extension facility introduced with the IBM
32500 z13 machine generation.
32501 This option changes the ABI for some vector type values with regard to
32502 alignment and calling conventions.  In case vector type values are
32503 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
32504 command will be added to mark the resulting binary with the ABI used.
32505 @option{-mvx} is enabled by default when using @option{-march=z13}.
32507 @opindex mzvector
32508 @opindex mno-zvector
32509 @item -mzvector
32510 @itemx -mno-zvector
32511 The @option{-mzvector} option enables vector language extensions and
32512 builtins using instructions available with the vector extension
32513 facility introduced with the IBM z13 machine generation.
32514 This option adds support for @samp{vector} to be used as a keyword to
32515 define vector type variables and arguments.  @samp{vector} is only
32516 available when GNU extensions are enabled.  It will not be expanded
32517 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
32518 In addition to the GCC low-level builtins @option{-mzvector} enables
32519 a set of builtins added for compatibility with AltiVec-style
32520 implementations like Power and Cell.  In order to make use of these
32521 builtins the header file @file{vecintrin.h} needs to be included.
32522 @option{-mzvector} is disabled by default.
32524 @opindex mmvcle
32525 @opindex mno-mvcle
32526 @item -mmvcle
32527 @itemx -mno-mvcle
32528 Generate (or do not generate) code using the @code{mvcle} instruction
32529 to perform block moves.  When @option{-mno-mvcle} is specified,
32530 use a @code{mvc} loop instead.  This is the default unless optimizing for
32531 size.
32533 @opindex mdebug
32534 @opindex mno-debug
32535 @item -mdebug
32536 @itemx -mno-debug
32537 Print (or do not print) additional debug information when compiling.
32538 The default is to not print debug information.
32540 @opindex march
32541 @item -march=@var{cpu-type}
32542 Generate code that runs on @var{cpu-type}, which is the name of a
32543 system representing a certain processor type.  Possible values for
32544 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
32545 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
32546 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
32547 @samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13},
32548 @samp{z16}/@samp{arch14}, and @samp{native}.
32550 The default is @option{-march=z900}.
32552 Specifying @samp{native} as cpu type can be used to select the best
32553 architecture option for the host processor.
32554 @option{-march=native} has no effect if GCC does not recognize the
32555 processor.
32557 @opindex mtune
32558 @item -mtune=@var{cpu-type}
32559 Tune to @var{cpu-type} everything applicable about the generated code,
32560 except for the ABI and the set of available instructions.
32561 The list of @var{cpu-type} values is the same as for @option{-march}.
32562 The default is the value used for @option{-march}.
32564 @opindex mtpf-trace
32565 @opindex mno-tpf-trace
32566 @item -mtpf-trace
32567 @itemx -mno-tpf-trace
32568 Generate code that adds (does not add) in TPF OS specific branches to trace
32569 routines in the operating system.  This option is off by default, even
32570 when compiling for the TPF OS@.
32572 @opindex mtpf-trace-skip
32573 @opindex mno-tpf-trace-skip
32574 @item -mtpf-trace-skip
32575 @itemx -mno-tpf-trace-skip
32576 Generate code that changes (does not change) the default branch
32577 targets enabled by @option{-mtpf-trace} to point to specialized trace
32578 routines providing the ability of selectively skipping function trace
32579 entries for the TPF OS.  This option is off by default, even when
32580 compiling for the TPF OS and specifying @option{-mtpf-trace}.
32582 @opindex mfused-madd
32583 @opindex mno-fused-madd
32584 @item -mfused-madd
32585 @itemx -mno-fused-madd
32586 Generate code that uses (does not use) the floating-point multiply and
32587 accumulate instructions.  These instructions are generated by default if
32588 hardware floating point is used.
32590 @opindex mwarn-framesize
32591 @item -mwarn-framesize=@var{framesize}
32592 Emit a warning if the current function exceeds the given frame size.  Because
32593 this is a compile-time check it doesn't need to be a real problem when the program
32594 runs.  It is intended to identify functions that most probably cause
32595 a stack overflow.  It is useful to be used in an environment with limited stack
32596 size e.g.@: the linux kernel.
32598 @opindex mwarn-dynamicstack
32599 @item -mwarn-dynamicstack
32600 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
32601 arrays.  This is generally a bad idea with a limited stack size.
32603 @opindex mstack-guard
32604 @opindex mstack-size
32605 @item -mstack-guard=@var{stack-guard}
32606 @itemx -mstack-size=@var{stack-size}
32607 If these options are provided the S/390 back end emits additional instructions in
32608 the function prologue that trigger a trap if the stack size is @var{stack-guard}
32609 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
32610 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
32611 the frame size of the compiled function is chosen.
32612 These options are intended to be used to help debugging stack overflow problems.
32613 The additionally emitted code causes only little overhead and hence can also be
32614 used in production-like systems without greater performance degradation.  The given
32615 values have to be exact powers of 2 and @var{stack-size} has to be greater than
32616 @var{stack-guard} without exceeding 64k.
32617 In order to be efficient the extra code makes the assumption that the stack starts
32618 at an address aligned to the value given by @var{stack-size}.
32619 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
32621 @opindex mhotpatch
32622 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
32623 If the hotpatch option is enabled, a ``hot-patching'' function
32624 prologue is generated for all functions in the compilation unit.
32625 The funtion label is prepended with the given number of two-byte
32626 NOP instructions (@var{pre-halfwords}, maximum 1000000).  After
32627 the label, 2 * @var{post-halfwords} bytes are appended, using the
32628 largest NOP like instructions the architecture allows (maximum
32629 1000000).
32631 If both arguments are zero, hotpatching is disabled.
32633 This option can be overridden for individual functions with the
32634 @code{hotpatch} attribute.
32635 @end table
32637 @node SH Options
32638 @subsection SH Options
32640 These @samp{-m} options are defined for the SH implementations:
32642 @table @gcctabopt
32643 @opindex m1
32644 @item -m1
32645 Generate code for the SH1.
32647 @opindex m2
32648 @item -m2
32649 Generate code for the SH2.
32651 @item -m2e
32652 Generate code for the SH2e.
32654 @opindex m2a-nofpu
32655 @item -m2a-nofpu
32656 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
32657 that the floating-point unit is not used.
32659 @opindex m2a-single-only
32660 @item -m2a-single-only
32661 Generate code for the SH2a-FPU, in such a way that no double-precision
32662 floating-point operations are used.
32664 @opindex m2a-single
32665 @item -m2a-single
32666 Generate code for the SH2a-FPU assuming the floating-point unit is in
32667 single-precision mode by default.
32669 @opindex m2a
32670 @item -m2a
32671 Generate code for the SH2a-FPU assuming the floating-point unit is in
32672 double-precision mode by default.
32674 @opindex m3
32675 @item -m3
32676 Generate code for the SH3.
32678 @opindex m3e
32679 @item -m3e
32680 Generate code for the SH3e.
32682 @opindex m4-nofpu
32683 @item -m4-nofpu
32684 Generate code for the SH4 without a floating-point unit.
32686 @opindex m4-single-only
32687 @item -m4-single-only
32688 Generate code for the SH4 with a floating-point unit that only
32689 supports single-precision arithmetic.
32691 @opindex m4-single
32692 @item -m4-single
32693 Generate code for the SH4 assuming the floating-point unit is in
32694 single-precision mode by default.
32696 @opindex m4
32697 @item -m4
32698 Generate code for the SH4.
32700 @opindex m4-100
32701 @item -m4-100
32702 Generate code for SH4-100.
32704 @opindex m4-100-nofpu
32705 @item -m4-100-nofpu
32706 Generate code for SH4-100 in such a way that the
32707 floating-point unit is not used.
32709 @opindex m4-100-single
32710 @item -m4-100-single
32711 Generate code for SH4-100 assuming the floating-point unit is in
32712 single-precision mode by default.
32714 @opindex m4-100-single-only
32715 @item -m4-100-single-only
32716 Generate code for SH4-100 in such a way that no double-precision
32717 floating-point operations are used.
32719 @opindex m4-200
32720 @item -m4-200
32721 Generate code for SH4-200.
32723 @opindex m4-200-nofpu
32724 @item -m4-200-nofpu
32725 Generate code for SH4-200 without in such a way that the
32726 floating-point unit is not used.
32728 @opindex m4-200-single
32729 @item -m4-200-single
32730 Generate code for SH4-200 assuming the floating-point unit is in
32731 single-precision mode by default.
32733 @opindex m4-200-single-only
32734 @item -m4-200-single-only
32735 Generate code for SH4-200 in such a way that no double-precision
32736 floating-point operations are used.
32738 @opindex m4-300
32739 @item -m4-300
32740 Generate code for SH4-300.
32742 @opindex m4-300-nofpu
32743 @item -m4-300-nofpu
32744 Generate code for SH4-300 without in such a way that the
32745 floating-point unit is not used.
32747 @opindex m4-300-single
32748 @item -m4-300-single
32749 Generate code for SH4-300 in such a way that no double-precision
32750 floating-point operations are used.
32752 @opindex m4-300-single-only
32753 @item -m4-300-single-only
32754 Generate code for SH4-300 in such a way that no double-precision
32755 floating-point operations are used.
32757 @opindex m4-340
32758 @item -m4-340
32759 Generate code for SH4-340 (no MMU, no FPU).
32761 @opindex m4-500
32762 @item -m4-500
32763 Generate code for SH4-500 (no FPU).  Passes @option{-isa=sh4-nofpu} to the
32764 assembler.
32766 @opindex m4a-nofpu
32767 @item -m4a-nofpu
32768 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
32769 floating-point unit is not used.
32771 @opindex m4a-single-only
32772 @item -m4a-single-only
32773 Generate code for the SH4a, in such a way that no double-precision
32774 floating-point operations are used.
32776 @opindex m4a-single
32777 @item -m4a-single
32778 Generate code for the SH4a assuming the floating-point unit is in
32779 single-precision mode by default.
32781 @opindex m4a
32782 @item -m4a
32783 Generate code for the SH4a.
32785 @opindex m4al
32786 @item -m4al
32787 Same as @option{-m4a-nofpu}, except that it implicitly passes
32788 @option{-dsp} to the assembler.  GCC doesn't generate any DSP
32789 instructions at the moment.
32791 @opindex mb
32792 @item -mb
32793 Compile code for the processor in big-endian mode.
32795 @opindex ml
32796 @item -ml
32797 Compile code for the processor in little-endian mode.
32799 @opindex mdalign
32800 @item -mdalign
32801 Align doubles at 64-bit boundaries.  Note that this changes the calling
32802 conventions, and thus some functions from the standard C library do
32803 not work unless you recompile it first with @option{-mdalign}.
32805 @opindex mrelax
32806 @item -mrelax
32807 Shorten some address references at link time, when possible; uses the
32808 linker option @option{-relax}.
32810 @opindex mbigtable
32811 @item -mbigtable
32812 Use 32-bit offsets in @code{switch} tables.  The default is to use
32813 16-bit offsets.
32815 @opindex mbitops
32816 @item -mbitops
32817 Enable the use of bit manipulation instructions on SH2A.
32819 @opindex mfmovd
32820 @item -mfmovd
32821 Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
32822 alignment constraints.
32824 @opindex mrenesas
32825 @item -mrenesas
32826 Comply with the calling conventions defined by Renesas.
32828 @opindex mno-renesas
32829 @item -mno-renesas
32830 Comply with the calling conventions defined for GCC before the Renesas
32831 conventions were available.  This option is the default for all
32832 targets of the SH toolchain.
32834 @opindex mnomacsave
32835 @item -mnomacsave
32836 Mark the @code{MAC} register as call-clobbered, even if
32837 @option{-mrenesas} is given.
32839 @opindex mieee
32840 @opindex mno-ieee
32841 @item -mieee
32842 @itemx -mno-ieee
32843 Control the IEEE compliance of floating-point comparisons, which affects the
32844 handling of cases where the result of a comparison is unordered.  By default
32845 @option{-mieee} is implicitly enabled.  If @option{-ffinite-math-only} is
32846 enabled @option{-mno-ieee} is implicitly set, which results in faster
32847 floating-point greater-equal and less-equal comparisons.  The implicit settings
32848 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
32850 @opindex minline-ic_invalidate
32851 @item -minline-ic_invalidate
32852 Inline code to invalidate instruction cache entries after setting up
32853 nested function trampolines.
32854 This option has no effect if @option{-musermode} is in effect and the selected
32855 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
32856 instruction.
32857 If the selected code generation option does not allow the use of the @code{icbi}
32858 instruction, and @option{-musermode} is not in effect, the inlined code
32859 manipulates the instruction cache address array directly with an associative
32860 write.  This not only requires privileged mode at run time, but it also
32861 fails if the cache line had been mapped via the TLB and has become unmapped.
32863 @opindex misize
32864 @item -misize
32865 Dump instruction size and location in the assembly code.
32867 @opindex mpadstruct
32868 @item -mpadstruct
32869 This option is deprecated.  It pads structures to multiple of 4 bytes,
32870 which is incompatible with the SH ABI@.
32872 @opindex matomic-model=@var{model}
32873 @item -matomic-model=@var{model}
32874 Sets the model of atomic operations and additional parameters as a comma
32875 separated list.  For details on the atomic built-in functions see
32876 @ref{__atomic Builtins}.  The following models and parameters are supported:
32878 @table @samp
32880 @item none
32881 Disable compiler generated atomic sequences and emit library calls for atomic
32882 operations.  This is the default if the target is not @code{sh*-*-linux*}.
32884 @item soft-gusa
32885 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
32886 built-in functions.  The generated atomic sequences require additional support
32887 from the interrupt/exception handling code of the system and are only suitable
32888 for SH3* and SH4* single-core systems.  This option is enabled by default when
32889 the target is @code{sh*-*-linux*} and SH3* or SH4*.  When the target is SH4A,
32890 this option also partially utilizes the hardware atomic instructions
32891 @code{movli.l} and @code{movco.l} to create more efficient code, unless
32892 @samp{strict} is specified.  
32894 @item soft-tcb
32895 Generate software atomic sequences that use a variable in the thread control
32896 block.  This is a variation of the gUSA sequences which can also be used on
32897 SH1* and SH2* targets.  The generated atomic sequences require additional
32898 support from the interrupt/exception handling code of the system and are only
32899 suitable for single-core systems.  When using this model, the @samp{gbr-offset=}
32900 parameter has to be specified as well.
32902 @item soft-imask
32903 Generate software atomic sequences that temporarily disable interrupts by
32904 setting @code{SR.IMASK = 1111}.  This model works only when the program runs
32905 in privileged mode and is only suitable for single-core systems.  Additional
32906 support from the interrupt/exception handling code of the system is not
32907 required.  This model is enabled by default when the target is
32908 @code{sh*-*-linux*} and SH1* or SH2*.
32910 @item hard-llcs
32911 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
32912 instructions only.  This is only available on SH4A and is suitable for
32913 multi-core systems.  Since the hardware instructions support only 32 bit atomic
32914 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
32915 Code compiled with this option is also compatible with other software
32916 atomic model interrupt/exception handling systems if executed on an SH4A
32917 system.  Additional support from the interrupt/exception handling code of the
32918 system is not required for this model.
32920 @item gbr-offset=
32921 This parameter specifies the offset in bytes of the variable in the thread
32922 control block structure that should be used by the generated atomic sequences
32923 when the @samp{soft-tcb} model has been selected.  For other models this
32924 parameter is ignored.  The specified value must be an integer multiple of four
32925 and in the range 0-1020.
32927 @item strict
32928 This parameter prevents mixed usage of multiple atomic models, even if they
32929 are compatible, and makes the compiler generate atomic sequences of the
32930 specified model only.
32932 @end table
32934 @opindex mtas
32935 @item -mtas
32936 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
32937 Notice that depending on the particular hardware and software configuration
32938 this can degrade overall performance due to the operand cache line flushes
32939 that are implied by the @code{tas.b} instruction.  On multi-core SH4A
32940 processors the @code{tas.b} instruction must be used with caution since it
32941 can result in data corruption for certain cache configurations.
32943 @opindex mprefergot
32944 @item -mprefergot
32945 When generating position-independent code, emit function calls using
32946 the Global Offset Table instead of the Procedure Linkage Table.
32948 @opindex musermode
32949 @opindex mno-usermode
32950 @item -musermode
32951 @itemx -mno-usermode
32952 Don't allow (allow) the compiler generating privileged mode code.  Specifying
32953 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
32954 inlined code would not work in user mode.  @option{-musermode} is the default
32955 when the target is @code{sh*-*-linux*}.  If the target is SH1* or SH2*
32956 @option{-musermode} has no effect, since there is no user mode.
32958 @opindex multcost=@var{number}
32959 @item -multcost=@var{number}
32960 Set the cost to assume for a multiply insn.
32962 @opindex mdiv=@var{strategy}
32963 @item -mdiv=@var{strategy}
32964 Set the division strategy to be used for integer division operations.
32965 @var{strategy} can be one of: 
32967 @table @samp
32969 @item call-div1
32970 Calls a library function that uses the single-step division instruction
32971 @code{div1} to perform the operation.  Division by zero calculates an
32972 unspecified result and does not trap.  This is the default except for SH4,
32973 SH2A and SHcompact.
32975 @item call-fp
32976 Calls a library function that performs the operation in double precision
32977 floating point.  Division by zero causes a floating-point exception.  This is
32978 the default for SHcompact with FPU.  Specifying this for targets that do not
32979 have a double precision FPU defaults to @code{call-div1}.
32981 @item call-table
32982 Calls a library function that uses a lookup table for small divisors and
32983 the @code{div1} instruction with case distinction for larger divisors.  Division
32984 by zero calculates an unspecified result and does not trap.  This is the default
32985 for SH4.  Specifying this for targets that do not have dynamic shift
32986 instructions defaults to @code{call-div1}.
32988 @end table
32990 When a division strategy has not been specified the default strategy is
32991 selected based on the current target.  For SH2A the default strategy is to
32992 use the @code{divs} and @code{divu} instructions instead of library function
32993 calls.
32995 @opindex maccumulate-outgoing-args
32996 @item -maccumulate-outgoing-args
32997 Reserve space once for outgoing arguments in the function prologue rather
32998 than around each call.  Generally beneficial for performance and size.  Also
32999 needed for unwinding to avoid changing the stack frame around conditional code.
33001 @opindex mdivsi3_libfunc=@var{name}
33002 @item -mdivsi3_libfunc=@var{name}
33003 Set the name of the library function used for 32-bit signed division to
33004 @var{name}.
33005 This only affects the name used in the @samp{call} division strategies, and
33006 the compiler still expects the same sets of input/output/clobbered registers as
33007 if this option were not present.
33009 @opindex mfixed-range
33010 @item -mfixed-range=@var{register-range}
33011 Generate code treating the given register range as fixed registers.
33012 A fixed register is one that the register allocator cannot use.  This is
33013 useful when compiling kernel code.  A register range is specified as
33014 two registers separated by a dash.  Multiple register ranges can be
33015 specified separated by a comma.
33017 @opindex mbranch-cost=@var{num}
33018 @item -mbranch-cost=@var{num}
33019 Assume @var{num} to be the cost for a branch instruction.  Higher numbers
33020 make the compiler try to generate more branch-free code if possible.  
33021 If not specified the value is selected depending on the processor type that
33022 is being compiled for.
33024 @opindex mzdcbranch
33025 @opindex mno-zdcbranch
33026 @item -mzdcbranch
33027 @itemx -mno-zdcbranch
33028 Assume (do not assume) that zero displacement conditional branch instructions
33029 @code{bt} and @code{bf} are fast.  If @option{-mzdcbranch} is specified, the
33030 compiler prefers zero displacement branch code sequences.  This is
33031 enabled by default when generating code for SH4 and SH4A.  It can be explicitly
33032 disabled by specifying @option{-mno-zdcbranch}.
33034 @opindex mcbranch-force-delay-slot
33035 @item -mcbranch-force-delay-slot
33036 Force the usage of delay slots for conditional branches, which stuffs the delay
33037 slot with a @code{nop} if a suitable instruction cannot be found.  By default
33038 this option is disabled.  It can be enabled to work around hardware bugs as
33039 found in the original SH7055.
33041 @opindex mfused-madd
33042 @opindex mno-fused-madd
33043 @item -mfused-madd
33044 @itemx -mno-fused-madd
33045 Generate code that uses (does not use) the floating-point multiply and
33046 accumulate instructions.  These instructions are generated by default
33047 if hardware floating point is used.  The machine-dependent
33048 @option{-mfused-madd} option is now mapped to the machine-independent
33049 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
33050 mapped to @option{-ffp-contract=off}.
33052 @opindex mfsca
33053 @opindex mno-fsca
33054 @item -mfsca
33055 @itemx -mno-fsca
33056 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
33057 and cosine approximations.  The option @option{-mfsca} must be used in
33058 combination with @option{-funsafe-math-optimizations}.  It is enabled by default
33059 when generating code for SH4A.  Using @option{-mno-fsca} disables sine and cosine
33060 approximations even if @option{-funsafe-math-optimizations} is in effect.
33062 @opindex mfsrra
33063 @opindex mno-fsrra
33064 @item -mfsrra
33065 @itemx -mno-fsrra
33066 Allow or disallow the compiler to emit the @code{fsrra} instruction for
33067 reciprocal square root approximations.  The option @option{-mfsrra} must be used
33068 in combination with @option{-funsafe-math-optimizations} and
33069 @option{-ffinite-math-only}.  It is enabled by default when generating code for
33070 SH4A.  Using @option{-mno-fsrra} disables reciprocal square root approximations
33071 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
33072 in effect.
33074 @opindex mpretend-cmove
33075 @item -mpretend-cmove
33076 Prefer zero-displacement conditional branches for conditional move instruction
33077 patterns.  This can result in faster code on the SH4 processor.
33079 @opindex fdpic
33080 @item -mfdpic
33081 Generate code using the FDPIC ABI.
33083 @end table
33085 @node Solaris 2 Options
33086 @subsection Solaris 2 Options
33087 @cindex Solaris 2 options
33089 These @samp{-m} options are supported on Solaris 2:
33091 @table @gcctabopt
33092 @opindex mclear-hwcap
33093 @item -mclear-hwcap
33094 @option{-mclear-hwcap} tells the compiler to remove the hardware
33095 capabilities generated by the Solaris assembler.  This is only necessary
33096 when object files use ISA extensions not supported by the current
33097 machine, but check at runtime whether or not to use them.
33099 @opindex mimpure-text
33100 @item -mimpure-text
33101 @option{-mimpure-text}, used in addition to @option{-shared}, tells
33102 the compiler to not pass @option{-z text} to the linker when linking a
33103 shared object.  Using this option, you can link position-dependent
33104 code into a shared object.
33106 @option{-mimpure-text} suppresses the ``relocations remain against
33107 allocatable but non-writable sections'' linker error message.
33108 However, the necessary relocations trigger copy-on-write, and the
33109 shared object is not actually shared across processes.  Instead of
33110 using @option{-mimpure-text}, you should compile all source code with
33111 @option{-fpic} or @option{-fPIC}.
33113 @end table
33115 These switches are supported in addition to the above on Solaris 2:
33117 @table @gcctabopt
33118 @opindex pthreads
33119 @item -pthreads
33120 This is a synonym for @option{-pthread}.
33121 @end table
33123 @node SPARC Options
33124 @subsection SPARC Options
33125 @cindex SPARC options
33127 These @samp{-m} options are supported on the SPARC:
33129 @table @gcctabopt
33130 @opindex mno-app-regs
33131 @opindex mapp-regs
33132 @item -mno-app-regs
33133 @itemx -mapp-regs
33134 Specify @option{-mapp-regs} to generate output using the global registers
33135 2 through 4, which the SPARC SVR4 ABI reserves for applications.  Like the
33136 global register 1, each global register 2 through 4 is then treated as an
33137 allocable register that is clobbered by function calls.  This is the default.
33139 To be fully SVR4 ABI-compliant at the cost of some performance loss,
33140 specify @option{-mno-app-regs}.  You should compile libraries and system
33141 software with this option.
33143 @opindex mflat
33144 @opindex mno-flat
33145 @item -mflat
33146 @itemx -mno-flat
33147 With @option{-mflat}, the compiler does not generate save/restore instructions
33148 and uses a ``flat'' or single register window model.  This model is compatible
33149 with the regular register window model.  The local registers and the input
33150 registers (0--5) are still treated as ``call-saved'' registers and are
33151 saved on the stack as needed.
33153 With @option{-mno-flat} (the default), the compiler generates save/restore
33154 instructions (except for leaf functions).  This is the normal operating mode.
33156 @opindex mfpu
33157 @opindex mhard-float
33158 @item -mfpu
33159 @itemx -mhard-float
33160 Generate output containing floating-point instructions.  This is the
33161 default.
33163 @opindex mno-fpu
33164 @opindex msoft-float
33165 @item -mno-fpu
33166 @itemx -msoft-float
33167 Generate output containing library calls for floating point.
33168 @strong{Warning:} the requisite libraries are not available for all SPARC
33169 targets.  Normally the facilities of the machine's usual C compiler are
33170 used, but this cannot be done directly in cross-compilation.  You must make
33171 your own arrangements to provide suitable library functions for
33172 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
33173 @samp{sparclite-*-*} do provide software floating-point support.
33175 @option{-msoft-float} changes the calling convention in the output file;
33176 therefore, it is only useful if you compile @emph{all} of a program with
33177 this option.  In particular, you need to compile @file{libgcc.a}, the
33178 library that comes with GCC, with @option{-msoft-float} in order for
33179 this to work.
33181 @opindex mhard-quad-float
33182 @item -mhard-quad-float
33183 Generate output containing quad-word (long double) floating-point
33184 instructions.
33186 @opindex msoft-quad-float
33187 @item -msoft-quad-float
33188 Generate output containing library calls for quad-word (long double)
33189 floating-point instructions.  The functions called are those specified
33190 in the SPARC ABI@.  This is the default.
33192 As of this writing, there are no SPARC implementations that have hardware
33193 support for the quad-word floating-point instructions.  They all invoke
33194 a trap handler for one of these instructions, and then the trap handler
33195 emulates the effect of the instruction.  Because of the trap handler overhead,
33196 this is much slower than calling the ABI library routines.  Thus the
33197 @option{-msoft-quad-float} option is the default.
33199 @opindex mno-unaligned-doubles
33200 @opindex munaligned-doubles
33201 @item -mno-unaligned-doubles
33202 @itemx -munaligned-doubles
33203 Assume that doubles have 8-byte alignment.  This is the default.
33205 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
33206 alignment only if they are contained in another type, or if they have an
33207 absolute address.  Otherwise, it assumes they have 4-byte alignment.
33208 Specifying this option avoids some rare compatibility problems with code
33209 generated by other compilers.  It is not the default because it results
33210 in a performance loss, especially for floating-point code.
33212 @opindex muser-mode
33213 @opindex mno-user-mode
33214 @item -muser-mode
33215 @itemx -mno-user-mode
33216 Do not generate code that can only run in supervisor mode.  This is relevant
33217 only for the @code{casa} instruction emitted for the LEON3 processor.  This
33218 is the default.
33220 @opindex mfaster-structs
33221 @opindex mno-faster-structs
33222 @item -mfaster-structs
33223 @itemx -mno-faster-structs
33224 With @option{-mfaster-structs}, the compiler assumes that structures
33225 should have 8-byte alignment.  This enables the use of pairs of
33226 @code{ldd} and @code{std} instructions for copies in structure
33227 assignment, in place of twice as many @code{ld} and @code{st} pairs.
33228 However, the use of this changed alignment directly violates the SPARC
33229 ABI@.  Thus, it's intended only for use on targets where the developer
33230 acknowledges that their resulting code is not directly in line with
33231 the rules of the ABI@.
33233 @opindex mstd-struct-return
33234 @opindex mno-std-struct-return
33235 @item -mstd-struct-return
33236 @itemx -mno-std-struct-return
33237 With @option{-mstd-struct-return}, the compiler generates checking code
33238 in functions returning structures or unions to detect size mismatches
33239 between the two sides of function calls, as per the 32-bit ABI@.
33241 The default is @option{-mno-std-struct-return}.  This option has no effect
33242 in 64-bit mode.
33244 @opindex mlra
33245 @opindex mno-lra
33246 @item -mlra
33247 @itemx -mno-lra
33248 Enable Local Register Allocation.  This is the default for SPARC since GCC 7
33249 so @option{-mno-lra} needs to be passed to get old Reload.
33251 @opindex mcpu
33252 @item -mcpu=@var{cpu_type}
33253 Set the instruction set, register set, and instruction scheduling parameters
33254 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
33255 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
33256 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
33257 @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
33258 @samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
33259 @samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
33260 @samp{m8}.
33262 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
33263 which selects the best architecture option for the host processor.
33264 @option{-mcpu=native} has no effect if GCC does not recognize
33265 the processor.
33267 Default instruction scheduling parameters are used for values that select
33268 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
33269 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
33271 Here is a list of each supported architecture and their supported
33272 implementations.
33274 @table @asis
33275 @item v7
33276 cypress, leon3v7
33278 @item v8
33279 supersparc, hypersparc, leon, leon3, leon5
33281 @item sparclite
33282 f930, f934, sparclite86x
33284 @item sparclet
33285 tsc701
33287 @item v9
33288 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
33289 niagara7, m8
33290 @end table
33292 By default (unless configured otherwise), GCC generates code for the V7
33293 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
33294 additionally optimizes it for the Cypress CY7C602 chip, as used in the
33295 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
33296 SPARCStation 1, 2, IPX etc.
33298 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
33299 architecture.  The only difference from V7 code is that the compiler emits
33300 the integer multiply and integer divide instructions which exist in SPARC-V8
33301 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
33302 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
33303 2000 series.
33305 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
33306 the SPARC architecture.  This adds the integer multiply, integer divide step
33307 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
33308 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
33309 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
33310 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
33311 MB86934 chip, which is the more recent SPARClite with FPU@.
33313 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
33314 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
33315 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
33316 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
33317 optimizes it for the TEMIC SPARClet chip.
33319 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
33320 architecture.  This adds 64-bit integer and floating-point move instructions,
33321 3 additional floating-point condition code registers and conditional move
33322 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
33323 optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
33324 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
33325 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
33326 @option{-mcpu=niagara}, the compiler additionally optimizes it for
33327 Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
33328 additionally optimizes it for Sun UltraSPARC T2 chips. With
33329 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
33330 UltraSPARC T3 chips.  With @option{-mcpu=niagara4}, the compiler
33331 additionally optimizes it for Sun UltraSPARC T4 chips.  With
33332 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
33333 Oracle SPARC M7 chips.  With @option{-mcpu=m8}, the compiler
33334 additionally optimizes it for Oracle M8 chips.
33336 @opindex mtune
33337 @item -mtune=@var{cpu_type}
33338 Set the instruction scheduling parameters for machine type
33339 @var{cpu_type}, but do not set the instruction set or register set that the
33340 option @option{-mcpu=@var{cpu_type}} does.
33342 The same values for @option{-mcpu=@var{cpu_type}} can be used for
33343 @option{-mtune=@var{cpu_type}}, but the only useful values are those
33344 that select a particular CPU implementation.  Those are
33345 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
33346 @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
33347 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
33348 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
33349 @samp{niagara4}, @samp{niagara7} and @samp{m8}.  With native Solaris
33350 and GNU/Linux toolchains, @samp{native} can also be used.
33352 @opindex mv8plus
33353 @opindex mno-v8plus
33354 @item -mv8plus
33355 @itemx -mno-v8plus
33356 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
33357 difference from the V8 ABI is that the global and out registers are
33358 considered 64 bits wide.  This is enabled by default on Solaris in 32-bit
33359 mode for all SPARC-V9 processors.
33361 @opindex mvis
33362 @opindex mno-vis
33363 @item -mvis
33364 @itemx -mno-vis
33365 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
33366 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
33368 @opindex mvis2
33369 @opindex mno-vis2
33370 @item -mvis2
33371 @itemx -mno-vis2
33372 With @option{-mvis2}, GCC generates code that takes advantage of
33373 version 2.0 of the UltraSPARC Visual Instruction Set extensions.  The
33374 default is @option{-mvis2} when targeting a cpu that supports such
33375 instructions, such as UltraSPARC-III and later.  Setting @option{-mvis2}
33376 also sets @option{-mvis}.
33378 @opindex mvis3
33379 @opindex mno-vis3
33380 @item -mvis3
33381 @itemx -mno-vis3
33382 With @option{-mvis3}, GCC generates code that takes advantage of
33383 version 3.0 of the UltraSPARC Visual Instruction Set extensions.  The
33384 default is @option{-mvis3} when targeting a cpu that supports such
33385 instructions, such as niagara-3 and later.  Setting @option{-mvis3}
33386 also sets @option{-mvis2} and @option{-mvis}.
33388 @opindex mvis4
33389 @opindex mno-vis4
33390 @item -mvis4
33391 @itemx -mno-vis4
33392 With @option{-mvis4}, GCC generates code that takes advantage of
33393 version 4.0 of the UltraSPARC Visual Instruction Set extensions.  The
33394 default is @option{-mvis4} when targeting a cpu that supports such
33395 instructions, such as niagara-7 and later.  Setting @option{-mvis4}
33396 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
33398 @opindex mvis4b
33399 @opindex mno-vis4b
33400 @item -mvis4b
33401 @itemx -mno-vis4b
33402 With @option{-mvis4b}, GCC generates code that takes advantage of
33403 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
33404 the additional VIS instructions introduced in the Oracle SPARC
33405 Architecture 2017.  The default is @option{-mvis4b} when targeting a
33406 cpu that supports such instructions, such as m8 and later.  Setting
33407 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
33408 @option{-mvis2} and @option{-mvis}.
33410 @opindex mcbcond
33411 @opindex mno-cbcond
33412 @item -mcbcond
33413 @itemx -mno-cbcond
33414 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
33415 Compare-and-Branch-on-Condition instructions.  The default is @option{-mcbcond}
33416 when targeting a CPU that supports such instructions, such as Niagara-4 and
33417 later.
33419 @opindex mfmaf
33420 @opindex mno-fmaf
33421 @item -mfmaf
33422 @itemx -mno-fmaf
33423 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
33424 Fused Multiply-Add Floating-point instructions.  The default is @option{-mfmaf}
33425 when targeting a CPU that supports such instructions, such as Niagara-3 and
33426 later.
33428 @opindex mfsmuld
33429 @opindex mno-fsmuld
33430 @item -mfsmuld
33431 @itemx -mno-fsmuld
33432 With @option{-mfsmuld}, GCC generates code that takes advantage of the
33433 Floating-point Multiply Single to Double (FsMULd) instruction.  The default is
33434 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
33435 or V9 with FPU except @option{-mcpu=leon}.
33437 @opindex mpopc
33438 @opindex mno-popc
33439 @item -mpopc
33440 @itemx -mno-popc
33441 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
33442 Population Count instruction.  The default is @option{-mpopc}
33443 when targeting a CPU that supports such an instruction, such as Niagara-2 and
33444 later.
33446 @opindex msubxc
33447 @opindex mno-subxc
33448 @item -msubxc
33449 @itemx -mno-subxc
33450 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
33451 Subtract-Extended-with-Carry instruction.  The default is @option{-msubxc}
33452 when targeting a CPU that supports such an instruction, such as Niagara-7 and
33453 later.
33455 @opindex mfix-at697f
33456 @item -mfix-at697f
33457 Enable the documented workaround for the single erratum of the Atmel AT697F
33458 processor (which corresponds to erratum #13 of the AT697E processor).
33460 @opindex mfix-ut699
33461 @item -mfix-ut699
33462 Enable the documented workarounds for the floating-point errata and the data
33463 cache nullify errata of the UT699 processor.
33465 @opindex mfix-ut700
33466 @item -mfix-ut700
33467 Enable the documented workaround for the back-to-back store errata of
33468 the UT699E/UT700 processor.
33470 @opindex mfix-gr712rc
33471 @item -mfix-gr712rc
33472 Enable the documented workaround for the back-to-back store errata of
33473 the GR712RC processor.
33474 @end table
33476 These @samp{-m} options are supported in addition to the above
33477 on SPARC-V9 processors in 64-bit environments:
33479 @table @gcctabopt
33480 @opindex m32
33481 @opindex m64
33482 @item -m32
33483 @itemx -m64
33484 Generate code for a 32-bit or 64-bit environment.
33485 The 32-bit environment sets int, long and pointer to 32 bits.
33486 The 64-bit environment sets int to 32 bits and long and pointer
33487 to 64 bits.
33489 @opindex mcmodel
33490 @item -mcmodel=@var{which}
33491 Set the code model to one of
33493 @table @samp
33494 @item medlow
33495 The Medium/Low code model: 64-bit addresses, programs
33496 must be linked in the low 32 bits of memory.  Programs can be statically
33497 or dynamically linked.
33499 @item medmid
33500 The Medium/Middle code model: 64-bit addresses, programs
33501 must be linked in the low 44 bits of memory, the text and data segments must
33502 be less than 2GB in size and the data segment must be located within 2GB of
33503 the text segment.
33505 @item medany
33506 The Medium/Anywhere code model: 64-bit addresses, programs
33507 may be linked anywhere in memory, the text and data segments must be less
33508 than 2GB in size and the data segment must be located within 2GB of the
33509 text segment.
33511 @item embmedany
33512 The Medium/Anywhere code model for embedded systems:
33513 64-bit addresses, the text and data segments must be less than 2GB in
33514 size, both starting anywhere in memory (determined at link time).  The
33515 global register %g4 points to the base of the data segment.  Programs
33516 are statically linked and PIC is not supported.
33517 @end table
33519 @opindex mmemory-model
33520 @item -mmemory-model=@var{mem-model}
33521 Set the memory model in force on the processor to one of
33523 @table @samp
33524 @item default
33525 The default memory model for the processor and operating system.
33527 @item rmo
33528 Relaxed Memory Order
33530 @item pso
33531 Partial Store Order
33533 @item tso
33534 Total Store Order
33536 @item sc
33537 Sequential Consistency
33538 @end table
33540 These memory models are formally defined in Appendix D of the SPARC-V9
33541 architecture manual, as set in the processor's @code{PSTATE.MM} field.
33543 @opindex mstack-bias
33544 @opindex mno-stack-bias
33545 @item -mstack-bias
33546 @itemx -mno-stack-bias
33547 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
33548 frame pointer if present, are offset by @minus{}2047 which must be added back
33549 when making stack frame references.  This is the default in 64-bit mode.
33550 Otherwise, assume no such offset is present.
33551 @end table
33553 @node System V Options
33554 @subsection Options for System V
33556 These additional options are available on System V Release 4 for
33557 compatibility with other compilers on those systems:
33559 @table @gcctabopt
33560 @opindex G
33561 @item -G
33562 Create a shared object.
33563 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
33565 @opindex Qy
33566 @item -Qy
33567 Identify the versions of each tool used by the compiler, in a
33568 @code{.ident} assembler directive in the output.
33570 @opindex Qn
33571 @item -Qn
33572 Refrain from adding @code{.ident} directives to the output file (this is
33573 the default).
33575 @opindex YP
33576 @item -YP,@var{dirs}
33577 Search the directories @var{dirs}, and no others, for libraries
33578 specified with @option{-l}.
33580 @opindex Ym
33581 @item -Ym,@var{dir}
33582 Look in the directory @var{dir} to find the M4 preprocessor.
33583 The assembler uses this option.
33584 @c This is supposed to go with a -Yd for predefined M4 macro files, but
33585 @c the generic assembler that comes with Solaris takes just -Ym.
33586 @end table
33588 @node V850 Options
33589 @subsection V850 Options
33590 @cindex V850 Options
33592 These @samp{-m} options are defined for V850 implementations:
33594 @table @gcctabopt
33595 @opindex mlong-calls
33596 @opindex mno-long-calls
33597 @item -mlong-calls
33598 @itemx -mno-long-calls
33599 Treat all calls as being far away (near).  If calls are assumed to be
33600 far away, the compiler always loads the function's address into a
33601 register, and calls indirect through the pointer.
33603 @opindex mno-ep
33604 @opindex mep
33605 @item -mno-ep
33606 @itemx -mep
33607 Do not optimize (do optimize) basic blocks that use the same index
33608 pointer 4 or more times to copy pointer into the @code{ep} register, and
33609 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
33610 option is on by default if you optimize.
33612 @opindex mno-prolog-function
33613 @opindex mprolog-function
33614 @item -mno-prolog-function
33615 @itemx -mprolog-function
33616 Do not use (do use) external functions to save and restore registers
33617 at the prologue and epilogue of a function.  The external functions
33618 are slower, but use less code space if more than one function saves
33619 the same number of registers.  The @option{-mprolog-function} option
33620 is on by default if you optimize.
33622 @opindex mspace
33623 @item -mspace
33624 Try to make the code as small as possible.  At present, this just turns
33625 on the @option{-mep} and @option{-mprolog-function} options.
33627 @opindex mtda
33628 @item -mtda=@var{n}
33629 Put static or global variables whose size is @var{n} bytes or less into
33630 the tiny data area that register @code{ep} points to.  The tiny data
33631 area can hold up to 256 bytes in total (128 bytes for byte references).
33633 @opindex msda
33634 @item -msda=@var{n}
33635 Put static or global variables whose size is @var{n} bytes or less into
33636 the small data area that register @code{gp} points to.  The small data
33637 area can hold up to 64 kilobytes.
33639 @opindex mzda
33640 @item -mzda=@var{n}
33641 Put static or global variables whose size is @var{n} bytes or less into
33642 the first 32 kilobytes of memory.
33644 @opindex mv850
33645 @item -mv850
33646 Specify that the target processor is the V850.
33648 @opindex mv850e3v5
33649 @item -mv850e3v5
33650 Specify that the target processor is the V850E3V5.  The preprocessor
33651 constant @code{__v850e3v5__} is defined if this option is used.
33653 @opindex mv850e2v4
33654 @item -mv850e2v4
33655 Specify that the target processor is the V850E3V5.  This is an alias for
33656 the @option{-mv850e3v5} option.
33658 @opindex mv850e2v3
33659 @item -mv850e2v3
33660 Specify that the target processor is the V850E2V3.  The preprocessor
33661 constant @code{__v850e2v3__} is defined if this option is used.
33663 @opindex mv850e2
33664 @item -mv850e2
33665 Specify that the target processor is the V850E2.  The preprocessor
33666 constant @code{__v850e2__} is defined if this option is used.
33668 @opindex mv850e1
33669 @item -mv850e1
33670 Specify that the target processor is the V850E1.  The preprocessor
33671 constants @code{__v850e1__} and @code{__v850e__} are defined if
33672 this option is used.
33674 @opindex mv850es
33675 @item -mv850es
33676 Specify that the target processor is the V850ES.  This is an alias for
33677 the @option{-mv850e1} option.
33679 @opindex mv850e
33680 @item -mv850e
33681 Specify that the target processor is the V850E@.  The preprocessor
33682 constant @code{__v850e__} is defined if this option is used.
33684 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
33685 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
33686 are defined then a default target processor is chosen and the
33687 relevant @samp{__v850*__} preprocessor constant is defined.
33689 The preprocessor constants @code{__v850} and @code{__v851__} are always
33690 defined, regardless of which processor variant is the target.
33692 @opindex mdisable-callt
33693 @opindex mno-disable-callt
33694 @item -mdisable-callt
33695 @itemx -mno-disable-callt
33696 This option suppresses generation of the @code{CALLT} instruction for the
33697 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
33698 architecture.
33700 This option is enabled by default when the RH850 ABI is
33701 in use (see @option{-mrh850-abi}), and disabled by default when the
33702 GCC ABI is in use.  If @code{CALLT} instructions are being generated
33703 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
33705 @opindex mrelax
33706 @opindex mno-relax
33707 @item -mrelax
33708 @itemx -mno-relax
33709 Pass on (or do not pass on) the @option{-mrelax} command-line option
33710 to the assembler.
33712 @opindex mlong-jumps
33713 @opindex mno-long-jumps
33714 @item -mlong-jumps
33715 @itemx -mno-long-jumps
33716 Disable (or re-enable) the generation of PC-relative jump instructions.
33718 @opindex msoft-float
33719 @opindex mhard-float
33720 @item -msoft-float
33721 @itemx -mhard-float
33722 Disable (or re-enable) the generation of hardware floating point
33723 instructions.  This option is only significant when the target
33724 architecture is @samp{V850E2V3} or higher.  If hardware floating point
33725 instructions are being generated then the C preprocessor symbol
33726 @code{__FPU_OK__} is defined, otherwise the symbol
33727 @code{__NO_FPU__} is defined.
33729 @opindex mloop
33730 @item -mloop
33731 Enables the use of the e3v5 LOOP instruction.  The use of this
33732 instruction is not enabled by default when the e3v5 architecture is
33733 selected because its use is still experimental.
33735 @opindex mrh850-abi
33736 @opindex mghs
33737 @item -mrh850-abi
33738 @itemx -mghs
33739 Enables support for the RH850 version of the V850 ABI.  This is the
33740 default.  With this version of the ABI the following rules apply:
33742 @itemize
33743 @item
33744 Integer sized structures and unions are returned via a memory pointer
33745 rather than a register.
33747 @item
33748 Large structures and unions (more than 8 bytes in size) are passed by
33749 value.
33751 @item
33752 Functions are aligned to 16-bit boundaries.
33754 @item
33755 The @option{-m8byte-align} command-line option is supported.
33757 @item
33758 The @option{-mdisable-callt} command-line option is enabled by
33759 default.  The @option{-mno-disable-callt} command-line option is not
33760 supported.
33761 @end itemize
33763 When this version of the ABI is enabled the C preprocessor symbol
33764 @code{__V850_RH850_ABI__} is defined.
33766 @opindex mgcc-abi
33767 @item -mgcc-abi
33768 Enables support for the old GCC version of the V850 ABI.  With this
33769 version of the ABI the following rules apply:
33771 @itemize
33772 @item
33773 Integer sized structures and unions are returned in register @code{r10}.
33775 @item
33776 Large structures and unions (more than 8 bytes in size) are passed by
33777 reference.
33779 @item
33780 Functions are aligned to 32-bit boundaries, unless optimizing for
33781 size.
33783 @item
33784 The @option{-m8byte-align} command-line option is not supported.
33786 @item
33787 The @option{-mdisable-callt} command-line option is supported but not
33788 enabled by default.
33789 @end itemize
33791 When this version of the ABI is enabled the C preprocessor symbol
33792 @code{__V850_GCC_ABI__} is defined.
33794 @opindex m8byte-align
33795 @opindex mno-8byte-align
33796 @item -m8byte-align
33797 @itemx -mno-8byte-align
33798 Enables support for @code{double} and @code{long long} types to be
33799 aligned on 8-byte boundaries.  The default is to restrict the
33800 alignment of all objects to at most 4-bytes.  When
33801 @option{-m8byte-align} is in effect the C preprocessor symbol
33802 @code{__V850_8BYTE_ALIGN__} is defined.
33804 @opindex mbig-switch
33805 @item -mbig-switch
33806 Generate code suitable for big switch tables.  Use this option only if
33807 the assembler/linker complain about out of range branches within a switch
33808 table.
33810 @opindex mapp-regs
33811 @item -mapp-regs
33812 This option causes r2 and r5 to be used in the code generated by
33813 the compiler.  This setting is the default.
33815 @opindex mno-app-regs
33816 @item -mno-app-regs
33817 This option causes r2 and r5 to be treated as fixed registers.
33819 @end table
33821 @node VAX Options
33822 @subsection VAX Options
33823 @cindex VAX options
33825 These @samp{-m} options are defined for the VAX:
33827 @table @gcctabopt
33828 @opindex munix
33829 @item -munix
33830 Do not output certain jump instructions (@code{aobleq} and so on)
33831 that the Unix assembler for the VAX cannot handle across long
33832 ranges.
33834 @opindex mgnu
33835 @item -mgnu
33836 Do output those jump instructions, on the assumption that the
33837 GNU assembler is being used.
33839 @opindex mg
33840 @item -mg
33841 Output code for G-format floating-point numbers instead of D-format.
33843 @opindex mlra
33844 @opindex mno-lra
33845 @item -mlra
33846 @itemx -mno-lra
33847 Enable Local Register Allocation.  This is still experimental for the VAX,
33848 so by default the compiler uses standard reload.
33849 @end table
33851 @node Visium Options
33852 @subsection Visium Options
33853 @cindex Visium options
33855 @table @gcctabopt
33857 @opindex mdebug
33858 @item -mdebug
33859 A program which performs file I/O and is destined to run on an MCM target
33860 should be linked with this option.  It causes the libraries libc.a and
33861 libdebug.a to be linked.  The program should be run on the target under
33862 the control of the GDB remote debugging stub.
33864 @opindex msim
33865 @item -msim
33866 A program which performs file I/O and is destined to run on the simulator
33867 should be linked with option.  This causes libraries libc.a and libsim.a to
33868 be linked.
33870 @opindex mfpu
33871 @opindex mhard-float
33872 @item -mfpu
33873 @itemx -mhard-float
33874 Generate code containing floating-point instructions.  This is the
33875 default.
33877 @opindex mno-fpu
33878 @opindex msoft-float
33879 @item -mno-fpu
33880 @itemx -msoft-float
33881 Generate code containing library calls for floating-point.
33883 @option{-msoft-float} changes the calling convention in the output file;
33884 therefore, it is only useful if you compile @emph{all} of a program with
33885 this option.  In particular, you need to compile @file{libgcc.a}, the
33886 library that comes with GCC, with @option{-msoft-float} in order for
33887 this to work.
33889 @opindex mcpu
33890 @item -mcpu=@var{cpu_type}
33891 Set the instruction set, register set, and instruction scheduling parameters
33892 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
33893 @samp{mcm}, @samp{gr5} and @samp{gr6}.
33895 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
33897 By default (unless configured otherwise), GCC generates code for the GR5
33898 variant of the Visium architecture.  
33900 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
33901 architecture.  The only difference from GR5 code is that the compiler will
33902 generate block move instructions.
33904 @opindex mtune
33905 @item -mtune=@var{cpu_type}
33906 Set the instruction scheduling parameters for machine type @var{cpu_type},
33907 but do not set the instruction set or register set that the option
33908 @option{-mcpu=@var{cpu_type}} would.
33910 @opindex msv-mode
33911 @item -msv-mode
33912 Generate code for the supervisor mode, where there are no restrictions on
33913 the access to general registers.  This is the default.
33915 @opindex muser-mode
33916 @item -muser-mode
33917 Generate code for the user mode, where the access to some general registers
33918 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
33919 mode; on the GR6, only registers r29 to r31 are affected.
33920 @end table
33922 @node VMS Options
33923 @subsection VMS Options
33925 These @samp{-m} options are defined for the VMS implementations:
33927 @table @gcctabopt
33928 @opindex mvms-return-codes
33929 @item -mvms-return-codes
33930 Return VMS condition codes from @code{main}. The default is to return POSIX-style
33931 condition (e.g.@: error) codes.
33933 @opindex mdebug-main=@var{prefix}
33934 @item -mdebug-main=@var{prefix}
33935 Flag the first routine whose name starts with @var{prefix} as the main
33936 routine for the debugger.
33938 @opindex mmalloc64
33939 @item -mmalloc64
33940 Default to 64-bit memory allocation routines.
33942 @opindex mpointer-size=@var{size}
33943 @item -mpointer-size=@var{size}
33944 Set the default size of pointers. Possible options for @var{size} are
33945 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
33946 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
33947 The later option disables @code{pragma pointer_size}.
33948 @end table
33950 @node VxWorks Options
33951 @subsection VxWorks Options
33952 @cindex VxWorks Options
33954 The options in this section are defined for all VxWorks targets.
33955 Options specific to the target hardware are listed with the other
33956 options for that target.
33958 @table @gcctabopt
33959 @opindex mrtp
33960 @item -mrtp
33961 GCC can generate code for both VxWorks kernels and real time processes
33962 (RTPs).  This option switches from the former to the latter.  It also
33963 defines the preprocessor macro @code{__RTP__}.
33965 @opindex msmp
33966 @item -msmp
33967 Select SMP runtimes for linking.  Not available on architectures other
33968 than PowerPC, nor on VxWorks version 7 or later, in which the selection
33969 is part of the VxWorks build configuration and the library paths are the
33970 same for either choice.
33972 @opindex non-static
33973 @item -non-static
33974 Link an RTP executable against shared libraries rather than static
33975 libraries.  The options @option{-static} and @option{-shared} can
33976 also be used for RTPs (@pxref{Link Options}); @option{-static}
33977 is the default.
33979 @opindex Bstatic
33980 @opindex Bdynamic
33981 @item -Bstatic
33982 @itemx -Bdynamic
33983 These options are passed down to the linker.  They are defined for
33984 compatibility with Diab.
33986 @opindex Xbind-lazy
33987 @item -Xbind-lazy
33988 Enable lazy binding of function calls.  This option is equivalent to
33989 @option{-Wl,-z,now} and is defined for compatibility with Diab.
33991 @opindex Xbind-now
33992 @item -Xbind-now
33993 Disable lazy binding of function calls.  This option is the default and
33994 is defined for compatibility with Diab.
33995 @end table
33997 @node x86 Options
33998 @subsection x86 Options
33999 @cindex x86 Options
34001 These @samp{-m} options are defined for the x86 family of computers.
34003 @table @gcctabopt
34005 @opindex march
34006 @item -march=@var{cpu-type}
34007 Generate instructions for the machine type @var{cpu-type}.  In contrast to
34008 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code 
34009 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
34010 to generate code that may not run at all on processors other than the one
34011 indicated.  Specifying @option{-march=@var{cpu-type}} implies 
34012 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
34014 The choices for @var{cpu-type} are:
34016 @table @samp
34017 @item native
34018 This selects the CPU to generate code for at compilation time by determining
34019 the processor type of the compiling machine.  Using @option{-march=native}
34020 enables all instruction subsets supported by the local machine (hence
34021 the result might not run on different machines).  Using @option{-mtune=native}
34022 produces code optimized for the local machine under the constraints
34023 of the selected instruction set.  
34025 @item x86-64
34026 A generic CPU with 64-bit extensions.
34028 @item x86-64-v2
34029 @itemx x86-64-v3
34030 @itemx x86-64-v4
34031 These choices for @var{cpu-type} select the corresponding
34032 micro-architecture level from the x86-64 psABI.  On ABIs other than
34033 the x86-64 psABI they select the same CPU features as the x86-64 psABI
34034 documents for the particular micro-architecture level.
34036 Since these @var{cpu-type} values do not have a corresponding
34037 @option{-mtune} setting, using @option{-march} with these values enables
34038 generic tuning.  Specific tuning can be enabled using the
34039 @option{-mtune=@var{other-cpu-type}} option with an appropriate
34040 @var{other-cpu-type} value.
34042 @item i386
34043 Original Intel i386 CPU@.
34045 @item i486
34046 Intel i486 CPU@.  (No scheduling is implemented for this chip.)
34048 @item i586
34049 @itemx pentium
34050 Intel Pentium CPU with no MMX support.
34052 @item lakemont
34053 Intel Lakemont MCU, based on Intel Pentium CPU.
34055 @item pentium-mmx
34056 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
34058 @item pentiumpro
34059 Intel Pentium Pro CPU@.
34061 @item i686
34062 When used with @option{-march}, the Pentium Pro
34063 instruction set is used, so the code runs on all i686 family chips.
34064 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
34066 @item pentium2
34067 Intel Pentium II CPU, based on Pentium Pro core with MMX and FXSR instruction
34068 set support.
34070 @item pentium3
34071 @itemx pentium3m
34072 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR and SSE
34073 instruction set support.
34075 @item pentium-m
34076 Intel Pentium M; low-power version of Intel Pentium III CPU
34077 with MMX, SSE, SSE2 and FXSR instruction set support.  Used by Centrino
34078 notebooks.
34080 @item pentium4
34081 @itemx pentium4m
34082 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction set support.
34084 @item prescott
34085 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2, SSE3 and FXSR
34086 instruction set support.
34088 @item nocona
34089 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
34090 SSE2, SSE3 and FXSR instruction set support.
34092 @item core2
34093 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, CX16,
34094 SAHF and FXSR instruction set support.
34096 @item nehalem
34097 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
34098 SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction set support.
34100 @item westmere
34101 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
34102 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and PCLMUL instruction set support.
34104 @item sandybridge
34105 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
34106 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE and PCLMUL instruction set
34107 support.
34109 @item ivybridge
34110 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
34111 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND
34112 and F16C instruction set support.
34114 @item haswell
34115 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34116 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34117 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE and HLE instruction set support.
34119 @item broadwell
34120 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34121 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34122 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW
34123 instruction set support.
34125 @item skylake
34126 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34127 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34128 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
34129 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
34131 @item bonnell
34132 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
34133 instruction set support.
34135 @item silvermont
34136 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34137 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW and RDRND
34138 instruction set support.
34140 @item goldmont
34141 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34142 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
34143 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction
34144 set support.
34146 @item goldmont-plus
34147 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34148 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES,
34149 SHA, RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE,
34150 RDPID and SGX instruction set support.
34152 @item tremont
34153 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34154 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
34155 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID,
34156 SGX, CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG instruction set
34157 support.
34159 @item sierraforest
34160 Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34161 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
34162 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
34163 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
34164 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34165 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, ENQCMD and UINTR instruction set
34166 support.
34168 @item grandridge
34169 Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34170 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
34171 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
34172 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
34173 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34174 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, ENQCMD and UINTR instruction set
34175 support.
34177 @item clearwaterforest
34178 Intel Clearwater Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
34179 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE,
34180 XSAVEC, XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB,
34181 MOVDIRI, MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
34182 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34183 ENQCMD, UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16,
34184 SHA512, SM3, SM4, USER_MSR and PREFETCHI instruction set support.
34186 @item knl
34187 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34188 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34189 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34190 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1 instruction set support.
34192 @item knm
34193 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34194 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34195 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34196 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
34197 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
34199 @item skylake-avx512
34200 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34201 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34202 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34203 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW,
34204 AVX512DQ and AVX512CD instruction set support.
34206 @item cannonlake
34207 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
34208 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL,
34209 FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX,
34210 PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
34211 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA instruction set
34212 support.
34214 @item icelake-client
34215 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34216 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34217 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34218 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
34219 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
34220 , VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
34222 @item icelake-server
34223 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34224 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34225 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34226 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
34227 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
34228 , VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB
34229 instruction set support.
34231 @item cascadelake
34232 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34233 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34234 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
34235 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
34236 AVX512CD and AVX512VNNI instruction set support.
34238 @item cooperlake
34239 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34240 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34241 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
34242 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
34243 AVX512CD, AVX512VNNI and AVX512BF16 instruction set support.
34245 @item tigerlake
34246 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34247 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34248 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
34249 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
34250 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
34251 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
34252 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
34254 @item sapphirerapids
34255 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34256 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34257 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34258 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
34259 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
34260 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
34261 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
34262 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16 and AVX512BF16
34263 instruction set support.
34265 @item alderlake
34266 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34267 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
34268 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
34269 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, PCONFIG, PKU,
34270 VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI instruction set
34271 support.
34273 @item rocketlake
34274 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3
34275 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34276 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
34277 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
34278 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
34279 VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
34281 @item graniterapids
34282 Intel graniterapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34283 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34284 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34285 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
34286 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
34287 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
34288 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
34289 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16, AVX512BF16, AMX-FP16
34290 and PREFETCHI instruction set support.
34292 @item graniterapids-d
34293 Intel graniterapids D CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34294 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34295 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34296 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
34297 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
34298 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
34299 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
34300 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16, AVX512BF16, AMX-FP16,
34301 PREFETCHI and AMX-COMPLEX instruction set support.
34303 @item arrowlake
34304 Intel Arrow Lake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34305 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
34306 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
34307 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
34308 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34309 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT and CMPCCXADD instruction set
34310 support.
34312 @item arrowlake-s
34313 Intel Arrow Lake S CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34314 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
34315 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
34316 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
34317 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34318 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16, SHA512,
34319 SM3 and SM4 instruction set support.
34321 @item pantherlake
34322 Intel Panther Lake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34323 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
34324 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
34325 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
34326 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34327 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16, SHA512,
34328 SM3, SM4 and PREFETCHI instruction set support.
34330 @item k6
34331 AMD K6 CPU with MMX instruction set support.
34333 @item k6-2
34334 @itemx k6-3
34335 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
34337 @item athlon
34338 @itemx athlon-tbird
34339 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
34340 support.
34342 @item athlon-4
34343 @itemx athlon-xp
34344 @itemx athlon-mp
34345 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
34346 instruction set support.
34348 @item k8
34349 @itemx opteron
34350 @itemx athlon64
34351 @itemx athlon-fx
34352 Processors based on the AMD K8 core with x86-64 instruction set support,
34353 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
34354 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
34355 instruction set extensions.)
34357 @item k8-sse3
34358 @itemx opteron-sse3
34359 @itemx athlon64-sse3
34360 Improved versions of AMD K8 cores with SSE3 instruction set support.
34362 @item amdfam10
34363 @itemx barcelona
34364 CPUs based on AMD Family 10h cores with x86-64 instruction set support.  (This
34365 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
34366 instruction set extensions.)
34368 @item bdver1
34369 CPUs based on AMD Family 15h cores with x86-64 instruction set support.  (This
34370 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
34371 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
34373 @item bdver2
34374 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
34375 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
34376 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 
34377 extensions.)
34379 @item bdver3
34380 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
34381 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 
34382 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
34383 64-bit instruction set extensions.)
34385 @item bdver4
34386 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
34387 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 
34388 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
34389 SSE4.2, ABM and 64-bit instruction set extensions.)
34391 @item znver1
34392 AMD Family 17h core based CPUs with x86-64 instruction set support.  (This
34393 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
34394 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
34395 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
34396 instruction set extensions.)
34398 @item znver2
34399 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
34400 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
34401 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
34402 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
34403 WBNOINVD, and 64-bit instruction set extensions.)
34405 @item znver3
34406 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
34407 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
34408 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
34409 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
34410 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
34412 @item znver4
34413 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
34414 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
34415 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
34416 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
34417 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD,
34418 AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, AVX512VNNI,
34419 AVX512BITALG, AVX512VPOPCNTDQ, GFNI and 64-bit instruction set extensions.)
34421 @item btver1
34422 CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
34423 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
34424 instruction set extensions.)
34426 @item btver2
34427 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
34428 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
34429 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
34431 @item winchip-c6
34432 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
34433 set support.
34435 @item winchip2
34436 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
34437 instruction set support.
34439 @item c3
34440 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
34441 (No scheduling is implemented for this chip.)
34443 @item c3-2
34444 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
34445 (No scheduling is implemented for this chip.)
34447 @item c7
34448 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
34449 (No scheduling is implemented for this chip.)
34451 @item samuel-2
34452 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
34453 (No scheduling is implemented for this chip.)
34455 @item nehemiah
34456 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
34457 (No scheduling is implemented for this chip.)
34459 @item esther
34460 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
34461 (No scheduling is implemented for this chip.)
34463 @item eden-x2
34464 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
34465 (No scheduling is implemented for this chip.)
34467 @item eden-x4
34468 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
34469 AVX and AVX2 instruction set support.
34470 (No scheduling is implemented for this chip.)
34472 @item nano
34473 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
34474 instruction set support.
34475 (No scheduling is implemented for this chip.)
34477 @item nano-1000
34478 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
34479 instruction set support.
34480 (No scheduling is implemented for this chip.)
34482 @item nano-2000
34483 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
34484 instruction set support.
34485 (No scheduling is implemented for this chip.)
34487 @item nano-3000
34488 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
34489 instruction set support.
34490 (No scheduling is implemented for this chip.)
34492 @item nano-x2
34493 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
34494 instruction set support.
34495 (No scheduling is implemented for this chip.)
34497 @item nano-x4
34498 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
34499 instruction set support.
34500 (No scheduling is implemented for this chip.)
34502 @item lujiazui
34503 ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
34504 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
34505 ABM, BMI, BMI2, F16C, FXSR, RDSEED instruction set support.
34507 @item yongfeng
34508 ZHAOXIN yongfeng CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
34509 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
34510 ABM, BMI, BMI2, F16C, FXSR, RDSEED, AVX2, FMA, SHA, LZCNT
34511 instruction set support.
34513 @item geode
34514 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
34515 @end table
34517 @opindex mtune
34518 @item -mtune=@var{cpu-type}
34519 Tune to @var{cpu-type} everything applicable about the generated code, except
34520 for the ABI and the set of available instructions.  
34521 While picking a specific @var{cpu-type} schedules things appropriately
34522 for that particular chip, the compiler does not generate any code that
34523 cannot run on the default machine type unless you use a
34524 @option{-march=@var{cpu-type}} option.
34525 For example, if GCC is configured for i686-pc-linux-gnu
34526 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
34527 but still runs on i686 machines.
34529 The choices for @var{cpu-type} are the same as for @option{-march}.
34530 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
34532 @table @samp
34533 @item generic
34534 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
34535 If you know the CPU on which your code will run, then you should use
34536 the corresponding @option{-mtune} or @option{-march} option instead of
34537 @option{-mtune=generic}.  But, if you do not know exactly what CPU users
34538 of your application will have, then you should use this option.
34540 As new processors are deployed in the marketplace, the behavior of this
34541 option will change.  Therefore, if you upgrade to a newer version of
34542 GCC, code generation controlled by this option will change to reflect
34543 the processors
34544 that are most common at the time that version of GCC is released.
34546 There is no @option{-march=generic} option because @option{-march}
34547 indicates the instruction set the compiler can use, and there is no
34548 generic instruction set applicable to all processors.  In contrast,
34549 @option{-mtune} indicates the processor (or, in this case, collection of
34550 processors) for which the code is optimized.
34552 @item intel
34553 Produce code optimized for the most current Intel processors, which are
34554 Haswell and Silvermont for this version of GCC.  If you know the CPU
34555 on which your code will run, then you should use the corresponding
34556 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
34557 But, if you want your application performs better on both Haswell and
34558 Silvermont, then you should use this option.
34560 As new Intel processors are deployed in the marketplace, the behavior of
34561 this option will change.  Therefore, if you upgrade to a newer version of
34562 GCC, code generation controlled by this option will change to reflect
34563 the most current Intel processors at the time that version of GCC is
34564 released.
34566 There is no @option{-march=intel} option because @option{-march} indicates
34567 the instruction set the compiler can use, and there is no common
34568 instruction set applicable to all processors.  In contrast,
34569 @option{-mtune} indicates the processor (or, in this case, collection of
34570 processors) for which the code is optimized.
34571 @end table
34573 @opindex mcpu
34574 @item -mcpu=@var{cpu-type}
34575 A deprecated synonym for @option{-mtune}.
34577 @opindex mfpmath
34578 @item -mfpmath=@var{unit}
34579 Generate floating-point arithmetic for selected unit @var{unit}.  The choices
34580 for @var{unit} are:
34582 @table @samp
34583 @item 387
34584 Use the standard 387 floating-point coprocessor present on the majority of chips and
34585 emulated otherwise.  Code compiled with this option runs almost everywhere.
34586 The temporary results are computed in 80-bit precision instead of the precision
34587 specified by the type, resulting in slightly different results compared to most
34588 of other chips.  See @option{-ffloat-store} for more detailed description.
34590 This is the default choice for non-Darwin x86-32 targets.
34592 @item sse
34593 Use scalar floating-point instructions present in the SSE instruction set.
34594 This instruction set is supported by Pentium III and newer chips,
34595 and in the AMD line
34596 by Athlon-4, Athlon XP and Athlon MP chips.  The earlier version of the SSE
34597 instruction set supports only single-precision arithmetic, thus the double and
34598 extended-precision arithmetic are still done using 387.  A later version, present
34599 only in Pentium 4 and AMD x86-64 chips, supports double-precision
34600 arithmetic too.
34602 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
34603 or @option{-msse2} switches to enable SSE extensions and make this option
34604 effective.  For the x86-64 compiler, these extensions are enabled by default.
34606 The resulting code should be considerably faster in the majority of cases and avoid
34607 the numerical instability problems of 387 code, but may break some existing
34608 code that expects temporaries to be 80 bits.
34610 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
34611 and the default choice for x86-32 targets with the SSE2 instruction set
34612 when @option{-ffast-math} is enabled.
34614 @item sse,387
34615 @itemx sse+387
34616 @itemx both
34617 Attempt to utilize both instruction sets at once.  This effectively doubles the
34618 amount of available registers, and on chips with separate execution units for
34619 387 and SSE the execution resources too.  Use this option with care, as it is
34620 still experimental, because the GCC register allocator does not model separate
34621 functional units well, resulting in unstable performance.
34622 @end table
34624 @opindex masm=@var{dialect}
34625 @item -masm=@var{dialect}
34626 Output assembly instructions using selected @var{dialect}.  Also affects
34627 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
34628 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
34629 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
34630 not support @samp{intel}.
34632 @opindex mieee-fp
34633 @opindex mno-ieee-fp
34634 @item -mieee-fp
34635 @itemx -mno-ieee-fp
34636 Control whether or not the compiler uses IEEE floating-point
34637 comparisons.  These correctly handle the case where the result of a
34638 comparison is unordered.
34640 @opindex m80387
34641 @opindex mhard-float
34642 @item -m80387
34643 @itemx -mhard-float
34644 Generate output containing 80387 instructions for floating point.
34646 @opindex no-80387
34647 @opindex msoft-float
34648 @item -mno-80387
34649 @itemx -msoft-float
34650 Generate output containing library calls for floating point.
34652 @strong{Warning:} the requisite libraries are not part of GCC@.
34653 Normally the facilities of the machine's usual C compiler are used, but
34654 this cannot be done directly in cross-compilation.  You must make your
34655 own arrangements to provide suitable library functions for
34656 cross-compilation.
34658 On machines where a function returns floating-point results in the 80387
34659 register stack, some floating-point opcodes may be emitted even if
34660 @option{-msoft-float} is used.
34662 @opindex mno-fp-ret-in-387
34663 @opindex mfp-ret-in-387
34664 @item -mno-fp-ret-in-387
34665 Do not use the FPU registers for return values of functions.
34667 The usual calling convention has functions return values of types
34668 @code{float} and @code{double} in an FPU register, even if there
34669 is no FPU@.  The idea is that the operating system should emulate
34670 an FPU@.
34672 The option @option{-mno-fp-ret-in-387} causes such values to be returned
34673 in ordinary CPU registers instead.
34675 @opindex mno-fancy-math-387
34676 @opindex mfancy-math-387
34677 @item -mno-fancy-math-387
34678 Some 387 emulators do not support the @code{sin}, @code{cos} and
34679 @code{sqrt} instructions for the 387.  Specify this option to avoid
34680 generating those instructions.
34681 This option is overridden when @option{-march}
34682 indicates that the target CPU always has an FPU and so the
34683 instruction does not need emulation.  These
34684 instructions are not generated unless you also use the
34685 @option{-funsafe-math-optimizations} switch.
34687 @opindex malign-double
34688 @opindex mno-align-double
34689 @item -malign-double
34690 @itemx -mno-align-double
34691 Control whether GCC aligns @code{double}, @code{long double}, and
34692 @code{long long} variables on a two-word boundary or a one-word
34693 boundary.  Aligning @code{double} variables on a two-word boundary
34694 produces code that runs somewhat faster on a Pentium at the
34695 expense of more memory.
34697 On x86-64, @option{-malign-double} is enabled by default.
34699 @strong{Warning:} if you use the @option{-malign-double} switch,
34700 structures containing the above types are aligned differently than
34701 the published application binary interface specifications for the x86-32
34702 and are not binary compatible with structures in code compiled
34703 without that switch.
34705 @opindex m96bit-long-double
34706 @opindex m128bit-long-double
34707 @item -m96bit-long-double
34708 @itemx -m128bit-long-double
34709 These switches control the size of @code{long double} type.  The x86-32
34710 application binary interface specifies the size to be 96 bits,
34711 so @option{-m96bit-long-double} is the default in 32-bit mode.
34713 Modern architectures (Pentium and newer) prefer @code{long double}
34714 to be aligned to an 8- or 16-byte boundary.  In arrays or structures
34715 conforming to the ABI, this is not possible.  So specifying
34716 @option{-m128bit-long-double} aligns @code{long double}
34717 to a 16-byte boundary by padding the @code{long double} with an additional
34718 32-bit zero.
34720 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
34721 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
34723 Notice that neither of these options enable any extra precision over the x87
34724 standard of 80 bits for a @code{long double}.
34726 @strong{Warning:} if you override the default value for your target ABI, this
34727 changes the size of 
34728 structures and arrays containing @code{long double} variables,
34729 as well as modifying the function calling convention for functions taking
34730 @code{long double}.  Hence they are not binary-compatible
34731 with code compiled without that switch.
34733 @opindex mlong-double-64
34734 @opindex mlong-double-80
34735 @opindex mlong-double-128
34736 @item -mlong-double-64
34737 @itemx -mlong-double-80
34738 @itemx -mlong-double-128
34739 These switches control the size of @code{long double} type. A size
34740 of 64 bits makes the @code{long double} type equivalent to the @code{double}
34741 type. This is the default for 32-bit Bionic C library.  A size
34742 of 128 bits makes the @code{long double} type equivalent to the
34743 @code{__float128} type. This is the default for 64-bit Bionic C library.
34745 @strong{Warning:} if you override the default value for your target ABI, this
34746 changes the size of
34747 structures and arrays containing @code{long double} variables,
34748 as well as modifying the function calling convention for functions taking
34749 @code{long double}.  Hence they are not binary-compatible
34750 with code compiled without that switch.
34752 @opindex malign-data
34753 @item -malign-data=@var{type}
34754 Control how GCC aligns variables.  Supported values for @var{type} are
34755 @samp{compat} uses increased alignment value compatible uses GCC 4.8
34756 and earlier, @samp{abi} uses alignment value as specified by the
34757 psABI, and @samp{cacheline} uses increased alignment value to match
34758 the cache line size.  @samp{compat} is the default.
34760 @opindex mlarge-data-threshold
34761 @item -mlarge-data-threshold=@var{threshold}
34762 When @option{-mcmodel=medium} or @option{-mcmodel=large} is specified, data
34763 objects larger than @var{threshold} are placed in large data sections.  The
34764 default is 65535.
34766 @opindex mrtd
34767 @item -mrtd
34768 Use a different function-calling convention, in which functions that
34769 take a fixed number of arguments return with the @code{ret @var{num}}
34770 instruction, which pops their arguments while returning.  This saves one
34771 instruction in the caller since there is no need to pop the arguments
34772 there.
34774 You can specify that an individual function is called with this calling
34775 sequence with the function attribute @code{stdcall}.  You can also
34776 override the @option{-mrtd} option by using the function attribute
34777 @code{cdecl}.  @xref{Function Attributes}.
34779 @strong{Warning:} this calling convention is incompatible with the one
34780 normally used on Unix, so you cannot use it if you need to call
34781 libraries compiled with the Unix compiler.
34783 Also, you must provide function prototypes for all functions that
34784 take variable numbers of arguments (including @code{printf});
34785 otherwise incorrect code is generated for calls to those
34786 functions.
34788 In addition, seriously incorrect code results if you call a
34789 function with too many arguments.  (Normally, extra arguments are
34790 harmlessly ignored.)
34792 @opindex mregparm
34793 @item -mregparm=@var{num}
34794 Control how many registers are used to pass integer arguments.  By
34795 default, no registers are used to pass arguments, and at most 3
34796 registers can be used.  You can control this behavior for a specific
34797 function by using the function attribute @code{regparm}.
34798 @xref{Function Attributes}.
34800 @strong{Warning:} if you use this switch, and
34801 @var{num} is nonzero, then you must build all modules with the same
34802 value, including any libraries.  This includes the system libraries and
34803 startup modules.
34805 @opindex msseregparm
34806 @item -msseregparm
34807 Use SSE register passing conventions for float and double arguments
34808 and return values.  You can control this behavior for a specific
34809 function by using the function attribute @code{sseregparm}.
34810 @xref{Function Attributes}.
34812 @strong{Warning:} if you use this switch then you must build all
34813 modules with the same value, including any libraries.  This includes
34814 the system libraries and startup modules.
34816 @opindex mvect8-ret-in-mem
34817 @item -mvect8-ret-in-mem
34818 Return 8-byte vectors in memory instead of MMX registers.  This is the
34819 default on VxWorks to match the ABI of the Sun Studio compilers until
34820 version 12.  @emph{Only} use this option if you need to remain
34821 compatible with existing code produced by those previous compiler
34822 versions or older versions of GCC@.
34824 @opindex mpc32
34825 @opindex mpc64
34826 @opindex mpc80
34827 @item -mpc32
34828 @itemx -mpc64
34829 @itemx -mpc80
34831 Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
34832 is specified, the significands of results of floating-point operations are
34833 rounded to 24 bits (single precision); @option{-mpc64} rounds the
34834 significands of results of floating-point operations to 53 bits (double
34835 precision) and @option{-mpc80} rounds the significands of results of
34836 floating-point operations to 64 bits (extended double precision), which is
34837 the default.  When this option is used, floating-point operations in higher
34838 precisions are not available to the programmer without setting the FPU
34839 control word explicitly.
34841 Setting the rounding of floating-point operations to less than the default
34842 80 bits can speed some programs by 2% or more.  Note that some mathematical
34843 libraries assume that extended-precision (80-bit) floating-point operations
34844 are enabled by default; routines in such libraries could suffer significant
34845 loss of accuracy, typically through so-called ``catastrophic cancellation'',
34846 when this option is used to set the precision to less than extended precision.
34848 @opindex mdaz-ftz
34849 @item -mdaz-ftz
34851 The flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the MXCSR register
34852 are used to control floating-point calculations.SSE and AVX instructions
34853 including scalar and vector instructions could benefit from enabling the FTZ
34854 and DAZ flags when @option{-mdaz-ftz} is specified. Don't set FTZ/DAZ flags
34855 when @option{-mno-daz-ftz} or @option{-shared} is specified, @option{-mdaz-ftz}
34856 will set FTZ/DAZ flags even with @option{-shared}.
34858 @opindex mstackrealign
34859 @item -mstackrealign
34860 Realign the stack at entry.  On the x86, the @option{-mstackrealign}
34861 option generates an alternate prologue and epilogue that realigns the
34862 run-time stack if necessary.  This supports mixing legacy codes that keep
34863 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
34864 SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
34865 applicable to individual functions.
34867 @opindex mpreferred-stack-boundary
34868 @item -mpreferred-stack-boundary=@var{num}
34869 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
34870 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
34871 the default is 4 (16 bytes or 128 bits).
34873 @strong{Warning:} When generating code for the x86-64 architecture with
34874 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
34875 used to keep the stack boundary aligned to 8 byte boundary.  Since
34876 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
34877 intended to be used in controlled environment where stack space is
34878 important limitation.  This option leads to wrong code when functions
34879 compiled with 16 byte stack alignment (such as functions from a standard
34880 library) are called with misaligned stack.  In this case, SSE
34881 instructions may lead to misaligned memory access traps.  In addition,
34882 variable arguments are handled incorrectly for 16 byte aligned
34883 objects (including x87 long double and __int128), leading to wrong
34884 results.  You must build all modules with
34885 @option{-mpreferred-stack-boundary=3}, including any libraries.  This
34886 includes the system libraries and startup modules.
34888 @opindex mincoming-stack-boundary
34889 @item -mincoming-stack-boundary=@var{num}
34890 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
34891 boundary.  If @option{-mincoming-stack-boundary} is not specified,
34892 the one specified by @option{-mpreferred-stack-boundary} is used.
34894 On Pentium and Pentium Pro, @code{double} and @code{long double} values
34895 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
34896 suffer significant run time performance penalties.  On Pentium III, the
34897 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
34898 properly if it is not 16-byte aligned.
34900 To ensure proper alignment of this values on the stack, the stack boundary
34901 must be as aligned as that required by any value stored on the stack.
34902 Further, every function must be generated such that it keeps the stack
34903 aligned.  Thus calling a function compiled with a higher preferred
34904 stack boundary from a function compiled with a lower preferred stack
34905 boundary most likely misaligns the stack.  It is recommended that
34906 libraries that use callbacks always use the default setting.
34908 This extra alignment does consume extra stack space, and generally
34909 increases code size.  Code that is sensitive to stack space usage, such
34910 as embedded systems and operating system kernels, may want to reduce the
34911 preferred alignment to @option{-mpreferred-stack-boundary=2}.
34913 @need 200
34914 @opindex mmmx
34915 @item -mmmx
34916 @need 200
34917 @opindex msse
34918 @itemx -msse
34919 @need 200
34920 @opindex msse2
34921 @itemx -msse2
34922 @need 200
34923 @opindex msse3
34924 @itemx -msse3
34925 @need 200
34926 @opindex mssse3
34927 @itemx -mssse3
34928 @need 200
34929 @opindex msse4
34930 @itemx -msse4
34931 @need 200
34932 @opindex msse4a
34933 @itemx -msse4a
34934 @need 200
34935 @opindex msse4.1
34936 @itemx -msse4.1
34937 @need 200
34938 @opindex msse4.2
34939 @itemx -msse4.2
34940 @need 200
34941 @opindex mavx
34942 @itemx -mavx
34943 @need 200
34944 @opindex mavx2
34945 @itemx -mavx2
34946 @need 200
34947 @opindex mavx512f
34948 @itemx -mavx512f
34949 @need 200
34950 @opindex mavx512pf
34951 @itemx -mavx512pf
34952 @need 200
34953 @opindex mavx512er
34954 @itemx -mavx512er
34955 @need 200
34956 @opindex mavx512cd
34957 @itemx -mavx512cd
34958 @need 200
34959 @opindex mavx512vl
34960 @itemx -mavx512vl
34961 @need 200
34962 @opindex mavx512bw
34963 @itemx -mavx512bw
34964 @need 200
34965 @opindex mavx512dq
34966 @itemx -mavx512dq
34967 @need 200
34968 @opindex mavx512ifma
34969 @itemx -mavx512ifma
34970 @need 200
34971 @opindex mavx512vbmi
34972 @itemx -mavx512vbmi
34973 @need 200
34974 @opindex msha
34975 @itemx -msha
34976 @need 200
34977 @opindex maes
34978 @itemx -maes
34979 @need 200
34980 @opindex mpclmul
34981 @itemx -mpclmul
34982 @need 200
34983 @opindex mclflushopt
34984 @itemx -mclflushopt
34985 @need 200
34986 @opindex mclwb
34987 @itemx -mclwb
34988 @need 200
34989 @opindex mfsgsbase
34990 @itemx -mfsgsbase
34991 @need 200
34992 @opindex mptwrite
34993 @itemx -mptwrite
34994 @need 200
34995 @opindex mrdrnd
34996 @itemx -mrdrnd
34997 @need 200
34998 @opindex mf16c
34999 @itemx -mf16c
35000 @need 200
35001 @opindex mfma
35002 @itemx -mfma
35003 @need 200
35004 @opindex mpconfig
35005 @itemx -mpconfig
35006 @need 200
35007 @opindex mwbnoinvd
35008 @itemx -mwbnoinvd
35009 @need 200
35010 @opindex mfma4
35011 @itemx -mfma4
35012 @need 200
35013 @opindex mprfchw
35014 @itemx -mprfchw
35015 @need 200
35016 @opindex mrdpid
35017 @itemx -mrdpid
35018 @need 200
35019 @opindex mprefetchwt1
35020 @itemx -mprefetchwt1
35021 @need 200
35022 @opindex mrdseed
35023 @itemx -mrdseed
35024 @need 200
35025 @opindex msgx
35026 @itemx -msgx
35027 @need 200
35028 @opindex mxop
35029 @itemx -mxop
35030 @need 200
35031 @opindex mlwp
35032 @itemx -mlwp
35033 @need 200
35034 @opindex m3dnow
35035 @itemx -m3dnow
35036 @need 200
35037 @opindex m3dnowa
35038 @itemx -m3dnowa
35039 @need 200
35040 @opindex mpopcnt
35041 @itemx -mpopcnt
35042 @need 200
35043 @opindex mabm
35044 @itemx -mabm
35045 @need 200
35046 @opindex madx
35047 @itemx -madx
35048 @need 200
35049 @opindex mbmi
35050 @itemx -mbmi
35051 @need 200
35052 @opindex mbmi2
35053 @itemx -mbmi2
35054 @need 200
35055 @opindex mlzcnt
35056 @itemx -mlzcnt
35057 @need 200
35058 @opindex mfxsr
35059 @itemx -mfxsr
35060 @need 200
35061 @opindex mxsave
35062 @itemx -mxsave
35063 @need 200
35064 @opindex mxsaveopt
35065 @itemx -mxsaveopt
35066 @need 200
35067 @opindex mxsavec
35068 @itemx -mxsavec
35069 @need 200
35070 @opindex mxsaves
35071 @itemx -mxsaves
35072 @need 200
35073 @opindex mrtm
35074 @itemx -mrtm
35075 @need 200
35076 @opindex mhle
35077 @itemx -mhle
35078 @need 200
35079 @opindex mtbm
35080 @itemx -mtbm
35081 @need 200
35082 @opindex mmwaitx
35083 @itemx -mmwaitx
35084 @need 200
35085 @opindex mclzero
35086 @itemx -mclzero
35087 @need 200
35088 @opindex mpku
35089 @itemx -mpku
35090 @need 200
35091 @opindex mavx512vbmi2
35092 @itemx -mavx512vbmi2
35093 @need 200
35094 @opindex mavx512bf16
35095 @itemx -mavx512bf16
35096 @need 200
35097 @opindex mavx512fp16
35098 @itemx -mavx512fp16
35099 @need 200
35100 @opindex mgfni
35101 @itemx -mgfni
35102 @need 200
35103 @opindex mvaes
35104 @itemx -mvaes
35105 @need 200
35106 @opindex mwaitpkg
35107 @itemx -mwaitpkg
35108 @need 200
35109 @opindex mvpclmulqdq
35110 @itemx -mvpclmulqdq
35111 @need 200
35112 @opindex mavx512bitalg
35113 @itemx -mavx512bitalg
35114 @need 200
35115 @opindex mmovdiri
35116 @itemx -mmovdiri
35117 @need 200
35118 @opindex mmovdir64b
35119 @itemx -mmovdir64b
35120 @need 200
35121 @opindex menqcmd
35122 @opindex muintr
35123 @itemx -menqcmd
35124 @itemx -muintr
35125 @need 200
35126 @opindex mtsxldtrk
35127 @itemx -mtsxldtrk
35128 @need 200
35129 @opindex mavx512vpopcntdq
35130 @itemx -mavx512vpopcntdq
35131 @need 200
35132 @opindex mavx512vp2intersect
35133 @itemx -mavx512vp2intersect
35134 @need 200
35135 @opindex mavx5124fmaps
35136 @itemx -mavx5124fmaps
35137 @need 200
35138 @opindex mavx512vnni
35139 @itemx -mavx512vnni
35140 @need 200
35141 @opindex mavxvnni
35142 @itemx -mavxvnni
35143 @need 200
35144 @opindex mavx5124vnniw
35145 @itemx -mavx5124vnniw
35146 @need 200
35147 @opindex mcldemote
35148 @itemx -mcldemote
35149 @need 200
35150 @opindex mserialize
35151 @itemx -mserialize
35152 @need 200
35153 @opindex mamx-tile
35154 @itemx -mamx-tile
35155 @need 200
35156 @opindex mamx-int8
35157 @itemx -mamx-int8
35158 @need 200
35159 @opindex mamx-bf16
35160 @itemx -mamx-bf16
35161 @need 200
35162 @opindex mhreset
35163 @opindex mkl
35164 @itemx -mhreset
35165 @itemx -mkl
35166 @need 200
35167 @opindex mwidekl
35168 @itemx -mwidekl
35169 @need 200
35170 @opindex mavxifma
35171 @itemx -mavxifma
35172 @need 200
35173 @opindex mavxvnniint8
35174 @itemx -mavxvnniint8
35175 @need 200
35176 @opindex mavxneconvert
35177 @itemx -mavxneconvert
35178 @need 200
35179 @opindex mcmpccxadd
35180 @itemx -mcmpccxadd
35181 @need 200
35182 @opindex mamx-fp16
35183 @itemx -mamx-fp16
35184 @need 200
35185 @opindex mprefetchi
35186 @itemx -mprefetchi
35187 @need 200
35188 @opindex mraoint
35189 @itemx -mraoint
35190 @need 200
35191 @opindex mamx-complex
35192 @itemx -mamx-complex
35193 @need 200
35194 @opindex mavxvnniint16
35195 @itemx -mavxvnniint16
35196 @need 200
35197 @opindex msm3
35198 @itemx -msm3
35199 @need 200
35200 @opindex msha512
35201 @itemx -msha512
35202 @need 200
35203 @opindex msm4
35204 @itemx -msm4
35205 @need 200
35206 @opindex mapxf
35207 @itemx -mapxf
35208 @need 200
35209 @opindex musermsr
35210 @itemx -musermsr
35211 @need 200
35212 @opindex mavx10.1
35213 @itemx -mavx10.1
35214 @need 200
35215 @opindex mavx10.1-256
35216 @itemx -mavx10.1-256
35217 @need 200
35218 @opindex mavx10.1-512
35219 @itemx -mavx10.1-512
35220 These switches enable the use of instructions in the MMX, SSE,
35221 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
35222 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
35223 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
35224 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
35225 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
35226 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
35227 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
35228 UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512-FP16,
35229 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AMX-FP16, PREFETCHI, RAOINT,
35230 AMX-COMPLEX, AVXVNNIINT16, SM3, SHA512, SM4, APX_F, USER_MSR, AVX10.1 or
35231 CLDEMOTE extended instruction sets.  Each has a corresponding @option{-mno-}
35232 option to disable use of these instructions.
35234 These extensions are also available as built-in functions: see
35235 @ref{x86 Built-in Functions}, for details of the functions enabled and
35236 disabled by these switches.
35238 To generate SSE/SSE2 instructions automatically from floating-point
35239 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
35241 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
35242 generates new AVX instructions or AVX equivalence for all SSEx instructions
35243 when needed.
35245 These options enable GCC to use these extended instructions in
35246 generated code, even without @option{-mfpmath=sse}.  Applications that
35247 perform run-time CPU detection must compile separate files for each
35248 supported architecture, using the appropriate flags.  In particular,
35249 the file containing the CPU detection code should be compiled without
35250 these options.
35252 @opindex mdump-tune-features
35253 @item -mdump-tune-features
35254 This option instructs GCC to dump the names of the x86 performance 
35255 tuning features and default settings. The names can be used in 
35256 @option{-mtune-ctrl=@var{feature-list}}.
35258 @opindex mtune-ctrl=@var{feature-list}
35259 @item -mtune-ctrl=@var{feature-list}
35260 This option is used to do fine grain control of x86 code generation features.
35261 @var{feature-list} is a comma separated list of @var{feature} names. See also
35262 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
35263 on if it is not preceded with @samp{^}, otherwise, it is turned off. 
35264 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
35265 developers. Using it may lead to code paths not covered by testing and can
35266 potentially result in compiler ICEs or runtime errors.
35268 @opindex mno-default
35269 @item -mno-default
35270 This option instructs GCC to turn off all tunable features. See also 
35271 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
35273 @opindex mcld
35274 @item -mcld
35275 This option instructs GCC to emit a @code{cld} instruction in the prologue
35276 of functions that use string instructions.  String instructions depend on
35277 the DF flag to select between autoincrement or autodecrement mode.  While the
35278 ABI specifies the DF flag to be cleared on function entry, some operating
35279 systems violate this specification by not clearing the DF flag in their
35280 exception dispatchers.  The exception handler can be invoked with the DF flag
35281 set, which leads to wrong direction mode when string instructions are used.
35282 This option can be enabled by default on 32-bit x86 targets by configuring
35283 GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
35284 instructions can be suppressed with the @option{-mno-cld} compiler option
35285 in this case.
35287 @opindex mvzeroupper
35288 @item -mvzeroupper
35289 This option instructs GCC to emit a @code{vzeroupper} instruction
35290 before a transfer of control flow out of the function to minimize
35291 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
35292 intrinsics.
35294 @opindex mprefer-avx128
35295 @item -mprefer-avx128
35296 This option instructs GCC to use 128-bit AVX instructions instead of
35297 256-bit AVX instructions in the auto-vectorizer.
35299 @opindex mprefer-vector-width
35300 @item -mprefer-vector-width=@var{opt}
35301 This option instructs GCC to use @var{opt}-bit vector width in instructions
35302 instead of default on the selected platform.
35304 @opindex mpartial-vector-fp-math
35305 @item -mpartial-vector-fp-math
35306 This option enables GCC to generate floating-point operations that might
35307 affect the set of floating-point status flags on partial vectors, where
35308 vector elements reside in the low part of the 128-bit SSE register.  Unless
35309 @option{-fno-trapping-math} is specified, the compiler guarantees correct
35310 behavior by sanitizing all input operands to have zeroes in the unused
35311 upper part of the vector register.  Note that by using built-in functions
35312 or inline assembly with partial vector arguments, NaNs, denormal or invalid
35313 values can leak into the upper part of the vector, causing possible
35314 performance issues when @option{-fno-trapping-math} is in effect.  These
35315 issues can be mitigated by manually sanitizing the upper part of the partial
35316 vector argument register or by using @option{-mdaz-ftz} to set
35317 denormals-are-zero (DAZ) flag in the MXCSR register.
35319 This option is enabled by default.
35321 @opindex mmove-max
35322 @item -mmove-max=@var{bits}
35323 This option instructs GCC to set the maximum number of bits can be
35324 moved from memory to memory efficiently to @var{bits}.  The valid
35325 @var{bits} are 128, 256 and 512.
35327 @opindex mstore-max
35328 @item -mstore-max=@var{bits}
35329 This option instructs GCC to set the maximum number of bits can be
35330 stored to memory efficiently to @var{bits}.  The valid @var{bits} are
35331 128, 256 and 512.
35333 @table @samp
35334 @item none
35335 No extra limitations applied to GCC other than defined by the selected platform.
35337 @item 128
35338 Prefer 128-bit vector width for instructions.
35340 @item 256
35341 Prefer 256-bit vector width for instructions.
35343 @item 512
35344 Prefer 512-bit vector width for instructions.
35345 @end table
35347 @opindex mcx16
35348 @item -mcx16
35349 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
35350 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
35351 objects.  This is useful for atomic updates of data structures exceeding one
35352 machine word in size.  The compiler uses this instruction to implement
35353 @ref{__sync Builtins}.  However, for @ref{__atomic Builtins} operating on
35354 128-bit integers, a library call is always used.
35356 @opindex msahf
35357 @item -msahf
35358 This option enables generation of @code{SAHF} instructions in 64-bit code.
35359 Early Intel Pentium 4 CPUs with Intel 64 support,
35360 prior to the introduction of Pentium 4 G1 step in December 2005,
35361 lacked the @code{LAHF} and @code{SAHF} instructions
35362 which are supported by AMD64.
35363 These are load and store instructions, respectively, for certain status flags.
35364 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
35365 @code{drem}, and @code{remainder} built-in functions;
35366 see @ref{Other Builtins} for details.
35368 @opindex mmovbe
35369 @item -mmovbe
35370 This option enables use of the @code{movbe} instruction to optimize
35371 byte swapping of four and eight byte entities.
35373 @opindex mshstk
35374 @item -mshstk
35375 The @option{-mshstk} option enables shadow stack built-in functions
35376 from x86 Control-flow Enforcement Technology (CET).
35378 @opindex mcrc32
35379 @item -mcrc32
35380 This option enables built-in functions @code{__builtin_ia32_crc32qi},
35381 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
35382 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
35384 @opindex mmwait
35385 @item -mmwait
35386 This option enables built-in functions @code{__builtin_ia32_monitor},
35387 and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
35388 @code{mwait} machine instructions.
35390 @opindex mrecip
35391 @item -mrecip
35392 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
35393 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
35394 with an additional Newton-Raphson step
35395 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
35396 (and their vectorized
35397 variants) for single-precision floating-point arguments.  These instructions
35398 are generated only when @option{-funsafe-math-optimizations} is enabled
35399 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
35400 Note that while the throughput of the sequence is higher than the throughput
35401 of the non-reciprocal instruction, the precision of the sequence can be
35402 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
35404 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
35405 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
35406 combination), and doesn't need @option{-mrecip}.
35408 Also note that GCC emits the above sequence with additional Newton-Raphson step
35409 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
35410 already with @option{-ffast-math} (or the above option combination), and
35411 doesn't need @option{-mrecip}.
35413 @opindex mrecip=opt
35414 @item -mrecip=@var{opt}
35415 This option controls which reciprocal estimate instructions
35416 may be used.  @var{opt} is a comma-separated list of options, which may
35417 be preceded by a @samp{!} to invert the option:
35419 @table @samp
35420 @item all
35421 Enable all estimate instructions.
35423 @item default
35424 Enable the default instructions, equivalent to @option{-mrecip}.
35426 @item none
35427 Disable all estimate instructions, equivalent to @option{-mno-recip}.
35429 @item div
35430 Enable the approximation for scalar division.
35432 @item vec-div
35433 Enable the approximation for vectorized division.
35435 @item sqrt
35436 Enable the approximation for scalar square root.
35438 @item vec-sqrt
35439 Enable the approximation for vectorized square root.
35440 @end table
35442 So, for example, @option{-mrecip=all,!sqrt} enables
35443 all of the reciprocal approximations, except for square root.
35445 @opindex mveclibabi
35446 @item -mveclibabi=@var{type}
35447 Specifies the ABI type to use for vectorizing intrinsics using an
35448 external library.  Supported values for @var{type} are @samp{svml} 
35449 for the Intel short
35450 vector math library and @samp{acml} for the AMD math core library.
35451 To use this option, both @option{-ftree-vectorize} and
35452 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 
35453 ABI-compatible library must be specified at link time.
35455 GCC currently emits calls to @code{vmldExp2},
35456 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
35457 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
35458 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
35459 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
35460 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
35461 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
35462 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
35463 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
35464 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
35465 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
35466 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
35467 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
35468 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
35469 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
35470 when @option{-mveclibabi=acml} is used.  
35472 @opindex mabi
35473 @item -mabi=@var{name}
35474 Generate code for the specified calling convention.  Permissible values
35475 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
35476 @samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
35477 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
35478 You can control this behavior for specific functions by
35479 using the function attributes @code{ms_abi} and @code{sysv_abi}.
35480 @xref{Function Attributes}.
35482 @opindex mforce-indirect-call
35483 @item -mforce-indirect-call
35484 Force all calls to functions to be indirect. This is useful
35485 when using Intel Processor Trace where it generates more precise timing
35486 information for function calls.
35488 @opindex mmanual-endbr
35489 @item -mmanual-endbr
35490 Insert ENDBR instruction at function entry only via the @code{cf_check}
35491 function attribute. This is useful when used with the option
35492 @option{-fcf-protection=branch} to control ENDBR insertion at the
35493 function entry.
35495 @opindex mcet-switch
35496 @item -mcet-switch
35497 By default, CET instrumentation is turned off on switch statements that
35498 use a jump table and indirect branch track is disabled.  Since jump
35499 tables are stored in read-only memory, this does not result in a direct
35500 loss of hardening.  But if the jump table index is attacker-controlled,
35501 the indirect jump may not be constrained by CET.  This option turns on
35502 CET instrumentation to enable indirect branch track for switch statements
35503 with jump tables which leads to the jump targets reachable via any indirect
35504 jumps.
35506 @opindex mcall-ms2sysv-xlogues
35507 @opindex mno-call-ms2sysv-xlogues
35508 @item -mcall-ms2sysv-xlogues
35509 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
35510 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered.  By
35511 default, the code for saving and restoring these registers is emitted inline,
35512 resulting in fairly lengthy prologues and epilogues.  Using
35513 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
35514 use stubs in the static portion of libgcc to perform these saves and restores,
35515 thus reducing function size at the cost of a few extra instructions.
35517 @opindex mtls-dialect
35518 @item -mtls-dialect=@var{type}
35519 Generate code to access thread-local storage using the @samp{gnu} or
35520 @samp{gnu2} conventions.  @samp{gnu} is the conservative default;
35521 @samp{gnu2} is more efficient, but it may add compile- and run-time
35522 requirements that cannot be satisfied on all systems.
35524 @opindex mpush-args
35525 @opindex mno-push-args
35526 @item -mpush-args
35527 @itemx -mno-push-args
35528 Use PUSH operations to store outgoing parameters.  This method is shorter
35529 and usually equally fast as method using SUB/MOV operations and is enabled
35530 by default.  In some cases disabling it may improve performance because of
35531 improved scheduling and reduced dependencies.
35533 @opindex maccumulate-outgoing-args
35534 @item -maccumulate-outgoing-args
35535 If enabled, the maximum amount of space required for outgoing arguments is
35536 computed in the function prologue.  This is faster on most modern CPUs
35537 because of reduced dependencies, improved scheduling and reduced stack usage
35538 when the preferred stack boundary is not equal to 2.  The drawback is a notable
35539 increase in code size.  This switch implies @option{-mno-push-args}.
35541 @opindex mthreads
35542 @item -mthreads
35543 Support thread-safe exception handling on MinGW.  Programs that rely
35544 on thread-safe exception handling must compile and link all code with the
35545 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
35546 @option{-D_MT}; when linking, it links in a special thread helper library
35547 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
35549 @opindex mms-bitfields
35550 @opindex mno-ms-bitfields
35551 @item -mms-bitfields
35552 @itemx -mno-ms-bitfields
35554 Enable/disable bit-field layout compatible with the native Microsoft
35555 Windows compiler.  
35557 If @code{packed} is used on a structure, or if bit-fields are used,
35558 it may be that the Microsoft ABI lays out the structure differently
35559 than the way GCC normally does.  Particularly when moving packed
35560 data between functions compiled with GCC and the native Microsoft compiler
35561 (either via function call or as data in a file), it may be necessary to access
35562 either format.
35564 This option is enabled by default for Microsoft Windows
35565 targets.  This behavior can also be controlled locally by use of variable
35566 or type attributes.  For more information, see @ref{x86 Variable Attributes}
35567 and @ref{x86 Type Attributes}.
35569 The Microsoft structure layout algorithm is fairly simple with the exception
35570 of the bit-field packing.  
35571 The padding and alignment of members of structures and whether a bit-field 
35572 can straddle a storage-unit boundary are determine by these rules:
35574 @enumerate
35575 @item Structure members are stored sequentially in the order in which they are
35576 declared: the first member has the lowest memory address and the last member
35577 the highest.
35579 @item Every data object has an alignment requirement.  The alignment requirement
35580 for all data except structures, unions, and arrays is either the size of the
35581 object or the current packing size (specified with either the
35582 @code{aligned} attribute or the @code{pack} pragma),
35583 whichever is less.  For structures, unions, and arrays,
35584 the alignment requirement is the largest alignment requirement of its members.
35585 Every object is allocated an offset so that:
35587 @smallexample
35588 offset % alignment_requirement == 0
35589 @end smallexample
35591 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
35592 unit if the integral types are the same size and if the next bit-field fits
35593 into the current allocation unit without crossing the boundary imposed by the
35594 common alignment requirements of the bit-fields.
35595 @end enumerate
35597 MSVC interprets zero-length bit-fields in the following ways:
35599 @enumerate
35600 @item If a zero-length bit-field is inserted between two bit-fields that
35601 are normally coalesced, the bit-fields are not coalesced.
35603 For example:
35605 @smallexample
35606 struct
35607  @{
35608    unsigned long bf_1 : 12;
35609    unsigned long : 0;
35610    unsigned long bf_2 : 12;
35611  @} t1;
35612 @end smallexample
35614 @noindent
35615 The size of @code{t1} is 8 bytes with the zero-length bit-field.  If the
35616 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
35618 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
35619 alignment of the zero-length bit-field is greater than the member that follows it,
35620 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
35622 For example:
35624 @smallexample
35625 struct
35626  @{
35627    char foo : 4;
35628    short : 0;
35629    char bar;
35630  @} t2;
35632 struct
35633  @{
35634    char foo : 4;
35635    short : 0;
35636    double bar;
35637  @} t3;
35638 @end smallexample
35640 @noindent
35641 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
35642 Accordingly, the size of @code{t2} is 4.  For @code{t3}, the zero-length
35643 bit-field does not affect the alignment of @code{bar} or, as a result, the size
35644 of the structure.
35646 Taking this into account, it is important to note the following:
35648 @enumerate
35649 @item If a zero-length bit-field follows a normal bit-field, the type of the
35650 zero-length bit-field may affect the alignment of the structure as whole. For
35651 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
35652 normal bit-field, and is of type short.
35654 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
35655 still affect the alignment of the structure:
35657 @smallexample
35658 struct
35659  @{
35660    char foo : 6;
35661    long : 0;
35662  @} t4;
35663 @end smallexample
35665 @noindent
35666 Here, @code{t4} takes up 4 bytes.
35667 @end enumerate
35669 @item Zero-length bit-fields following non-bit-field members are ignored:
35671 @smallexample
35672 struct
35673  @{
35674    char foo;
35675    long : 0;
35676    char bar;
35677  @} t5;
35678 @end smallexample
35680 @noindent
35681 Here, @code{t5} takes up 2 bytes.
35682 @end enumerate
35685 @opindex mno-align-stringops
35686 @opindex malign-stringops
35687 @item -mno-align-stringops
35688 Do not align the destination of inlined string operations.  This switch reduces
35689 code size and improves performance in case the destination is already aligned,
35690 but GCC doesn't know about it.
35692 @opindex minline-all-stringops
35693 @item -minline-all-stringops
35694 By default GCC inlines string operations only when the destination is 
35695 known to be aligned to least a 4-byte boundary.  
35696 This enables more inlining and increases code
35697 size, but may improve performance of code that depends on fast
35698 @code{memcpy} and @code{memset} for short lengths.
35699 The option enables inline expansion of @code{strlen} for all
35700 pointer alignments.
35702 @opindex minline-stringops-dynamically
35703 @item -minline-stringops-dynamically
35704 For string operations of unknown size, use run-time checks with
35705 inline code for small blocks and a library call for large blocks.
35707 @opindex mstringop-strategy=@var{alg}
35708 @item -mstringop-strategy=@var{alg}
35709 Override the internal decision heuristic for the particular algorithm to use
35710 for inlining string operations.  The allowed values for @var{alg} are:
35712 @table @samp
35713 @item rep_byte
35714 @itemx rep_4byte
35715 @itemx rep_8byte
35716 Expand using i386 @code{rep} prefix of the specified size.
35718 @item byte_loop
35719 @itemx loop
35720 @itemx unrolled_loop
35721 Expand into an inline loop.
35723 @item libcall
35724 Always use a library call.
35725 @end table
35727 @opindex mmemcpy-strategy=@var{strategy}
35728 @item -mmemcpy-strategy=@var{strategy}
35729 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
35730 should be inlined and what inline algorithm to use when the expected size
35731 of the copy operation is known. @var{strategy} 
35732 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 
35733 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
35734 the max byte size with which inline algorithm @var{alg} is allowed.  For the last
35735 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
35736 in the list must be specified in increasing order.  The minimal byte size for 
35737 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 
35738 preceding range.
35740 @opindex mmemset-strategy=@var{strategy}
35741 @item -mmemset-strategy=@var{strategy}
35742 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
35743 @code{__builtin_memset} expansion.
35745 @opindex momit-leaf-frame-pointer
35746 @item -momit-leaf-frame-pointer
35747 Don't keep the frame pointer in a register for leaf functions.  This
35748 avoids the instructions to save, set up, and restore frame pointers and
35749 makes an extra register available in leaf functions.  The option
35750 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
35751 which might make debugging harder.
35753 @opindex mtls-direct-seg-refs
35754 @item -mtls-direct-seg-refs
35755 @itemx -mno-tls-direct-seg-refs
35756 Controls whether TLS variables may be accessed with offsets from the
35757 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
35758 or whether the thread base pointer must be added.  Whether or not this
35759 is valid depends on the operating system, and whether it maps the
35760 segment to cover the entire TLS area.
35762 For systems that use the GNU C Library, the default is on.
35764 @opindex msse2avx
35765 @item -msse2avx
35766 @itemx -mno-sse2avx
35767 Specify that the assembler should encode SSE instructions with VEX
35768 prefix.  The option @option{-mavx} turns this on by default.
35770 @opindex mfentry
35771 @item -mfentry
35772 @itemx -mno-fentry
35773 If profiling is active (@option{-pg}), put the profiling
35774 counter call before the prologue.
35775 Note: On x86 architectures the attribute @code{ms_hook_prologue}
35776 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
35778 @opindex mrecord-mcount
35779 @item -mrecord-mcount
35780 @itemx -mno-record-mcount
35781 If profiling is active (@option{-pg}), generate a __mcount_loc section
35782 that contains pointers to each profiling call. This is useful for
35783 automatically patching and out calls.
35785 @opindex mnop-mcount
35786 @item -mnop-mcount
35787 @itemx -mno-nop-mcount
35788 If profiling is active (@option{-pg}), generate the calls to
35789 the profiling functions as NOPs. This is useful when they
35790 should be patched in later dynamically. This is likely only
35791 useful together with @option{-mrecord-mcount}.
35793 @opindex minstrument-return
35794 @item -minstrument-return=@var{type}
35795 Instrument function exit in -pg -mfentry instrumented functions with
35796 call to specified function. This only instruments true returns ending
35797 with ret, but not sibling calls ending with jump. Valid types
35798 are @var{none} to not instrument, @var{call} to generate a call to __return__,
35799 or @var{nop5} to generate a 5 byte nop.
35801 @opindex mrecord-return
35802 @item -mrecord-return
35803 @itemx -mno-record-return
35804 Generate a __return_loc section pointing to all return instrumentation code.
35806 @opindex mfentry-name
35807 @item -mfentry-name=@var{name}
35808 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
35810 @opindex mfentry-section
35811 @item -mfentry-section=@var{name}
35812 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
35814 @opindex mskip-rax-setup
35815 @item -mskip-rax-setup
35816 @itemx -mno-skip-rax-setup
35817 When generating code for the x86-64 architecture with SSE extensions
35818 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
35819 register when there are no variable arguments passed in vector registers.
35821 @strong{Warning:} Since RAX register is used to avoid unnecessarily
35822 saving vector registers on stack when passing variable arguments, the
35823 impacts of this option are callees may waste some stack space,
35824 misbehave or jump to a random location.  GCC 4.4 or newer don't have
35825 those issues, regardless the RAX register value.
35827 @opindex m8bit-idiv
35828 @item -m8bit-idiv
35829 @itemx -mno-8bit-idiv
35830 On some processors, like Intel Atom, 8-bit unsigned integer divide is
35831 much faster than 32-bit/64-bit integer divide.  This option generates a
35832 run-time check.  If both dividend and divisor are within range of 0
35833 to 255, 8-bit unsigned integer divide is used instead of
35834 32-bit/64-bit integer divide.
35836 @opindex mavx256-split-unaligned-load
35837 @opindex mavx256-split-unaligned-store
35838 @item -mavx256-split-unaligned-load
35839 @itemx -mavx256-split-unaligned-store
35840 Split 32-byte AVX unaligned load and store.
35842 @opindex mstack-protector-guard
35843 @opindex mstack-protector-guard-reg
35844 @opindex mstack-protector-guard-offset
35845 @item -mstack-protector-guard=@var{guard}
35846 @itemx -mstack-protector-guard-reg=@var{reg}
35847 @itemx -mstack-protector-guard-offset=@var{offset}
35848 Generate stack protection code using canary at @var{guard}.  Supported
35849 locations are @samp{global} for global canary or @samp{tls} for per-thread
35850 canary in the TLS block (the default).  This option has effect only when
35851 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
35853 With the latter choice the options
35854 @option{-mstack-protector-guard-reg=@var{reg}} and
35855 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
35856 which segment register (@code{%fs} or @code{%gs}) to use as base register
35857 for reading the canary, and from what offset from that base register.
35858 The default for those is as specified in the relevant ABI.
35860 @opindex mgeneral-regs-only
35861 @item -mgeneral-regs-only
35862 Generate code that uses only the general-purpose registers.  This
35863 prevents the compiler from using floating-point, vector, mask and bound
35864 registers.
35866 @opindex mrelax-cmpxchg-loop
35867 @item -mrelax-cmpxchg-loop
35868 When emitting a compare-and-swap loop for @ref{__sync Builtins}
35869 and @ref{__atomic Builtins} lacking a native instruction, optimize
35870 for the highly contended case by issuing an atomic load before the
35871 @code{CMPXCHG} instruction, and using the @code{PAUSE} instruction
35872 to save CPU power when restarting the loop.
35874 @opindex mindirect-branch
35875 @item -mindirect-branch=@var{choice}
35876 Convert indirect call and jump with @var{choice}.  The default is
35877 @samp{keep}, which keeps indirect call and jump unmodified.
35878 @samp{thunk} converts indirect call and jump to call and return thunk.
35879 @samp{thunk-inline} converts indirect call and jump to inlined call
35880 and return thunk.  @samp{thunk-extern} converts indirect call and jump
35881 to external call and return thunk provided in a separate object file.
35882 You can control this behavior for a specific function by using the
35883 function attribute @code{indirect_branch}.  @xref{Function Attributes}.
35885 Note that @option{-mcmodel=large} is incompatible with
35886 @option{-mindirect-branch=thunk} and
35887 @option{-mindirect-branch=thunk-extern} since the thunk function may
35888 not be reachable in the large code model.
35890 Note that @option{-mindirect-branch=thunk-extern} is compatible with
35891 @option{-fcf-protection=branch} since the external thunk can be made
35892 to enable control-flow check.
35894 @opindex mfunction-return
35895 @item -mfunction-return=@var{choice}
35896 Convert function return with @var{choice}.  The default is @samp{keep},
35897 which keeps function return unmodified.  @samp{thunk} converts function
35898 return to call and return thunk.  @samp{thunk-inline} converts function
35899 return to inlined call and return thunk.  @samp{thunk-extern} converts
35900 function return to external call and return thunk provided in a separate
35901 object file.  You can control this behavior for a specific function by
35902 using the function attribute @code{function_return}.
35903 @xref{Function Attributes}.
35905 Note that @option{-mindirect-return=thunk-extern} is compatible with
35906 @option{-fcf-protection=branch} since the external thunk can be made
35907 to enable control-flow check.
35909 Note that @option{-mcmodel=large} is incompatible with
35910 @option{-mfunction-return=thunk} and
35911 @option{-mfunction-return=thunk-extern} since the thunk function may
35912 not be reachable in the large code model.
35915 @opindex mindirect-branch-register
35916 @item -mindirect-branch-register
35917 Force indirect call and jump via register.
35919 @opindex mharden-sls
35920 @item -mharden-sls=@var{choice}
35921 Generate code to mitigate against straight line speculation (SLS) with
35922 @var{choice}.  The default is @samp{none} which disables all SLS
35923 hardening.  @samp{return} enables SLS hardening for function returns.
35924 @samp{indirect-jmp} enables SLS hardening for indirect jumps.
35925 @samp{all} enables all SLS hardening.
35927 @opindex mindirect-branch-cs-prefix
35928 @item -mindirect-branch-cs-prefix
35929 Add CS prefix to call and jmp to indirect thunk with branch target in
35930 r8-r15 registers so that the call and jmp instruction length is 6 bytes
35931 to allow them to be replaced with @samp{lfence; call *%r8-r15} or
35932 @samp{lfence; jmp *%r8-r15} at run-time.
35934 @opindex mapx-inline-asm-use-gpr32
35935 @item -mapx-inline-asm-use-gpr32
35936 For inline asm support with APX, by default the EGPR feature was
35937 disabled to prevent potential illegal instruction with EGPR occurs.
35938 To invoke egpr usage in inline asm, use new compiler option
35939 -mapx-inline-asm-use-gpr32 and user should ensure the instruction
35940 supports EGPR.
35942 @opindex mevex512
35943 @item -mevex512
35944 @itemx -mno-evex512
35945 Enables/disables 512-bit vector. It will be default on if AVX512F is enabled.
35947 @end table
35949 These @samp{-m} switches are supported in addition to the above
35950 on x86-64 processors in 64-bit environments.
35952 @table @gcctabopt
35953 @opindex m32
35954 @opindex m64
35955 @opindex mx32
35956 @opindex m16
35957 @opindex miamcu
35958 @item -m32
35959 @itemx -m64
35960 @itemx -mx32
35961 @itemx -m16
35962 @itemx -miamcu
35963 Generate code for a 16-bit, 32-bit or 64-bit environment.
35964 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
35965 to 32 bits, and
35966 generates code that runs in 32-bit mode.
35968 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
35969 types to 64 bits, and generates code for the x86-64 architecture.
35970 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
35971 and @option{-mdynamic-no-pic} options.
35973 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
35974 to 32 bits, and
35975 generates code for the x86-64 architecture.
35977 The @option{-m16} option is the same as @option{-m32}, except for that
35978 it outputs the @code{.code16gcc} assembly directive at the beginning of
35979 the assembly output so that the binary can run in 16-bit mode.
35981 The @option{-miamcu} option generates code which conforms to Intel MCU
35982 psABI.  It requires the @option{-m32} option to be turned on.
35984 @opindex mno-red-zone
35985 @opindex mred-zone
35986 @item -mno-red-zone
35987 Do not use a so-called ``red zone'' for x86-64 code.  The red zone is mandated
35988 by the x86-64 ABI; it is a 128-byte area beyond the location of the
35989 stack pointer that is not modified by signal or interrupt handlers
35990 and therefore can be used for temporary data without adjusting the stack
35991 pointer.  The flag @option{-mno-red-zone} disables this red zone.
35993 @opindex mcmodel=small
35994 @item -mcmodel=small
35995 Generate code for the small code model: the program and its symbols must
35996 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
35997 Programs can be statically or dynamically linked.  This is the default
35998 code model.
36000 @opindex mcmodel=kernel
36001 @item -mcmodel=kernel
36002 Generate code for the kernel code model.  The kernel runs in the
36003 negative 2 GB of the address space.
36004 This model has to be used for Linux kernel code.
36006 @opindex mcmodel=medium
36007 @item -mcmodel=medium
36008 Generate code for the medium model: the program is linked in the lower 2
36009 GB of the address space.  Small symbols are also placed there.  Symbols
36010 with sizes larger than @option{-mlarge-data-threshold} are put into
36011 large data or BSS sections and can be located above 2GB.  Programs can
36012 be statically or dynamically linked.
36014 @opindex mcmodel=large
36015 @item -mcmodel=large
36016 Generate code for the large model.  This model makes no assumptions
36017 about addresses and sizes of sections.
36019 @opindex maddress-mode=long
36020 @item -maddress-mode=long
36021 Generate code for long address mode.  This is only supported for 64-bit
36022 and x32 environments.  It is the default address mode for 64-bit
36023 environments.
36025 @opindex maddress-mode=short
36026 @item -maddress-mode=short
36027 Generate code for short address mode.  This is only supported for 32-bit
36028 and x32 environments.  It is the default address mode for 32-bit and
36029 x32 environments.
36031 @opindex mneeded
36032 @item -mneeded
36033 @itemx -mno-needed
36034 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
36035 indicate the micro-architecture ISA level required to execute the binary.
36037 @opindex mno-direct-extern-access
36038 @opindex mdirect-extern-access
36039 @item -mno-direct-extern-access
36040 Without @option{-fpic} nor @option{-fPIC}, always use the GOT pointer
36041 to access external symbols.  With @option{-fpic} or @option{-fPIC},
36042 treat access to protected symbols as local symbols.  The default is
36043 @option{-mdirect-extern-access}.
36045 @strong{Warning:} shared libraries compiled with
36046 @option{-mno-direct-extern-access} and executable compiled with
36047 @option{-mdirect-extern-access} may not be binary compatible if
36048 protected symbols are used in shared libraries and executable.
36050 @opindex munroll-only-small-loops
36051 @opindex mno-unroll-only-small-loops
36052 @item -munroll-only-small-loops
36053 Controls conservative small loop unrolling. It is default enabled by
36054 O2, and unrolls loop with less than 4 insns by 1 time. Explicit
36055 -f[no-]unroll-[all-]loops would disable this flag to avoid any
36056 unintended unrolling behavior that user does not want.
36058 @opindex mlam
36059 @item -mlam=@var{choice}
36060 LAM(linear-address masking) allows special bits in the pointer to be used
36061 for metadata. The default is @samp{none}. With @samp{u48}, pointer bits in
36062 positions 62:48 can be used for metadata; With @samp{u57}, pointer bits in
36063 positions 62:57 can be used for metadata.
36064 @end table
36066 @node x86 Windows Options
36067 @subsection x86 Windows Options
36068 @cindex x86 Windows Options
36069 @cindex Windows Options for x86
36071 These additional options are available for Microsoft Windows targets:
36073 @table @gcctabopt
36074 @opindex mconsole
36075 @item -mconsole
36076 This option
36077 specifies that a console application is to be generated, by
36078 instructing the linker to set the PE header subsystem type
36079 required for console applications.
36080 This option is available for Cygwin and MinGW targets and is
36081 enabled by default on those targets.
36083 @opindex mcrtdll
36084 @item -mcrtdll=@var{library}
36085 Preprocess, compile or link with specified C RunTime DLL @var{library}.
36086 This option adjust predefined macros @code{__CRTDLL__}, @code{__MSVCRT__}
36087 and @code{__MSVCRT_VERSION__} for specified CRT @var{library}, choose
36088 start file for CRT @var{library} and link with CRT @var{library}.
36089 Recognized CRT library names for proprocessor are:
36090 @code{crtdll}, @code{msvcrt10}, @code{msvcrt20}, @code{msvcrt40},
36091 @code{msvcrt-os}, @code{msvcr70}, @code{msvcr80}, @code{msvcr90},
36092 @code{msvcr100}, @code{msvcr110}, @code{msvcr120} and @code{ucrt}.
36093 If this options is not specified then the default MinGW import library
36094 @code{msvcrt} is used for linking and no other adjustment for
36095 preprocessor is done. MinGW import library @code{msvcrt} is just a
36096 symlink to (or a copy of) another MinGW CRT import library
36097 chosen during MinGW compilation. MinGW import library @code{msvcrt-os}
36098 is for Windows system CRT DLL library @code{msvcrt.dll} and
36099 in most cases is the default MinGW import library.
36100 Generally speaking, changing the CRT DLL requires recompiling
36101 the entire MinGW CRT. This option is for experimental and testing
36102 purposes only.
36103 This option is available for MinGW targets.
36105 @opindex mdll
36106 @item -mdll
36107 This option is available for Cygwin and MinGW targets.  It
36108 specifies that a DLL---a dynamic link library---is to be
36109 generated, enabling the selection of the required runtime
36110 startup object and entry point.
36112 @opindex mnop-fun-dllimport
36113 @item -mnop-fun-dllimport
36114 This option is available for Cygwin and MinGW targets.  It
36115 specifies that the @code{dllimport} attribute should be ignored.
36117 @opindex mthreads
36118 @item -mthreads
36119 This option is available for MinGW targets. It specifies
36120 that MinGW-specific thread support is to be used.
36122 @opindex municode
36123 @item -municode
36124 This option is available for MinGW-w64 targets.  It causes
36125 the @code{UNICODE} preprocessor macro to be predefined, and
36126 chooses Unicode-capable runtime startup code.
36128 @opindex mwin32
36129 @item -mwin32
36130 This option is available for Cygwin and MinGW targets.  It
36131 specifies that the typical Microsoft Windows predefined macros are to
36132 be set in the pre-processor, but does not influence the choice
36133 of runtime library/startup code.
36135 @opindex mwindows
36136 @item -mwindows
36137 This option is available for Cygwin and MinGW targets.  It
36138 specifies that a GUI application is to be generated by
36139 instructing the linker to set the PE header subsystem type
36140 appropriately.
36142 @opindex fno-set-stack-executable
36143 @opindex fset-stack-executable
36144 @item -fno-set-stack-executable
36145 This option is available for MinGW targets. It specifies that
36146 the executable flag for the stack used by nested functions isn't
36147 set. This is necessary for binaries running in kernel mode of
36148 Microsoft Windows, as there the User32 API, which is used to set executable
36149 privileges, isn't available.
36151 @opindex fno-writable-relocated-rdata
36152 @opindex fwritable-relocated-rdata
36153 @item -fwritable-relocated-rdata
36154 This option is available for MinGW and Cygwin targets.  It specifies
36155 that relocated-data in read-only section is put into the @code{.data}
36156 section.  This is a necessary for older runtimes not supporting
36157 modification of @code{.rdata} sections for pseudo-relocation.
36159 @opindex mpe-aligned-commons
36160 @item -mpe-aligned-commons
36161 This option is available for Cygwin and MinGW targets.  It
36162 specifies that the GNU extension to the PE file format that
36163 permits the correct alignment of COMMON variables should be
36164 used when generating code.  It is enabled by default if
36165 GCC detects that the target assembler found during configuration
36166 supports the feature.
36167 @end table
36169 See also under @ref{x86 Options} for standard options.
36171 @node Xstormy16 Options
36172 @subsection Xstormy16 Options
36173 @cindex Xstormy16 Options
36175 These options are defined for Xstormy16:
36177 @table @gcctabopt
36178 @opindex msim
36179 @item -msim
36180 Choose startup files and linker script suitable for the simulator.
36181 @end table
36183 @node Xtensa Options
36184 @subsection Xtensa Options
36185 @cindex Xtensa Options
36187 These options are supported for Xtensa targets:
36189 @table @gcctabopt
36190 @opindex mconst16
36191 @opindex mno-const16
36192 @item -mconst16
36193 @itemx -mno-const16
36194 Enable or disable use of @code{CONST16} instructions for loading
36195 constant values.  The @code{CONST16} instruction is currently not a
36196 standard option from Tensilica.  When enabled, @code{CONST16}
36197 instructions are always used in place of the standard @code{L32R}
36198 instructions.  The use of @code{CONST16} is enabled by default only if
36199 the @code{L32R} instruction is not available.
36201 @opindex mfused-madd
36202 @opindex mno-fused-madd
36203 @item -mfused-madd
36204 @itemx -mno-fused-madd
36205 Enable or disable use of fused multiply/add and multiply/subtract
36206 instructions in the floating-point option.  This has no effect if the
36207 floating-point option is not also enabled.  Disabling fused multiply/add
36208 and multiply/subtract instructions forces the compiler to use separate
36209 instructions for the multiply and add/subtract operations.  This may be
36210 desirable in some cases where strict IEEE 754-compliant results are
36211 required: the fused multiply add/subtract instructions do not round the
36212 intermediate result, thereby producing results with @emph{more} bits of
36213 precision than specified by the IEEE standard.  Disabling fused multiply
36214 add/subtract instructions also ensures that the program output is not
36215 sensitive to the compiler's ability to combine multiply and add/subtract
36216 operations.
36218 @opindex mserialize-volatile
36219 @opindex mno-serialize-volatile
36220 @item -mserialize-volatile
36221 @itemx -mno-serialize-volatile
36222 When this option is enabled, GCC inserts @code{MEMW} instructions before
36223 @code{volatile} memory references to guarantee sequential consistency.
36224 The default is @option{-mserialize-volatile}.  Use
36225 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
36227 @opindex mforce-no-pic
36228 @item -mforce-no-pic
36229 For targets, like GNU/Linux, where all user-mode Xtensa code must be
36230 position-independent code (PIC), this option disables PIC for compiling
36231 kernel code.
36233 @opindex mtext-section-literals
36234 @opindex mno-text-section-literals
36235 @item -mtext-section-literals
36236 @itemx -mno-text-section-literals
36237 These options control the treatment of literal pools.  The default is
36238 @option{-mno-text-section-literals}, which places literals in a separate
36239 section in the output file.  This allows the literal pool to be placed
36240 in a data RAM/ROM, and it also allows the linker to combine literal
36241 pools from separate object files to remove redundant literals and
36242 improve code size.  With @option{-mtext-section-literals}, the literals
36243 are interspersed in the text section in order to keep them as close as
36244 possible to their references.  This may be necessary for large assembly
36245 files.  Literals for each function are placed right before that function.
36247 @opindex mauto-litpools
36248 @opindex mno-auto-litpools
36249 @item -mauto-litpools
36250 @itemx -mno-auto-litpools
36251 These options control the treatment of literal pools.  The default is
36252 @option{-mno-auto-litpools}, which places literals in a separate
36253 section in the output file unless @option{-mtext-section-literals} is
36254 used.  With @option{-mauto-litpools} the literals are interspersed in
36255 the text section by the assembler.  Compiler does not produce explicit
36256 @code{.literal} directives and loads literals into registers with
36257 @code{MOVI} instructions instead of @code{L32R} to let the assembler
36258 do relaxation and place literals as necessary.  This option allows
36259 assembler to create several literal pools per function and assemble
36260 very big functions, which may not be possible with
36261 @option{-mtext-section-literals}.
36263 @opindex mtarget-align
36264 @opindex mno-target-align
36265 @item -mtarget-align
36266 @itemx -mno-target-align
36267 When this option is enabled, GCC instructs the assembler to
36268 automatically align instructions to reduce branch penalties at the
36269 expense of some code density.  The assembler attempts to widen density
36270 instructions to align branch targets and the instructions following call
36271 instructions.  If there are not enough preceding safe density
36272 instructions to align a target, no widening is performed.  The
36273 default is @option{-mtarget-align}.  These options do not affect the
36274 treatment of auto-aligned instructions like @code{LOOP}, which the
36275 assembler always aligns, either by widening density instructions or
36276 by inserting NOP instructions.
36278 @opindex mlongcalls
36279 @opindex mno-longcalls
36280 @item -mlongcalls
36281 @itemx -mno-longcalls
36282 When this option is enabled, GCC instructs the assembler to translate
36283 direct calls to indirect calls unless it can determine that the target
36284 of a direct call is in the range allowed by the call instruction.  This
36285 translation typically occurs for calls to functions in other source
36286 files.  Specifically, the assembler translates a direct @code{CALL}
36287 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
36288 The default is @option{-mno-longcalls}.  This option should be used in
36289 programs where the call target can potentially be out of range.  This
36290 option is implemented in the assembler, not the compiler, so the
36291 assembly code generated by GCC still shows direct call
36292 instructions---look at the disassembled object code to see the actual
36293 instructions.  Note that the assembler uses an indirect call for
36294 every cross-file call, not just those that really are out of range.
36296 @opindex mabi
36297 @item -mabi=@var{name}
36298 Generate code for the specified ABI@.  Permissible values are: @samp{call0},
36299 @samp{windowed}.  Default ABI is chosen by the Xtensa core configuration.
36301 @opindex mabi=call0
36302 @item -mabi=call0
36303 When this option is enabled function parameters are passed in registers
36304 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
36305 caller-saved, and register @code{a15} may be used as a frame pointer.
36306 When this version of the ABI is enabled the C preprocessor symbol
36307 @code{__XTENSA_CALL0_ABI__} is defined.
36309 @opindex mabi=windowed
36310 @item -mabi=windowed
36311 When this option is enabled function parameters are passed in registers
36312 @code{a10} through @code{a15}, and called function rotates register window
36313 by 8 registers on entry so that its arguments are found in registers
36314 @code{a2} through @code{a7}.  Register @code{a7} may be used as a frame
36315 pointer.  Register window is rotated 8 registers back upon return.
36316 When this version of the ABI is enabled the C preprocessor symbol
36317 @code{__XTENSA_WINDOWED_ABI__} is defined.
36319 @opindex mextra-l32r-costs
36320 @item -mextra-l32r-costs=@var{n}
36321 Specify an extra cost of instruction RAM/ROM access for @code{L32R}
36322 instructions, in clock cycles.  This affects, when optimizing for speed,
36323 whether loading a constant from literal pool using @code{L32R} or
36324 synthesizing the constant from a small one with a couple of arithmetic
36325 instructions.  The default value is 0.
36327 @opindex mstrict-align
36328 @opindex mno-strict-align
36329 @item -mstrict-align
36330 @itemx -mno-strict-align
36331 Avoid or allow generating memory accesses that may not be aligned on a natural
36332 object boundary as described in the architecture specification.
36333 The default is @option{-mno-strict-align} for cores that support both
36334 unaligned loads and stores in hardware and @option{-mstrict-align} for all
36335 other cores.
36337 @end table
36339 @node zSeries Options
36340 @subsection zSeries Options
36341 @cindex zSeries options
36343 These are listed under @xref{S/390 and zSeries Options}.
36346 @c man end
36348 @node Spec Files
36349 @section Specifying Subprocesses and the Switches to Pass to Them
36350 @cindex Spec Files
36352 @command{gcc} is a driver program.  It performs its job by invoking a
36353 sequence of other programs to do the work of compiling, assembling and
36354 linking.  GCC interprets its command-line parameters and uses these to
36355 deduce which programs it should invoke, and which command-line options
36356 it ought to place on their command lines.  This behavior is controlled
36357 by @dfn{spec strings}.  In most cases there is one spec string for each
36358 program that GCC can invoke, but a few programs have multiple spec
36359 strings to control their behavior.  The spec strings built into GCC can
36360 be overridden by using the @option{-specs=} command-line switch to specify
36361 a spec file.
36363 @dfn{Spec files} are plain-text files that are used to construct spec
36364 strings.  They consist of a sequence of directives separated by blank
36365 lines.  The type of directive is determined by the first non-whitespace
36366 character on the line, which can be one of the following:
36368 @table @code
36369 @item %@var{command}
36370 Issues a @var{command} to the spec file processor.  The commands that can
36371 appear here are:
36373 @table @code
36374 @cindex @code{%include}
36375 @item %include <@var{file}>
36376 Search for @var{file} and insert its text at the current point in the
36377 specs file.
36379 @cindex @code{%include_noerr}
36380 @item %include_noerr <@var{file}>
36381 Just like @samp{%include}, but do not generate an error message if the include
36382 file cannot be found.
36384 @cindex @code{%rename}
36385 @item %rename @var{old_name} @var{new_name}
36386 Rename the spec string @var{old_name} to @var{new_name}.
36388 @end table
36390 @item *[@var{spec_name}]:
36391 This tells the compiler to create, override or delete the named spec
36392 string.  All lines after this directive up to the next directive or
36393 blank line are considered to be the text for the spec string.  If this
36394 results in an empty string then the spec is deleted.  (Or, if the
36395 spec did not exist, then nothing happens.)  Otherwise, if the spec
36396 does not currently exist a new spec is created.  If the spec does
36397 exist then its contents are overridden by the text of this
36398 directive, unless the first character of that text is the @samp{+}
36399 character, in which case the text is appended to the spec.
36401 @item [@var{suffix}]:
36402 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
36403 and up to the next directive or blank line are considered to make up the
36404 spec string for the indicated suffix.  When the compiler encounters an
36405 input file with the named suffix, it processes the spec string in
36406 order to work out how to compile that file.  For example:
36408 @smallexample
36409 .ZZ:
36410 z-compile -input %i
36411 @end smallexample
36413 This says that any input file whose name ends in @samp{.ZZ} should be
36414 passed to the program @samp{z-compile}, which should be invoked with the
36415 command-line switch @option{-input} and with the result of performing the
36416 @samp{%i} substitution.  (See below.)
36418 As an alternative to providing a spec string, the text following a
36419 suffix directive can be one of the following:
36421 @table @code
36422 @item @@@var{language}
36423 This says that the suffix is an alias for a known @var{language}.  This is
36424 similar to using the @option{-x} command-line switch to GCC to specify a
36425 language explicitly.  For example:
36427 @smallexample
36428 .ZZ:
36429 @@c++
36430 @end smallexample
36432 Says that .ZZ files are, in fact, C++ source files.
36434 @item #@var{name}
36435 This causes an error messages saying:
36437 @smallexample
36438 @var{name} compiler not installed on this system.
36439 @end smallexample
36440 @end table
36442 GCC already has an extensive list of suffixes built into it.
36443 This directive adds an entry to the end of the list of suffixes, but
36444 since the list is searched from the end backwards, it is effectively
36445 possible to override earlier entries using this technique.
36447 @end table
36449 GCC has the following spec strings built into it.  Spec files can
36450 override these strings or create their own.  Note that individual
36451 targets can also add their own spec strings to this list.
36453 @smallexample
36454 asm          Options to pass to the assembler
36455 asm_final    Options to pass to the assembler post-processor
36456 cpp          Options to pass to the C preprocessor
36457 cc1          Options to pass to the C compiler
36458 cc1plus      Options to pass to the C++ compiler
36459 endfile      Object files to include at the end of the link
36460 link         Options to pass to the linker
36461 lib          Libraries to include on the command line to the linker
36462 libgcc       Decides which GCC support library to pass to the linker
36463 linker       Sets the name of the linker
36464 predefines   Defines to be passed to the C preprocessor
36465 signed_char  Defines to pass to CPP to say whether @code{char} is signed
36466              by default
36467 startfile    Object files to include at the start of the link
36468 @end smallexample
36470 Here is a small example of a spec file:
36472 @smallexample
36473 %rename lib                 old_lib
36475 *lib:
36476 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
36477 @end smallexample
36479 This example renames the spec called @samp{lib} to @samp{old_lib} and
36480 then overrides the previous definition of @samp{lib} with a new one.
36481 The new definition adds in some extra command-line options before
36482 including the text of the old definition.
36484 @dfn{Spec strings} are a list of command-line options to be passed to their
36485 corresponding program.  In addition, the spec strings can contain
36486 @samp{%}-prefixed sequences to substitute variable text or to
36487 conditionally insert text into the command line.  Using these constructs
36488 it is possible to generate quite complex command lines.
36490 Here is a table of all defined @samp{%}-sequences for spec
36491 strings.  Note that spaces are not generated automatically around the
36492 results of expanding these sequences.  Therefore you can concatenate them
36493 together or combine them with constant text in a single argument.
36495 @table @code
36496 @item %%
36497 Substitute one @samp{%} into the program name or argument.
36499 @item %"
36500 Substitute an empty argument.
36502 @item %i
36503 Substitute the name of the input file being processed.
36505 @item %b
36506 Substitute the basename for outputs related with the input file being
36507 processed.  This is often the substring up to (and not including) the
36508 last period and not including the directory but, unless %w is active, it
36509 expands to the basename for auxiliary outputs, which may be influenced
36510 by an explicit output name, and by various other options that control
36511 how auxiliary outputs are named.
36513 @item %B
36514 This is the same as @samp{%b}, but include the file suffix (text after
36515 the last period).  Without %w, it expands to the basename for dump
36516 outputs.
36518 @item %d
36519 Marks the argument containing or following the @samp{%d} as a
36520 temporary file name, so that that file is deleted if GCC exits
36521 successfully.  Unlike @samp{%g}, this contributes no text to the
36522 argument.
36524 @item %g@var{suffix}
36525 Substitute a file name that has suffix @var{suffix} and is chosen
36526 once per compilation, and mark the argument in the same way as
36527 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
36528 name is now chosen in a way that is hard to predict even when previously
36529 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
36530 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
36531 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
36532 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
36533 was simply substituted with a file name chosen once per compilation,
36534 without regard to any appended suffix (which was therefore treated
36535 just like ordinary text), making such attacks more likely to succeed.
36537 @item %u@var{suffix}
36538 Like @samp{%g}, but generates a new temporary file name
36539 each time it appears instead of once per compilation.
36541 @item %U@var{suffix}
36542 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
36543 new one if there is no such last file name.  In the absence of any
36544 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
36545 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
36546 involves the generation of two distinct file names, one
36547 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
36548 simply substituted with a file name chosen for the previous @samp{%u},
36549 without regard to any appended suffix.
36551 @item %j@var{suffix}
36552 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
36553 writable, and if @option{-save-temps} is not used; 
36554 otherwise, substitute the name
36555 of a temporary file, just like @samp{%u}.  This temporary file is not
36556 meant for communication between processes, but rather as a junk
36557 disposal mechanism.
36559 @item %|@var{suffix}
36560 @itemx %m@var{suffix}
36561 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
36562 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
36563 all.  These are the two most common ways to instruct a program that it
36564 should read from standard input or write to standard output.  If you
36565 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
36566 construct: see for example @file{gcc/fortran/lang-specs.h}.
36568 @item %.@var{SUFFIX}
36569 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
36570 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
36571 terminated by the next space or %.
36573 @item %w
36574 Marks the argument containing or following the @samp{%w} as the
36575 designated output file of this compilation.  This puts the argument
36576 into the sequence of arguments that @samp{%o} substitutes.
36578 @item %V
36579 Indicates that this compilation produces no output file.
36581 @item %o
36582 Substitutes the names of all the output files, with spaces
36583 automatically placed around them.  You should write spaces
36584 around the @samp{%o} as well or the results are undefined.
36585 @samp{%o} is for use in the specs for running the linker.
36586 Input files whose names have no recognized suffix are not compiled
36587 at all, but they are included among the output files, so they are
36588 linked.
36590 @item %O
36591 Substitutes the suffix for object files.  Note that this is
36592 handled specially when it immediately follows @samp{%g, %u, or %U},
36593 because of the need for those to form complete file names.  The
36594 handling is such that @samp{%O} is treated exactly as if it had already
36595 been substituted, except that @samp{%g, %u, and %U} do not currently
36596 support additional @var{suffix} characters following @samp{%O} as they do
36597 following, for example, @samp{.o}.
36599 @item %I
36600 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
36601 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
36602 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
36603 and @option{-imultilib} as necessary.
36605 @item %s
36606 Current argument is the name of a library or startup file of some sort.
36607 Search for that file in a standard list of directories and substitute
36608 the full name found.  The current working directory is included in the
36609 list of directories scanned.
36611 @item %T
36612 Current argument is the name of a linker script.  Search for that file
36613 in the current list of directories to scan for libraries. If the file
36614 is located insert a @option{--script} option into the command line
36615 followed by the full path name found.  If the file is not found then
36616 generate an error message.  Note: the current working directory is not
36617 searched.
36619 @item %e@var{str}
36620 Print @var{str} as an error message.  @var{str} is terminated by a newline.
36621 Use this when inconsistent options are detected.
36623 @item %n@var{str}
36624 Print @var{str} as a notice.  @var{str} is terminated by a newline.
36626 @item %(@var{name})
36627 Substitute the contents of spec string @var{name} at this point.
36629 @item %x@{@var{option}@}
36630 Accumulate an option for @samp{%X}.
36632 @item %X
36633 Output the accumulated linker options specified by a @samp{%x} spec string.
36635 @item %Y
36636 Output the accumulated assembler options specified by @option{-Wa}.
36638 @item %Z
36639 Output the accumulated preprocessor options specified by @option{-Wp}.
36641 @item %M
36642 Output @code{multilib_os_dir}.
36644 @item %R
36645 Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
36647 @item %a
36648 Process the @code{asm} spec.  This is used to compute the
36649 switches to be passed to the assembler.
36651 @item %A
36652 Process the @code{asm_final} spec.  This is a spec string for
36653 passing switches to an assembler post-processor, if such a program is
36654 needed.
36656 @item %l
36657 Process the @code{link} spec.  This is the spec for computing the
36658 command line passed to the linker.  Typically it makes use of the
36659 @samp{%L %G %S %D and %E} sequences.
36661 @item %D
36662 Dump out a @option{-L} option for each directory that GCC believes might
36663 contain startup files.  If the target supports multilibs then the
36664 current multilib directory is prepended to each of these paths.
36666 @item %L
36667 Process the @code{lib} spec.  This is a spec string for deciding which
36668 libraries are included on the command line to the linker.
36670 @item %G
36671 Process the @code{libgcc} spec.  This is a spec string for deciding
36672 which GCC support library is included on the command line to the linker.
36674 @item %S
36675 Process the @code{startfile} spec.  This is a spec for deciding which
36676 object files are the first ones passed to the linker.  Typically
36677 this might be a file named @file{crt0.o}.
36679 @item %E
36680 Process the @code{endfile} spec.  This is a spec string that specifies
36681 the last object files that are passed to the linker.
36683 @item %C
36684 Process the @code{cpp} spec.  This is used to construct the arguments
36685 to be passed to the C preprocessor.
36687 @item %1
36688 Process the @code{cc1} spec.  This is used to construct the options to be
36689 passed to the actual C compiler (@command{cc1}).
36691 @item %2
36692 Process the @code{cc1plus} spec.  This is used to construct the options to be
36693 passed to the actual C++ compiler (@command{cc1plus}).
36695 @item %*
36696 Substitute the variable part of a matched option.  See below.
36697 Note that each comma in the substituted string is replaced by
36698 a single space.
36700 @item %<S
36701 Remove all occurrences of @code{-S} from the command line.  Note---this
36702 command is position dependent.  @samp{%} commands in the spec string
36703 before this one see @code{-S}, @samp{%} commands in the spec string
36704 after this one do not.
36706 @item %<S*
36707 Similar to @samp{%<S}, but match all switches beginning with @code{-S}.
36709 @item %>S
36710 Similar to @samp{%<S}, but keep @code{-S} in the GCC command line.
36712 @item %:@var{function}(@var{args})
36713 Call the named function @var{function}, passing it @var{args}.
36714 @var{args} is first processed as a nested spec string, then split
36715 into an argument vector in the usual fashion.  The function returns
36716 a string which is processed as if it had appeared literally as part
36717 of the current spec.
36719 The following built-in spec functions are provided:
36721 @table @code
36722 @item @code{getenv}
36723 The @code{getenv} spec function takes two arguments: an environment
36724 variable name and a string.  If the environment variable is not
36725 defined, a fatal error is issued.  Otherwise, the return value is the
36726 value of the environment variable concatenated with the string.  For
36727 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
36729 @smallexample
36730 %:getenv(TOPDIR /include)
36731 @end smallexample
36733 expands to @file{/path/to/top/include}.
36735 @item @code{if-exists}
36736 The @code{if-exists} spec function takes one argument, an absolute
36737 pathname to a file.  If the file exists, @code{if-exists} returns the
36738 pathname.  Here is a small example of its usage:
36740 @smallexample
36741 *startfile:
36742 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
36743 @end smallexample
36745 @item @code{if-exists-else}
36746 The @code{if-exists-else} spec function is similar to the @code{if-exists}
36747 spec function, except that it takes two arguments.  The first argument is
36748 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
36749 returns the pathname.  If it does not exist, it returns the second argument.
36750 This way, @code{if-exists-else} can be used to select one file or another,
36751 based on the existence of the first.  Here is a small example of its usage:
36753 @smallexample
36754 *startfile:
36755 crt0%O%s %:if-exists(crti%O%s) \
36756 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
36757 @end smallexample
36759 @item @code{if-exists-then-else}
36760 The @code{if-exists-then-else} spec function takes at least two arguments
36761 and an optional third one. The first argument is an absolute pathname to a
36762 file.  If the file exists, the function returns the second argument.
36763 If the file does not exist, the function returns the third argument if there
36764 is one, or NULL otherwise. This can be used to expand one text, or optionally
36765 another, based on the existence of a file.  Here is a small example of its
36766 usage:
36768 @smallexample
36769 -l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
36770 @end smallexample
36772 @item @code{sanitize}
36773 The @code{sanitize} spec function takes no arguments.  It returns non-NULL if
36774 any address, thread or undefined behavior sanitizers are active.
36776 @smallexample
36777 %@{%:sanitize(address):-funwind-tables@}
36778 @end smallexample
36780 @item @code{replace-outfile}
36781 The @code{replace-outfile} spec function takes two arguments.  It looks for the
36782 first argument in the outfiles array and replaces it with the second argument.  Here
36783 is a small example of its usage:
36785 @smallexample
36786 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
36787 @end smallexample
36789 @item @code{remove-outfile}
36790 The @code{remove-outfile} spec function takes one argument.  It looks for the
36791 first argument in the outfiles array and removes it.  Here is a small example
36792 its usage:
36794 @smallexample
36795 %:remove-outfile(-lm)
36796 @end smallexample
36798 @item @code{version-compare}
36799 The @code{version-compare} spec function takes four or five arguments of the following
36800 form:
36802 @smallexample
36803 <comparison-op> <arg1> [<arg2>] <switch> <result>
36804 @end smallexample
36806 It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
36807 The supported @code{comparison-op} values are:
36809 @table @code
36810 @item >=
36811 True if @code{switch} is a later (or same) version than @code{arg1}
36813 @item !>
36814 Opposite of @code{>=}
36816 @item <
36817 True if @code{switch} is an earlier version than @code{arg1}
36819 @item !<
36820 Opposite of @code{<}
36822 @item ><
36823 True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
36825 @item <>
36826 True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
36827 @end table
36829 If the @code{switch} is not present at all, the condition is false unless the first character
36830 of the @code{comparison-op} is @code{!}.
36832 @smallexample
36833 %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
36834 @end smallexample
36836 The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
36837 passed.
36839 @item @code{include}
36840 The @code{include} spec function behaves much like @code{%include}, with the advantage
36841 that it can be nested inside a spec and thus be conditionalized.  It takes one argument,
36842 the filename, and looks for it in the startfile path.  It always returns NULL.
36844 @smallexample
36845 %@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
36846 @end smallexample
36848 @item @code{pass-through-libs}
36849 The @code{pass-through-libs} spec function takes any number of arguments.  It
36850 finds any @option{-l} options and any non-options ending in @file{.a} (which it
36851 assumes are the names of linker input library archive files) and returns a
36852 result containing all the found arguments each prepended by
36853 @option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
36854 intended to be passed to the LTO linker plugin.
36856 @smallexample
36857 %:pass-through-libs(%G %L %G)
36858 @end smallexample
36860 @item @code{print-asm-header}
36861 The @code{print-asm-header} function takes no arguments and simply
36862 prints a banner like:
36864 @smallexample
36865 Assembler options
36866 =================
36868 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
36869 @end smallexample
36871 It is used to separate compiler options from assembler options
36872 in the @option{--target-help} output.
36874 @item @code{gt}
36875 The @code{gt} spec function takes two or more arguments.  It returns @code{""} (the
36876 empty string) if the second-to-last argument is greater than the last argument, and NULL
36877 otherwise.  The following example inserts the @code{link_gomp} spec if the last
36878 @option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
36880 @smallexample
36881 %@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
36882 @end smallexample
36884 @item @code{debug-level-gt}
36885 The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
36886 empty string) if @code{debug_info_level} is greater than the specified number, and NULL
36887 otherwise.
36889 @smallexample
36890 %@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
36891 @end smallexample
36892 @end table
36894 @item %@{S@}
36895 Substitutes the @code{-S} switch, if that switch is given to GCC@.
36896 If that switch is not specified, this substitutes nothing.  Note that
36897 the leading dash is omitted when specifying this option, and it is
36898 automatically inserted if the substitution is performed.  Thus the spec
36899 string @samp{%@{foo@}} matches the command-line option @option{-foo}
36900 and outputs the command-line option @option{-foo}.
36902 @item %W@{S@}
36903 Like %@{@code{S}@} but mark last argument supplied within as a file to be
36904 deleted on failure.
36906 @item %@@@{S@}
36907 Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes
36908 @code{@@FILE} if an @code{@@file} argument has been supplied.
36910 @item %@{S*@}
36911 Substitutes all the switches specified to GCC whose names start
36912 with @code{-S}, but which also take an argument.  This is used for
36913 switches like @option{-o}, @option{-D}, @option{-I}, etc.
36914 GCC considers @option{-o foo} as being
36915 one switch whose name starts with @samp{o}.  %@{o*@} substitutes this
36916 text, including the space.  Thus two arguments are generated.
36918 @item %@{S*&T*@}
36919 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
36920 (the order of @code{S} and @code{T} in the spec is not significant).
36921 There can be any number of ampersand-separated variables; for each the
36922 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
36924 @item %@{S:X@}
36925 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
36927 @item %@{!S:X@}
36928 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
36930 @item %@{S*:X@}
36931 Substitutes @code{X} if one or more switches whose names start with
36932 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
36933 once, no matter how many such switches appeared.  However, if @code{%*}
36934 appears somewhere in @code{X}, then @code{X} is substituted once
36935 for each matching switch, with the @code{%*} replaced by the part of
36936 that switch matching the @code{*}.
36938 If @code{%*} appears as the last part of a spec sequence then a space
36939 is added after the end of the last substitution.  If there is more
36940 text in the sequence, however, then a space is not generated.  This
36941 allows the @code{%*} substitution to be used as part of a larger
36942 string.  For example, a spec string like this:
36944 @smallexample
36945 %@{mcu=*:--script=%*/memory.ld@}
36946 @end smallexample
36948 @noindent
36949 when matching an option like @option{-mcu=newchip} produces:
36951 @smallexample
36952 --script=newchip/memory.ld
36953 @end smallexample
36955 @item %@{.S:X@}
36956 Substitutes @code{X}, if processing a file with suffix @code{S}.
36958 @item %@{!.S:X@}
36959 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
36961 @item %@{,S:X@}
36962 Substitutes @code{X}, if processing a file for language @code{S}.
36964 @item %@{!,S:X@}
36965 Substitutes @code{X}, if not processing a file for language @code{S}.
36967 @item %@{S|P:X@}
36968 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
36969 GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
36970 @code{*} sequences as well, although they have a stronger binding than
36971 the @samp{|}.  If @code{%*} appears in @code{X}, all of the
36972 alternatives must be starred, and only the first matching alternative
36973 is substituted.
36975 For example, a spec string like this:
36977 @smallexample
36978 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
36979 @end smallexample
36981 @noindent
36982 outputs the following command-line options from the following input
36983 command-line options:
36985 @smallexample
36986 fred.c        -foo -baz
36987 jim.d         -bar -boggle
36988 -d fred.c     -foo -baz -boggle
36989 -d jim.d      -bar -baz -boggle
36990 @end smallexample
36992 @item %@{%:@var{function}(@var{args}):X@}
36994 Call function named @var{function} with args @var{args}.  If the
36995 function returns non-NULL, then @code{X} is substituted, if it returns
36996 NULL, it isn't substituted.
36998 @item %@{S:X; T:Y; :D@}
37000 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
37001 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
37002 be as many clauses as you need.  This may be combined with @code{.},
37003 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
37006 @end table
37008 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
37009 or similar construct can use a backslash to ignore the special meaning
37010 of the character following it, thus allowing literal matching of a
37011 character that is otherwise specially treated.  For example,
37012 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
37013 @option{-std=iso9899:1999} option is given.
37015 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
37016 construct may contain other nested @samp{%} constructs or spaces, or
37017 even newlines.  They are processed as usual, as described above.
37018 Trailing white space in @code{X} is ignored.  White space may also
37019 appear anywhere on the left side of the colon in these constructs,
37020 except between @code{.} or @code{*} and the corresponding word.
37022 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
37023 handled specifically in these constructs.  If another value of
37024 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
37025 @option{-W} switch is found later in the command line, the earlier
37026 switch value is ignored, except with @{@code{S}*@} where @code{S} is
37027 just one letter, which passes all matching options.
37029 The character @samp{|} at the beginning of the predicate text is used to
37030 indicate that a command should be piped to the following command, but
37031 only if @option{-pipe} is specified.
37033 It is built into GCC which switches take arguments and which do not.
37034 (You might think it would be useful to generalize this to allow each
37035 compiler's spec to say which switches take arguments.  But this cannot
37036 be done in a consistent fashion.  GCC cannot even decide which input
37037 files have been specified without knowing which switches take arguments,
37038 and it must know which input files to compile in order to tell which
37039 compilers to run).
37041 GCC also knows implicitly that arguments starting in @option{-l} are to be
37042 treated as compiler output files, and passed to the linker in their
37043 proper position among the other output files.
37045 @node Environment Variables
37046 @section Environment Variables Affecting GCC
37047 @cindex environment variables
37049 @c man begin ENVIRONMENT
37050 This section describes several environment variables that affect how GCC
37051 operates.  Some of them work by specifying directories or prefixes to use
37052 when searching for various kinds of files.  Some are used to specify other
37053 aspects of the compilation environment.
37055 Note that you can also specify places to search using options such as
37056 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
37057 take precedence over places specified using environment variables, which
37058 in turn take precedence over those specified by the configuration of GCC@.
37059 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
37060 GNU Compiler Collection (GCC) Internals}.
37062 @table @env
37063 @vindex LANG
37064 @vindex LC_CTYPE
37065 @c @vindex LC_COLLATE
37066 @vindex LC_MESSAGES
37067 @c @vindex LC_MONETARY
37068 @c @vindex LC_NUMERIC
37069 @c @vindex LC_TIME
37070 @vindex LC_ALL
37071 @cindex locale
37072 @item LANG
37073 @itemx LC_CTYPE
37074 @c @itemx LC_COLLATE
37075 @itemx LC_MESSAGES
37076 @c @itemx LC_MONETARY
37077 @c @itemx LC_NUMERIC
37078 @c @itemx LC_TIME
37079 @itemx LC_ALL
37080 These environment variables control the way that GCC uses
37081 localization information which allows GCC to work with different
37082 national conventions.  GCC inspects the locale categories
37083 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
37084 so.  These locale categories can be set to any value supported by your
37085 installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
37086 Kingdom encoded in UTF-8.
37088 The @env{LC_CTYPE} environment variable specifies character
37089 classification.  GCC uses it to determine the character boundaries in
37090 a string; this is needed for some multibyte encodings that contain quote
37091 and escape characters that are otherwise interpreted as a string
37092 end or escape.
37094 The @env{LC_MESSAGES} environment variable specifies the language to
37095 use in diagnostic messages.
37097 If the @env{LC_ALL} environment variable is set, it overrides the value
37098 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
37099 and @env{LC_MESSAGES} default to the value of the @env{LANG}
37100 environment variable.  If none of these variables are set, GCC
37101 defaults to traditional C English behavior.
37103 @vindex TMPDIR
37104 @item TMPDIR
37105 If @env{TMPDIR} is set, it specifies the directory to use for temporary
37106 files.  GCC uses temporary files to hold the output of one stage of
37107 compilation which is to be used as input to the next stage: for example,
37108 the output of the preprocessor, which is the input to the compiler
37109 proper.
37111 @vindex GCC_COMPARE_DEBUG
37112 @item GCC_COMPARE_DEBUG
37113 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
37114 @option{-fcompare-debug} to the compiler driver.  See the documentation
37115 of this option for more details.
37117 @vindex GCC_EXEC_PREFIX
37118 @item GCC_EXEC_PREFIX
37119 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
37120 names of the subprograms executed by the compiler.  No slash is added
37121 when this prefix is combined with the name of a subprogram, but you can
37122 specify a prefix that ends with a slash if you wish.
37124 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
37125 an appropriate prefix to use based on the pathname it is invoked with.
37127 If GCC cannot find the subprogram using the specified prefix, it
37128 tries looking in the usual places for the subprogram.
37130 The default value of @env{GCC_EXEC_PREFIX} is
37131 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
37132 the installed compiler. In many cases @var{prefix} is the value
37133 of @code{prefix} when you ran the @file{configure} script.
37135 Other prefixes specified with @option{-B} take precedence over this prefix.
37137 This prefix is also used for finding files such as @file{crt0.o} that are
37138 used for linking.
37140 In addition, the prefix is used in an unusual way in finding the
37141 directories to search for header files.  For each of the standard
37142 directories whose name normally begins with @samp{/usr/local/lib/gcc}
37143 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
37144 replacing that beginning with the specified prefix to produce an
37145 alternate directory name.  Thus, with @option{-Bfoo/}, GCC searches
37146 @file{foo/bar} just before it searches the standard directory 
37147 @file{/usr/local/lib/bar}.
37148 If a standard directory begins with the configured
37149 @var{prefix} then the value of @var{prefix} is replaced by
37150 @env{GCC_EXEC_PREFIX} when looking for header files.
37152 @vindex COMPILER_PATH
37153 @item COMPILER_PATH
37154 The value of @env{COMPILER_PATH} is a colon-separated list of
37155 directories, much like @env{PATH}.  GCC tries the directories thus
37156 specified when searching for subprograms, if it cannot find the
37157 subprograms using @env{GCC_EXEC_PREFIX}.
37159 @vindex LIBRARY_PATH
37160 @item LIBRARY_PATH
37161 The value of @env{LIBRARY_PATH} is a colon-separated list of
37162 directories, much like @env{PATH}.  When configured as a native compiler,
37163 GCC tries the directories thus specified when searching for special
37164 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}.  Linking
37165 using GCC also uses these directories when searching for ordinary
37166 libraries for the @option{-l} option (but directories specified with
37167 @option{-L} come first).
37169 @vindex LANG
37170 @cindex locale definition
37171 @item LANG
37172 This variable is used to pass locale information to the compiler.  One way in
37173 which this information is used is to determine the character set to be used
37174 when character literals, string literals and comments are parsed in C and C++.
37175 When the compiler is configured to allow multibyte characters,
37176 the following values for @env{LANG} are recognized:
37178 @table @samp
37179 @item C-JIS
37180 Recognize JIS characters.
37181 @item C-SJIS
37182 Recognize SJIS characters.
37183 @item C-EUCJP
37184 Recognize EUCJP characters.
37185 @end table
37187 If @env{LANG} is not defined, or if it has some other value, then the
37188 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
37189 recognize and translate multibyte characters.
37191 @vindex GCC_EXTRA_DIAGNOSTIC_OUTPUT
37192 @item GCC_EXTRA_DIAGNOSTIC_OUTPUT
37193 If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
37194 then additional text will be emitted to stderr when fix-it hints are
37195 emitted.  @option{-fdiagnostics-parseable-fixits} and
37196 @option{-fno-diagnostics-parseable-fixits} take precedence over this
37197 environment variable.
37199 @table @samp
37200 @item fixits-v1
37201 Emit parseable fix-it hints, equivalent to
37202 @option{-fdiagnostics-parseable-fixits}.  In particular, columns are
37203 expressed as a count of bytes, starting at byte 1 for the initial column.
37205 @item fixits-v2
37206 As @code{fixits-v1}, but columns are expressed as display columns,
37207 as per @option{-fdiagnostics-column-unit=display}.
37208 @end table
37210 @end table
37212 @noindent
37213 Some additional environment variables affect the behavior of the
37214 preprocessor.
37216 @include cppenv.texi
37218 @c man end
37220 @node Precompiled Headers
37221 @section Using Precompiled Headers
37222 @cindex precompiled headers
37223 @cindex speed of compilation
37225 Often large projects have many header files that are included in every
37226 source file.  The time the compiler takes to process these header files
37227 over and over again can account for nearly all of the time required to
37228 build the project.  To make builds faster, GCC allows you to
37229 @dfn{precompile} a header file.
37231 To create a precompiled header file, simply compile it as you would any
37232 other file, if necessary using the @option{-x} option to make the driver
37233 treat it as a C or C++ header file.  You may want to use a
37234 tool like @command{make} to keep the precompiled header up-to-date when
37235 the headers it contains change.
37237 A precompiled header file is searched for when @code{#include} is
37238 seen in the compilation.  As it searches for the included file
37239 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
37240 compiler looks for a precompiled header in each directory just before it
37241 looks for the include file in that directory.  The name searched for is
37242 the name specified in the @code{#include} with @samp{.gch} appended.  If
37243 the precompiled header file cannot be used, it is ignored.
37245 For instance, if you have @code{#include "all.h"}, and you have
37246 @file{all.h.gch} in the same directory as @file{all.h}, then the
37247 precompiled header file is used if possible, and the original
37248 header is used otherwise.
37250 Alternatively, you might decide to put the precompiled header file in a
37251 directory and use @option{-I} to ensure that directory is searched
37252 before (or instead of) the directory containing the original header.
37253 Then, if you want to check that the precompiled header file is always
37254 used, you can put a file of the same name as the original header in this
37255 directory containing an @code{#error} command.
37257 This also works with @option{-include}.  So yet another way to use
37258 precompiled headers, good for projects not designed with precompiled
37259 header files in mind, is to simply take most of the header files used by
37260 a project, include them from another header file, precompile that header
37261 file, and @option{-include} the precompiled header.  If the header files
37262 have guards against multiple inclusion, they are skipped because
37263 they've already been included (in the precompiled header).
37265 If you need to precompile the same header file for different
37266 languages, targets, or compiler options, you can instead make a
37267 @emph{directory} named like @file{all.h.gch}, and put each precompiled
37268 header in the directory, perhaps using @option{-o}.  It doesn't matter
37269 what you call the files in the directory; every precompiled header in
37270 the directory is considered.  The first precompiled header
37271 encountered in the directory that is valid for this compilation is
37272 used; they're searched in no particular order.
37274 There are many other possibilities, limited only by your imagination,
37275 good sense, and the constraints of your build system.
37277 A precompiled header file can be used only when these conditions apply:
37279 @itemize
37280 @item
37281 Only one precompiled header can be used in a particular compilation.
37283 @item
37284 A precompiled header cannot be used once the first C token is seen.  You
37285 can have preprocessor directives before a precompiled header; you cannot
37286 include a precompiled header from inside another header.
37288 @item
37289 The precompiled header file must be produced for the same language as
37290 the current compilation.  You cannot use a C precompiled header for a C++
37291 compilation.
37293 @item
37294 The precompiled header file must have been produced by the same compiler
37295 binary as the current compilation is using.
37297 @item
37298 Any macros defined before the precompiled header is included must
37299 either be defined in the same way as when the precompiled header was
37300 generated, or must not affect the precompiled header, which usually
37301 means that they don't appear in the precompiled header at all.
37303 The @option{-D} option is one way to define a macro before a
37304 precompiled header is included; using a @code{#define} can also do it.
37305 There are also some options that define macros implicitly, like
37306 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
37307 defined this way.
37309 @item If debugging information is output when using the precompiled
37310 header, using @option{-g} or similar, the same kind of debugging information
37311 must have been output when building the precompiled header.  However,
37312 a precompiled header built using @option{-g} can be used in a compilation
37313 when no debugging information is being output.
37315 @item The same @option{-m} options must generally be used when building
37316 and using the precompiled header.  @xref{Submodel Options},
37317 for any cases where this rule is relaxed.
37319 @item Each of the following options must be the same when building and using
37320 the precompiled header:
37322 @gccoptlist{-fexceptions}
37324 @item
37325 Some other command-line options starting with @option{-f},
37326 @option{-p}, or @option{-O} must be defined in the same way as when
37327 the precompiled header was generated.  At present, it's not clear
37328 which options are safe to change and which are not; the safest choice
37329 is to use exactly the same options when generating and using the
37330 precompiled header.  The following are known to be safe:
37332 @gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock
37333 -fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous
37334 -fsched-verbose=@var{number}  -fschedule-insns  -fvisibility=
37335 -pedantic-errors}
37337 @item Address space layout randomization (ASLR) can lead to not binary identical
37338 PCH files.  If you rely on stable PCH file contents disable ASLR when generating
37339 PCH files.
37341 @end itemize
37343 For all of these except the last, the compiler automatically
37344 ignores the precompiled header if the conditions aren't met.  If you
37345 find an option combination that doesn't work and doesn't cause the
37346 precompiled header to be ignored, please consider filing a bug report,
37347 see @ref{Bugs}.
37349 If you do use differing options when generating and using the
37350 precompiled header, the actual behavior is a mixture of the
37351 behavior for the options.  For instance, if you use @option{-g} to
37352 generate the precompiled header but not when using it, you may or may
37353 not get debugging information for routines in the precompiled header.
37355 @node C++ Modules
37356 @section C++ Modules
37357 @cindex speed of compilation
37359 Modules are a C++20 language feature.  As the name suggests, they
37360 provides a modular compilation system, intending to provide both
37361 faster builds and better library isolation.  The ``Merging Modules''
37362 paper @uref{https://wg21.link/p1103}, provides the easiest to read set
37363 of changes to the standard, although it does not capture later
37364 changes.
37366 @emph{G++'s modules support is not complete.}  Other than bugs, the
37367 known missing pieces are:
37369 @table @emph
37371 @item Private Module Fragment
37372 The Private Module Fragment is recognized, but an error is emitted.
37374 @item Partition definition visibility rules
37375 Entities may be defined in implementation partitions, and those
37376 definitions are not available outside of the module.  This is not
37377 implemented, and the definitions are available to extra-module use.
37379 @item Textual merging of reachable GM entities
37380 Entities may be multiply defined across different header-units.
37381 These must be de-duplicated, and this is implemented across imports,
37382 or when an import redefines a textually-defined entity.  However the
37383 reverse is not implemented---textually redefining an entity that has
37384 been defined in an imported header-unit.  A redefinition error is
37385 emitted.
37387 @item Translation-Unit local referencing rules
37388 Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
37389 (@uref{https://wg21.link/p2003}) add limitations on which entities an
37390 exported region may reference (for instance, the entities an exported
37391 template definition may reference).  These are not fully implemented.
37393 @item Standard Library Header Units
37394 The Standard Library is not provided as importable header units.  If
37395 you want to import such units, you must explicitly build them first.
37396 If you do not do this with care, you may have multiple declarations,
37397 which the module machinery must merge---compiler resource usage can be
37398 affected by how you partition header files into header units.
37400 @end table
37402 Modular compilation is @emph{not} enabled with just the
37403 @option{-std=c++20} option.  You must explicitly enable it with the
37404 @option{-fmodules-ts} option.  It is independent of the language
37405 version selected, although in pre-C++20 versions, it is of course an
37406 extension.
37408 No new source file suffixes are required or supported.  If you wish to
37409 use a non-standard suffix (@pxref{Overall Options}), you also need
37410 to provide a @option{-x c++} option too.@footnote{Some users like to
37411 distinguish module interface files with a new suffix, such as naming
37412 the source @code{module.cppm}, which involves
37413 teaching all tools about the new suffix.  A different scheme, such as
37414 naming @code{module-m.cpp} would be less invasive.}
37416 Compiling a module interface unit produces an additional output (to
37417 the assembly or object file), called a Compiled Module Interface
37418 (CMI).  This encodes the exported declarations of the module.
37419 Importing a module reads in the CMI.  The import graph is a Directed
37420 Acyclic Graph (DAG).  You must build imports before the importer.
37422 Header files may themselves be compiled to header units, which are a
37423 transitional ability aiming at faster compilation.  The
37424 @option{-fmodule-header} option is used to enable this, and implies
37425 the @option{-fmodules-ts} option.  These CMIs are named by the fully
37426 resolved underlying header file, and thus may be a complete pathname
37427 containing subdirectories.  If the header file is found at an absolute
37428 pathname, the CMI location is still relative to a CMI root directory.
37430 As header files often have no suffix, you commonly have to specify a
37431 @option{-x} option to tell the compiler the source is a header file.
37432 You may use @option{-x c++-header}, @option{-x c++-user-header} or
37433 @option{-x c++-system-header}.  When used in conjunction with
37434 @option{-fmodules-ts}, these all imply an appropriate
37435 @option{-fmodule-header} option.  The latter two variants use the
37436 user or system include path to search for the file specified.  This
37437 allows you to, for instance, compile standard library header files as
37438 header units, without needing to know exactly where they are
37439 installed.  Specifying the language as one of these variants also
37440 inhibits output of the object file, as header files have no associated
37441 object file.
37443 The @option{-fmodule-only} option disables generation of the
37444 associated object file for compiling a module interface.  Only the CMI
37445 is generated.  This option is implied when using the
37446 @option{-fmodule-header} option.
37448 The @option{-flang-info-include-translate} and
37449 @option{-flang-info-include-translate-not} options notes whether
37450 include translation occurs or not.  With no argument, the first will
37451 note all include translation.  The second will note all
37452 non-translations of include files not known to intentionally be
37453 textual.  With an argument, queries about include translation of a
37454 header files with that particular trailing pathname are noted.  You
37455 may repeat this form to cover several different header files.  This
37456 option may be helpful in determining whether include translation is
37457 happening---if it is working correctly, it behaves as if it isn't
37458 there at all.
37460 The @option{-flang-info-module-cmi} option can be used to determine
37461 where the compiler is reading a CMI from.  Without the option, the
37462 compiler is silent when such a read is successful.  This option has an
37463 optional argument, which will restrict the notification to just the
37464 set of named modules or header units specified.
37466 The @option{-Winvalid-imported-macros} option causes all imported macros
37467 to be resolved at the end of compilation.  Without this, imported
37468 macros are only resolved when expanded or (re)defined.  This option
37469 detects conflicting import definitions for all macros.
37471 For details of the @option{-fmodule-mapper} family of options,
37472 @pxref{C++ Module Mapper}.
37474 @menu
37475 * C++ Module Mapper::       Module Mapper
37476 * C++ Module Preprocessing::  Module Preprocessing
37477 * C++ Compiled Module Interface:: Compiled Module Interface
37478 @end menu
37480 @node C++ Module Mapper
37481 @subsection Module Mapper
37482 @cindex C++ Module Mapper
37484 A module mapper provides a server or file that the compiler queries to
37485 determine the mapping between module names and CMI files.  It is also
37486 used to build CMIs on demand.  @emph{Mapper functionality is in its
37487 infancy and is intended for experimentation with build system
37488 interactions.}
37490 You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
37491 option or @env{CXX_MODULE_MAPPER} environment variable.  The value may
37492 have one of the following forms:
37494 @table @gcctabopt
37496 @item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
37497 An optional hostname and a numeric port number to connect to.  If the
37498 hostname is omitted, the loopback address is used.  If the hostname
37499 corresponds to multiple IPV6 addresses, these are tried in turn, until
37500 one is successful.  If your host lacks IPv6, this form is
37501 non-functional.  If you must use IPv4 use
37502 @option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
37504 @item =@var{socket}@r{[}?@var{ident}@r{]}
37505 A local domain socket.  If your host lacks local domain sockets, this
37506 form is non-functional.
37508 @item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
37509 A program to spawn, and communicate with on its stdin/stdout streams.
37510 Your @var{PATH} environment variable is searched for the program.
37511 Arguments are separated by space characters, (it is not possible for
37512 one of the arguments delivered to the program to contain a space).  An
37513 exception is if @var{program} begins with @@.  In that case
37514 @var{program} (sans @@) is looked for in the compiler's internal
37515 binary directory.  Thus the sample mapper-server can be specified
37516 with @code{@@g++-mapper-server}.
37518 @item <>@r{[}?@var{ident}@r{]}
37519 @item <>@var{inout}@r{[}?@var{ident}@r{]}
37520 @item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
37521 Named pipes or file descriptors to communicate over.  The first form,
37522 @option{<>}, communicates over stdin and stdout.  The other forms
37523 allow you to specify a file descriptor or name a pipe.  A numeric value
37524 is interpreted as a file descriptor, otherwise named pipe is opened.
37525 The second form specifies a bidirectional pipe and the last form
37526 allows specifying two independent pipes.  Using file descriptors
37527 directly in this manner is fragile in general, as it can require the
37528 cooperation of intermediate processes.  In particular using stdin &
37529 stdout is fraught with danger as other compiler options might also
37530 cause the compiler to read stdin or write stdout, and it can have
37531 unfortunate interactions with signal delivery from the terminal.
37533 @item @var{file}@r{[}?@var{ident}@r{]}
37534 A mapping file consisting of space-separated module-name, filename
37535 pairs, one per line.  Only the mappings for the direct imports and any
37536 module export name need be provided.  If other mappings are provided,
37537 they override those stored in any imported CMI files.  A repository
37538 root may be specified in the mapping file by using @samp{$root} as the
37539 module name in the first active line.  Use of this option will disable
37540 any default module->CMI name mapping.
37542 @end table
37544 As shown, an optional @var{ident} may suffix the first word of the
37545 option, indicated by a @samp{?} prefix.  The value is used in the
37546 initial handshake with the module server, or to specify a prefix on
37547 mapping file lines.  In the server case, the main source file name is
37548 used if no @var{ident} is specified.  In the file case, all non-blank
37549 lines are significant, unless a value is specified, in which case only
37550 lines beginning with @var{ident} are significant.  The @var{ident}
37551 must be separated by whitespace from the module name.  Be aware that
37552 @samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
37553 significant to the shell, and therefore may need quoting.
37555 The mapper is connected to or loaded lazily, when the first module
37556 mapping is required.  The networking protocols are only supported on
37557 hosts that provide networking.  If no mapper is specified a default is
37558 provided.
37560 A project-specific mapper is expected to be provided by the build
37561 system that invokes the compiler.  It is not expected that a
37562 general-purpose server is provided for all compilations.  As such, the
37563 server will know the build configuration, the compiler it invoked, and
37564 the environment (such as working directory) in which that is
37565 operating.  As it may parallelize builds, several compilations may
37566 connect to the same socket.
37568 The default mapper generates CMI files in a @samp{gcm.cache}
37569 directory.  CMI files have a @samp{.gcm} suffix.  The module unit name
37570 is used directly to provide the basename.  Header units construct a
37571 relative path using the underlying header file name.  If the path is
37572 already relative, a @samp{,} directory is prepended.  Internal
37573 @samp{..} components are translated to @samp{,,}.  No attempt is made
37574 to canonicalize these filenames beyond that done by the preprocessor's
37575 include search algorithm, as in general it is ambiguous when symbolic
37576 links are present.
37578 The mapper protocol was published as ``A Module Mapper''
37579 @uref{https://wg21.link/p1184}.  The implementation is provided by
37580 @command{libcody}, @uref{https://github.com/urnathan/libcody},
37581 which specifies the canonical protocol definition.  A proof of concept
37582 server implementation embedded in @command{make} was described in
37583 ''Make Me A Module'', @uref{https://wg21.link/p1602}.
37585 @node C++ Module Preprocessing
37586 @subsection Module Preprocessing
37587 @cindex C++ Module Preprocessing
37589 Modules affect preprocessing because of header units and include
37590 translation.  Some uses of the preprocessor as a separate step either
37591 do not produce a correct output, or require CMIs to be available.
37593 Header units import macros.  These macros can affect later conditional
37594 inclusion, which therefore can cascade to differing import sets.  When
37595 preprocessing, it is necessary to load the CMI.  If a header unit is
37596 unavailable, the preprocessor issues a warning and continue (when
37597 not just preprocessing, an error is emitted).  Detecting such imports
37598 requires preprocessor tokenization of the input stream to phase 4
37599 (macro expansion).
37601 Include translation converts @code{#include}, @code{#include_next} and
37602 @code{#import} directives to internal @code{import} declarations.
37603 Whether a particular directive is translated is controlled by the
37604 module mapper.  Header unit names are canonicalized during
37605 preprocessing.
37607 Dependency information can be emitted for macro import, extending the
37608 functionality of @option{-MD} and @option{-MMD} options.  Detection of
37609 import declarations also requires phase 4 preprocessing, and thus
37610 requires full preprocessing (or compilation).
37612 The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
37613 preprocessing before phase 4.
37615 The @option{-save-temps} option uses @option{-fdirectives-only} for
37616 preprocessing, and preserve the macro definitions in the preprocessed
37617 output.  Usually you also want to use this option when explicitly
37618 preprocessing a header-unit, or consuming such preprocessed output:
37620 @smallexample
37621 g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
37622 g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
37623 @end smallexample
37625 @node C++ Compiled Module Interface
37626 @subsection Compiled Module Interface
37627 @cindex C++ Compiled Module Interface
37629 CMIs are an additional artifact when compiling named module
37630 interfaces, partitions or header units.  These are read when
37631 importing.  CMI contents are implementation-specific, and in GCC's
37632 case tied to the compiler version.  Consider them a rebuildable cache
37633 artifact, not a distributable object.
37635 When creating an output CMI, any missing directory components are
37636 created in a manner that is safe for concurrent builds creating
37637 multiple, different, CMIs within a common subdirectory tree.
37639 CMI contents are written to a temporary file, which is then atomically
37640 renamed.  Observers either see old contents (if there is an
37641 existing file), or complete new contents.  They do not observe the
37642 CMI during its creation.  This is unlike object file writing, which
37643 may be observed by an external process.
37645 CMIs are read in lazily, if the host OS provides @code{mmap}
37646 functionality.  Generally blocks are read when name lookup or template
37647 instantiation occurs.  To inhibit this, the @option{-fno-module-lazy}
37648 option may be used.
37650 The @option{--param lazy-modules=@var{n}} parameter controls the limit
37651 on the number of concurrently open module files during lazy loading.
37652 Should more modules be imported, an LRU algorithm is used to determine
37653 which files to close---until that file is needed again.  This limit
37654 may be exceeded with deep module dependency hierarchies.  With large
37655 code bases there may be more imports than the process limit of file
37656 descriptors.  By default, the limit is a few less than the per-process
37657 file descriptor hard limit, if that is determinable.@footnote{Where
37658 applicable the soft limit is incremented as needed towards the hard limit.}
37660 GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
37661 You may use @command{readelf} to inspect them, although section
37662 contents are largely undecipherable.  There is a section named
37663 @code{.gnu.c++.README}, which contains human-readable text.  Other
37664 than the first line, each line consists of @code{@var{tag}: @code{value}}
37665 tuples.
37667 @smallexample
37668 > @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
37670 String dump of section '.gnu.c++.README':
37671   [     0]  GNU C++ primary module interface
37672   [    21]  compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
37673   [    6f]  version: 2020/11/16-04:54
37674   [    89]  module: foo
37675   [    95]  source: c_b.ii
37676   [    a4]  dialect: C++20/coroutines
37677   [    be]  cwd: /data/users/nathans/modules/obj/x86_64/gcc
37678   [    ee]  repository: gcm.cache
37679   [   104]  buildtime: 2020/11/16 15:03:21 UTC
37680   [   127]  localtime: 2020/11/16 07:03:21 PST
37681   [   14a]  export: foo:part1 foo-part1.gcm
37682 @end smallexample
37684 Amongst other things, this lists the source that was built, C++
37685 dialect used and imports of the module.@footnote{The precise contents
37686 of this output may change.} The timestamp is the same value as that
37687 provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
37688 explicitly specified with the environment variable
37689 @code{SOURCE_DATE_EPOCH}.  For further details
37690 @pxref{Environment Variables}.
37692 A set of related CMIs may be copied, provided the relative pathnames
37693 are preserved.
37695 The @code{.gnu.c++.README} contents do not affect CMI integrity, and
37696 it may be removed or altered.  The section numbering of the sections
37697 whose names do not begin with @code{.gnu.c++.}, or are not the string
37698 section is significant and must not be altered.